From 247ac0ceff346a2373b7096fd355a508d1c7d779 Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Wed, 27 May 2026 09:01:40 +0000 Subject: [PATCH 1/3] Configurations: 'specification/education/resource-manager/Microsoft.Education/Education/tspconfig.yaml', API Version: 2021-12-01-preview, SDK Release Type: beta, and CommitSHA: '5a45c68db967ced0736a2f91a74774a65771dadc' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=6357065 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release. --- pnpm-lock.yaml | 27 +- sdk/education/arm-education/CHANGELOG.md | 36 +- sdk/education/arm-education/LICENSE | 2 +- sdk/education/arm-education/README.md | 27 +- sdk/education/arm-education/_meta.json | 8 - .../arm-education/api-extractor.json | 4 +- .../arm-education/config/tsconfig.lint.json | 7 - .../config/tsconfig.samples.json | 4 +- .../config/tsconfig.src.browser.json | 4 +- .../config/tsconfig.src.cjs.json | 4 +- .../config/tsconfig.src.esm.json | 4 +- .../config/tsconfig.test.browser.json | 10 + .../config/tsconfig.test.node.json | 9 +- sdk/education/arm-education/eslint.config.mjs | 29 +- sdk/education/arm-education/metadata.json | 68 ++ sdk/education/arm-education/package.json | 274 +++-- .../review/arm-education-node.api.md | 361 +++--- sdk/education/arm-education/sample.env | 5 +- .../samples-dev/grantsGetSample.ts | 37 +- .../samples-dev/grantsListAllSample.ts | 31 +- .../samples-dev/grantsListSample.ts | 39 +- .../samples-dev/joinRequestsApproveSample.ts | 29 +- .../samples-dev/joinRequestsDenySample.ts | 29 +- .../samples-dev/joinRequestsGetSample.ts | 22 +- .../samples-dev/joinRequestsListSample.ts | 25 +- .../samples-dev/labsCreateOrUpdateSample.ts | 37 +- .../samples-dev/labsDeleteSample.ts | 24 +- .../labsGenerateInviteCodeSample.ts | 27 +- .../samples-dev/labsGetSample.ts | 47 +- .../samples-dev/labsListAllSample.ts | 39 +- .../samples-dev/labsListSample.ts | 49 +- .../samples-dev/operationsListSample.ts | 14 +- .../samples-dev/redeemInvitationCodeSample.ts | 25 +- .../samples-dev/studentLabsGetSample.ts | 17 +- .../samples-dev/studentLabsListAllSample.ts | 15 +- .../studentsCreateOrUpdateSample.ts | 44 +- .../samples-dev/studentsDeleteSample.ts | 29 +- .../samples-dev/studentsGetSample.ts | 26 +- .../samples-dev/studentsListSample.ts | 24 +- .../samples/v1-beta/javascript/README.md | 58 +- .../v1-beta/javascript/grantsGetSample.js | 42 +- .../v1-beta/javascript/grantsListAllSample.js | 36 +- .../v1-beta/javascript/grantsListSample.js | 44 +- .../javascript/joinRequestsApproveSample.js | 33 +- .../javascript/joinRequestsDenySample.js | 33 +- .../javascript/joinRequestsGetSample.js | 26 +- .../javascript/joinRequestsListSample.js | 30 +- .../javascript/labsCreateOrUpdateSample.js | 40 +- .../v1-beta/javascript/labsDeleteSample.js | 28 +- .../labsGenerateInviteCodeSample.js | 30 +- .../v1-beta/javascript/labsGetSample.js | 52 +- .../v1-beta/javascript/labsListAllSample.js | 44 +- .../v1-beta/javascript/labsListSample.js | 58 +- .../javascript/operationsListSample.js | 18 +- .../samples/v1-beta/javascript/package.json | 10 +- .../javascript/redeemInvitationCodeSample.js | 28 +- .../samples/v1-beta/javascript/sample.env | 5 +- .../javascript/studentLabsGetSample.js | 21 +- .../javascript/studentLabsListAllSample.js | 21 +- .../studentsCreateOrUpdateSample.js | 47 +- .../javascript/studentsDeleteSample.js | 33 +- .../v1-beta/javascript/studentsGetSample.js | 30 +- .../v1-beta/javascript/studentsListSample.js | 30 +- .../samples/v1-beta/typescript/README.md | 58 +- .../samples/v1-beta/typescript/package.json | 12 +- .../samples/v1-beta/typescript/sample.env | 5 +- .../v1-beta/typescript/src/grantsGetSample.ts | 55 +- .../typescript/src/grantsListAllSample.ts | 41 +- .../typescript/src/grantsListSample.ts | 57 +- .../src/joinRequestsApproveSample.ts | 33 +- .../typescript/src/joinRequestsDenySample.ts | 33 +- .../typescript/src/joinRequestsGetSample.ts | 26 +- .../typescript/src/joinRequestsListSample.ts | 35 +- .../src/labsCreateOrUpdateSample.ts | 42 +- .../typescript/src/labsDeleteSample.ts | 28 +- .../src/labsGenerateInviteCodeSample.ts | 35 +- .../v1-beta/typescript/src/labsGetSample.ts | 57 +- .../typescript/src/labsListAllSample.ts | 57 +- .../v1-beta/typescript/src/labsListSample.ts | 63 +- .../typescript/src/operationsListSample.ts | 18 +- .../src/redeemInvitationCodeSample.ts | 32 +- .../typescript/src/studentLabsGetSample.ts | 21 +- .../src/studentLabsListAllSample.ts | 21 +- .../src/studentsCreateOrUpdateSample.ts | 52 +- .../typescript/src/studentsDeleteSample.ts | 33 +- .../typescript/src/studentsGetSample.ts | 30 +- .../typescript/src/studentsListSample.ts | 30 +- .../samples/v1-beta/typescript/tsconfig.json | 6 +- .../src/api/educationManagementContext.ts | 49 + .../arm-education/src/api/grants/index.ts | 9 + .../src/api/grants/operations.ts | 182 +++ .../arm-education/src/api/grants/options.ts | 22 + sdk/education/arm-education/src/api/index.ts | 10 + .../src/api/joinRequests/index.ts | 10 + .../src/api/joinRequests/operations.ts | 258 ++++ .../src/api/joinRequests/options.ts | 19 + .../arm-education/src/api/labs/index.ts | 12 + .../arm-education/src/api/labs/operations.ts | 382 ++++++ .../arm-education/src/api/labs/options.ts | 36 + .../arm-education/src/api/operations.ts | 62 + .../arm-education/src/api/operations/index.ts | 5 + .../src/api/operations/operations.ts | 59 + .../src/api/operations/options.ts | 7 + .../arm-education/src/api/options.ts | 7 + .../src/api/studentLabs/index.ts | 5 + .../src/api/studentLabs/operations.ts | 117 ++ .../src/api/studentLabs/options.ts | 10 + .../arm-education/src/api/students/index.ts | 10 + .../src/api/students/operations.ts | 269 +++++ .../arm-education/src/api/students/options.ts | 19 + .../arm-education/src/classic/grants/index.ts | 52 + .../arm-education/src/classic/index.ts | 9 + .../src/classic/joinRequests/index.ts | 112 ++ .../arm-education/src/classic/labs/index.ts | 133 ++ .../src/classic/operations/index.ts | 27 + .../src/classic/studentLabs/index.ts | 40 + .../src/classic/students/index.ts | 113 ++ .../src/educationManagementClient.ts | 236 +--- sdk/education/arm-education/src/index.ts | 110 +- sdk/education/arm-education/src/logger.ts | 5 + .../arm-education/src/models/index.ts | 833 +------------ .../arm-education/src/models/mappers.ts | 775 ------------ .../arm-education/src/models/models.ts | 1070 +++++++++++++++++ .../arm-education/src/models/parameters.ts | 215 ---- .../arm-education/src/operations/grants.ts | 354 ------ .../arm-education/src/operations/index.ts | 14 - .../src/operations/joinRequests.ts | 371 ------ .../arm-education/src/operations/labs.ts | 591 --------- .../src/operations/operations.ts | 59 - .../src/operations/studentLabs.ts | 182 --- .../arm-education/src/operations/students.ts | 384 ------ .../src/operationsInterfaces/grants.ts | 50 - .../src/operationsInterfaces/index.ts | 14 - .../src/operationsInterfaces/joinRequests.ts | 80 -- .../src/operationsInterfaces/labs.ts | 110 -- .../src/operationsInterfaces/operations.ts | 21 - .../src/operationsInterfaces/studentLabs.ts | 36 - .../src/operationsInterfaces/students.ts | 84 -- .../arm-education/src/pagingHelper.ts | 39 - .../src/static-helpers/cloudSettingHelpers.ts | 42 + .../src/static-helpers/pagingHelpers.ts | 267 ++++ .../serialization/check-prop-undefined.ts | 17 + .../src/static-helpers/urlTemplate.ts | 227 ++++ .../arm-education/test/snippets.spec.ts | 6 +- sdk/education/arm-education/tsconfig.json | 9 +- sdk/education/arm-education/tsp-location.yaml | 4 + sdk/education/arm-education/warp.config.yml | 13 +- sdk/education/ci.mgmt.yml | 5 +- 148 files changed, 5225 insertions(+), 6232 deletions(-) delete mode 100644 sdk/education/arm-education/_meta.json delete mode 100644 sdk/education/arm-education/config/tsconfig.lint.json create mode 100644 sdk/education/arm-education/config/tsconfig.test.browser.json create mode 100644 sdk/education/arm-education/metadata.json create mode 100644 sdk/education/arm-education/src/api/educationManagementContext.ts create mode 100644 sdk/education/arm-education/src/api/grants/index.ts create mode 100644 sdk/education/arm-education/src/api/grants/operations.ts create mode 100644 sdk/education/arm-education/src/api/grants/options.ts create mode 100644 sdk/education/arm-education/src/api/index.ts create mode 100644 sdk/education/arm-education/src/api/joinRequests/index.ts create mode 100644 sdk/education/arm-education/src/api/joinRequests/operations.ts create mode 100644 sdk/education/arm-education/src/api/joinRequests/options.ts create mode 100644 sdk/education/arm-education/src/api/labs/index.ts create mode 100644 sdk/education/arm-education/src/api/labs/operations.ts create mode 100644 sdk/education/arm-education/src/api/labs/options.ts create mode 100644 sdk/education/arm-education/src/api/operations.ts create mode 100644 sdk/education/arm-education/src/api/operations/index.ts create mode 100644 sdk/education/arm-education/src/api/operations/operations.ts create mode 100644 sdk/education/arm-education/src/api/operations/options.ts create mode 100644 sdk/education/arm-education/src/api/options.ts create mode 100644 sdk/education/arm-education/src/api/studentLabs/index.ts create mode 100644 sdk/education/arm-education/src/api/studentLabs/operations.ts create mode 100644 sdk/education/arm-education/src/api/studentLabs/options.ts create mode 100644 sdk/education/arm-education/src/api/students/index.ts create mode 100644 sdk/education/arm-education/src/api/students/operations.ts create mode 100644 sdk/education/arm-education/src/api/students/options.ts create mode 100644 sdk/education/arm-education/src/classic/grants/index.ts create mode 100644 sdk/education/arm-education/src/classic/index.ts create mode 100644 sdk/education/arm-education/src/classic/joinRequests/index.ts create mode 100644 sdk/education/arm-education/src/classic/labs/index.ts create mode 100644 sdk/education/arm-education/src/classic/operations/index.ts create mode 100644 sdk/education/arm-education/src/classic/studentLabs/index.ts create mode 100644 sdk/education/arm-education/src/classic/students/index.ts create mode 100644 sdk/education/arm-education/src/logger.ts delete mode 100644 sdk/education/arm-education/src/models/mappers.ts create mode 100644 sdk/education/arm-education/src/models/models.ts delete mode 100644 sdk/education/arm-education/src/models/parameters.ts delete mode 100644 sdk/education/arm-education/src/operations/grants.ts delete mode 100644 sdk/education/arm-education/src/operations/index.ts delete mode 100644 sdk/education/arm-education/src/operations/joinRequests.ts delete mode 100644 sdk/education/arm-education/src/operations/labs.ts delete mode 100644 sdk/education/arm-education/src/operations/operations.ts delete mode 100644 sdk/education/arm-education/src/operations/studentLabs.ts delete mode 100644 sdk/education/arm-education/src/operations/students.ts delete mode 100644 sdk/education/arm-education/src/operationsInterfaces/grants.ts delete mode 100644 sdk/education/arm-education/src/operationsInterfaces/index.ts delete mode 100644 sdk/education/arm-education/src/operationsInterfaces/joinRequests.ts delete mode 100644 sdk/education/arm-education/src/operationsInterfaces/labs.ts delete mode 100644 sdk/education/arm-education/src/operationsInterfaces/operations.ts delete mode 100644 sdk/education/arm-education/src/operationsInterfaces/studentLabs.ts delete mode 100644 sdk/education/arm-education/src/operationsInterfaces/students.ts delete mode 100644 sdk/education/arm-education/src/pagingHelper.ts create mode 100644 sdk/education/arm-education/src/static-helpers/cloudSettingHelpers.ts create mode 100644 sdk/education/arm-education/src/static-helpers/pagingHelpers.ts create mode 100644 sdk/education/arm-education/src/static-helpers/serialization/check-prop-undefined.ts create mode 100644 sdk/education/arm-education/src/static-helpers/urlTemplate.ts create mode 100644 sdk/education/arm-education/tsp-location.yaml diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3d6a2a7cfd1c..3cd001e28c82 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12737,18 +12737,21 @@ importers: sdk/education/arm-education: dependencies: + '@azure-rest/core-client': + specifier: ^2.3.1 + version: link:../../core/core-client-rest '@azure/core-auth': specifier: ^1.9.0 version: link:../../core/core-auth - '@azure/core-client': - specifier: ^1.9.2 - version: link:../../core/core-client - '@azure/core-paging': - specifier: ^1.6.2 - version: link:../../core/core-paging '@azure/core-rest-pipeline': specifier: link:../../core/core-rest-pipeline version: link:../../core/core-rest-pipeline + '@azure/core-util': + specifier: ^1.12.0 + version: link:../../core/core-util + '@azure/logger': + specifier: ^1.2.0 + version: link:../../core/logger tslib: specifier: ^2.8.1 version: 2.8.1 @@ -12765,12 +12768,12 @@ importers: '@azure/dev-tool': specifier: workspace:^ version: link:../../../common/tools/dev-tool + '@azure/eslint-plugin-azure-sdk': + specifier: workspace:^ + version: link:../../../common/tools/eslint-plugin-azure-sdk '@azure/identity': specifier: catalog:internal version: 4.13.0 - '@azure/logger': - specifier: ^1.1.4 - version: link:../../core/logger '@types/node': specifier: 'catalog:' version: 20.19.40 @@ -12786,9 +12789,15 @@ importers: dotenv: specifier: catalog:testing version: 16.6.1 + eslint: + specifier: 'catalog:' + version: 9.39.4 playwright: specifier: catalog:testing version: 1.60.0 + prettier: + specifier: 'catalog:' + version: 3.8.3 rimraf: specifier: 'catalog:' version: 6.1.3 diff --git a/sdk/education/arm-education/CHANGELOG.md b/sdk/education/arm-education/CHANGELOG.md index ef8cd4788d64..2c1b1302073c 100644 --- a/sdk/education/arm-education/CHANGELOG.md +++ b/sdk/education/arm-education/CHANGELOG.md @@ -1,21 +1,33 @@ # Release History -## 1.0.0-beta.5 (Unreleased) +## 1.0.0-beta.5 (2026-05-27) +Compared with version 1.0.0-beta.3 ### Features Added + - Added Interface GrantDetailProperties + - Added Interface JoinRequestProperties + - Added Interface LabProperties + - Added Interface PagedAsyncIterableIterator + - Added Interface PageSettings + - Added Interface ProxyResource + - Added Interface StudentLabProperties + - Added Interface StudentProperties + - Interface LabDetails has a new optional parameter totalAllocatedBudget + - Interface LabDetails has a new optional parameter totalBudget + - Added Type Alias AzureSupportedClouds + - Added Enum AzureClouds + - Added Enum KnownVersions ### Breaking Changes + - Removed Interface GrantListResponse + - Removed Interface JoinRequestList + - Interface LabDetails no longer has parameter currencyPropertiesTotalAllocatedBudgetCurrency + - Interface LabDetails no longer has parameter currencyPropertiesTotalBudgetCurrency + - Interface LabDetails no longer has parameter valuePropertiesTotalAllocatedBudgetValue + - Interface LabDetails no longer has parameter valuePropertiesTotalBudgetValue + - Parameter value of interface OperationListResult is now required -### Bugs Fixed - -### Other Changes - -## 1.0.0-beta.4 (2025-08-22) - -### Other Changes - - - Other fixes - + ## 1.0.0-beta.3 (2023-01-10) ### Features Added @@ -43,4 +55,4 @@ ## 1.0.0-beta.1 (2022-05-24) -The package of @azure/arm-education is using our next generation design principles. To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/js/mgmt/quickstart ). +The package of @azure/arm-education is using our next generation design principles. To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/js/mgmt/quickstart). diff --git a/sdk/education/arm-education/LICENSE b/sdk/education/arm-education/LICENSE index b2f52a2bad4e..63447fd8bbbf 100644 --- a/sdk/education/arm-education/LICENSE +++ b/sdk/education/arm-education/LICENSE @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +SOFTWARE. \ No newline at end of file diff --git a/sdk/education/arm-education/README.md b/sdk/education/arm-education/README.md index cc89f515bf4e..f424560e5e1a 100644 --- a/sdk/education/arm-education/README.md +++ b/sdk/education/arm-education/README.md @@ -4,10 +4,12 @@ This package contains an isomorphic SDK (runs both in Node.js and in browsers) f Education client provides access to education resources for Azure subscriptions. -[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/education/arm-education) | -[Package (NPM)](https://www.npmjs.com/package/@azure/arm-education) | -[API reference documentation](https://learn.microsoft.com/javascript/api/@azure/arm-education?view=azure-node-preview) | -[Samples](https://github.com/Azure-Samples/azure-samples-js-management) +Key links: + +- [Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/education/arm-education) +- [Package (NPM)](https://www.npmjs.com/package/@azure/arm-education) +- [API reference documentation](https://learn.microsoft.com/javascript/api/@azure/arm-education?view=azure-node-preview) +- [Samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/education/arm-education/samples) ## Getting started @@ -35,7 +37,7 @@ npm install @azure/arm-education To create a client object to access the Azure EducationManagement API, you will need the `endpoint` of your Azure EducationManagement resource and a `credential`. The Azure EducationManagement client can use Azure Active Directory credentials to authenticate. You can find the endpoint for your Azure EducationManagement 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). +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/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token). To use the [DefaultAzureCredential][defaultazurecredential] provider shown below, or other credential providers provided with the Azure SDK, please install the `@azure/identity` package: @@ -44,7 +46,6 @@ npm install @azure/identity ``` You will also need to **register a new AAD application and grant access to Azure EducationManagement** 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://learn.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal). @@ -54,8 +55,7 @@ Using Node.js and Node-like environments, you can use the `DefaultAzureCredentia import { EducationManagementClient } from "@azure/arm-education"; import { DefaultAzureCredential } from "@azure/identity"; -const subscriptionId = "00000000-0000-0000-0000-000000000000"; -const client = new EducationManagementClient(new DefaultAzureCredential(), subscriptionId); +const client = new EducationManagementClient(new DefaultAzureCredential()); ``` For browser environments, use the `InteractiveBrowserCredential` from the `@azure/identity` package to authenticate. @@ -64,16 +64,15 @@ For browser environments, use the `InteractiveBrowserCredential` from the `@azur import { InteractiveBrowserCredential } from "@azure/identity"; import { EducationManagementClient } from "@azure/arm-education"; -const subscriptionId = "00000000-0000-0000-0000-000000000000"; const credential = new InteractiveBrowserCredential({ tenantId: "", clientId: "", }); -const client = new EducationManagementClient(credential, subscriptionId); +const client = new EducationManagementClient(credential); ``` -### JavaScript Bundle +### JavaScript Bundle To use this client library in the browser, first you need to use a bundler. For details on how to do this, please refer to our [bundling documentation](https://aka.ms/AzureSDKBundling). ## Key concepts @@ -98,7 +97,7 @@ For more detailed instructions on how to enable logs, you can look at the [@azur ## Next steps -Please take a look at the [samples](https://github.com/Azure-Samples/azure-samples-js-management) directory for detailed examples on how to use this library. +Please take a look at the [samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/education/arm-education/samples) directory for detailed examples on how to use this library. ## Contributing @@ -108,10 +107,6 @@ If you'd like to contribute to this library, please read the [contributing guide - [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js) - - -[azure_cli]: https://learn.microsoft.com/cli/azure -[azure_sub]: https://azure.microsoft.com/free/ [azure_sub]: https://azure.microsoft.com/free/ [azure_portal]: https://portal.azure.com [azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity diff --git a/sdk/education/arm-education/_meta.json b/sdk/education/arm-education/_meta.json deleted file mode 100644 index 5434ae034fe4..000000000000 --- a/sdk/education/arm-education/_meta.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "commit": "ac155b972d0619a6e5bf665a863fb05ee7eeb30f", - "readme": "specification\\education\\resource-manager\\readme.md", - "autorest_command": "autorest --version=3.9.3 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=F:\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\education\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-rc.6.20221226.1 --generate-sample=true", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "release_tool": "@azure-tools/js-sdk-release-tools@2.5.4", - "use": "@autorest/typescript@6.0.0-rc.6.20221226.1" -} diff --git a/sdk/education/arm-education/api-extractor.json b/sdk/education/arm-education/api-extractor.json index 16d81e2eb512..870d6d399477 100644 --- a/sdk/education/arm-education/api-extractor.json +++ b/sdk/education/arm-education/api-extractor.json @@ -1,3 +1 @@ -{ - "extends": "../../../api-extractor-base.json" -} +{ "extends": "../../../api-extractor-base.json" } diff --git a/sdk/education/arm-education/config/tsconfig.lint.json b/sdk/education/arm-education/config/tsconfig.lint.json deleted file mode 100644 index 8431a95cbcb1..000000000000 --- a/sdk/education/arm-education/config/tsconfig.lint.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extends": "../../../../tsconfig.json", - "include": [ - "../src", - "../test" - ] -} diff --git a/sdk/education/arm-education/config/tsconfig.samples.json b/sdk/education/arm-education/config/tsconfig.samples.json index 7aa5bbcce065..f24063d7dd1f 100644 --- a/sdk/education/arm-education/config/tsconfig.samples.json +++ b/sdk/education/arm-education/config/tsconfig.samples.json @@ -2,9 +2,7 @@ "extends": "../../../../eng/tsconfigs/samples.json", "compilerOptions": { "paths": { - "@azure/arm-education": [ - "../dist/esm" - ] + "@azure/arm-education": ["../dist/esm"] } } } diff --git a/sdk/education/arm-education/config/tsconfig.src.browser.json b/sdk/education/arm-education/config/tsconfig.src.browser.json index 2e75154106a2..429817e79b26 100644 --- a/sdk/education/arm-education/config/tsconfig.src.browser.json +++ b/sdk/education/arm-education/config/tsconfig.src.browser.json @@ -1,6 +1,4 @@ { "extends": "../../../../eng/tsconfigs/src.browser.json", - "include": [ - "../src/index.ts" - ] + "include": ["../src/index.ts"] } diff --git a/sdk/education/arm-education/config/tsconfig.src.cjs.json b/sdk/education/arm-education/config/tsconfig.src.cjs.json index 018cc5885d5b..b000a4a9909e 100644 --- a/sdk/education/arm-education/config/tsconfig.src.cjs.json +++ b/sdk/education/arm-education/config/tsconfig.src.cjs.json @@ -1,6 +1,4 @@ { "extends": "../../../../eng/tsconfigs/src.cjs.json", - "include": [ - "../src/index.ts" - ] + "include": ["../src/index.ts"] } diff --git a/sdk/education/arm-education/config/tsconfig.src.esm.json b/sdk/education/arm-education/config/tsconfig.src.esm.json index bc91d3d2b231..b393943938eb 100644 --- a/sdk/education/arm-education/config/tsconfig.src.esm.json +++ b/sdk/education/arm-education/config/tsconfig.src.esm.json @@ -1,6 +1,4 @@ { "extends": "../../../../eng/tsconfigs/src.esm.json", - "include": [ - "../src/index.ts" - ] + "include": ["../src/index.ts"] } diff --git a/sdk/education/arm-education/config/tsconfig.test.browser.json b/sdk/education/arm-education/config/tsconfig.test.browser.json new file mode 100644 index 000000000000..1d3230fb2852 --- /dev/null +++ b/sdk/education/arm-education/config/tsconfig.test.browser.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../../eng/tsconfigs/test.browser.json", + "compilerOptions": { + "paths": { + "@azure/arm-education": ["../src/index.ts"], + "@azure/arm-education/*": ["../src/*"], + "$internal/*": ["../src/*"] + } + } +} diff --git a/sdk/education/arm-education/config/tsconfig.test.node.json b/sdk/education/arm-education/config/tsconfig.test.node.json index d123d08c39d5..9e4a65ec5c67 100644 --- a/sdk/education/arm-education/config/tsconfig.test.node.json +++ b/sdk/education/arm-education/config/tsconfig.test.node.json @@ -1,3 +1,10 @@ { - "extends": "../../../../eng/tsconfigs/test.node.json" + "extends": "../../../../eng/tsconfigs/test.node.json", + "compilerOptions": { + "paths": { + "@azure/arm-education": ["../src/index.ts"], + "@azure/arm-education/*": ["../src/*"], + "$internal/*": ["../src/*"] + } + } } diff --git a/sdk/education/arm-education/eslint.config.mjs b/sdk/education/arm-education/eslint.config.mjs index 06fec08fcab3..6d2f8a5914c3 100644 --- a/sdk/education/arm-education/eslint.config.mjs +++ b/sdk/education/arm-education/eslint.config.mjs @@ -1,25 +1,14 @@ import azsdkEslint from "@azure/eslint-plugin-azure-sdk"; -export default [ - ...azsdkEslint.config([ - { - rules: { - "@azure/azure-sdk/ts-modules-only-named": "warn", - "@azure/azure-sdk/ts-package-json-types": "warn", - "@azure/azure-sdk/ts-package-json-engine-is-present": "warn", - "@azure/azure-sdk/ts-package-json-files-required": "off", - "@azure/azure-sdk/ts-package-json-main-is-cjs": "off", - "tsdoc/syntax": "warn" - } - } - ]), +export default azsdkEslint.config([ { - files: ["src/**/*.ts", "src/**/*.mts", "test/**/*.ts"], - languageOptions: { - parserOptions: { - projectService: false, - project: "./config/tsconfig.lint.json", - }, + rules: { + "@azure/azure-sdk/ts-modules-only-named": "warn", + "@azure/azure-sdk/ts-package-json-types": "warn", + "@azure/azure-sdk/ts-package-json-engine-is-present": "warn", + "@azure/azure-sdk/ts-package-json-files-required": "off", + "@azure/azure-sdk/ts-package-json-main-is-cjs": "off", + "tsdoc/syntax": "warn", }, }, -]; +]); diff --git a/sdk/education/arm-education/metadata.json b/sdk/education/arm-education/metadata.json new file mode 100644 index 000000000000..9c5530afd2de --- /dev/null +++ b/sdk/education/arm-education/metadata.json @@ -0,0 +1,68 @@ +{ + "apiVersions": { + "Microsoft.Education": "2021-12-01-preview" + }, + "emitterVersion": "0.53.3", + "crossLanguageDefinitions": { + "CrossLanguagePackageId": "Microsoft.Education", + "CrossLanguageDefinitionId": { + "@azure/arm-education!RedeemRequest:interface": "Microsoft.Education.RedeemRequest", + "@azure/arm-education!ErrorResponseBody:interface": "Microsoft.Education.ErrorResponseBody", + "@azure/arm-education!ErrorResponse:interface": "Microsoft.Education.ErrorResponse", + "@azure/arm-education!OperationListResult:interface": "Azure.ResourceManager.CommonTypes.OperationListResult", + "@azure/arm-education!Operation:interface": "Azure.ResourceManager.CommonTypes.Operation", + "@azure/arm-education!OperationDisplay:interface": "Azure.ResourceManager.CommonTypes.OperationDisplay", + "@azure/arm-education!GrantDetails:interface": "Microsoft.Education.GrantDetails", + "@azure/arm-education!GrantDetailProperties:interface": "Microsoft.Education.GrantDetailProperties", + "@azure/arm-education!Amount:interface": "Microsoft.Education.Amount", + "@azure/arm-education!ProxyResource:interface": "Azure.ResourceManager.CommonTypes.ProxyResource", + "@azure/arm-education!Resource:interface": "Azure.ResourceManager.CommonTypes.Resource", + "@azure/arm-education!SystemData:interface": "Azure.ResourceManager.CommonTypes.SystemData", + "@azure/arm-education!GrantListResponse:interface": "Microsoft.Education.GrantListResponse", + "@azure/arm-education!LabDetails:interface": "Microsoft.Education.LabDetails", + "@azure/arm-education!LabProperties:interface": "Microsoft.Education.LabProperties", + "@azure/arm-education!LabListResult:interface": "Microsoft.Education.LabListResult", + "@azure/arm-education!InviteCodeGenerateRequest:interface": "Microsoft.Education.InviteCodeGenerateRequest", + "@azure/arm-education!JoinRequestDetails:interface": "Microsoft.Education.JoinRequestDetails", + "@azure/arm-education!JoinRequestProperties:interface": "Microsoft.Education.JoinRequestProperties", + "@azure/arm-education!JoinRequestList:interface": "Microsoft.Education.JoinRequestList", + "@azure/arm-education!StudentDetails:interface": "Microsoft.Education.StudentDetails", + "@azure/arm-education!StudentProperties:interface": "Microsoft.Education.StudentProperties", + "@azure/arm-education!StudentListResult:interface": "Microsoft.Education.StudentListResult", + "@azure/arm-education!StudentLabDetails:interface": "Microsoft.Education.StudentLabDetails", + "@azure/arm-education!StudentLabProperties:interface": "Microsoft.Education.StudentLabProperties", + "@azure/arm-education!StudentLabListResult:interface": "Microsoft.Education.StudentLabListResult", + "@azure/arm-education!KnownOrigin:enum": "Azure.ResourceManager.CommonTypes.Origin", + "@azure/arm-education!KnownActionType:enum": "Azure.ResourceManager.CommonTypes.ActionType", + "@azure/arm-education!KnownGrantType:enum": "Microsoft.Education.GrantType", + "@azure/arm-education!KnownGrantStatus:enum": "Microsoft.Education.GrantStatus", + "@azure/arm-education!KnowncreatedByType:enum": "Azure.ResourceManager.CommonTypes.createdByType", + "@azure/arm-education!KnownLabStatus:enum": "Microsoft.Education.LabStatus", + "@azure/arm-education!KnownJoinRequestStatus:enum": "Microsoft.Education.JoinRequestStatus", + "@azure/arm-education!KnownStudentRole:enum": "Microsoft.Education.StudentRole", + "@azure/arm-education!KnownStudentLabStatus:enum": "Microsoft.Education.StudentLabStatus", + "@azure/arm-education!KnownVersions:enum": "Microsoft.Education.Versions", + "@azure/arm-education!EducationManagementClient#redeemInvitationCode:member(1)": "Microsoft.Education.redeemInvitationCode", + "@azure/arm-education!StudentLabsOperations#listAll:member": "Microsoft.Education.StudentLabs.listAll", + "@azure/arm-education!StudentLabsOperations#get:member": "Microsoft.Education.StudentLabs.get", + "@azure/arm-education!StudentsOperations#list:member": "Microsoft.Education.Students.list", + "@azure/arm-education!StudentsOperations#delete:member": "Microsoft.Education.Students.delete", + "@azure/arm-education!StudentsOperations#createOrUpdate:member": "Microsoft.Education.Students.createOrUpdate", + "@azure/arm-education!StudentsOperations#get:member": "Microsoft.Education.Students.get", + "@azure/arm-education!JoinRequestsOperations#deny:member": "Microsoft.Education.JoinRequests.deny", + "@azure/arm-education!JoinRequestsOperations#approve:member": "Microsoft.Education.JoinRequests.approve", + "@azure/arm-education!JoinRequestsOperations#list:member": "Microsoft.Education.JoinRequests.list", + "@azure/arm-education!JoinRequestsOperations#get:member": "Microsoft.Education.JoinRequests.get", + "@azure/arm-education!LabsOperations#generateInviteCode:member": "Microsoft.Education.Labs.generateInviteCode", + "@azure/arm-education!LabsOperations#listAll:member": "Microsoft.Education.Labs.listAll", + "@azure/arm-education!LabsOperations#list:member": "Microsoft.Education.Labs.list", + "@azure/arm-education!LabsOperations#delete:member": "Microsoft.Education.Labs.delete", + "@azure/arm-education!LabsOperations#createOrUpdate:member": "Microsoft.Education.Labs.createOrUpdate", + "@azure/arm-education!LabsOperations#get:member": "Microsoft.Education.Labs.get", + "@azure/arm-education!GrantsOperations#listAll:member": "Microsoft.Education.Grants.listAll", + "@azure/arm-education!GrantsOperations#list:member": "Microsoft.Education.Grants.list", + "@azure/arm-education!GrantsOperations#get:member": "Microsoft.Education.Grants.get", + "@azure/arm-education!OperationsOperations#list:member": "Microsoft.Education.Operations.list" + } + } +} diff --git a/sdk/education/arm-education/package.json b/sdk/education/arm-education/package.json index 204432c093d0..49fc44bead87 100644 --- a/sdk/education/arm-education/package.json +++ b/sdk/education/arm-education/package.json @@ -1,120 +1,238 @@ { "name": "@azure/arm-education", - "sdk-type": "mgmt", - "author": "Microsoft Corporation", - "description": "A generated SDK for EducationManagementClient.", "version": "1.0.0-beta.5", + "description": "A generated SDK for EducationManagementClient.", "engines": { "node": ">=20.0.0" }, - "dependencies": { - "@azure/core-auth": "^1.9.0", - "@azure/core-client": "^1.9.2", - "@azure/core-paging": "^1.6.2", - "@azure/core-rest-pipeline": "^1.18.2", - "tslib": "^2.8.1" + "sideEffects": false, + "autoPublish": false, + "type": "module", + "main": "./dist/commonjs/index.js", + "module": "./dist/esm/index.js", + "types": "./dist/commonjs/index.d.ts", + "browser": "./dist/browser/index.js", + "imports": { + "#platform/*": { + "browser": "./src/*-browser.mts", + "default": "./src/*.ts" + } + }, + "exports": { + "./package.json": "./package.json", + ".": { + "browser": { + "types": "./dist/browser/index.d.ts", + "default": "./dist/browser/index.js" + }, + "import": { + "types": "./dist/esm/index.d.ts", + "default": "./dist/esm/index.js" + }, + "require": { + "types": "./dist/commonjs/index.d.ts", + "default": "./dist/commonjs/index.js" + } + }, + "./api": { + "browser": { + "types": "./dist/browser/api/index.d.ts", + "default": "./dist/browser/api/index.js" + }, + "import": { + "types": "./dist/esm/api/index.d.ts", + "default": "./dist/esm/api/index.js" + }, + "require": { + "types": "./dist/commonjs/api/index.d.ts", + "default": "./dist/commonjs/api/index.js" + } + }, + "./api/studentLabs": { + "browser": { + "types": "./dist/browser/api/studentLabs/index.d.ts", + "default": "./dist/browser/api/studentLabs/index.js" + }, + "import": { + "types": "./dist/esm/api/studentLabs/index.d.ts", + "default": "./dist/esm/api/studentLabs/index.js" + }, + "require": { + "types": "./dist/commonjs/api/studentLabs/index.d.ts", + "default": "./dist/commonjs/api/studentLabs/index.js" + } + }, + "./api/students": { + "browser": { + "types": "./dist/browser/api/students/index.d.ts", + "default": "./dist/browser/api/students/index.js" + }, + "import": { + "types": "./dist/esm/api/students/index.d.ts", + "default": "./dist/esm/api/students/index.js" + }, + "require": { + "types": "./dist/commonjs/api/students/index.d.ts", + "default": "./dist/commonjs/api/students/index.js" + } + }, + "./api/joinRequests": { + "browser": { + "types": "./dist/browser/api/joinRequests/index.d.ts", + "default": "./dist/browser/api/joinRequests/index.js" + }, + "import": { + "types": "./dist/esm/api/joinRequests/index.d.ts", + "default": "./dist/esm/api/joinRequests/index.js" + }, + "require": { + "types": "./dist/commonjs/api/joinRequests/index.d.ts", + "default": "./dist/commonjs/api/joinRequests/index.js" + } + }, + "./api/labs": { + "browser": { + "types": "./dist/browser/api/labs/index.d.ts", + "default": "./dist/browser/api/labs/index.js" + }, + "import": { + "types": "./dist/esm/api/labs/index.d.ts", + "default": "./dist/esm/api/labs/index.js" + }, + "require": { + "types": "./dist/commonjs/api/labs/index.d.ts", + "default": "./dist/commonjs/api/labs/index.js" + } + }, + "./api/grants": { + "browser": { + "types": "./dist/browser/api/grants/index.d.ts", + "default": "./dist/browser/api/grants/index.js" + }, + "import": { + "types": "./dist/esm/api/grants/index.d.ts", + "default": "./dist/esm/api/grants/index.js" + }, + "require": { + "types": "./dist/commonjs/api/grants/index.d.ts", + "default": "./dist/commonjs/api/grants/index.js" + } + }, + "./api/operations": { + "browser": { + "types": "./dist/browser/api/operations/index.d.ts", + "default": "./dist/browser/api/operations/index.js" + }, + "import": { + "types": "./dist/esm/api/operations/index.d.ts", + "default": "./dist/esm/api/operations/index.js" + }, + "require": { + "types": "./dist/commonjs/api/operations/index.d.ts", + "default": "./dist/commonjs/api/operations/index.js" + } + }, + "./models": { + "browser": { + "types": "./dist/browser/models/index.d.ts", + "default": "./dist/browser/models/index.js" + }, + "import": { + "types": "./dist/esm/models/index.d.ts", + "default": "./dist/esm/models/index.js" + }, + "require": { + "types": "./dist/commonjs/models/index.d.ts", + "default": "./dist/commonjs/models/index.js" + } + } }, "keywords": [ "node", "azure", + "cloud", "typescript", "browser", - "isomorphic", - "cloud" + "isomorphic" ], + "author": "Microsoft Corporation", "license": "MIT", - "main": "./dist/commonjs/index.js", - "module": "./dist/esm/index.js", - "types": "./dist/commonjs/index.d.ts", + "files": [ + "dist/", + "!dist/**/*.d.*ts.map", + "README.md", + "LICENSE" + ], + "sdk-type": "mgmt", + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js", + "directory": "sdk/education/arm-education" + }, + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/education/arm-education/README.md", + "prettier": "@azure/eslint-plugin-azure-sdk/prettier.json", + "//metadata": { + "constantPaths": [ + { + "path": "src/api/educationManagementContext.ts", + "prefix": "userAgentInfo" + } + ] + }, + "dependencies": { + "@azure/core-util": "^1.12.0", + "@azure-rest/core-client": "^2.3.1", + "@azure/core-auth": "^1.9.0", + "@azure/core-rest-pipeline": "^1.20.0", + "@azure/logger": "^1.2.0", + "tslib": "^2.8.1" + }, "devDependencies": { "@azure-tools/test-credential": "workspace:^", "@azure-tools/test-recorder": "workspace:^", "@azure-tools/test-utils-vitest": "workspace:^", "@azure/dev-tool": "workspace:^", + "@azure/eslint-plugin-azure-sdk": "workspace:^", "@azure/identity": "catalog:internal", - "@azure/logger": "^1.1.4", "@types/node": "catalog:", + "cross-env": "catalog:", + "eslint": "catalog:", + "prettier": "catalog:", + "rimraf": "catalog:", "@vitest/browser-playwright": "catalog:testing", "@vitest/coverage-istanbul": "catalog:testing", - "cross-env": "catalog:", "dotenv": "catalog:testing", "playwright": "catalog:testing", - "rimraf": "catalog:", "typescript": "catalog:", "vitest": "catalog:testing" }, - "repository": { - "type": "git", - "url": "git+https://github.com/Azure/azure-sdk-for-js", - "directory": "sdk/education/arm-education" - }, - "bugs": { - "url": "https://github.com/Azure/azure-sdk-for-js/issues" - }, - "files": [ - "dist/", - "README.md", - "LICENSE", - "review/", - "CHANGELOG.md" - ], "scripts": { - "build": "npm run clean && dev-tool run build-package && dev-tool run extract-api", - "build:samples": "tsc -p config/tsconfig.samples.json && dev-tool samples publish -f", - "check-format": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", - "execute:samples": "echo skipped", - "extract-api": "dev-tool run extract-api", - "format": "echo skipped", - "lint": "echo skipped", + "extract-api": "rimraf review && dev-tool run extract-api", "pack": "pnpm pack 2>&1", - "test": "tsc -b --noEmit && npm run test:node && npm run test:browser", - "test:browser": "echo skipped", + "lint": "echo skipped", + "lint:fix": "echo skipped", + "build:samples": "tsc -p config/tsconfig.samples.json && dev-tool samples publish -f", + "check-format": "prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\" \"samples-dev/*.ts\"", + "execute:samples": "dev-tool samples run samples-dev", + "format": "prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\" \"samples-dev/*.ts\"", + "generate:client": "echo skipped", + "test:browser": "dev-tool run build-test && dev-tool run test:vitest --browser", + "build": "npm run clean && dev-tool run build-package && dev-tool run extract-api", "test:node": "dev-tool run test:vitest", + "test:node:esm": "dev-tool run test:vitest --esm", + "test": "npm run test:node && npm run test:browser", "update-snippets": "dev-tool run update-snippets" }, - "sideEffects": false, - "//metadata": { - "constantPaths": [ - { - "path": "src/educationManagementClient.ts", - "prefix": "packageDetails" - } - ] - }, - "autoPublish": true, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/education/arm-education/README.md", "//sampleConfiguration": { - "productName": "", + "productName": "@azure/arm-education", "productSlugs": [ "azure" ], "disableDocsMs": true, "apiRefLink": "https://learn.microsoft.com/javascript/api/@azure/arm-education?view=azure-node-preview" - }, - "type": "module", - "browser": "./dist/browser/index.js", - "exports": { - "./package.json": "./package.json", - ".": { - "browser": { - "types": "./dist/browser/index.d.ts", - "default": "./dist/browser/index.js" - }, - "import": { - "types": "./dist/esm/index.d.ts", - "default": "./dist/esm/index.js" - }, - "require": { - "types": "./dist/commonjs/index.d.ts", - "default": "./dist/commonjs/index.js" - } - } - }, - "imports": { - "#platform/*": { - "browser": "./src/*-browser.mts", - "default": "./src/*.ts" - } } } diff --git a/sdk/education/arm-education/review/arm-education-node.api.md b/sdk/education/arm-education/review/arm-education-node.api.md index f28c9479b4a3..734f99840caf 100644 --- a/sdk/education/arm-education/review/arm-education-node.api.md +++ b/sdk/education/arm-education/review/arm-education-node.api.md @@ -4,9 +4,12 @@ ```ts -import * as coreAuth from '@azure/core-auth'; -import * as coreClient from '@azure/core-client'; -import { PagedAsyncIterableIterator } from '@azure/core-paging'; +import { ClientOptions } from '@azure-rest/core-client'; +import { isRestError } from '@azure/core-rest-pipeline'; +import { OperationOptions } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; +import { RestError } from '@azure/core-rest-pipeline'; +import { TokenCredential } from '@azure/core-auth'; // @public export type ActionType = string; @@ -17,36 +20,41 @@ export interface Amount { value?: number; } +// @public +export enum AzureClouds { + AZURE_CHINA_CLOUD = "AZURE_CHINA_CLOUD", + AZURE_PUBLIC_CLOUD = "AZURE_PUBLIC_CLOUD", + AZURE_US_GOVERNMENT = "AZURE_US_GOVERNMENT" +} + +// @public +export type AzureSupportedClouds = `${AzureClouds}`; + +// @public +export type ContinuablePage = TPage & { + continuationToken?: string; +}; + // @public export type CreatedByType = string; // @public (undocumented) -export class EducationManagementClient extends coreClient.ServiceClient { - // (undocumented) - $host: string; - constructor(credentials: coreAuth.TokenCredential, options?: EducationManagementClientOptionalParams); - // (undocumented) - apiVersion: string; - // (undocumented) - grants: Grants; - // (undocumented) - joinRequests: JoinRequests; - // (undocumented) - labs: Labs; - // (undocumented) - operations: Operations; +export class EducationManagementClient { + constructor(credential: TokenCredential, options?: EducationManagementClientOptionalParams); + readonly grants: GrantsOperations; + readonly joinRequests: JoinRequestsOperations; + readonly labs: LabsOperations; + readonly operations: OperationsOperations; + readonly pipeline: Pipeline; redeemInvitationCode(parameters: RedeemRequest, options?: RedeemInvitationCodeOptionalParams): Promise; - // (undocumented) - studentLabs: StudentLabs; - // (undocumented) - students: Students; + readonly studentLabs: StudentLabsOperations; + readonly students: StudentsOperations; } // @public -export interface EducationManagementClientOptionalParams extends coreClient.ServiceClientOptions { - $host?: string; +export interface EducationManagementClientOptionalParams extends ClientOptions { apiVersion?: string; - endpoint?: string; + cloudSetting?: AzureSupportedClouds; } // @public @@ -61,10 +69,7 @@ export interface ErrorResponseBody { } // @public -export function getContinuationToken(page: unknown): string | undefined; - -// @public -export interface GrantDetails extends Resource { +export interface GrantDetailProperties { readonly allocatedBudget?: Amount; readonly effectiveDate?: Date; readonly expirationDate?: Date; @@ -74,55 +79,36 @@ export interface GrantDetails extends Resource { } // @public -export interface GrantListResponse { - readonly nextLink?: string; - readonly value?: GrantDetails[]; -} - -// @public -export interface Grants { - get(billingAccountName: string, billingProfileName: string, options?: GrantsGetOptionalParams): Promise; - list(billingAccountName: string, billingProfileName: string, options?: GrantsListOptionalParams): PagedAsyncIterableIterator; - listAll(options?: GrantsListAllOptionalParams): PagedAsyncIterableIterator; +export interface GrantDetails extends ProxyResource { + readonly allocatedBudget?: Amount; + readonly effectiveDate?: Date; + readonly expirationDate?: Date; + readonly offerCap?: Amount; + readonly offerType?: GrantType; + readonly status?: GrantStatus; } // @public -export interface GrantsGetOptionalParams extends coreClient.OperationOptions { +export interface GrantsGetOptionalParams extends OperationOptions { includeAllocatedBudget?: boolean; } // @public -export type GrantsGetResponse = GrantDetails; - -// @public -export interface GrantsListAllNextOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type GrantsListAllNextResponse = GrantListResponse; - -// @public -export interface GrantsListAllOptionalParams extends coreClient.OperationOptions { +export interface GrantsListAllOptionalParams extends OperationOptions { includeAllocatedBudget?: boolean; } // @public -export type GrantsListAllResponse = GrantListResponse; - -// @public -export interface GrantsListNextOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type GrantsListNextResponse = GrantListResponse; - -// @public -export interface GrantsListOptionalParams extends coreClient.OperationOptions { +export interface GrantsListOptionalParams extends OperationOptions { includeAllocatedBudget?: boolean; } // @public -export type GrantsListResponse = GrantListResponse; +export interface GrantsOperations { + get: (billingAccountName: string, billingProfileName: string, options?: GrantsGetOptionalParams) => Promise; + list: (billingAccountName: string, billingProfileName: string, options?: GrantsListOptionalParams) => PagedAsyncIterableIterator; + listAll: (options?: GrantsListAllOptionalParams) => PagedAsyncIterableIterator; +} // @public export type GrantStatus = string; @@ -135,8 +121,10 @@ export interface InviteCodeGenerateRequest { maxStudentCount?: number; } +export { isRestError } + // @public -export interface JoinRequestDetails extends Resource { +export interface JoinRequestDetails extends ProxyResource { email?: string; firstName?: string; lastName?: string; @@ -144,48 +132,37 @@ export interface JoinRequestDetails extends Resource { } // @public -export interface JoinRequestList { - readonly nextLink?: string; - readonly value?: JoinRequestDetails[]; -} - -// @public -export interface JoinRequests { - approve(billingAccountName: string, billingProfileName: string, invoiceSectionName: string, joinRequestName: string, options?: JoinRequestsApproveOptionalParams): Promise; - deny(billingAccountName: string, billingProfileName: string, invoiceSectionName: string, joinRequestName: string, options?: JoinRequestsDenyOptionalParams): Promise; - get(billingAccountName: string, billingProfileName: string, invoiceSectionName: string, joinRequestName: string, options?: JoinRequestsGetOptionalParams): Promise; - list(billingAccountName: string, billingProfileName: string, invoiceSectionName: string, options?: JoinRequestsListOptionalParams): PagedAsyncIterableIterator; -} - -// @public -export interface JoinRequestsApproveOptionalParams extends coreClient.OperationOptions { +export interface JoinRequestProperties { + email?: string; + firstName?: string; + lastName?: string; + status?: JoinRequestStatus; } // @public -export interface JoinRequestsDenyOptionalParams extends coreClient.OperationOptions { +export interface JoinRequestsApproveOptionalParams extends OperationOptions { } // @public -export interface JoinRequestsGetOptionalParams extends coreClient.OperationOptions { +export interface JoinRequestsDenyOptionalParams extends OperationOptions { } // @public -export type JoinRequestsGetResponse = JoinRequestDetails; - -// @public -export interface JoinRequestsListNextOptionalParams extends coreClient.OperationOptions { +export interface JoinRequestsGetOptionalParams extends OperationOptions { } // @public -export type JoinRequestsListNextResponse = JoinRequestList; - -// @public -export interface JoinRequestsListOptionalParams extends coreClient.OperationOptions { +export interface JoinRequestsListOptionalParams extends OperationOptions { includeDenied?: boolean; } // @public -export type JoinRequestsListResponse = JoinRequestList; +export interface JoinRequestsOperations { + approve: (billingAccountName: string, billingProfileName: string, invoiceSectionName: string, joinRequestName: string, options?: JoinRequestsApproveOptionalParams) => Promise; + deny: (billingAccountName: string, billingProfileName: string, invoiceSectionName: string, joinRequestName: string, options?: JoinRequestsDenyOptionalParams) => Promise; + get: (billingAccountName: string, billingProfileName: string, invoiceSectionName: string, joinRequestName: string, options?: JoinRequestsGetOptionalParams) => Promise; + list: (billingAccountName: string, billingProfileName: string, invoiceSectionName: string, options?: JoinRequestsListOptionalParams) => PagedAsyncIterableIterator; +} // @public export type JoinRequestStatus = string; @@ -251,10 +228,13 @@ export enum KnownStudentRole { } // @public -export interface LabDetails extends Resource { +export enum KnownVersions { + V20211201Preview = "2021-12-01-preview" +} + +// @public +export interface LabDetails extends ProxyResource { budgetPerStudent?: Amount; - currencyPropertiesTotalAllocatedBudgetCurrency?: string; - currencyPropertiesTotalBudgetCurrency?: string; description?: string; displayName?: string; readonly effectiveDate?: Date; @@ -262,83 +242,64 @@ export interface LabDetails extends Resource { readonly invitationCode?: string; readonly maxStudentCount?: number; readonly status?: LabStatus; - valuePropertiesTotalAllocatedBudgetValue?: number; - valuePropertiesTotalBudgetValue?: number; -} - -// @public -export interface LabListResult { - readonly nextLink?: string; - readonly value?: LabDetails[]; + readonly totalAllocatedBudget?: Amount; + readonly totalBudget?: Amount; } // @public -export interface Labs { - createOrUpdate(billingAccountName: string, billingProfileName: string, invoiceSectionName: string, parameters: LabDetails, options?: LabsCreateOrUpdateOptionalParams): Promise; - delete(billingAccountName: string, billingProfileName: string, invoiceSectionName: string, options?: LabsDeleteOptionalParams): Promise; - generateInviteCode(billingAccountName: string, billingProfileName: string, invoiceSectionName: string, parameters: InviteCodeGenerateRequest, options?: LabsGenerateInviteCodeOptionalParams): Promise; - get(billingAccountName: string, billingProfileName: string, invoiceSectionName: string, options?: LabsGetOptionalParams): Promise; - list(billingAccountName: string, billingProfileName: string, invoiceSectionName: string, options?: LabsListOptionalParams): PagedAsyncIterableIterator; - listAll(billingAccountName: string, billingProfileName: string, options?: LabsListAllOptionalParams): PagedAsyncIterableIterator; +export interface LabProperties { + budgetPerStudent: Amount; + currency?: string; + currencyTotalAllocatedBudgetCurrency?: string; + description: string; + displayName: string; + readonly effectiveDate?: Date; + expirationDate: Date; + readonly invitationCode?: string; + readonly maxStudentCount?: number; + readonly status?: LabStatus; + value?: number; + valueTotalAllocatedBudgetValue?: number; } // @public -export interface LabsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { +export interface LabsCreateOrUpdateOptionalParams extends OperationOptions { } // @public -export type LabsCreateOrUpdateResponse = LabDetails; - -// @public -export interface LabsDeleteOptionalParams extends coreClient.OperationOptions { +export interface LabsDeleteOptionalParams extends OperationOptions { } // @public -export interface LabsGenerateInviteCodeOptionalParams extends coreClient.OperationOptions { +export interface LabsGenerateInviteCodeOptionalParams extends OperationOptions { onlyUpdateStudentCountParameter?: boolean; } // @public -export type LabsGenerateInviteCodeResponse = LabDetails; - -// @public -export interface LabsGetOptionalParams extends coreClient.OperationOptions { +export interface LabsGetOptionalParams extends OperationOptions { includeBudget?: boolean; } // @public -export type LabsGetResponse = LabDetails; - -// @public -export interface LabsListAllNextOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type LabsListAllNextResponse = LabListResult; - -// @public -export interface LabsListAllOptionalParams extends coreClient.OperationOptions { +export interface LabsListAllOptionalParams extends OperationOptions { includeBudget?: boolean; includeDeleted?: boolean; } // @public -export type LabsListAllResponse = LabListResult; - -// @public -export interface LabsListNextOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type LabsListNextResponse = LabListResult; - -// @public -export interface LabsListOptionalParams extends coreClient.OperationOptions { +export interface LabsListOptionalParams extends OperationOptions { includeBudget?: boolean; } // @public -export type LabsListResponse = LabListResult; +export interface LabsOperations { + createOrUpdate: (billingAccountName: string, billingProfileName: string, invoiceSectionName: string, parameters: LabDetails, options?: LabsCreateOrUpdateOptionalParams) => Promise; + delete: (billingAccountName: string, billingProfileName: string, invoiceSectionName: string, options?: LabsDeleteOptionalParams) => Promise; + generateInviteCode: (billingAccountName: string, billingProfileName: string, invoiceSectionName: string, parameters: InviteCodeGenerateRequest, options?: LabsGenerateInviteCodeOptionalParams) => Promise; + get: (billingAccountName: string, billingProfileName: string, invoiceSectionName: string, options?: LabsGetOptionalParams) => Promise; + list: (billingAccountName: string, billingProfileName: string, invoiceSectionName: string, options?: LabsListOptionalParams) => PagedAsyncIterableIterator; + listAll: (billingAccountName: string, billingProfileName: string, options?: LabsListAllOptionalParams) => PagedAsyncIterableIterator; +} // @public export type LabStatus = string; @@ -363,26 +324,39 @@ export interface OperationDisplay { // @public export interface OperationListResult { readonly nextLink?: string; - readonly value?: Operation[]; + readonly value: Operation[]; } // @public -export interface Operations { - list(options?: OperationsListOptionalParams): Promise; +export interface OperationsListOptionalParams extends OperationOptions { } // @public -export interface OperationsListOptionalParams extends coreClient.OperationOptions { +export interface OperationsOperations { + list: (options?: OperationsListOptionalParams) => Promise; } // @public -export type OperationsListResponse = OperationListResult; +export type Origin = string; // @public -export type Origin = string; +export interface PagedAsyncIterableIterator { + [Symbol.asyncIterator](): PagedAsyncIterableIterator; + byPage: (settings?: TPageSettings) => AsyncIterableIterator>; + next(): Promise>; +} + +// @public +export interface PageSettings { + continuationToken?: string; +} + +// @public +export interface ProxyResource extends Resource { +} // @public -export interface RedeemInvitationCodeOptionalParams extends coreClient.OperationOptions { +export interface RedeemInvitationCodeOptionalParams extends OperationOptions { } // @public @@ -400,8 +374,10 @@ export interface Resource { readonly type?: string; } +export { RestError } + // @public -export interface StudentDetails extends Resource { +export interface StudentDetails extends ProxyResource { budget?: Amount; readonly effectiveDate?: Date; email?: string; @@ -416,7 +392,7 @@ export interface StudentDetails extends Resource { } // @public -export interface StudentLabDetails extends Resource { +export interface StudentLabDetails extends ProxyResource { readonly budget?: Amount; readonly description?: string; readonly displayName?: string; @@ -429,90 +405,77 @@ export interface StudentLabDetails extends Resource { } // @public -export interface StudentLabListResult { - readonly nextLink?: string; - readonly value?: StudentLabDetails[]; -} - -// @public -export interface StudentLabs { - get(studentLabName: string, options?: StudentLabsGetOptionalParams): Promise; - listAll(options?: StudentLabsListAllOptionalParams): PagedAsyncIterableIterator; +export interface StudentLabProperties { + readonly budget?: Amount; + readonly description?: string; + readonly displayName?: string; + readonly effectiveDate?: Date; + readonly expirationDate?: Date; + readonly labScope?: string; + readonly role?: StudentRole; + readonly status?: StudentLabStatus; + readonly subscriptionId?: string; } // @public -export interface StudentLabsGetOptionalParams extends coreClient.OperationOptions { +export interface StudentLabsGetOptionalParams extends OperationOptions { } // @public -export type StudentLabsGetResponse = StudentLabDetails; - -// @public -export interface StudentLabsListAllNextOptionalParams extends coreClient.OperationOptions { +export interface StudentLabsListAllOptionalParams extends OperationOptions { } // @public -export type StudentLabsListAllNextResponse = StudentLabListResult; - -// @public -export interface StudentLabsListAllOptionalParams extends coreClient.OperationOptions { +export interface StudentLabsOperations { + get: (studentLabName: string, options?: StudentLabsGetOptionalParams) => Promise; + listAll: (options?: StudentLabsListAllOptionalParams) => PagedAsyncIterableIterator; } -// @public -export type StudentLabsListAllResponse = StudentLabListResult; - // @public export type StudentLabStatus = string; // @public -export interface StudentListResult { - readonly nextLink?: string; - readonly value?: StudentDetails[]; +export interface StudentProperties { + budget: Amount; + readonly effectiveDate?: Date; + email: string; + expirationDate: Date; + firstName: string; + lastName: string; + role: StudentRole; + readonly status?: StudentLabStatus; + subscriptionAlias?: string; + readonly subscriptionId?: string; + subscriptionInviteLastSentDate?: Date; } // @public export type StudentRole = string; // @public -export interface Students { - createOrUpdate(billingAccountName: string, billingProfileName: string, invoiceSectionName: string, studentAlias: string, parameters: StudentDetails, options?: StudentsCreateOrUpdateOptionalParams): Promise; - delete(billingAccountName: string, billingProfileName: string, invoiceSectionName: string, studentAlias: string, options?: StudentsDeleteOptionalParams): Promise; - get(billingAccountName: string, billingProfileName: string, invoiceSectionName: string, studentAlias: string, options?: StudentsGetOptionalParams): Promise; - list(billingAccountName: string, billingProfileName: string, invoiceSectionName: string, options?: StudentsListOptionalParams): PagedAsyncIterableIterator; -} - -// @public -export interface StudentsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type StudentsCreateOrUpdateResponse = StudentDetails; - -// @public -export interface StudentsDeleteOptionalParams extends coreClient.OperationOptions { +export interface StudentsCreateOrUpdateOptionalParams extends OperationOptions { } // @public -export interface StudentsGetOptionalParams extends coreClient.OperationOptions { +export interface StudentsDeleteOptionalParams extends OperationOptions { } // @public -export type StudentsGetResponse = StudentDetails; - -// @public -export interface StudentsListNextOptionalParams extends coreClient.OperationOptions { +export interface StudentsGetOptionalParams extends OperationOptions { } // @public -export type StudentsListNextResponse = StudentListResult; - -// @public -export interface StudentsListOptionalParams extends coreClient.OperationOptions { +export interface StudentsListOptionalParams extends OperationOptions { includeDeleted?: boolean; } // @public -export type StudentsListResponse = StudentListResult; +export interface StudentsOperations { + createOrUpdate: (billingAccountName: string, billingProfileName: string, invoiceSectionName: string, studentAlias: string, parameters: StudentDetails, options?: StudentsCreateOrUpdateOptionalParams) => Promise; + delete: (billingAccountName: string, billingProfileName: string, invoiceSectionName: string, studentAlias: string, options?: StudentsDeleteOptionalParams) => Promise; + get: (billingAccountName: string, billingProfileName: string, invoiceSectionName: string, studentAlias: string, options?: StudentsGetOptionalParams) => Promise; + list: (billingAccountName: string, billingProfileName: string, invoiceSectionName: string, options?: StudentsListOptionalParams) => PagedAsyncIterableIterator; +} // @public export interface SystemData { diff --git a/sdk/education/arm-education/sample.env b/sdk/education/arm-education/sample.env index 672847a3fea0..508439fc7d62 100644 --- a/sdk/education/arm-education/sample.env +++ b/sdk/education/arm-education/sample.env @@ -1,4 +1 @@ -# App registration secret for AAD authentication -AZURE_CLIENT_SECRET= -AZURE_CLIENT_ID= -AZURE_TENANT_ID= \ No newline at end of file +# Feel free to add your own environment variables. \ No newline at end of file diff --git a/sdk/education/arm-education/samples-dev/grantsGetSample.ts b/sdk/education/arm-education/samples-dev/grantsGetSample.ts index 84139781f61a..01889cb5a7f4 100644 --- a/sdk/education/arm-education/samples-dev/grantsGetSample.ts +++ b/sdk/education/arm-education/samples-dev/grantsGetSample.ts @@ -1,43 +1,36 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Get details for a specific grant linked to the provided billing account and billing profile. - * - * @summary Get details for a specific grant linked to the provided billing account and billing profile. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/Grant.json - */ - -import type { GrantsGetOptionalParams } from "@azure/arm-education"; import { EducationManagementClient } from "@azure/arm-education"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to get details for a specific grant linked to the provided billing account and billing profile. + * + * @summary get details for a specific grant linked to the provided billing account and billing profile. + * x-ms-original-file: 2021-12-01-preview/Grant.json + */ async function grant(): Promise { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const includeAllocatedBudget = false; - const options: GrantsGetOptionalParams = { includeAllocatedBudget }; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); - const result = await client.grants.get(billingAccountName, billingProfileName, options); + const result = await client.grants.get("{billingAccountName}", "{billingProfileName}", { + includeAllocatedBudget: false, + }); console.log(result); } /** - * This sample demonstrates how to Get details for a specific grant linked to the provided billing account and billing profile. + * This sample demonstrates how to get details for a specific grant linked to the provided billing account and billing profile. * - * @summary Get details for a specific grant linked to the provided billing account and billing profile. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/GrantIncludeAllocatedBudget.json + * @summary get details for a specific grant linked to the provided billing account and billing profile. + * x-ms-original-file: 2021-12-01-preview/GrantIncludeAllocatedBudget.json */ async function grantIncludeAllocatedBudget(): Promise { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const includeAllocatedBudget = false; - const options: GrantsGetOptionalParams = { includeAllocatedBudget }; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); - const result = await client.grants.get(billingAccountName, billingProfileName, options); + const result = await client.grants.get("{billingAccountName}", "{billingProfileName}", { + includeAllocatedBudget: false, + }); console.log(result); } diff --git a/sdk/education/arm-education/samples-dev/grantsListAllSample.ts b/sdk/education/arm-education/samples-dev/grantsListAllSample.ts index 034e855dcac5..f92c1225961c 100644 --- a/sdk/education/arm-education/samples-dev/grantsListAllSample.ts +++ b/sdk/education/arm-education/samples-dev/grantsListAllSample.ts @@ -1,45 +1,40 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Get a list of grants that Microsoft has provided. - * - * @summary Get a list of grants that Microsoft has provided. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/GrantList.json - */ - -import type { GrantsListAllOptionalParams } from "@azure/arm-education"; import { EducationManagementClient } from "@azure/arm-education"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to get a list of grants that Microsoft has provided. + * + * @summary get a list of grants that Microsoft has provided. + * x-ms-original-file: 2021-12-01-preview/GrantList.json + */ async function grantList(): Promise { - const includeAllocatedBudget = false; - const options: GrantsListAllOptionalParams = { includeAllocatedBudget }; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); const resArray = new Array(); - for await (const item of client.grants.listAll(options)) { + for await (const item of client.grants.listAll({ includeAllocatedBudget: false })) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Get a list of grants that Microsoft has provided. + * This sample demonstrates how to get a list of grants that Microsoft has provided. * - * @summary Get a list of grants that Microsoft has provided. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/GrantListIncludeAllocatedBudget.json + * @summary get a list of grants that Microsoft has provided. + * x-ms-original-file: 2021-12-01-preview/GrantListIncludeAllocatedBudget.json */ async function grantListIncludeAllocatedBudget(): Promise { - const includeAllocatedBudget = true; - const options: GrantsListAllOptionalParams = { includeAllocatedBudget }; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); const resArray = new Array(); - for await (const item of client.grants.listAll(options)) { + for await (const item of client.grants.listAll({ includeAllocatedBudget: true })) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/education/arm-education/samples-dev/grantsListSample.ts b/sdk/education/arm-education/samples-dev/grantsListSample.ts index 55ec7878cd6d..fcc1fd83b3fc 100644 --- a/sdk/education/arm-education/samples-dev/grantsListSample.ts +++ b/sdk/education/arm-education/samples-dev/grantsListSample.ts @@ -1,49 +1,44 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Get details for a specific grant linked to the provided billing account and billing profile. - * - * @summary Get details for a specific grant linked to the provided billing account and billing profile. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/GrantDefaultList.json - */ - -import type { GrantsListOptionalParams } from "@azure/arm-education"; import { EducationManagementClient } from "@azure/arm-education"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to get details for a specific grant linked to the provided billing account and billing profile. + * + * @summary get details for a specific grant linked to the provided billing account and billing profile. + * x-ms-original-file: 2021-12-01-preview/GrantDefaultList.json + */ async function grantList(): Promise { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const includeAllocatedBudget = false; - const options: GrantsListOptionalParams = { includeAllocatedBudget }; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); const resArray = new Array(); - for await (const item of client.grants.list(billingAccountName, billingProfileName, options)) { + for await (const item of client.grants.list("{billingAccountName}", "{billingProfileName}", { + includeAllocatedBudget: false, + })) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Get details for a specific grant linked to the provided billing account and billing profile. + * This sample demonstrates how to get details for a specific grant linked to the provided billing account and billing profile. * - * @summary Get details for a specific grant linked to the provided billing account and billing profile. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/GrantDefaultListIncludeAllocatedBudget.json + * @summary get details for a specific grant linked to the provided billing account and billing profile. + * x-ms-original-file: 2021-12-01-preview/GrantDefaultListIncludeAllocatedBudget.json */ async function grantListIncludeAllocatedBudget(): Promise { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const includeAllocatedBudget = false; - const options: GrantsListOptionalParams = { includeAllocatedBudget }; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); const resArray = new Array(); - for await (const item of client.grants.list(billingAccountName, billingProfileName, options)) { + for await (const item of client.grants.list("{billingAccountName}", "{billingProfileName}", { + includeAllocatedBudget: false, + })) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/education/arm-education/samples-dev/joinRequestsApproveSample.ts b/sdk/education/arm-education/samples-dev/joinRequestsApproveSample.ts index 45e586f7e180..541d4fe0ae19 100644 --- a/sdk/education/arm-education/samples-dev/joinRequestsApproveSample.ts +++ b/sdk/education/arm-education/samples-dev/joinRequestsApproveSample.ts @@ -1,31 +1,24 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Approve student joining the redeemable lab - * - * @summary Approve student joining the redeemable lab - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/JoinRequestApproveAndDeny.json - */ - import { EducationManagementClient } from "@azure/arm-education"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to approve student joining the redeemable lab + * + * @summary approve student joining the redeemable lab + * x-ms-original-file: 2021-12-01-preview/JoinRequestApproveAndDenyForApprove.json + */ async function joinRequestApprove(): Promise { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const invoiceSectionName = "{invoiceSectionName}"; - const joinRequestName = "{joinRequestName}"; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); - const result = await client.joinRequests.approve( - billingAccountName, - billingProfileName, - invoiceSectionName, - joinRequestName, + await client.joinRequests.approve( + "{billingAccountName}", + "{billingProfileName}", + "{invoiceSectionName}", + "{joinRequestName}", ); - console.log(result); } async function main(): Promise { diff --git a/sdk/education/arm-education/samples-dev/joinRequestsDenySample.ts b/sdk/education/arm-education/samples-dev/joinRequestsDenySample.ts index e654f1353b3a..c9572153822f 100644 --- a/sdk/education/arm-education/samples-dev/joinRequestsDenySample.ts +++ b/sdk/education/arm-education/samples-dev/joinRequestsDenySample.ts @@ -1,31 +1,24 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Deny student joining the redeemable lab - * - * @summary Deny student joining the redeemable lab - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/JoinRequestApproveAndDeny.json - */ - import { EducationManagementClient } from "@azure/arm-education"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to deny student joining the redeemable lab + * + * @summary deny student joining the redeemable lab + * x-ms-original-file: 2021-12-01-preview/JoinRequestApproveAndDeny.json + */ async function joinRequestDeny(): Promise { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const invoiceSectionName = "{invoiceSectionName}"; - const joinRequestName = "{joinRequestName}"; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); - const result = await client.joinRequests.deny( - billingAccountName, - billingProfileName, - invoiceSectionName, - joinRequestName, + await client.joinRequests.deny( + "{billingAccountName}", + "{billingProfileName}", + "{invoiceSectionName}", + "{joinRequestName}", ); - console.log(result); } async function main(): Promise { diff --git a/sdk/education/arm-education/samples-dev/joinRequestsGetSample.ts b/sdk/education/arm-education/samples-dev/joinRequestsGetSample.ts index f764304f57df..fd68cb45d566 100644 --- a/sdk/education/arm-education/samples-dev/joinRequestsGetSample.ts +++ b/sdk/education/arm-education/samples-dev/joinRequestsGetSample.ts @@ -1,29 +1,23 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +import { EducationManagementClient } from "@azure/arm-education"; +import { DefaultAzureCredential } from "@azure/identity"; + /** * This sample demonstrates how to get student join requests * * @summary get student join requests - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/JoinRequest.json + * x-ms-original-file: 2021-12-01-preview/JoinRequest.json */ - -import { EducationManagementClient } from "@azure/arm-education"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - async function joinRequest(): Promise { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const invoiceSectionName = "{invoiceSectionName}"; - const joinRequestName = "{joinRequestName}"; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); const result = await client.joinRequests.get( - billingAccountName, - billingProfileName, - invoiceSectionName, - joinRequestName, + "{billingAccountName}", + "{billingProfileName}", + "{invoiceSectionName}", + "{joinRequestName}", ); console.log(result); } diff --git a/sdk/education/arm-education/samples-dev/joinRequestsListSample.ts b/sdk/education/arm-education/samples-dev/joinRequestsListSample.ts index da61d45e83d9..cc673f3e6289 100644 --- a/sdk/education/arm-education/samples-dev/joinRequestsListSample.ts +++ b/sdk/education/arm-education/samples-dev/joinRequestsListSample.ts @@ -1,35 +1,28 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +import { EducationManagementClient } from "@azure/arm-education"; +import { DefaultAzureCredential } from "@azure/identity"; + /** * This sample demonstrates how to get student join requests * * @summary get student join requests - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/JoinRequestList.json + * x-ms-original-file: 2021-12-01-preview/JoinRequestList.json */ - -import type { JoinRequestsListOptionalParams } from "@azure/arm-education"; -import { EducationManagementClient } from "@azure/arm-education"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - async function joinRequestList(): Promise { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const invoiceSectionName = "{invoiceSectionName}"; - const includeDenied = false; - const options: JoinRequestsListOptionalParams = { includeDenied }; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); const resArray = new Array(); for await (const item of client.joinRequests.list( - billingAccountName, - billingProfileName, - invoiceSectionName, - options, + "{billingAccountName}", + "{billingProfileName}", + "{invoiceSectionName}", + { includeDenied: false }, )) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/education/arm-education/samples-dev/labsCreateOrUpdateSample.ts b/sdk/education/arm-education/samples-dev/labsCreateOrUpdateSample.ts index e3366134486b..e7487cc46127 100644 --- a/sdk/education/arm-education/samples-dev/labsCreateOrUpdateSample.ts +++ b/sdk/education/arm-education/samples-dev/labsCreateOrUpdateSample.ts @@ -1,35 +1,28 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Create a new lab or update a previously created lab. - * - * @summary Create a new lab or update a previously created lab. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/CreateLab.json - */ - -import type { LabDetails } from "@azure/arm-education"; import { EducationManagementClient } from "@azure/arm-education"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to create a new lab or update a previously created lab. + * + * @summary create a new lab or update a previously created lab. + * x-ms-original-file: 2021-12-01-preview/CreateLab.json + */ async function createLab(): Promise { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const invoiceSectionName = "{invoiceSectionName}"; - const parameters: LabDetails = { - description: "example lab description", - budgetPerStudent: { currency: "USD", value: 100 }, - displayName: "example lab", - expirationDate: new Date("2021-12-09T22:11:29.422Z"), - }; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); const result = await client.labs.createOrUpdate( - billingAccountName, - billingProfileName, - invoiceSectionName, - parameters, + "{billingAccountName}", + "{billingProfileName}", + "{invoiceSectionName}", + { + description: "example lab description", + budgetPerStudent: { currency: "USD", value: 100 }, + displayName: "example lab", + expirationDate: new Date("2021-12-09T22:11:29.422Z"), + }, ); console.log(result); } diff --git a/sdk/education/arm-education/samples-dev/labsDeleteSample.ts b/sdk/education/arm-education/samples-dev/labsDeleteSample.ts index 47f89aa8ec20..d1f5cc94e5a0 100644 --- a/sdk/education/arm-education/samples-dev/labsDeleteSample.ts +++ b/sdk/education/arm-education/samples-dev/labsDeleteSample.ts @@ -1,29 +1,19 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Delete a specific lab associated with the provided billing account name, billing profile name, and invoice section name. Note all students must be removed from the lab in order to delete the lab. - * - * @summary Delete a specific lab associated with the provided billing account name, billing profile name, and invoice section name. Note all students must be removed from the lab in order to delete the lab. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/DeleteLab.json - */ - import { EducationManagementClient } from "@azure/arm-education"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to delete a specific lab associated with the provided billing account name, billing profile name, and invoice section name. Note all students must be removed from the lab in order to delete the lab. + * + * @summary delete a specific lab associated with the provided billing account name, billing profile name, and invoice section name. Note all students must be removed from the lab in order to delete the lab. + * x-ms-original-file: 2021-12-01-preview/DeleteLab.json + */ async function deleteLab(): Promise { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const invoiceSectionName = "{invoiceSectionName}"; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); - const result = await client.labs.delete( - billingAccountName, - billingProfileName, - invoiceSectionName, - ); - console.log(result); + await client.labs.delete("{billingAccountName}", "{billingProfileName}", "{invoiceSectionName}"); } async function main(): Promise { diff --git a/sdk/education/arm-education/samples-dev/labsGenerateInviteCodeSample.ts b/sdk/education/arm-education/samples-dev/labsGenerateInviteCodeSample.ts index b35d00fc328c..83c18c9ed027 100644 --- a/sdk/education/arm-education/samples-dev/labsGenerateInviteCodeSample.ts +++ b/sdk/education/arm-education/samples-dev/labsGenerateInviteCodeSample.ts @@ -1,30 +1,23 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Generate invite code for a lab - * - * @summary Generate invite code for a lab - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/GenerateInviteCode.json - */ - -import type { InviteCodeGenerateRequest } from "@azure/arm-education"; import { EducationManagementClient } from "@azure/arm-education"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to generate invite code for a lab + * + * @summary generate invite code for a lab + * x-ms-original-file: 2021-12-01-preview/GenerateInviteCode.json + */ async function createLab(): Promise { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const invoiceSectionName = "{invoiceSectionName}"; - const parameters: InviteCodeGenerateRequest = { maxStudentCount: 10 }; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); const result = await client.labs.generateInviteCode( - billingAccountName, - billingProfileName, - invoiceSectionName, - parameters, + "{billingAccountName}", + "{billingProfileName}", + "{invoiceSectionName}", + { maxStudentCount: 10 }, ); console.log(result); } diff --git a/sdk/education/arm-education/samples-dev/labsGetSample.ts b/sdk/education/arm-education/samples-dev/labsGetSample.ts index 67e9b5b8075a..b744e5aa6f1a 100644 --- a/sdk/education/arm-education/samples-dev/labsGetSample.ts +++ b/sdk/education/arm-education/samples-dev/labsGetSample.ts @@ -1,54 +1,41 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. - * - * @summary Get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/Lab.json - */ - -import type { LabsGetOptionalParams } from "@azure/arm-education"; import { EducationManagementClient } from "@azure/arm-education"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. + * + * @summary get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. + * x-ms-original-file: 2021-12-01-preview/Lab.json + */ async function lab(): Promise { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const invoiceSectionName = "{invoiceSectionName}"; - const includeBudget = false; - const options: LabsGetOptionalParams = { includeBudget }; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); const result = await client.labs.get( - billingAccountName, - billingProfileName, - invoiceSectionName, - options, + "{billingAccountName}", + "{billingProfileName}", + "{invoiceSectionName}", + { includeBudget: false }, ); console.log(result); } /** - * This sample demonstrates how to Get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. + * This sample demonstrates how to get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. * - * @summary Get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/LabIncludeBudget.json + * @summary get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. + * x-ms-original-file: 2021-12-01-preview/LabIncludeBudget.json */ async function labIncludeBudget(): Promise { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const invoiceSectionName = "{invoiceSectionName}"; - const includeBudget = true; - const options: LabsGetOptionalParams = { includeBudget }; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); const result = await client.labs.get( - billingAccountName, - billingProfileName, - invoiceSectionName, - options, + "{billingAccountName}", + "{billingProfileName}", + "{invoiceSectionName}", + { includeBudget: true }, ); console.log(result); } diff --git a/sdk/education/arm-education/samples-dev/labsListAllSample.ts b/sdk/education/arm-education/samples-dev/labsListAllSample.ts index e680e225e40f..cc7895054a81 100644 --- a/sdk/education/arm-education/samples-dev/labsListAllSample.ts +++ b/sdk/education/arm-education/samples-dev/labsListAllSample.ts @@ -1,49 +1,44 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Get a list of labs associated with the provided billing account name and billing profile name. - * - * @summary Get a list of labs associated with the provided billing account name and billing profile name. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/LabList.json - */ - -import type { LabsListAllOptionalParams } from "@azure/arm-education"; import { EducationManagementClient } from "@azure/arm-education"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to get a list of labs associated with the provided billing account name and billing profile name. + * + * @summary get a list of labs associated with the provided billing account name and billing profile name. + * x-ms-original-file: 2021-12-01-preview/LabList.json + */ async function labList(): Promise { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const includeBudget = false; - const options: LabsListAllOptionalParams = { includeBudget }; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); const resArray = new Array(); - for await (const item of client.labs.listAll(billingAccountName, billingProfileName, options)) { + for await (const item of client.labs.listAll("{billingAccountName}", "{billingProfileName}", { + includeBudget: false, + })) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Get a list of labs associated with the provided billing account name and billing profile name. + * This sample demonstrates how to get a list of labs associated with the provided billing account name and billing profile name. * - * @summary Get a list of labs associated with the provided billing account name and billing profile name. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/LabListIncludeBudget.json + * @summary get a list of labs associated with the provided billing account name and billing profile name. + * x-ms-original-file: 2021-12-01-preview/LabListIncludeBudget.json */ async function labListIncludeBudget(): Promise { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const includeBudget = true; - const options: LabsListAllOptionalParams = { includeBudget }; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); const resArray = new Array(); - for await (const item of client.labs.listAll(billingAccountName, billingProfileName, options)) { + for await (const item of client.labs.listAll("{billingAccountName}", "{billingProfileName}", { + includeBudget: true, + })) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/education/arm-education/samples-dev/labsListSample.ts b/sdk/education/arm-education/samples-dev/labsListSample.ts index 8a151040d170..54e385a4ea06 100644 --- a/sdk/education/arm-education/samples-dev/labsListSample.ts +++ b/sdk/education/arm-education/samples-dev/labsListSample.ts @@ -1,61 +1,50 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. - * - * @summary Get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/LabListWithInvoiceSectionName.json - */ - -import type { LabsListOptionalParams } from "@azure/arm-education"; import { EducationManagementClient } from "@azure/arm-education"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. + * + * @summary get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. + * x-ms-original-file: 2021-12-01-preview/LabListWithInvoiceSectionName.json + */ async function labListWithInvoiceSectionName(): Promise { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const invoiceSectionName = "{invoiceSectionName}"; - const includeBudget = true; - const options: LabsListOptionalParams = { includeBudget }; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); const resArray = new Array(); for await (const item of client.labs.list( - billingAccountName, - billingProfileName, - invoiceSectionName, - options, + "{billingAccountName}", + "{billingProfileName}", + "{invoiceSectionName}", + { includeBudget: true }, )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. + * This sample demonstrates how to get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. * - * @summary Get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/LabListWithInvoiceSectionNameIncludeBudget.json + * @summary get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. + * x-ms-original-file: 2021-12-01-preview/LabListWithInvoiceSectionNameIncludeBudget.json */ async function labListWithInvoiceSectionNameIncludeBudget(): Promise { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const invoiceSectionName = "{invoiceSectionName}"; - const includeBudget = true; - const options: LabsListOptionalParams = { includeBudget }; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); const resArray = new Array(); for await (const item of client.labs.list( - billingAccountName, - billingProfileName, - invoiceSectionName, - options, + "{billingAccountName}", + "{billingProfileName}", + "{invoiceSectionName}", + { includeBudget: true }, )) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/education/arm-education/samples-dev/operationsListSample.ts b/sdk/education/arm-education/samples-dev/operationsListSample.ts index 5218a7e694a4..131760467492 100644 --- a/sdk/education/arm-education/samples-dev/operationsListSample.ts +++ b/sdk/education/arm-education/samples-dev/operationsListSample.ts @@ -1,17 +1,15 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Lists all of the available Microsoft.Education API operations. - * - * @summary Lists all of the available Microsoft.Education API operations. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/GetOperations.json - */ - import { EducationManagementClient } from "@azure/arm-education"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to lists all of the available Microsoft.Education API operations. + * + * @summary lists all of the available Microsoft.Education API operations. + * x-ms-original-file: 2021-12-01-preview/GetOperations.json + */ async function getOperations(): Promise { const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); diff --git a/sdk/education/arm-education/samples-dev/redeemInvitationCodeSample.ts b/sdk/education/arm-education/samples-dev/redeemInvitationCodeSample.ts index 9618d0b99205..61a465aca1a2 100644 --- a/sdk/education/arm-education/samples-dev/redeemInvitationCodeSample.ts +++ b/sdk/education/arm-education/samples-dev/redeemInvitationCodeSample.ts @@ -1,28 +1,23 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Redeem invite code to join a redeemable lab - * - * @summary Redeem invite code to join a redeemable lab - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/RedeemCode.json - */ - -import type { RedeemRequest } from "@azure/arm-education"; import { EducationManagementClient } from "@azure/arm-education"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to redeem invite code to join a redeemable lab + * + * @summary redeem invite code to join a redeemable lab + * x-ms-original-file: 2021-12-01-preview/RedeemCode.json + */ async function redeemCode(): Promise { - const parameters: RedeemRequest = { + const credential = new DefaultAzureCredential(); + const client = new EducationManagementClient(credential); + await client.redeemInvitationCode({ firstName: "test", lastName: "user", redeemCode: "exampleRedeemCode", - }; - const credential = new DefaultAzureCredential(); - const client = new EducationManagementClient(credential); - const result = await client.redeemInvitationCode(parameters); - console.log(result); + }); } async function main(): Promise { diff --git a/sdk/education/arm-education/samples-dev/studentLabsGetSample.ts b/sdk/education/arm-education/samples-dev/studentLabsGetSample.ts index 3244894ec601..208b91236bc5 100644 --- a/sdk/education/arm-education/samples-dev/studentLabsGetSample.ts +++ b/sdk/education/arm-education/samples-dev/studentLabsGetSample.ts @@ -1,22 +1,19 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Get the details for a specified lab associated with the student lab. - * - * @summary Get the details for a specified lab associated with the student lab. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/StudentLab.json - */ - import { EducationManagementClient } from "@azure/arm-education"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to get the details for a specified lab associated with the student lab. + * + * @summary get the details for a specified lab associated with the student lab. + * x-ms-original-file: 2021-12-01-preview/StudentLab.json + */ async function studentLab(): Promise { - const studentLabName = "{studentLabName}"; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); - const result = await client.studentLabs.get(studentLabName); + const result = await client.studentLabs.get("{studentLabName}"); console.log(result); } diff --git a/sdk/education/arm-education/samples-dev/studentLabsListAllSample.ts b/sdk/education/arm-education/samples-dev/studentLabsListAllSample.ts index 4ab41abb4fe0..5e704d581c22 100644 --- a/sdk/education/arm-education/samples-dev/studentLabsListAllSample.ts +++ b/sdk/education/arm-education/samples-dev/studentLabsListAllSample.ts @@ -1,17 +1,15 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Get a list of all labs associated with the caller of the API. - * - * @summary Get a list of all labs associated with the caller of the API. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/StudentLabList.json - */ - import { EducationManagementClient } from "@azure/arm-education"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to get a list of all labs associated with the caller of the API. + * + * @summary get a list of all labs associated with the caller of the API. + * x-ms-original-file: 2021-12-01-preview/StudentLabList.json + */ async function studentLabList(): Promise { const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); @@ -19,6 +17,7 @@ async function studentLabList(): Promise { for await (const item of client.studentLabs.listAll()) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/education/arm-education/samples-dev/studentsCreateOrUpdateSample.ts b/sdk/education/arm-education/samples-dev/studentsCreateOrUpdateSample.ts index 02a53c6fb332..1e0da83b2685 100644 --- a/sdk/education/arm-education/samples-dev/studentsCreateOrUpdateSample.ts +++ b/sdk/education/arm-education/samples-dev/studentsCreateOrUpdateSample.ts @@ -1,39 +1,31 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Create and add a new student to the specified lab or update the details of an existing student in a lab. Note the student must have a valid tenant to accept the lab after they have been added to lab. - * - * @summary Create and add a new student to the specified lab or update the details of an existing student in a lab. Note the student must have a valid tenant to accept the lab after they have been added to lab. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/CreateStudent.json - */ - -import type { StudentDetails } from "@azure/arm-education"; import { EducationManagementClient } from "@azure/arm-education"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to create and add a new student to the specified lab or update the details of an existing student in a lab. Note the student must have a valid tenant to accept the lab after they have been added to lab. + * + * @summary create and add a new student to the specified lab or update the details of an existing student in a lab. Note the student must have a valid tenant to accept the lab after they have been added to lab. + * x-ms-original-file: 2021-12-01-preview/CreateStudent.json + */ async function student(): Promise { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const invoiceSectionName = "{invoiceSectionName}"; - const studentAlias = "{studentAlias}"; - const parameters: StudentDetails = { - budget: { currency: "USD", value: 100 }, - email: "test@contoso.com", - expirationDate: new Date("2021-11-09T22:13:21.795Z"), - firstName: "test", - lastName: "user", - role: "Student", - }; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); const result = await client.students.createOrUpdate( - billingAccountName, - billingProfileName, - invoiceSectionName, - studentAlias, - parameters, + "{billingAccountName}", + "{billingProfileName}", + "{invoiceSectionName}", + "{studentAlias}", + { + budget: { currency: "USD", value: 100 }, + email: "test@contoso.com", + expirationDate: new Date("2021-11-09T22:13:21.795Z"), + firstName: "test", + lastName: "user", + role: "Student", + }, ); console.log(result); } diff --git a/sdk/education/arm-education/samples-dev/studentsDeleteSample.ts b/sdk/education/arm-education/samples-dev/studentsDeleteSample.ts index 24ea4e7c955a..ab5fde85a2ec 100644 --- a/sdk/education/arm-education/samples-dev/studentsDeleteSample.ts +++ b/sdk/education/arm-education/samples-dev/studentsDeleteSample.ts @@ -1,31 +1,24 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Delete the specified student based on the student alias. - * - * @summary Delete the specified student based on the student alias. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/DeleteStudent.json - */ - import { EducationManagementClient } from "@azure/arm-education"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to delete the specified student based on the student alias. + * + * @summary delete the specified student based on the student alias. + * x-ms-original-file: 2021-12-01-preview/DeleteStudent.json + */ async function deleteLab(): Promise { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const invoiceSectionName = "{invoiceSectionName}"; - const studentAlias = "{studentAlias}"; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); - const result = await client.students.delete( - billingAccountName, - billingProfileName, - invoiceSectionName, - studentAlias, + await client.students.delete( + "{billingAccountName}", + "{billingProfileName}", + "{invoiceSectionName}", + "{studentAlias}", ); - console.log(result); } async function main(): Promise { diff --git a/sdk/education/arm-education/samples-dev/studentsGetSample.ts b/sdk/education/arm-education/samples-dev/studentsGetSample.ts index 70732ccc90a0..66fc37cc404c 100644 --- a/sdk/education/arm-education/samples-dev/studentsGetSample.ts +++ b/sdk/education/arm-education/samples-dev/studentsGetSample.ts @@ -1,29 +1,23 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Get the details for a specific student in the specified lab by student alias - * - * @summary Get the details for a specific student in the specified lab by student alias - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/Student.json - */ - import { EducationManagementClient } from "@azure/arm-education"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to get the details for a specific student in the specified lab by student alias + * + * @summary get the details for a specific student in the specified lab by student alias + * x-ms-original-file: 2021-12-01-preview/Student.json + */ async function student(): Promise { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const invoiceSectionName = "{invoiceSectionName}"; - const studentAlias = "{studentAlias}"; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); const result = await client.students.get( - billingAccountName, - billingProfileName, - invoiceSectionName, - studentAlias, + "{billingAccountName}", + "{billingProfileName}", + "{invoiceSectionName}", + "{studentAlias}", ); console.log(result); } diff --git a/sdk/education/arm-education/samples-dev/studentsListSample.ts b/sdk/education/arm-education/samples-dev/studentsListSample.ts index 77fe5847ac69..c85deb44fe14 100644 --- a/sdk/education/arm-education/samples-dev/studentsListSample.ts +++ b/sdk/education/arm-education/samples-dev/studentsListSample.ts @@ -1,31 +1,27 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Get a list of details about students that are associated with the specified lab. - * - * @summary Get a list of details about students that are associated with the specified lab. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/StudentList.json - */ - import { EducationManagementClient } from "@azure/arm-education"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to get a list of details about students that are associated with the specified lab. + * + * @summary get a list of details about students that are associated with the specified lab. + * x-ms-original-file: 2021-12-01-preview/StudentList.json + */ async function studentList(): Promise { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const invoiceSectionName = "{invoiceSectionName}"; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); const resArray = new Array(); for await (const item of client.students.list( - billingAccountName, - billingProfileName, - invoiceSectionName, + "{billingAccountName}", + "{billingProfileName}", + "{invoiceSectionName}", )) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/education/arm-education/samples/v1-beta/javascript/README.md b/sdk/education/arm-education/samples/v1-beta/javascript/README.md index 69d4b2965227..ab03d2d55b42 100644 --- a/sdk/education/arm-education/samples/v1-beta/javascript/README.md +++ b/sdk/education/arm-education/samples/v1-beta/javascript/README.md @@ -1,30 +1,30 @@ -# client library samples for JavaScript (Beta) - -These sample programs show how to use the JavaScript client libraries for in some common scenarios. - -| **File Name** | **Description** | -| --------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [grantsGetSample.js][grantsgetsample] | Get details for a specific grant linked to the provided billing account and billing profile. x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/Grant.json | -| [grantsListAllSample.js][grantslistallsample] | Get a list of grants that Microsoft has provided. x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/GrantList.json | -| [grantsListSample.js][grantslistsample] | Get details for a specific grant linked to the provided billing account and billing profile. x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/GrantDefaultList.json | -| [joinRequestsApproveSample.js][joinrequestsapprovesample] | Approve student joining the redeemable lab x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/JoinRequestApproveAndDeny.json | -| [joinRequestsDenySample.js][joinrequestsdenysample] | Deny student joining the redeemable lab x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/JoinRequestApproveAndDeny.json | -| [joinRequestsGetSample.js][joinrequestsgetsample] | get student join requests x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/JoinRequest.json | -| [joinRequestsListSample.js][joinrequestslistsample] | get student join requests x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/JoinRequestList.json | -| [labsCreateOrUpdateSample.js][labscreateorupdatesample] | Create a new lab or update a previously created lab. x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/CreateLab.json | -| [labsDeleteSample.js][labsdeletesample] | Delete a specific lab associated with the provided billing account name, billing profile name, and invoice section name. Note all students must be removed from the lab in order to delete the lab. x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/DeleteLab.json | -| [labsGenerateInviteCodeSample.js][labsgenerateinvitecodesample] | Generate invite code for a lab x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/GenerateInviteCode.json | -| [labsGetSample.js][labsgetsample] | Get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/Lab.json | -| [labsListAllSample.js][labslistallsample] | Get a list of labs associated with the provided billing account name and billing profile name. x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/LabList.json | -| [labsListSample.js][labslistsample] | Get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/LabListWithInvoiceSectionName.json | -| [operationsListSample.js][operationslistsample] | Lists all of the available Microsoft.Education API operations. x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/GetOperations.json | -| [redeemInvitationCodeSample.js][redeeminvitationcodesample] | Redeem invite code to join a redeemable lab x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/RedeemCode.json | -| [studentLabsGetSample.js][studentlabsgetsample] | Get the details for a specified lab associated with the student lab. x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/StudentLab.json | -| [studentLabsListAllSample.js][studentlabslistallsample] | Get a list of all labs associated with the caller of the API. x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/StudentLabList.json | -| [studentsCreateOrUpdateSample.js][studentscreateorupdatesample] | Create and add a new student to the specified lab or update the details of an existing student in a lab. Note the student must have a valid tenant to accept the lab after they have been added to lab. x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/CreateStudent.json | -| [studentsDeleteSample.js][studentsdeletesample] | Delete the specified student based on the student alias. x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/DeleteStudent.json | -| [studentsGetSample.js][studentsgetsample] | Get the details for a specific student in the specified lab by student alias x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/Student.json | -| [studentsListSample.js][studentslistsample] | Get a list of details about students that are associated with the specified lab. x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/StudentList.json | +# @azure/arm-education client library samples for JavaScript (Beta) + +These sample programs show how to use the JavaScript client libraries for @azure/arm-education in some common scenarios. + +| **File Name** | **Description** | +| --------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [grantsGetSample.js][grantsgetsample] | get details for a specific grant linked to the provided billing account and billing profile. x-ms-original-file: 2021-12-01-preview/Grant.json | +| [grantsListAllSample.js][grantslistallsample] | get a list of grants that Microsoft has provided. x-ms-original-file: 2021-12-01-preview/GrantList.json | +| [grantsListSample.js][grantslistsample] | get details for a specific grant linked to the provided billing account and billing profile. x-ms-original-file: 2021-12-01-preview/GrantDefaultList.json | +| [joinRequestsApproveSample.js][joinrequestsapprovesample] | approve student joining the redeemable lab x-ms-original-file: 2021-12-01-preview/JoinRequestApproveAndDenyForApprove.json | +| [joinRequestsDenySample.js][joinrequestsdenysample] | deny student joining the redeemable lab x-ms-original-file: 2021-12-01-preview/JoinRequestApproveAndDeny.json | +| [joinRequestsGetSample.js][joinrequestsgetsample] | get student join requests x-ms-original-file: 2021-12-01-preview/JoinRequest.json | +| [joinRequestsListSample.js][joinrequestslistsample] | get student join requests x-ms-original-file: 2021-12-01-preview/JoinRequestList.json | +| [labsCreateOrUpdateSample.js][labscreateorupdatesample] | create a new lab or update a previously created lab. x-ms-original-file: 2021-12-01-preview/CreateLab.json | +| [labsDeleteSample.js][labsdeletesample] | delete a specific lab associated with the provided billing account name, billing profile name, and invoice section name. Note all students must be removed from the lab in order to delete the lab. x-ms-original-file: 2021-12-01-preview/DeleteLab.json | +| [labsGenerateInviteCodeSample.js][labsgenerateinvitecodesample] | generate invite code for a lab x-ms-original-file: 2021-12-01-preview/GenerateInviteCode.json | +| [labsGetSample.js][labsgetsample] | get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. x-ms-original-file: 2021-12-01-preview/Lab.json | +| [labsListAllSample.js][labslistallsample] | get a list of labs associated with the provided billing account name and billing profile name. x-ms-original-file: 2021-12-01-preview/LabList.json | +| [labsListSample.js][labslistsample] | get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. x-ms-original-file: 2021-12-01-preview/LabListWithInvoiceSectionName.json | +| [operationsListSample.js][operationslistsample] | lists all of the available Microsoft.Education API operations. x-ms-original-file: 2021-12-01-preview/GetOperations.json | +| [redeemInvitationCodeSample.js][redeeminvitationcodesample] | redeem invite code to join a redeemable lab x-ms-original-file: 2021-12-01-preview/RedeemCode.json | +| [studentLabsGetSample.js][studentlabsgetsample] | get the details for a specified lab associated with the student lab. x-ms-original-file: 2021-12-01-preview/StudentLab.json | +| [studentLabsListAllSample.js][studentlabslistallsample] | get a list of all labs associated with the caller of the API. x-ms-original-file: 2021-12-01-preview/StudentLabList.json | +| [studentsCreateOrUpdateSample.js][studentscreateorupdatesample] | create and add a new student to the specified lab or update the details of an existing student in a lab. Note the student must have a valid tenant to accept the lab after they have been added to lab. x-ms-original-file: 2021-12-01-preview/CreateStudent.json | +| [studentsDeleteSample.js][studentsdeletesample] | delete the specified student based on the student alias. x-ms-original-file: 2021-12-01-preview/DeleteStudent.json | +| [studentsGetSample.js][studentsgetsample] | get the details for a specific student in the specified lab by student alias x-ms-original-file: 2021-12-01-preview/Student.json | +| [studentsListSample.js][studentslistsample] | get a list of details about students that are associated with the specified lab. x-ms-original-file: 2021-12-01-preview/StudentList.json | ## Prerequisites @@ -54,10 +54,10 @@ npm install node grantsGetSample.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): +Alternatively, run a single sample with the required environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): ```bash -cross-env node grantsGetSample.js +node grantsGetSample.js ``` ## Next Steps diff --git a/sdk/education/arm-education/samples/v1-beta/javascript/grantsGetSample.js b/sdk/education/arm-education/samples/v1-beta/javascript/grantsGetSample.js index 9d5a90a9e09e..7e015ff0eb29 100644 --- a/sdk/education/arm-education/samples/v1-beta/javascript/grantsGetSample.js +++ b/sdk/education/arm-education/samples/v1-beta/javascript/grantsGetSample.js @@ -1,54 +1,42 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { EducationManagementClient } = require("@azure/arm-education"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Get details for a specific grant linked to the provided billing account and billing profile. + * This sample demonstrates how to get details for a specific grant linked to the provided billing account and billing profile. * - * @summary Get details for a specific grant linked to the provided billing account and billing profile. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/Grant.json + * @summary get details for a specific grant linked to the provided billing account and billing profile. + * x-ms-original-file: 2021-12-01-preview/Grant.json */ async function grant() { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const includeAllocatedBudget = false; - const options = { includeAllocatedBudget }; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); - const result = await client.grants.get(billingAccountName, billingProfileName, options); + const result = await client.grants.get("{billingAccountName}", "{billingProfileName}", { + includeAllocatedBudget: false, + }); console.log(result); } /** - * This sample demonstrates how to Get details for a specific grant linked to the provided billing account and billing profile. + * This sample demonstrates how to get details for a specific grant linked to the provided billing account and billing profile. * - * @summary Get details for a specific grant linked to the provided billing account and billing profile. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/GrantIncludeAllocatedBudget.json + * @summary get details for a specific grant linked to the provided billing account and billing profile. + * x-ms-original-file: 2021-12-01-preview/GrantIncludeAllocatedBudget.json */ async function grantIncludeAllocatedBudget() { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const includeAllocatedBudget = false; - const options = { includeAllocatedBudget }; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); - const result = await client.grants.get(billingAccountName, billingProfileName, options); + const result = await client.grants.get("{billingAccountName}", "{billingProfileName}", { + includeAllocatedBudget: false, + }); console.log(result); } async function main() { - grant(); - grantIncludeAllocatedBudget(); + await grant(); + await grantIncludeAllocatedBudget(); } main().catch(console.error); diff --git a/sdk/education/arm-education/samples/v1-beta/javascript/grantsListAllSample.js b/sdk/education/arm-education/samples/v1-beta/javascript/grantsListAllSample.js index a4860549c627..68f95f88b14b 100644 --- a/sdk/education/arm-education/samples/v1-beta/javascript/grantsListAllSample.js +++ b/sdk/education/arm-education/samples/v1-beta/javascript/grantsListAllSample.js @@ -1,56 +1,46 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { EducationManagementClient } = require("@azure/arm-education"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Get a list of grants that Microsoft has provided. + * This sample demonstrates how to get a list of grants that Microsoft has provided. * - * @summary Get a list of grants that Microsoft has provided. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/GrantList.json + * @summary get a list of grants that Microsoft has provided. + * x-ms-original-file: 2021-12-01-preview/GrantList.json */ async function grantList() { - const includeAllocatedBudget = false; - const options = { includeAllocatedBudget }; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); const resArray = new Array(); - for await (let item of client.grants.listAll(options)) { + for await (const item of client.grants.listAll({ includeAllocatedBudget: false })) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Get a list of grants that Microsoft has provided. + * This sample demonstrates how to get a list of grants that Microsoft has provided. * - * @summary Get a list of grants that Microsoft has provided. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/GrantListIncludeAllocatedBudget.json + * @summary get a list of grants that Microsoft has provided. + * x-ms-original-file: 2021-12-01-preview/GrantListIncludeAllocatedBudget.json */ async function grantListIncludeAllocatedBudget() { - const includeAllocatedBudget = true; - const options = { includeAllocatedBudget }; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); const resArray = new Array(); - for await (let item of client.grants.listAll(options)) { + for await (const item of client.grants.listAll({ includeAllocatedBudget: true })) { resArray.push(item); } + console.log(resArray); } async function main() { - grantList(); - grantListIncludeAllocatedBudget(); + await grantList(); + await grantListIncludeAllocatedBudget(); } main().catch(console.error); diff --git a/sdk/education/arm-education/samples/v1-beta/javascript/grantsListSample.js b/sdk/education/arm-education/samples/v1-beta/javascript/grantsListSample.js index a999ab583e80..cad1b1545884 100644 --- a/sdk/education/arm-education/samples/v1-beta/javascript/grantsListSample.js +++ b/sdk/education/arm-education/samples/v1-beta/javascript/grantsListSample.js @@ -1,60 +1,50 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { EducationManagementClient } = require("@azure/arm-education"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Get details for a specific grant linked to the provided billing account and billing profile. + * This sample demonstrates how to get details for a specific grant linked to the provided billing account and billing profile. * - * @summary Get details for a specific grant linked to the provided billing account and billing profile. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/GrantDefaultList.json + * @summary get details for a specific grant linked to the provided billing account and billing profile. + * x-ms-original-file: 2021-12-01-preview/GrantDefaultList.json */ async function grantList() { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const includeAllocatedBudget = false; - const options = { includeAllocatedBudget }; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); const resArray = new Array(); - for await (let item of client.grants.list(billingAccountName, billingProfileName, options)) { + for await (const item of client.grants.list("{billingAccountName}", "{billingProfileName}", { + includeAllocatedBudget: false, + })) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Get details for a specific grant linked to the provided billing account and billing profile. + * This sample demonstrates how to get details for a specific grant linked to the provided billing account and billing profile. * - * @summary Get details for a specific grant linked to the provided billing account and billing profile. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/GrantDefaultListIncludeAllocatedBudget.json + * @summary get details for a specific grant linked to the provided billing account and billing profile. + * x-ms-original-file: 2021-12-01-preview/GrantDefaultListIncludeAllocatedBudget.json */ async function grantListIncludeAllocatedBudget() { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const includeAllocatedBudget = false; - const options = { includeAllocatedBudget }; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); const resArray = new Array(); - for await (let item of client.grants.list(billingAccountName, billingProfileName, options)) { + for await (const item of client.grants.list("{billingAccountName}", "{billingProfileName}", { + includeAllocatedBudget: false, + })) { resArray.push(item); } + console.log(resArray); } async function main() { - grantList(); - grantListIncludeAllocatedBudget(); + await grantList(); + await grantListIncludeAllocatedBudget(); } main().catch(console.error); diff --git a/sdk/education/arm-education/samples/v1-beta/javascript/joinRequestsApproveSample.js b/sdk/education/arm-education/samples/v1-beta/javascript/joinRequestsApproveSample.js index 05692ab3902d..07d5a4d2cd77 100644 --- a/sdk/education/arm-education/samples/v1-beta/javascript/joinRequestsApproveSample.js +++ b/sdk/education/arm-education/samples/v1-beta/javascript/joinRequestsApproveSample.js @@ -1,41 +1,28 @@ -/* - * 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 { EducationManagementClient } = require("@azure/arm-education"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Approve student joining the redeemable lab + * This sample demonstrates how to approve student joining the redeemable lab * - * @summary Approve student joining the redeemable lab - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/JoinRequestApproveAndDeny.json + * @summary approve student joining the redeemable lab + * x-ms-original-file: 2021-12-01-preview/JoinRequestApproveAndDenyForApprove.json */ async function joinRequestApprove() { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const invoiceSectionName = "{invoiceSectionName}"; - const joinRequestName = "{joinRequestName}"; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); - const result = await client.joinRequests.approve( - billingAccountName, - billingProfileName, - invoiceSectionName, - joinRequestName + await client.joinRequests.approve( + "{billingAccountName}", + "{billingProfileName}", + "{invoiceSectionName}", + "{joinRequestName}", ); - console.log(result); } async function main() { - joinRequestApprove(); + await joinRequestApprove(); } main().catch(console.error); diff --git a/sdk/education/arm-education/samples/v1-beta/javascript/joinRequestsDenySample.js b/sdk/education/arm-education/samples/v1-beta/javascript/joinRequestsDenySample.js index d852deffe73c..983722496c37 100644 --- a/sdk/education/arm-education/samples/v1-beta/javascript/joinRequestsDenySample.js +++ b/sdk/education/arm-education/samples/v1-beta/javascript/joinRequestsDenySample.js @@ -1,41 +1,28 @@ -/* - * 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 { EducationManagementClient } = require("@azure/arm-education"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Deny student joining the redeemable lab + * This sample demonstrates how to deny student joining the redeemable lab * - * @summary Deny student joining the redeemable lab - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/JoinRequestApproveAndDeny.json + * @summary deny student joining the redeemable lab + * x-ms-original-file: 2021-12-01-preview/JoinRequestApproveAndDeny.json */ async function joinRequestDeny() { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const invoiceSectionName = "{invoiceSectionName}"; - const joinRequestName = "{joinRequestName}"; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); - const result = await client.joinRequests.deny( - billingAccountName, - billingProfileName, - invoiceSectionName, - joinRequestName + await client.joinRequests.deny( + "{billingAccountName}", + "{billingProfileName}", + "{invoiceSectionName}", + "{joinRequestName}", ); - console.log(result); } async function main() { - joinRequestDeny(); + await joinRequestDeny(); } main().catch(console.error); diff --git a/sdk/education/arm-education/samples/v1-beta/javascript/joinRequestsGetSample.js b/sdk/education/arm-education/samples/v1-beta/javascript/joinRequestsGetSample.js index e16b61bdeca5..90b2f55dfd8a 100644 --- a/sdk/education/arm-education/samples/v1-beta/javascript/joinRequestsGetSample.js +++ b/sdk/education/arm-education/samples/v1-beta/javascript/joinRequestsGetSample.js @@ -1,41 +1,29 @@ -/* - * 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 { EducationManagementClient } = require("@azure/arm-education"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** * This sample demonstrates how to get student join requests * * @summary get student join requests - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/JoinRequest.json + * x-ms-original-file: 2021-12-01-preview/JoinRequest.json */ async function joinRequest() { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const invoiceSectionName = "{invoiceSectionName}"; - const joinRequestName = "{joinRequestName}"; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); const result = await client.joinRequests.get( - billingAccountName, - billingProfileName, - invoiceSectionName, - joinRequestName + "{billingAccountName}", + "{billingProfileName}", + "{invoiceSectionName}", + "{joinRequestName}", ); console.log(result); } async function main() { - joinRequest(); + await joinRequest(); } main().catch(console.error); diff --git a/sdk/education/arm-education/samples/v1-beta/javascript/joinRequestsListSample.js b/sdk/education/arm-education/samples/v1-beta/javascript/joinRequestsListSample.js index 3870e52b478e..889713bab22a 100644 --- a/sdk/education/arm-education/samples/v1-beta/javascript/joinRequestsListSample.js +++ b/sdk/education/arm-education/samples/v1-beta/javascript/joinRequestsListSample.js @@ -1,45 +1,33 @@ -/* - * 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 { EducationManagementClient } = require("@azure/arm-education"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** * This sample demonstrates how to get student join requests * * @summary get student join requests - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/JoinRequestList.json + * x-ms-original-file: 2021-12-01-preview/JoinRequestList.json */ async function joinRequestList() { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const invoiceSectionName = "{invoiceSectionName}"; - const includeDenied = false; - const options = { includeDenied }; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); const resArray = new Array(); - for await (let item of client.joinRequests.list( - billingAccountName, - billingProfileName, - invoiceSectionName, - options + for await (const item of client.joinRequests.list( + "{billingAccountName}", + "{billingProfileName}", + "{invoiceSectionName}", + { includeDenied: false }, )) { resArray.push(item); } + console.log(resArray); } async function main() { - joinRequestList(); + await joinRequestList(); } main().catch(console.error); diff --git a/sdk/education/arm-education/samples/v1-beta/javascript/labsCreateOrUpdateSample.js b/sdk/education/arm-education/samples/v1-beta/javascript/labsCreateOrUpdateSample.js index 85abb397b490..1ea2c2bf6afa 100644 --- a/sdk/education/arm-education/samples/v1-beta/javascript/labsCreateOrUpdateSample.js +++ b/sdk/education/arm-education/samples/v1-beta/javascript/labsCreateOrUpdateSample.js @@ -1,46 +1,34 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { EducationManagementClient } = require("@azure/arm-education"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Create a new lab or update a previously created lab. + * This sample demonstrates how to create a new lab or update a previously created lab. * - * @summary Create a new lab or update a previously created lab. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/CreateLab.json + * @summary create a new lab or update a previously created lab. + * x-ms-original-file: 2021-12-01-preview/CreateLab.json */ async function createLab() { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const invoiceSectionName = "{invoiceSectionName}"; - const parameters = { - description: "example lab description", - budgetPerStudent: { currency: "USD", value: 100 }, - displayName: "example lab", - expirationDate: new Date("2021-12-09T22:11:29.422Z"), - }; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); const result = await client.labs.createOrUpdate( - billingAccountName, - billingProfileName, - invoiceSectionName, - parameters + "{billingAccountName}", + "{billingProfileName}", + "{invoiceSectionName}", + { + description: "example lab description", + budgetPerStudent: { currency: "USD", value: 100 }, + displayName: "example lab", + expirationDate: new Date("2021-12-09T22:11:29.422Z"), + }, ); console.log(result); } async function main() { - createLab(); + await createLab(); } main().catch(console.error); diff --git a/sdk/education/arm-education/samples/v1-beta/javascript/labsDeleteSample.js b/sdk/education/arm-education/samples/v1-beta/javascript/labsDeleteSample.js index e9a29b621eb9..753f1e8f5943 100644 --- a/sdk/education/arm-education/samples/v1-beta/javascript/labsDeleteSample.js +++ b/sdk/education/arm-education/samples/v1-beta/javascript/labsDeleteSample.js @@ -1,39 +1,23 @@ -/* - * 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 { EducationManagementClient } = require("@azure/arm-education"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Delete a specific lab associated with the provided billing account name, billing profile name, and invoice section name. Note all students must be removed from the lab in order to delete the lab. + * This sample demonstrates how to delete a specific lab associated with the provided billing account name, billing profile name, and invoice section name. Note all students must be removed from the lab in order to delete the lab. * - * @summary Delete a specific lab associated with the provided billing account name, billing profile name, and invoice section name. Note all students must be removed from the lab in order to delete the lab. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/DeleteLab.json + * @summary delete a specific lab associated with the provided billing account name, billing profile name, and invoice section name. Note all students must be removed from the lab in order to delete the lab. + * x-ms-original-file: 2021-12-01-preview/DeleteLab.json */ async function deleteLab() { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const invoiceSectionName = "{invoiceSectionName}"; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); - const result = await client.labs.delete( - billingAccountName, - billingProfileName, - invoiceSectionName - ); - console.log(result); + await client.labs.delete("{billingAccountName}", "{billingProfileName}", "{invoiceSectionName}"); } async function main() { - deleteLab(); + await deleteLab(); } main().catch(console.error); diff --git a/sdk/education/arm-education/samples/v1-beta/javascript/labsGenerateInviteCodeSample.js b/sdk/education/arm-education/samples/v1-beta/javascript/labsGenerateInviteCodeSample.js index 806ddfc3858c..57fadfcdb527 100644 --- a/sdk/education/arm-education/samples/v1-beta/javascript/labsGenerateInviteCodeSample.js +++ b/sdk/education/arm-education/samples/v1-beta/javascript/labsGenerateInviteCodeSample.js @@ -1,41 +1,29 @@ -/* - * 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 { EducationManagementClient } = require("@azure/arm-education"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Generate invite code for a lab + * This sample demonstrates how to generate invite code for a lab * - * @summary Generate invite code for a lab - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/GenerateInviteCode.json + * @summary generate invite code for a lab + * x-ms-original-file: 2021-12-01-preview/GenerateInviteCode.json */ async function createLab() { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const invoiceSectionName = "{invoiceSectionName}"; - const parameters = { maxStudentCount: 10 }; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); const result = await client.labs.generateInviteCode( - billingAccountName, - billingProfileName, - invoiceSectionName, - parameters + "{billingAccountName}", + "{billingProfileName}", + "{invoiceSectionName}", + { maxStudentCount: 10 }, ); console.log(result); } async function main() { - createLab(); + await createLab(); } main().catch(console.error); diff --git a/sdk/education/arm-education/samples/v1-beta/javascript/labsGetSample.js b/sdk/education/arm-education/samples/v1-beta/javascript/labsGetSample.js index 5b515f47d1cf..e169bb287eae 100644 --- a/sdk/education/arm-education/samples/v1-beta/javascript/labsGetSample.js +++ b/sdk/education/arm-education/samples/v1-beta/javascript/labsGetSample.js @@ -1,66 +1,48 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { EducationManagementClient } = require("@azure/arm-education"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. + * This sample demonstrates how to get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. * - * @summary Get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/Lab.json + * @summary get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. + * x-ms-original-file: 2021-12-01-preview/Lab.json */ async function lab() { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const invoiceSectionName = "{invoiceSectionName}"; - const includeBudget = false; - const options = { includeBudget }; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); const result = await client.labs.get( - billingAccountName, - billingProfileName, - invoiceSectionName, - options + "{billingAccountName}", + "{billingProfileName}", + "{invoiceSectionName}", + { includeBudget: false }, ); console.log(result); } /** - * This sample demonstrates how to Get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. + * This sample demonstrates how to get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. * - * @summary Get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/LabIncludeBudget.json + * @summary get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. + * x-ms-original-file: 2021-12-01-preview/LabIncludeBudget.json */ async function labIncludeBudget() { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const invoiceSectionName = "{invoiceSectionName}"; - const includeBudget = true; - const options = { includeBudget }; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); const result = await client.labs.get( - billingAccountName, - billingProfileName, - invoiceSectionName, - options + "{billingAccountName}", + "{billingProfileName}", + "{invoiceSectionName}", + { includeBudget: true }, ); console.log(result); } async function main() { - lab(); - labIncludeBudget(); + await lab(); + await labIncludeBudget(); } main().catch(console.error); diff --git a/sdk/education/arm-education/samples/v1-beta/javascript/labsListAllSample.js b/sdk/education/arm-education/samples/v1-beta/javascript/labsListAllSample.js index 5cc3683a0b60..c660c16dbdfe 100644 --- a/sdk/education/arm-education/samples/v1-beta/javascript/labsListAllSample.js +++ b/sdk/education/arm-education/samples/v1-beta/javascript/labsListAllSample.js @@ -1,60 +1,50 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { EducationManagementClient } = require("@azure/arm-education"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Get a list of labs associated with the provided billing account name and billing profile name. + * This sample demonstrates how to get a list of labs associated with the provided billing account name and billing profile name. * - * @summary Get a list of labs associated with the provided billing account name and billing profile name. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/LabList.json + * @summary get a list of labs associated with the provided billing account name and billing profile name. + * x-ms-original-file: 2021-12-01-preview/LabList.json */ async function labList() { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const includeBudget = false; - const options = { includeBudget }; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); const resArray = new Array(); - for await (let item of client.labs.listAll(billingAccountName, billingProfileName, options)) { + for await (const item of client.labs.listAll("{billingAccountName}", "{billingProfileName}", { + includeBudget: false, + })) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Get a list of labs associated with the provided billing account name and billing profile name. + * This sample demonstrates how to get a list of labs associated with the provided billing account name and billing profile name. * - * @summary Get a list of labs associated with the provided billing account name and billing profile name. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/LabListIncludeBudget.json + * @summary get a list of labs associated with the provided billing account name and billing profile name. + * x-ms-original-file: 2021-12-01-preview/LabListIncludeBudget.json */ async function labListIncludeBudget() { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const includeBudget = true; - const options = { includeBudget }; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); const resArray = new Array(); - for await (let item of client.labs.listAll(billingAccountName, billingProfileName, options)) { + for await (const item of client.labs.listAll("{billingAccountName}", "{billingProfileName}", { + includeBudget: true, + })) { resArray.push(item); } + console.log(resArray); } async function main() { - labList(); - labListIncludeBudget(); + await labList(); + await labListIncludeBudget(); } main().catch(console.error); diff --git a/sdk/education/arm-education/samples/v1-beta/javascript/labsListSample.js b/sdk/education/arm-education/samples/v1-beta/javascript/labsListSample.js index debaafa2a5e0..f61aced4a2ed 100644 --- a/sdk/education/arm-education/samples/v1-beta/javascript/labsListSample.js +++ b/sdk/education/arm-education/samples/v1-beta/javascript/labsListSample.js @@ -1,72 +1,56 @@ -/* - * 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 { EducationManagementClient } = require("@azure/arm-education"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. + * This sample demonstrates how to get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. * - * @summary Get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/LabListWithInvoiceSectionName.json + * @summary get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. + * x-ms-original-file: 2021-12-01-preview/LabListWithInvoiceSectionName.json */ async function labListWithInvoiceSectionName() { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const invoiceSectionName = "{invoiceSectionName}"; - const includeBudget = true; - const options = { includeBudget }; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); const resArray = new Array(); - for await (let item of client.labs.list( - billingAccountName, - billingProfileName, - invoiceSectionName, - options + for await (const item of client.labs.list( + "{billingAccountName}", + "{billingProfileName}", + "{invoiceSectionName}", + { includeBudget: true }, )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. + * This sample demonstrates how to get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. * - * @summary Get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/LabListWithInvoiceSectionNameIncludeBudget.json + * @summary get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. + * x-ms-original-file: 2021-12-01-preview/LabListWithInvoiceSectionNameIncludeBudget.json */ async function labListWithInvoiceSectionNameIncludeBudget() { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const invoiceSectionName = "{invoiceSectionName}"; - const includeBudget = true; - const options = { includeBudget }; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); const resArray = new Array(); - for await (let item of client.labs.list( - billingAccountName, - billingProfileName, - invoiceSectionName, - options + for await (const item of client.labs.list( + "{billingAccountName}", + "{billingProfileName}", + "{invoiceSectionName}", + { includeBudget: true }, )) { resArray.push(item); } + console.log(resArray); } async function main() { - labListWithInvoiceSectionName(); - labListWithInvoiceSectionNameIncludeBudget(); + await labListWithInvoiceSectionName(); + await labListWithInvoiceSectionNameIncludeBudget(); } main().catch(console.error); diff --git a/sdk/education/arm-education/samples/v1-beta/javascript/operationsListSample.js b/sdk/education/arm-education/samples/v1-beta/javascript/operationsListSample.js index f832cbfa625a..8b0d53e55bc0 100644 --- a/sdk/education/arm-education/samples/v1-beta/javascript/operationsListSample.js +++ b/sdk/education/arm-education/samples/v1-beta/javascript/operationsListSample.js @@ -1,22 +1,14 @@ -/* - * 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 { EducationManagementClient } = require("@azure/arm-education"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Lists all of the available Microsoft.Education API operations. + * This sample demonstrates how to lists all of the available Microsoft.Education API operations. * - * @summary Lists all of the available Microsoft.Education API operations. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/GetOperations.json + * @summary lists all of the available Microsoft.Education API operations. + * x-ms-original-file: 2021-12-01-preview/GetOperations.json */ async function getOperations() { const credential = new DefaultAzureCredential(); @@ -26,7 +18,7 @@ async function getOperations() { } async function main() { - getOperations(); + await getOperations(); } main().catch(console.error); diff --git a/sdk/education/arm-education/samples/v1-beta/javascript/package.json b/sdk/education/arm-education/samples/v1-beta/javascript/package.json index 86ab01ee1a67..149ee08b69e3 100644 --- a/sdk/education/arm-education/samples/v1-beta/javascript/package.json +++ b/sdk/education/arm-education/samples/v1-beta/javascript/package.json @@ -2,7 +2,7 @@ "name": "@azure-samples/arm-education-js-beta", "private": true, "version": "1.0.0", - "description": " client library samples for JavaScript (Beta)", + "description": "@azure/arm-education client library samples for JavaScript (Beta)", "engines": { "node": ">=20.0.0" }, @@ -14,6 +14,7 @@ "keywords": [ "node", "azure", + "cloud", "typescript", "browser", "isomorphic" @@ -25,8 +26,11 @@ }, "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/education/arm-education", "dependencies": { - "@azure/arm-education": "next", + "@azure/arm-education": "beta", "dotenv": "latest", - "@azure/identity": "^4.2.1" + "@azure/identity": "^4.13.0" + }, + "devDependencies": { + "cross-env": "latest" } } diff --git a/sdk/education/arm-education/samples/v1-beta/javascript/redeemInvitationCodeSample.js b/sdk/education/arm-education/samples/v1-beta/javascript/redeemInvitationCodeSample.js index cb5c009a2624..4f803c7835ba 100644 --- a/sdk/education/arm-education/samples/v1-beta/javascript/redeemInvitationCodeSample.js +++ b/sdk/education/arm-education/samples/v1-beta/javascript/redeemInvitationCodeSample.js @@ -1,37 +1,27 @@ -/* - * 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 { EducationManagementClient } = require("@azure/arm-education"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Redeem invite code to join a redeemable lab + * This sample demonstrates how to redeem invite code to join a redeemable lab * - * @summary Redeem invite code to join a redeemable lab - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/RedeemCode.json + * @summary redeem invite code to join a redeemable lab + * x-ms-original-file: 2021-12-01-preview/RedeemCode.json */ async function redeemCode() { - const parameters = { + const credential = new DefaultAzureCredential(); + const client = new EducationManagementClient(credential); + await client.redeemInvitationCode({ firstName: "test", lastName: "user", redeemCode: "exampleRedeemCode", - }; - const credential = new DefaultAzureCredential(); - const client = new EducationManagementClient(credential); - const result = await client.redeemInvitationCode(parameters); - console.log(result); + }); } async function main() { - redeemCode(); + await redeemCode(); } main().catch(console.error); diff --git a/sdk/education/arm-education/samples/v1-beta/javascript/sample.env b/sdk/education/arm-education/samples/v1-beta/javascript/sample.env index 672847a3fea0..508439fc7d62 100644 --- a/sdk/education/arm-education/samples/v1-beta/javascript/sample.env +++ b/sdk/education/arm-education/samples/v1-beta/javascript/sample.env @@ -1,4 +1 @@ -# App registration secret for AAD authentication -AZURE_CLIENT_SECRET= -AZURE_CLIENT_ID= -AZURE_TENANT_ID= \ No newline at end of file +# Feel free to add your own environment variables. \ No newline at end of file diff --git a/sdk/education/arm-education/samples/v1-beta/javascript/studentLabsGetSample.js b/sdk/education/arm-education/samples/v1-beta/javascript/studentLabsGetSample.js index 60354c6e54de..c51d067f5c5c 100644 --- a/sdk/education/arm-education/samples/v1-beta/javascript/studentLabsGetSample.js +++ b/sdk/education/arm-education/samples/v1-beta/javascript/studentLabsGetSample.js @@ -1,33 +1,24 @@ -/* - * 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 { EducationManagementClient } = require("@azure/arm-education"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Get the details for a specified lab associated with the student lab. + * This sample demonstrates how to get the details for a specified lab associated with the student lab. * - * @summary Get the details for a specified lab associated with the student lab. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/StudentLab.json + * @summary get the details for a specified lab associated with the student lab. + * x-ms-original-file: 2021-12-01-preview/StudentLab.json */ async function studentLab() { - const studentLabName = "{studentLabName}"; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); - const result = await client.studentLabs.get(studentLabName); + const result = await client.studentLabs.get("{studentLabName}"); console.log(result); } async function main() { - studentLab(); + await studentLab(); } main().catch(console.error); diff --git a/sdk/education/arm-education/samples/v1-beta/javascript/studentLabsListAllSample.js b/sdk/education/arm-education/samples/v1-beta/javascript/studentLabsListAllSample.js index a912ffd5d8fd..d8e15021a0fa 100644 --- a/sdk/education/arm-education/samples/v1-beta/javascript/studentLabsListAllSample.js +++ b/sdk/education/arm-education/samples/v1-beta/javascript/studentLabsListAllSample.js @@ -1,35 +1,28 @@ -/* - * 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 { EducationManagementClient } = require("@azure/arm-education"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Get a list of all labs associated with the caller of the API. + * This sample demonstrates how to get a list of all labs associated with the caller of the API. * - * @summary Get a list of all labs associated with the caller of the API. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/StudentLabList.json + * @summary get a list of all labs associated with the caller of the API. + * x-ms-original-file: 2021-12-01-preview/StudentLabList.json */ async function studentLabList() { const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); const resArray = new Array(); - for await (let item of client.studentLabs.listAll()) { + for await (const item of client.studentLabs.listAll()) { resArray.push(item); } + console.log(resArray); } async function main() { - studentLabList(); + await studentLabList(); } main().catch(console.error); diff --git a/sdk/education/arm-education/samples/v1-beta/javascript/studentsCreateOrUpdateSample.js b/sdk/education/arm-education/samples/v1-beta/javascript/studentsCreateOrUpdateSample.js index 658a02bdc0d7..363411cf6d25 100644 --- a/sdk/education/arm-education/samples/v1-beta/javascript/studentsCreateOrUpdateSample.js +++ b/sdk/education/arm-education/samples/v1-beta/javascript/studentsCreateOrUpdateSample.js @@ -1,50 +1,37 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { EducationManagementClient } = require("@azure/arm-education"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Create and add a new student to the specified lab or update the details of an existing student in a lab. Note the student must have a valid tenant to accept the lab after they have been added to lab. + * This sample demonstrates how to create and add a new student to the specified lab or update the details of an existing student in a lab. Note the student must have a valid tenant to accept the lab after they have been added to lab. * - * @summary Create and add a new student to the specified lab or update the details of an existing student in a lab. Note the student must have a valid tenant to accept the lab after they have been added to lab. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/CreateStudent.json + * @summary create and add a new student to the specified lab or update the details of an existing student in a lab. Note the student must have a valid tenant to accept the lab after they have been added to lab. + * x-ms-original-file: 2021-12-01-preview/CreateStudent.json */ async function student() { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const invoiceSectionName = "{invoiceSectionName}"; - const studentAlias = "{studentAlias}"; - const parameters = { - budget: { currency: "USD", value: 100 }, - email: "test@contoso.com", - expirationDate: new Date("2021-11-09T22:13:21.795Z"), - firstName: "test", - lastName: "user", - role: "Student", - }; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); const result = await client.students.createOrUpdate( - billingAccountName, - billingProfileName, - invoiceSectionName, - studentAlias, - parameters + "{billingAccountName}", + "{billingProfileName}", + "{invoiceSectionName}", + "{studentAlias}", + { + budget: { currency: "USD", value: 100 }, + email: "test@contoso.com", + expirationDate: new Date("2021-11-09T22:13:21.795Z"), + firstName: "test", + lastName: "user", + role: "Student", + }, ); console.log(result); } async function main() { - student(); + await student(); } main().catch(console.error); diff --git a/sdk/education/arm-education/samples/v1-beta/javascript/studentsDeleteSample.js b/sdk/education/arm-education/samples/v1-beta/javascript/studentsDeleteSample.js index dac714bede7d..5baa9bb7791a 100644 --- a/sdk/education/arm-education/samples/v1-beta/javascript/studentsDeleteSample.js +++ b/sdk/education/arm-education/samples/v1-beta/javascript/studentsDeleteSample.js @@ -1,41 +1,28 @@ -/* - * 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 { EducationManagementClient } = require("@azure/arm-education"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Delete the specified student based on the student alias. + * This sample demonstrates how to delete the specified student based on the student alias. * - * @summary Delete the specified student based on the student alias. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/DeleteStudent.json + * @summary delete the specified student based on the student alias. + * x-ms-original-file: 2021-12-01-preview/DeleteStudent.json */ async function deleteLab() { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const invoiceSectionName = "{invoiceSectionName}"; - const studentAlias = "{studentAlias}"; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); - const result = await client.students.delete( - billingAccountName, - billingProfileName, - invoiceSectionName, - studentAlias + await client.students.delete( + "{billingAccountName}", + "{billingProfileName}", + "{invoiceSectionName}", + "{studentAlias}", ); - console.log(result); } async function main() { - deleteLab(); + await deleteLab(); } main().catch(console.error); diff --git a/sdk/education/arm-education/samples/v1-beta/javascript/studentsGetSample.js b/sdk/education/arm-education/samples/v1-beta/javascript/studentsGetSample.js index 6b32e415f5d7..08d809df4eec 100644 --- a/sdk/education/arm-education/samples/v1-beta/javascript/studentsGetSample.js +++ b/sdk/education/arm-education/samples/v1-beta/javascript/studentsGetSample.js @@ -1,41 +1,29 @@ -/* - * 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 { EducationManagementClient } = require("@azure/arm-education"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Get the details for a specific student in the specified lab by student alias + * This sample demonstrates how to get the details for a specific student in the specified lab by student alias * - * @summary Get the details for a specific student in the specified lab by student alias - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/Student.json + * @summary get the details for a specific student in the specified lab by student alias + * x-ms-original-file: 2021-12-01-preview/Student.json */ async function student() { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const invoiceSectionName = "{invoiceSectionName}"; - const studentAlias = "{studentAlias}"; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); const result = await client.students.get( - billingAccountName, - billingProfileName, - invoiceSectionName, - studentAlias + "{billingAccountName}", + "{billingProfileName}", + "{invoiceSectionName}", + "{studentAlias}", ); console.log(result); } async function main() { - student(); + await student(); } main().catch(console.error); diff --git a/sdk/education/arm-education/samples/v1-beta/javascript/studentsListSample.js b/sdk/education/arm-education/samples/v1-beta/javascript/studentsListSample.js index cfb93a2bdf48..4ded05f410d0 100644 --- a/sdk/education/arm-education/samples/v1-beta/javascript/studentsListSample.js +++ b/sdk/education/arm-education/samples/v1-beta/javascript/studentsListSample.js @@ -1,42 +1,32 @@ -/* - * 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 { EducationManagementClient } = require("@azure/arm-education"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Get a list of details about students that are associated with the specified lab. + * This sample demonstrates how to get a list of details about students that are associated with the specified lab. * - * @summary Get a list of details about students that are associated with the specified lab. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/StudentList.json + * @summary get a list of details about students that are associated with the specified lab. + * x-ms-original-file: 2021-12-01-preview/StudentList.json */ async function studentList() { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const invoiceSectionName = "{invoiceSectionName}"; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); const resArray = new Array(); - for await (let item of client.students.list( - billingAccountName, - billingProfileName, - invoiceSectionName + for await (const item of client.students.list( + "{billingAccountName}", + "{billingProfileName}", + "{invoiceSectionName}", )) { resArray.push(item); } + console.log(resArray); } async function main() { - studentList(); + await studentList(); } main().catch(console.error); diff --git a/sdk/education/arm-education/samples/v1-beta/typescript/README.md b/sdk/education/arm-education/samples/v1-beta/typescript/README.md index 38f0340061cd..3ee323f368f3 100644 --- a/sdk/education/arm-education/samples/v1-beta/typescript/README.md +++ b/sdk/education/arm-education/samples/v1-beta/typescript/README.md @@ -1,30 +1,30 @@ -# client library samples for TypeScript (Beta) - -These sample programs show how to use the TypeScript client libraries for in some common scenarios. - -| **File Name** | **Description** | -| --------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [grantsGetSample.ts][grantsgetsample] | Get details for a specific grant linked to the provided billing account and billing profile. x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/Grant.json | -| [grantsListAllSample.ts][grantslistallsample] | Get a list of grants that Microsoft has provided. x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/GrantList.json | -| [grantsListSample.ts][grantslistsample] | Get details for a specific grant linked to the provided billing account and billing profile. x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/GrantDefaultList.json | -| [joinRequestsApproveSample.ts][joinrequestsapprovesample] | Approve student joining the redeemable lab x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/JoinRequestApproveAndDeny.json | -| [joinRequestsDenySample.ts][joinrequestsdenysample] | Deny student joining the redeemable lab x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/JoinRequestApproveAndDeny.json | -| [joinRequestsGetSample.ts][joinrequestsgetsample] | get student join requests x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/JoinRequest.json | -| [joinRequestsListSample.ts][joinrequestslistsample] | get student join requests x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/JoinRequestList.json | -| [labsCreateOrUpdateSample.ts][labscreateorupdatesample] | Create a new lab or update a previously created lab. x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/CreateLab.json | -| [labsDeleteSample.ts][labsdeletesample] | Delete a specific lab associated with the provided billing account name, billing profile name, and invoice section name. Note all students must be removed from the lab in order to delete the lab. x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/DeleteLab.json | -| [labsGenerateInviteCodeSample.ts][labsgenerateinvitecodesample] | Generate invite code for a lab x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/GenerateInviteCode.json | -| [labsGetSample.ts][labsgetsample] | Get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/Lab.json | -| [labsListAllSample.ts][labslistallsample] | Get a list of labs associated with the provided billing account name and billing profile name. x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/LabList.json | -| [labsListSample.ts][labslistsample] | Get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/LabListWithInvoiceSectionName.json | -| [operationsListSample.ts][operationslistsample] | Lists all of the available Microsoft.Education API operations. x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/GetOperations.json | -| [redeemInvitationCodeSample.ts][redeeminvitationcodesample] | Redeem invite code to join a redeemable lab x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/RedeemCode.json | -| [studentLabsGetSample.ts][studentlabsgetsample] | Get the details for a specified lab associated with the student lab. x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/StudentLab.json | -| [studentLabsListAllSample.ts][studentlabslistallsample] | Get a list of all labs associated with the caller of the API. x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/StudentLabList.json | -| [studentsCreateOrUpdateSample.ts][studentscreateorupdatesample] | Create and add a new student to the specified lab or update the details of an existing student in a lab. Note the student must have a valid tenant to accept the lab after they have been added to lab. x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/CreateStudent.json | -| [studentsDeleteSample.ts][studentsdeletesample] | Delete the specified student based on the student alias. x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/DeleteStudent.json | -| [studentsGetSample.ts][studentsgetsample] | Get the details for a specific student in the specified lab by student alias x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/Student.json | -| [studentsListSample.ts][studentslistsample] | Get a list of details about students that are associated with the specified lab. x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/StudentList.json | +# @azure/arm-education client library samples for TypeScript (Beta) + +These sample programs show how to use the TypeScript client libraries for @azure/arm-education in some common scenarios. + +| **File Name** | **Description** | +| --------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [grantsGetSample.ts][grantsgetsample] | get details for a specific grant linked to the provided billing account and billing profile. x-ms-original-file: 2021-12-01-preview/Grant.json | +| [grantsListAllSample.ts][grantslistallsample] | get a list of grants that Microsoft has provided. x-ms-original-file: 2021-12-01-preview/GrantList.json | +| [grantsListSample.ts][grantslistsample] | get details for a specific grant linked to the provided billing account and billing profile. x-ms-original-file: 2021-12-01-preview/GrantDefaultList.json | +| [joinRequestsApproveSample.ts][joinrequestsapprovesample] | approve student joining the redeemable lab x-ms-original-file: 2021-12-01-preview/JoinRequestApproveAndDenyForApprove.json | +| [joinRequestsDenySample.ts][joinrequestsdenysample] | deny student joining the redeemable lab x-ms-original-file: 2021-12-01-preview/JoinRequestApproveAndDeny.json | +| [joinRequestsGetSample.ts][joinrequestsgetsample] | get student join requests x-ms-original-file: 2021-12-01-preview/JoinRequest.json | +| [joinRequestsListSample.ts][joinrequestslistsample] | get student join requests x-ms-original-file: 2021-12-01-preview/JoinRequestList.json | +| [labsCreateOrUpdateSample.ts][labscreateorupdatesample] | create a new lab or update a previously created lab. x-ms-original-file: 2021-12-01-preview/CreateLab.json | +| [labsDeleteSample.ts][labsdeletesample] | delete a specific lab associated with the provided billing account name, billing profile name, and invoice section name. Note all students must be removed from the lab in order to delete the lab. x-ms-original-file: 2021-12-01-preview/DeleteLab.json | +| [labsGenerateInviteCodeSample.ts][labsgenerateinvitecodesample] | generate invite code for a lab x-ms-original-file: 2021-12-01-preview/GenerateInviteCode.json | +| [labsGetSample.ts][labsgetsample] | get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. x-ms-original-file: 2021-12-01-preview/Lab.json | +| [labsListAllSample.ts][labslistallsample] | get a list of labs associated with the provided billing account name and billing profile name. x-ms-original-file: 2021-12-01-preview/LabList.json | +| [labsListSample.ts][labslistsample] | get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. x-ms-original-file: 2021-12-01-preview/LabListWithInvoiceSectionName.json | +| [operationsListSample.ts][operationslistsample] | lists all of the available Microsoft.Education API operations. x-ms-original-file: 2021-12-01-preview/GetOperations.json | +| [redeemInvitationCodeSample.ts][redeeminvitationcodesample] | redeem invite code to join a redeemable lab x-ms-original-file: 2021-12-01-preview/RedeemCode.json | +| [studentLabsGetSample.ts][studentlabsgetsample] | get the details for a specified lab associated with the student lab. x-ms-original-file: 2021-12-01-preview/StudentLab.json | +| [studentLabsListAllSample.ts][studentlabslistallsample] | get a list of all labs associated with the caller of the API. x-ms-original-file: 2021-12-01-preview/StudentLabList.json | +| [studentsCreateOrUpdateSample.ts][studentscreateorupdatesample] | create and add a new student to the specified lab or update the details of an existing student in a lab. Note the student must have a valid tenant to accept the lab after they have been added to lab. x-ms-original-file: 2021-12-01-preview/CreateStudent.json | +| [studentsDeleteSample.ts][studentsdeletesample] | delete the specified student based on the student alias. x-ms-original-file: 2021-12-01-preview/DeleteStudent.json | +| [studentsGetSample.ts][studentsgetsample] | get the details for a specific student in the specified lab by student alias x-ms-original-file: 2021-12-01-preview/Student.json | +| [studentsListSample.ts][studentslistsample] | get a list of details about students that are associated with the specified lab. x-ms-original-file: 2021-12-01-preview/StudentList.json | ## Prerequisites @@ -66,10 +66,10 @@ npm run build node dist/grantsGetSample.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): +Alternatively, run a single sample with the required environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): ```bash -cross-env node dist/grantsGetSample.js +node dist/grantsGetSample.js ``` ## Next Steps diff --git a/sdk/education/arm-education/samples/v1-beta/typescript/package.json b/sdk/education/arm-education/samples/v1-beta/typescript/package.json index cd3a0001c1e1..6ae59706ce76 100644 --- a/sdk/education/arm-education/samples/v1-beta/typescript/package.json +++ b/sdk/education/arm-education/samples/v1-beta/typescript/package.json @@ -2,7 +2,7 @@ "name": "@azure-samples/arm-education-ts-beta", "private": true, "version": "1.0.0", - "description": " client library samples for TypeScript (Beta)", + "description": "@azure/arm-education client library samples for TypeScript (Beta)", "engines": { "node": ">=20.0.0" }, @@ -18,6 +18,7 @@ "keywords": [ "node", "azure", + "cloud", "typescript", "browser", "isomorphic" @@ -29,13 +30,14 @@ }, "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/education/arm-education", "dependencies": { - "@azure/arm-education": "next", + "@azure/arm-education": "beta", "dotenv": "latest", - "@azure/identity": "^4.2.1" + "@azure/identity": "^4.13.0" }, "devDependencies": { "@types/node": "^20.0.0", - "typescript": "~5.8.2", - "rimraf": "latest" + "cross-env": "latest", + "rimraf": "latest", + "typescript": "~6.0.2" } } diff --git a/sdk/education/arm-education/samples/v1-beta/typescript/sample.env b/sdk/education/arm-education/samples/v1-beta/typescript/sample.env index 672847a3fea0..508439fc7d62 100644 --- a/sdk/education/arm-education/samples/v1-beta/typescript/sample.env +++ b/sdk/education/arm-education/samples/v1-beta/typescript/sample.env @@ -1,4 +1 @@ -# App registration secret for AAD authentication -AZURE_CLIENT_SECRET= -AZURE_CLIENT_ID= -AZURE_TENANT_ID= \ No newline at end of file +# Feel free to add your own environment variables. \ No newline at end of file diff --git a/sdk/education/arm-education/samples/v1-beta/typescript/src/grantsGetSample.ts b/sdk/education/arm-education/samples/v1-beta/typescript/src/grantsGetSample.ts index 8677c0e8ad7a..01889cb5a7f4 100644 --- a/sdk/education/arm-education/samples/v1-beta/typescript/src/grantsGetSample.ts +++ b/sdk/education/arm-education/samples/v1-beta/typescript/src/grantsGetSample.ts @@ -1,65 +1,42 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { - GrantsGetOptionalParams, - EducationManagementClient -} from "@azure/arm-education"; + +import { EducationManagementClient } from "@azure/arm-education"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Get details for a specific grant linked to the provided billing account and billing profile. + * This sample demonstrates how to get details for a specific grant linked to the provided billing account and billing profile. * - * @summary Get details for a specific grant linked to the provided billing account and billing profile. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/Grant.json + * @summary get details for a specific grant linked to the provided billing account and billing profile. + * x-ms-original-file: 2021-12-01-preview/Grant.json */ async function grant(): Promise { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const includeAllocatedBudget = false; - const options: GrantsGetOptionalParams = { includeAllocatedBudget }; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); - const result = await client.grants.get( - billingAccountName, - billingProfileName, - options - ); + const result = await client.grants.get("{billingAccountName}", "{billingProfileName}", { + includeAllocatedBudget: false, + }); console.log(result); } /** - * This sample demonstrates how to Get details for a specific grant linked to the provided billing account and billing profile. + * This sample demonstrates how to get details for a specific grant linked to the provided billing account and billing profile. * - * @summary Get details for a specific grant linked to the provided billing account and billing profile. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/GrantIncludeAllocatedBudget.json + * @summary get details for a specific grant linked to the provided billing account and billing profile. + * x-ms-original-file: 2021-12-01-preview/GrantIncludeAllocatedBudget.json */ async function grantIncludeAllocatedBudget(): Promise { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const includeAllocatedBudget = false; - const options: GrantsGetOptionalParams = { includeAllocatedBudget }; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); - const result = await client.grants.get( - billingAccountName, - billingProfileName, - options - ); + const result = await client.grants.get("{billingAccountName}", "{billingProfileName}", { + includeAllocatedBudget: false, + }); console.log(result); } async function main(): Promise { - grant(); - grantIncludeAllocatedBudget(); + await grant(); + await grantIncludeAllocatedBudget(); } main().catch(console.error); diff --git a/sdk/education/arm-education/samples/v1-beta/typescript/src/grantsListAllSample.ts b/sdk/education/arm-education/samples/v1-beta/typescript/src/grantsListAllSample.ts index a9cea5ccabee..f92c1225961c 100644 --- a/sdk/education/arm-education/samples/v1-beta/typescript/src/grantsListAllSample.ts +++ b/sdk/education/arm-education/samples/v1-beta/typescript/src/grantsListAllSample.ts @@ -1,59 +1,46 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { - GrantsListAllOptionalParams, - EducationManagementClient -} from "@azure/arm-education"; + +import { EducationManagementClient } from "@azure/arm-education"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Get a list of grants that Microsoft has provided. + * This sample demonstrates how to get a list of grants that Microsoft has provided. * - * @summary Get a list of grants that Microsoft has provided. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/GrantList.json + * @summary get a list of grants that Microsoft has provided. + * x-ms-original-file: 2021-12-01-preview/GrantList.json */ async function grantList(): Promise { - const includeAllocatedBudget = false; - const options: GrantsListAllOptionalParams = { includeAllocatedBudget }; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); const resArray = new Array(); - for await (let item of client.grants.listAll(options)) { + for await (const item of client.grants.listAll({ includeAllocatedBudget: false })) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Get a list of grants that Microsoft has provided. + * This sample demonstrates how to get a list of grants that Microsoft has provided. * - * @summary Get a list of grants that Microsoft has provided. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/GrantListIncludeAllocatedBudget.json + * @summary get a list of grants that Microsoft has provided. + * x-ms-original-file: 2021-12-01-preview/GrantListIncludeAllocatedBudget.json */ async function grantListIncludeAllocatedBudget(): Promise { - const includeAllocatedBudget = true; - const options: GrantsListAllOptionalParams = { includeAllocatedBudget }; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); const resArray = new Array(); - for await (let item of client.grants.listAll(options)) { + for await (const item of client.grants.listAll({ includeAllocatedBudget: true })) { resArray.push(item); } + console.log(resArray); } async function main(): Promise { - grantList(); - grantListIncludeAllocatedBudget(); + await grantList(); + await grantListIncludeAllocatedBudget(); } main().catch(console.error); diff --git a/sdk/education/arm-education/samples/v1-beta/typescript/src/grantsListSample.ts b/sdk/education/arm-education/samples/v1-beta/typescript/src/grantsListSample.ts index 0e496e64531a..fcc1fd83b3fc 100644 --- a/sdk/education/arm-education/samples/v1-beta/typescript/src/grantsListSample.ts +++ b/sdk/education/arm-education/samples/v1-beta/typescript/src/grantsListSample.ts @@ -1,71 +1,50 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { - GrantsListOptionalParams, - EducationManagementClient -} from "@azure/arm-education"; + +import { EducationManagementClient } from "@azure/arm-education"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Get details for a specific grant linked to the provided billing account and billing profile. + * This sample demonstrates how to get details for a specific grant linked to the provided billing account and billing profile. * - * @summary Get details for a specific grant linked to the provided billing account and billing profile. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/GrantDefaultList.json + * @summary get details for a specific grant linked to the provided billing account and billing profile. + * x-ms-original-file: 2021-12-01-preview/GrantDefaultList.json */ async function grantList(): Promise { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const includeAllocatedBudget = false; - const options: GrantsListOptionalParams = { includeAllocatedBudget }; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); const resArray = new Array(); - for await (let item of client.grants.list( - billingAccountName, - billingProfileName, - options - )) { + for await (const item of client.grants.list("{billingAccountName}", "{billingProfileName}", { + includeAllocatedBudget: false, + })) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Get details for a specific grant linked to the provided billing account and billing profile. + * This sample demonstrates how to get details for a specific grant linked to the provided billing account and billing profile. * - * @summary Get details for a specific grant linked to the provided billing account and billing profile. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/GrantDefaultListIncludeAllocatedBudget.json + * @summary get details for a specific grant linked to the provided billing account and billing profile. + * x-ms-original-file: 2021-12-01-preview/GrantDefaultListIncludeAllocatedBudget.json */ async function grantListIncludeAllocatedBudget(): Promise { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const includeAllocatedBudget = false; - const options: GrantsListOptionalParams = { includeAllocatedBudget }; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); const resArray = new Array(); - for await (let item of client.grants.list( - billingAccountName, - billingProfileName, - options - )) { + for await (const item of client.grants.list("{billingAccountName}", "{billingProfileName}", { + includeAllocatedBudget: false, + })) { resArray.push(item); } + console.log(resArray); } async function main(): Promise { - grantList(); - grantListIncludeAllocatedBudget(); + await grantList(); + await grantListIncludeAllocatedBudget(); } main().catch(console.error); diff --git a/sdk/education/arm-education/samples/v1-beta/typescript/src/joinRequestsApproveSample.ts b/sdk/education/arm-education/samples/v1-beta/typescript/src/joinRequestsApproveSample.ts index 6bf24faa90a8..541d4fe0ae19 100644 --- a/sdk/education/arm-education/samples/v1-beta/typescript/src/joinRequestsApproveSample.ts +++ b/sdk/education/arm-education/samples/v1-beta/typescript/src/joinRequestsApproveSample.ts @@ -1,41 +1,28 @@ -/* - * 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 { EducationManagementClient } from "@azure/arm-education"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Approve student joining the redeemable lab + * This sample demonstrates how to approve student joining the redeemable lab * - * @summary Approve student joining the redeemable lab - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/JoinRequestApproveAndDeny.json + * @summary approve student joining the redeemable lab + * x-ms-original-file: 2021-12-01-preview/JoinRequestApproveAndDenyForApprove.json */ async function joinRequestApprove(): Promise { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const invoiceSectionName = "{invoiceSectionName}"; - const joinRequestName = "{joinRequestName}"; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); - const result = await client.joinRequests.approve( - billingAccountName, - billingProfileName, - invoiceSectionName, - joinRequestName + await client.joinRequests.approve( + "{billingAccountName}", + "{billingProfileName}", + "{invoiceSectionName}", + "{joinRequestName}", ); - console.log(result); } async function main(): Promise { - joinRequestApprove(); + await joinRequestApprove(); } main().catch(console.error); diff --git a/sdk/education/arm-education/samples/v1-beta/typescript/src/joinRequestsDenySample.ts b/sdk/education/arm-education/samples/v1-beta/typescript/src/joinRequestsDenySample.ts index 4cd8fa4ee02f..c9572153822f 100644 --- a/sdk/education/arm-education/samples/v1-beta/typescript/src/joinRequestsDenySample.ts +++ b/sdk/education/arm-education/samples/v1-beta/typescript/src/joinRequestsDenySample.ts @@ -1,41 +1,28 @@ -/* - * 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 { EducationManagementClient } from "@azure/arm-education"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Deny student joining the redeemable lab + * This sample demonstrates how to deny student joining the redeemable lab * - * @summary Deny student joining the redeemable lab - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/JoinRequestApproveAndDeny.json + * @summary deny student joining the redeemable lab + * x-ms-original-file: 2021-12-01-preview/JoinRequestApproveAndDeny.json */ async function joinRequestDeny(): Promise { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const invoiceSectionName = "{invoiceSectionName}"; - const joinRequestName = "{joinRequestName}"; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); - const result = await client.joinRequests.deny( - billingAccountName, - billingProfileName, - invoiceSectionName, - joinRequestName + await client.joinRequests.deny( + "{billingAccountName}", + "{billingProfileName}", + "{invoiceSectionName}", + "{joinRequestName}", ); - console.log(result); } async function main(): Promise { - joinRequestDeny(); + await joinRequestDeny(); } main().catch(console.error); diff --git a/sdk/education/arm-education/samples/v1-beta/typescript/src/joinRequestsGetSample.ts b/sdk/education/arm-education/samples/v1-beta/typescript/src/joinRequestsGetSample.ts index 7de0652d3181..fd68cb45d566 100644 --- a/sdk/education/arm-education/samples/v1-beta/typescript/src/joinRequestsGetSample.ts +++ b/sdk/education/arm-education/samples/v1-beta/typescript/src/joinRequestsGetSample.ts @@ -1,41 +1,29 @@ -/* - * 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 { EducationManagementClient } from "@azure/arm-education"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** * This sample demonstrates how to get student join requests * * @summary get student join requests - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/JoinRequest.json + * x-ms-original-file: 2021-12-01-preview/JoinRequest.json */ async function joinRequest(): Promise { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const invoiceSectionName = "{invoiceSectionName}"; - const joinRequestName = "{joinRequestName}"; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); const result = await client.joinRequests.get( - billingAccountName, - billingProfileName, - invoiceSectionName, - joinRequestName + "{billingAccountName}", + "{billingProfileName}", + "{invoiceSectionName}", + "{joinRequestName}", ); console.log(result); } async function main(): Promise { - joinRequest(); + await joinRequest(); } main().catch(console.error); diff --git a/sdk/education/arm-education/samples/v1-beta/typescript/src/joinRequestsListSample.ts b/sdk/education/arm-education/samples/v1-beta/typescript/src/joinRequestsListSample.ts index a9379a51f19a..cc673f3e6289 100644 --- a/sdk/education/arm-education/samples/v1-beta/typescript/src/joinRequestsListSample.ts +++ b/sdk/education/arm-education/samples/v1-beta/typescript/src/joinRequestsListSample.ts @@ -1,48 +1,33 @@ -/* - * 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 { - JoinRequestsListOptionalParams, - EducationManagementClient -} from "@azure/arm-education"; + +import { EducationManagementClient } from "@azure/arm-education"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** * This sample demonstrates how to get student join requests * * @summary get student join requests - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/JoinRequestList.json + * x-ms-original-file: 2021-12-01-preview/JoinRequestList.json */ async function joinRequestList(): Promise { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const invoiceSectionName = "{invoiceSectionName}"; - const includeDenied = false; - const options: JoinRequestsListOptionalParams = { includeDenied }; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); const resArray = new Array(); - for await (let item of client.joinRequests.list( - billingAccountName, - billingProfileName, - invoiceSectionName, - options + for await (const item of client.joinRequests.list( + "{billingAccountName}", + "{billingProfileName}", + "{invoiceSectionName}", + { includeDenied: false }, )) { resArray.push(item); } + console.log(resArray); } async function main(): Promise { - joinRequestList(); + await joinRequestList(); } main().catch(console.error); diff --git a/sdk/education/arm-education/samples/v1-beta/typescript/src/labsCreateOrUpdateSample.ts b/sdk/education/arm-education/samples/v1-beta/typescript/src/labsCreateOrUpdateSample.ts index f8e2925434cf..e7487cc46127 100644 --- a/sdk/education/arm-education/samples/v1-beta/typescript/src/labsCreateOrUpdateSample.ts +++ b/sdk/education/arm-education/samples/v1-beta/typescript/src/labsCreateOrUpdateSample.ts @@ -1,46 +1,34 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { LabDetails, EducationManagementClient } from "@azure/arm-education"; + +import { EducationManagementClient } from "@azure/arm-education"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Create a new lab or update a previously created lab. + * This sample demonstrates how to create a new lab or update a previously created lab. * - * @summary Create a new lab or update a previously created lab. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/CreateLab.json + * @summary create a new lab or update a previously created lab. + * x-ms-original-file: 2021-12-01-preview/CreateLab.json */ async function createLab(): Promise { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const invoiceSectionName = "{invoiceSectionName}"; - const parameters: LabDetails = { - description: "example lab description", - budgetPerStudent: { currency: "USD", value: 100 }, - displayName: "example lab", - expirationDate: new Date("2021-12-09T22:11:29.422Z") - }; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); const result = await client.labs.createOrUpdate( - billingAccountName, - billingProfileName, - invoiceSectionName, - parameters + "{billingAccountName}", + "{billingProfileName}", + "{invoiceSectionName}", + { + description: "example lab description", + budgetPerStudent: { currency: "USD", value: 100 }, + displayName: "example lab", + expirationDate: new Date("2021-12-09T22:11:29.422Z"), + }, ); console.log(result); } async function main(): Promise { - createLab(); + await createLab(); } main().catch(console.error); diff --git a/sdk/education/arm-education/samples/v1-beta/typescript/src/labsDeleteSample.ts b/sdk/education/arm-education/samples/v1-beta/typescript/src/labsDeleteSample.ts index 05b76c69c822..d1f5cc94e5a0 100644 --- a/sdk/education/arm-education/samples/v1-beta/typescript/src/labsDeleteSample.ts +++ b/sdk/education/arm-education/samples/v1-beta/typescript/src/labsDeleteSample.ts @@ -1,39 +1,23 @@ -/* - * 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 { EducationManagementClient } from "@azure/arm-education"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Delete a specific lab associated with the provided billing account name, billing profile name, and invoice section name. Note all students must be removed from the lab in order to delete the lab. + * This sample demonstrates how to delete a specific lab associated with the provided billing account name, billing profile name, and invoice section name. Note all students must be removed from the lab in order to delete the lab. * - * @summary Delete a specific lab associated with the provided billing account name, billing profile name, and invoice section name. Note all students must be removed from the lab in order to delete the lab. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/DeleteLab.json + * @summary delete a specific lab associated with the provided billing account name, billing profile name, and invoice section name. Note all students must be removed from the lab in order to delete the lab. + * x-ms-original-file: 2021-12-01-preview/DeleteLab.json */ async function deleteLab(): Promise { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const invoiceSectionName = "{invoiceSectionName}"; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); - const result = await client.labs.delete( - billingAccountName, - billingProfileName, - invoiceSectionName - ); - console.log(result); + await client.labs.delete("{billingAccountName}", "{billingProfileName}", "{invoiceSectionName}"); } async function main(): Promise { - deleteLab(); + await deleteLab(); } main().catch(console.error); diff --git a/sdk/education/arm-education/samples/v1-beta/typescript/src/labsGenerateInviteCodeSample.ts b/sdk/education/arm-education/samples/v1-beta/typescript/src/labsGenerateInviteCodeSample.ts index ac0a5fc9e940..83c18c9ed027 100644 --- a/sdk/education/arm-education/samples/v1-beta/typescript/src/labsGenerateInviteCodeSample.ts +++ b/sdk/education/arm-education/samples/v1-beta/typescript/src/labsGenerateInviteCodeSample.ts @@ -1,44 +1,29 @@ -/* - * 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 { - InviteCodeGenerateRequest, - EducationManagementClient -} from "@azure/arm-education"; + +import { EducationManagementClient } from "@azure/arm-education"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Generate invite code for a lab + * This sample demonstrates how to generate invite code for a lab * - * @summary Generate invite code for a lab - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/GenerateInviteCode.json + * @summary generate invite code for a lab + * x-ms-original-file: 2021-12-01-preview/GenerateInviteCode.json */ async function createLab(): Promise { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const invoiceSectionName = "{invoiceSectionName}"; - const parameters: InviteCodeGenerateRequest = { maxStudentCount: 10 }; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); const result = await client.labs.generateInviteCode( - billingAccountName, - billingProfileName, - invoiceSectionName, - parameters + "{billingAccountName}", + "{billingProfileName}", + "{invoiceSectionName}", + { maxStudentCount: 10 }, ); console.log(result); } async function main(): Promise { - createLab(); + await createLab(); } main().catch(console.error); diff --git a/sdk/education/arm-education/samples/v1-beta/typescript/src/labsGetSample.ts b/sdk/education/arm-education/samples/v1-beta/typescript/src/labsGetSample.ts index 4763a1508b09..b744e5aa6f1a 100644 --- a/sdk/education/arm-education/samples/v1-beta/typescript/src/labsGetSample.ts +++ b/sdk/education/arm-education/samples/v1-beta/typescript/src/labsGetSample.ts @@ -1,69 +1,48 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { - LabsGetOptionalParams, - EducationManagementClient -} from "@azure/arm-education"; + +import { EducationManagementClient } from "@azure/arm-education"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. + * This sample demonstrates how to get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. * - * @summary Get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/Lab.json + * @summary get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. + * x-ms-original-file: 2021-12-01-preview/Lab.json */ async function lab(): Promise { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const invoiceSectionName = "{invoiceSectionName}"; - const includeBudget = false; - const options: LabsGetOptionalParams = { includeBudget }; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); const result = await client.labs.get( - billingAccountName, - billingProfileName, - invoiceSectionName, - options + "{billingAccountName}", + "{billingProfileName}", + "{invoiceSectionName}", + { includeBudget: false }, ); console.log(result); } /** - * This sample demonstrates how to Get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. + * This sample demonstrates how to get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. * - * @summary Get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/LabIncludeBudget.json + * @summary get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. + * x-ms-original-file: 2021-12-01-preview/LabIncludeBudget.json */ async function labIncludeBudget(): Promise { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const invoiceSectionName = "{invoiceSectionName}"; - const includeBudget = true; - const options: LabsGetOptionalParams = { includeBudget }; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); const result = await client.labs.get( - billingAccountName, - billingProfileName, - invoiceSectionName, - options + "{billingAccountName}", + "{billingProfileName}", + "{invoiceSectionName}", + { includeBudget: true }, ); console.log(result); } async function main(): Promise { - lab(); - labIncludeBudget(); + await lab(); + await labIncludeBudget(); } main().catch(console.error); diff --git a/sdk/education/arm-education/samples/v1-beta/typescript/src/labsListAllSample.ts b/sdk/education/arm-education/samples/v1-beta/typescript/src/labsListAllSample.ts index 48b9d1c0857a..cc7895054a81 100644 --- a/sdk/education/arm-education/samples/v1-beta/typescript/src/labsListAllSample.ts +++ b/sdk/education/arm-education/samples/v1-beta/typescript/src/labsListAllSample.ts @@ -1,71 +1,50 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { - LabsListAllOptionalParams, - EducationManagementClient -} from "@azure/arm-education"; + +import { EducationManagementClient } from "@azure/arm-education"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Get a list of labs associated with the provided billing account name and billing profile name. + * This sample demonstrates how to get a list of labs associated with the provided billing account name and billing profile name. * - * @summary Get a list of labs associated with the provided billing account name and billing profile name. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/LabList.json + * @summary get a list of labs associated with the provided billing account name and billing profile name. + * x-ms-original-file: 2021-12-01-preview/LabList.json */ async function labList(): Promise { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const includeBudget = false; - const options: LabsListAllOptionalParams = { includeBudget }; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); const resArray = new Array(); - for await (let item of client.labs.listAll( - billingAccountName, - billingProfileName, - options - )) { + for await (const item of client.labs.listAll("{billingAccountName}", "{billingProfileName}", { + includeBudget: false, + })) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Get a list of labs associated with the provided billing account name and billing profile name. + * This sample demonstrates how to get a list of labs associated with the provided billing account name and billing profile name. * - * @summary Get a list of labs associated with the provided billing account name and billing profile name. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/LabListIncludeBudget.json + * @summary get a list of labs associated with the provided billing account name and billing profile name. + * x-ms-original-file: 2021-12-01-preview/LabListIncludeBudget.json */ async function labListIncludeBudget(): Promise { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const includeBudget = true; - const options: LabsListAllOptionalParams = { includeBudget }; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); const resArray = new Array(); - for await (let item of client.labs.listAll( - billingAccountName, - billingProfileName, - options - )) { + for await (const item of client.labs.listAll("{billingAccountName}", "{billingProfileName}", { + includeBudget: true, + })) { resArray.push(item); } + console.log(resArray); } async function main(): Promise { - labList(); - labListIncludeBudget(); + await labList(); + await labListIncludeBudget(); } main().catch(console.error); diff --git a/sdk/education/arm-education/samples/v1-beta/typescript/src/labsListSample.ts b/sdk/education/arm-education/samples/v1-beta/typescript/src/labsListSample.ts index fa8e1b829883..54e385a4ea06 100644 --- a/sdk/education/arm-education/samples/v1-beta/typescript/src/labsListSample.ts +++ b/sdk/education/arm-education/samples/v1-beta/typescript/src/labsListSample.ts @@ -1,75 +1,56 @@ -/* - * 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 { - LabsListOptionalParams, - EducationManagementClient -} from "@azure/arm-education"; + +import { EducationManagementClient } from "@azure/arm-education"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. + * This sample demonstrates how to get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. * - * @summary Get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/LabListWithInvoiceSectionName.json + * @summary get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. + * x-ms-original-file: 2021-12-01-preview/LabListWithInvoiceSectionName.json */ async function labListWithInvoiceSectionName(): Promise { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const invoiceSectionName = "{invoiceSectionName}"; - const includeBudget = true; - const options: LabsListOptionalParams = { includeBudget }; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); const resArray = new Array(); - for await (let item of client.labs.list( - billingAccountName, - billingProfileName, - invoiceSectionName, - options + for await (const item of client.labs.list( + "{billingAccountName}", + "{billingProfileName}", + "{invoiceSectionName}", + { includeBudget: true }, )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. + * This sample demonstrates how to get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. * - * @summary Get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/LabListWithInvoiceSectionNameIncludeBudget.json + * @summary get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. + * x-ms-original-file: 2021-12-01-preview/LabListWithInvoiceSectionNameIncludeBudget.json */ async function labListWithInvoiceSectionNameIncludeBudget(): Promise { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const invoiceSectionName = "{invoiceSectionName}"; - const includeBudget = true; - const options: LabsListOptionalParams = { includeBudget }; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); const resArray = new Array(); - for await (let item of client.labs.list( - billingAccountName, - billingProfileName, - invoiceSectionName, - options + for await (const item of client.labs.list( + "{billingAccountName}", + "{billingProfileName}", + "{invoiceSectionName}", + { includeBudget: true }, )) { resArray.push(item); } + console.log(resArray); } async function main(): Promise { - labListWithInvoiceSectionName(); - labListWithInvoiceSectionNameIncludeBudget(); + await labListWithInvoiceSectionName(); + await labListWithInvoiceSectionNameIncludeBudget(); } main().catch(console.error); diff --git a/sdk/education/arm-education/samples/v1-beta/typescript/src/operationsListSample.ts b/sdk/education/arm-education/samples/v1-beta/typescript/src/operationsListSample.ts index 14badba496f7..131760467492 100644 --- a/sdk/education/arm-education/samples/v1-beta/typescript/src/operationsListSample.ts +++ b/sdk/education/arm-education/samples/v1-beta/typescript/src/operationsListSample.ts @@ -1,22 +1,14 @@ -/* - * 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 { EducationManagementClient } from "@azure/arm-education"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Lists all of the available Microsoft.Education API operations. + * This sample demonstrates how to lists all of the available Microsoft.Education API operations. * - * @summary Lists all of the available Microsoft.Education API operations. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/GetOperations.json + * @summary lists all of the available Microsoft.Education API operations. + * x-ms-original-file: 2021-12-01-preview/GetOperations.json */ async function getOperations(): Promise { const credential = new DefaultAzureCredential(); @@ -26,7 +18,7 @@ async function getOperations(): Promise { } async function main(): Promise { - getOperations(); + await getOperations(); } main().catch(console.error); diff --git a/sdk/education/arm-education/samples/v1-beta/typescript/src/redeemInvitationCodeSample.ts b/sdk/education/arm-education/samples/v1-beta/typescript/src/redeemInvitationCodeSample.ts index 0ebf494d0135..61a465aca1a2 100644 --- a/sdk/education/arm-education/samples/v1-beta/typescript/src/redeemInvitationCodeSample.ts +++ b/sdk/education/arm-education/samples/v1-beta/typescript/src/redeemInvitationCodeSample.ts @@ -1,37 +1,27 @@ -/* - * 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 { RedeemRequest, EducationManagementClient } from "@azure/arm-education"; + +import { EducationManagementClient } from "@azure/arm-education"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Redeem invite code to join a redeemable lab + * This sample demonstrates how to redeem invite code to join a redeemable lab * - * @summary Redeem invite code to join a redeemable lab - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/RedeemCode.json + * @summary redeem invite code to join a redeemable lab + * x-ms-original-file: 2021-12-01-preview/RedeemCode.json */ async function redeemCode(): Promise { - const parameters: RedeemRequest = { - firstName: "test", - lastName: "user", - redeemCode: "exampleRedeemCode" - }; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); - const result = await client.redeemInvitationCode(parameters); - console.log(result); + await client.redeemInvitationCode({ + firstName: "test", + lastName: "user", + redeemCode: "exampleRedeemCode", + }); } async function main(): Promise { - redeemCode(); + await redeemCode(); } main().catch(console.error); diff --git a/sdk/education/arm-education/samples/v1-beta/typescript/src/studentLabsGetSample.ts b/sdk/education/arm-education/samples/v1-beta/typescript/src/studentLabsGetSample.ts index cd517829bbe8..208b91236bc5 100644 --- a/sdk/education/arm-education/samples/v1-beta/typescript/src/studentLabsGetSample.ts +++ b/sdk/education/arm-education/samples/v1-beta/typescript/src/studentLabsGetSample.ts @@ -1,33 +1,24 @@ -/* - * 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 { EducationManagementClient } from "@azure/arm-education"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Get the details for a specified lab associated with the student lab. + * This sample demonstrates how to get the details for a specified lab associated with the student lab. * - * @summary Get the details for a specified lab associated with the student lab. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/StudentLab.json + * @summary get the details for a specified lab associated with the student lab. + * x-ms-original-file: 2021-12-01-preview/StudentLab.json */ async function studentLab(): Promise { - const studentLabName = "{studentLabName}"; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); - const result = await client.studentLabs.get(studentLabName); + const result = await client.studentLabs.get("{studentLabName}"); console.log(result); } async function main(): Promise { - studentLab(); + await studentLab(); } main().catch(console.error); diff --git a/sdk/education/arm-education/samples/v1-beta/typescript/src/studentLabsListAllSample.ts b/sdk/education/arm-education/samples/v1-beta/typescript/src/studentLabsListAllSample.ts index 5da0d4c654c1..5e704d581c22 100644 --- a/sdk/education/arm-education/samples/v1-beta/typescript/src/studentLabsListAllSample.ts +++ b/sdk/education/arm-education/samples/v1-beta/typescript/src/studentLabsListAllSample.ts @@ -1,35 +1,28 @@ -/* - * 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 { EducationManagementClient } from "@azure/arm-education"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Get a list of all labs associated with the caller of the API. + * This sample demonstrates how to get a list of all labs associated with the caller of the API. * - * @summary Get a list of all labs associated with the caller of the API. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/StudentLabList.json + * @summary get a list of all labs associated with the caller of the API. + * x-ms-original-file: 2021-12-01-preview/StudentLabList.json */ async function studentLabList(): Promise { const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); const resArray = new Array(); - for await (let item of client.studentLabs.listAll()) { + for await (const item of client.studentLabs.listAll()) { resArray.push(item); } + console.log(resArray); } async function main(): Promise { - studentLabList(); + await studentLabList(); } main().catch(console.error); diff --git a/sdk/education/arm-education/samples/v1-beta/typescript/src/studentsCreateOrUpdateSample.ts b/sdk/education/arm-education/samples/v1-beta/typescript/src/studentsCreateOrUpdateSample.ts index e03ea470cd07..1e0da83b2685 100644 --- a/sdk/education/arm-education/samples/v1-beta/typescript/src/studentsCreateOrUpdateSample.ts +++ b/sdk/education/arm-education/samples/v1-beta/typescript/src/studentsCreateOrUpdateSample.ts @@ -1,53 +1,37 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { - StudentDetails, - EducationManagementClient -} from "@azure/arm-education"; + +import { EducationManagementClient } from "@azure/arm-education"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Create and add a new student to the specified lab or update the details of an existing student in a lab. Note the student must have a valid tenant to accept the lab after they have been added to lab. + * This sample demonstrates how to create and add a new student to the specified lab or update the details of an existing student in a lab. Note the student must have a valid tenant to accept the lab after they have been added to lab. * - * @summary Create and add a new student to the specified lab or update the details of an existing student in a lab. Note the student must have a valid tenant to accept the lab after they have been added to lab. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/CreateStudent.json + * @summary create and add a new student to the specified lab or update the details of an existing student in a lab. Note the student must have a valid tenant to accept the lab after they have been added to lab. + * x-ms-original-file: 2021-12-01-preview/CreateStudent.json */ async function student(): Promise { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const invoiceSectionName = "{invoiceSectionName}"; - const studentAlias = "{studentAlias}"; - const parameters: StudentDetails = { - budget: { currency: "USD", value: 100 }, - email: "test@contoso.com", - expirationDate: new Date("2021-11-09T22:13:21.795Z"), - firstName: "test", - lastName: "user", - role: "Student" - }; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); const result = await client.students.createOrUpdate( - billingAccountName, - billingProfileName, - invoiceSectionName, - studentAlias, - parameters + "{billingAccountName}", + "{billingProfileName}", + "{invoiceSectionName}", + "{studentAlias}", + { + budget: { currency: "USD", value: 100 }, + email: "test@contoso.com", + expirationDate: new Date("2021-11-09T22:13:21.795Z"), + firstName: "test", + lastName: "user", + role: "Student", + }, ); console.log(result); } async function main(): Promise { - student(); + await student(); } main().catch(console.error); diff --git a/sdk/education/arm-education/samples/v1-beta/typescript/src/studentsDeleteSample.ts b/sdk/education/arm-education/samples/v1-beta/typescript/src/studentsDeleteSample.ts index aafa69580b3d..ab5fde85a2ec 100644 --- a/sdk/education/arm-education/samples/v1-beta/typescript/src/studentsDeleteSample.ts +++ b/sdk/education/arm-education/samples/v1-beta/typescript/src/studentsDeleteSample.ts @@ -1,41 +1,28 @@ -/* - * 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 { EducationManagementClient } from "@azure/arm-education"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Delete the specified student based on the student alias. + * This sample demonstrates how to delete the specified student based on the student alias. * - * @summary Delete the specified student based on the student alias. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/DeleteStudent.json + * @summary delete the specified student based on the student alias. + * x-ms-original-file: 2021-12-01-preview/DeleteStudent.json */ async function deleteLab(): Promise { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const invoiceSectionName = "{invoiceSectionName}"; - const studentAlias = "{studentAlias}"; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); - const result = await client.students.delete( - billingAccountName, - billingProfileName, - invoiceSectionName, - studentAlias + await client.students.delete( + "{billingAccountName}", + "{billingProfileName}", + "{invoiceSectionName}", + "{studentAlias}", ); - console.log(result); } async function main(): Promise { - deleteLab(); + await deleteLab(); } main().catch(console.error); diff --git a/sdk/education/arm-education/samples/v1-beta/typescript/src/studentsGetSample.ts b/sdk/education/arm-education/samples/v1-beta/typescript/src/studentsGetSample.ts index 3075ce8f65fa..66fc37cc404c 100644 --- a/sdk/education/arm-education/samples/v1-beta/typescript/src/studentsGetSample.ts +++ b/sdk/education/arm-education/samples/v1-beta/typescript/src/studentsGetSample.ts @@ -1,41 +1,29 @@ -/* - * 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 { EducationManagementClient } from "@azure/arm-education"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Get the details for a specific student in the specified lab by student alias + * This sample demonstrates how to get the details for a specific student in the specified lab by student alias * - * @summary Get the details for a specific student in the specified lab by student alias - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/Student.json + * @summary get the details for a specific student in the specified lab by student alias + * x-ms-original-file: 2021-12-01-preview/Student.json */ async function student(): Promise { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const invoiceSectionName = "{invoiceSectionName}"; - const studentAlias = "{studentAlias}"; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); const result = await client.students.get( - billingAccountName, - billingProfileName, - invoiceSectionName, - studentAlias + "{billingAccountName}", + "{billingProfileName}", + "{invoiceSectionName}", + "{studentAlias}", ); console.log(result); } async function main(): Promise { - student(); + await student(); } main().catch(console.error); diff --git a/sdk/education/arm-education/samples/v1-beta/typescript/src/studentsListSample.ts b/sdk/education/arm-education/samples/v1-beta/typescript/src/studentsListSample.ts index d57f3783d06c..c85deb44fe14 100644 --- a/sdk/education/arm-education/samples/v1-beta/typescript/src/studentsListSample.ts +++ b/sdk/education/arm-education/samples/v1-beta/typescript/src/studentsListSample.ts @@ -1,42 +1,32 @@ -/* - * 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 { EducationManagementClient } from "@azure/arm-education"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Get a list of details about students that are associated with the specified lab. + * This sample demonstrates how to get a list of details about students that are associated with the specified lab. * - * @summary Get a list of details about students that are associated with the specified lab. - * x-ms-original-file: specification/education/resource-manager/Microsoft.Education/preview/2021-12-01-preview/examples/StudentList.json + * @summary get a list of details about students that are associated with the specified lab. + * x-ms-original-file: 2021-12-01-preview/StudentList.json */ async function studentList(): Promise { - const billingAccountName = "{billingAccountName}"; - const billingProfileName = "{billingProfileName}"; - const invoiceSectionName = "{invoiceSectionName}"; const credential = new DefaultAzureCredential(); const client = new EducationManagementClient(credential); const resArray = new Array(); - for await (let item of client.students.list( - billingAccountName, - billingProfileName, - invoiceSectionName + for await (const item of client.students.list( + "{billingAccountName}", + "{billingProfileName}", + "{invoiceSectionName}", )) { resArray.push(item); } + console.log(resArray); } async function main(): Promise { - studentList(); + await studentList(); } main().catch(console.error); diff --git a/sdk/education/arm-education/samples/v1-beta/typescript/tsconfig.json b/sdk/education/arm-education/samples/v1-beta/typescript/tsconfig.json index 984eed535aa8..82d2ed3be723 100644 --- a/sdk/education/arm-education/samples/v1-beta/typescript/tsconfig.json +++ b/sdk/education/arm-education/samples/v1-beta/typescript/tsconfig.json @@ -1,8 +1,8 @@ { "compilerOptions": { - "target": "ES2020", - "module": "commonjs", - "moduleResolution": "node", + "target": "ES2023", + "module": "nodenext", + "moduleResolution": "nodenext", "resolveJsonModule": true, "esModuleInterop": true, "allowSyntheticDefaultImports": true, diff --git a/sdk/education/arm-education/src/api/educationManagementContext.ts b/sdk/education/arm-education/src/api/educationManagementContext.ts new file mode 100644 index 000000000000..39017db4b8f8 --- /dev/null +++ b/sdk/education/arm-education/src/api/educationManagementContext.ts @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { logger } from "../logger.js"; +import { KnownVersions } from "../models/models.js"; +import { AzureSupportedClouds, getArmEndpoint } from "../static-helpers/cloudSettingHelpers.js"; +import { Client, ClientOptions, getClient } from "@azure-rest/core-client"; +import { TokenCredential } from "@azure/core-auth"; + +/** Education client provides access to education resources for Azure subscriptions. */ +export interface EducationManagementContext extends Client { + /** The API version to use for this operation. */ + /** Known values of {@link KnownVersions} that the service accepts. */ + apiVersion?: string; +} + +/** Optional parameters for the client. */ +export interface EducationManagementClientOptionalParams extends ClientOptions { + /** The API version to use for this operation. */ + /** Known values of {@link KnownVersions} that the service accepts. */ + apiVersion?: string; + /** Specifies the Azure cloud environment for the client. */ + cloudSetting?: AzureSupportedClouds; +} + +/** Education client provides access to education resources for Azure subscriptions. */ +export function createEducationManagement( + credential: TokenCredential, + options: EducationManagementClientOptionalParams = {}, +): EducationManagementContext { + const endpointUrl = + options.endpoint ?? getArmEndpoint(options.cloudSetting) ?? "https://management.azure.com"; + const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; + const userAgentInfo = `azsdk-js-arm-education/1.0.0-beta.5`; + const userAgentPrefix = prefixFromOptions + ? `${prefixFromOptions} azsdk-js-api ${userAgentInfo}` + : `azsdk-js-api ${userAgentInfo}`; + const { apiVersion: _, ...updatedOptions } = { + ...options, + userAgentOptions: { userAgentPrefix }, + loggingOptions: { logger: options.loggingOptions?.logger ?? logger.info }, + credentials: { + scopes: options.credentials?.scopes ?? ["https://management.azure.com/.default"], + }, + }; + const clientContext = getClient(endpointUrl, credential, updatedOptions); + const apiVersion = options.apiVersion; + return { ...clientContext, apiVersion } as EducationManagementContext; +} diff --git a/sdk/education/arm-education/src/api/grants/index.ts b/sdk/education/arm-education/src/api/grants/index.ts new file mode 100644 index 000000000000..2effb4b26388 --- /dev/null +++ b/sdk/education/arm-education/src/api/grants/index.ts @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { listAll, list, get } from "./operations.js"; +export type { + GrantsListAllOptionalParams, + GrantsListOptionalParams, + GrantsGetOptionalParams, +} from "./options.js"; diff --git a/sdk/education/arm-education/src/api/grants/operations.ts b/sdk/education/arm-education/src/api/grants/operations.ts new file mode 100644 index 000000000000..cade9d915234 --- /dev/null +++ b/sdk/education/arm-education/src/api/grants/operations.ts @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { EducationManagementContext as Client } from "../index.js"; +import { + errorResponseBodyDeserializer, + GrantDetails, + grantDetailsDeserializer, + _GrantListResponse, + _grantListResponseDeserializer, +} from "../../models/models.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import { + GrantsListAllOptionalParams, + GrantsListOptionalParams, + GrantsGetOptionalParams, +} from "./options.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; + +export function _listAllSend( + context: Client, + options: GrantsListAllOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/Microsoft.Education/grants{?api%2Dversion,includeAllocatedBudget}", + { + "api%2Dversion": context.apiVersion ?? "2021-12-01-preview", + includeAllocatedBudget: options?.includeAllocatedBudget, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listAllDeserialize( + result: PathUncheckedResponse, +): Promise<_GrantListResponse> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseBodyDeserializer(result.body); + + throw error; + } + + return _grantListResponseDeserializer(result.body); +} + +/** Get a list of grants that Microsoft has provided. */ +export function listAll( + context: Client, + options: GrantsListAllOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listAllSend(context, options), + _listAllDeserialize, + ["200"], + { + itemName: "value", + nextLinkName: "nextLink", + apiVersion: context.apiVersion ?? "2021-12-01-preview", + }, + ); +} + +export function _listSend( + context: Client, + billingAccountName: string, + billingProfileName: string, + options: GrantsListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.Education/grants{?api%2Dversion,includeAllocatedBudget}", + { + billingAccountName: billingAccountName, + billingProfileName: billingProfileName, + "api%2Dversion": context.apiVersion ?? "2021-12-01-preview", + includeAllocatedBudget: options?.includeAllocatedBudget, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listDeserialize(result: PathUncheckedResponse): Promise<_GrantListResponse> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseBodyDeserializer(result.body); + + throw error; + } + + return _grantListResponseDeserializer(result.body); +} + +/** Get details for a specific grant linked to the provided billing account and billing profile. */ +export function list( + context: Client, + billingAccountName: string, + billingProfileName: string, + options: GrantsListOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listSend(context, billingAccountName, billingProfileName, options), + _listDeserialize, + ["200"], + { + itemName: "value", + nextLinkName: "nextLink", + apiVersion: context.apiVersion ?? "2021-12-01-preview", + }, + ); +} + +export function _getSend( + context: Client, + billingAccountName: string, + billingProfileName: string, + options: GrantsGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.Education/grants/default{?api%2Dversion,includeAllocatedBudget}", + { + billingAccountName: billingAccountName, + billingProfileName: billingProfileName, + "api%2Dversion": context.apiVersion ?? "2021-12-01-preview", + includeAllocatedBudget: options?.includeAllocatedBudget, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _getDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseBodyDeserializer(result.body); + + throw error; + } + + return grantDetailsDeserializer(result.body); +} + +/** Get details for a specific grant linked to the provided billing account and billing profile. */ +export async function get( + context: Client, + billingAccountName: string, + billingProfileName: string, + options: GrantsGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend(context, billingAccountName, billingProfileName, options); + return _getDeserialize(result); +} diff --git a/sdk/education/arm-education/src/api/grants/options.ts b/sdk/education/arm-education/src/api/grants/options.ts new file mode 100644 index 000000000000..7b60664d5d99 --- /dev/null +++ b/sdk/education/arm-education/src/api/grants/options.ts @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface GrantsListAllOptionalParams extends OperationOptions { + /** May be used to include information about budget that has been allocated. */ + includeAllocatedBudget?: boolean; +} + +/** Optional parameters. */ +export interface GrantsListOptionalParams extends OperationOptions { + /** May be used to include information about budget that has been allocated. */ + includeAllocatedBudget?: boolean; +} + +/** Optional parameters. */ +export interface GrantsGetOptionalParams extends OperationOptions { + /** May be used to include information about budget that has been allocated. */ + includeAllocatedBudget?: boolean; +} diff --git a/sdk/education/arm-education/src/api/index.ts b/sdk/education/arm-education/src/api/index.ts new file mode 100644 index 000000000000..cc0a17af5d06 --- /dev/null +++ b/sdk/education/arm-education/src/api/index.ts @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export type { + EducationManagementContext, + EducationManagementClientOptionalParams, +} from "./educationManagementContext.js"; +export { createEducationManagement } from "./educationManagementContext.js"; +export { redeemInvitationCode } from "./operations.js"; +export type { RedeemInvitationCodeOptionalParams } from "./options.js"; diff --git a/sdk/education/arm-education/src/api/joinRequests/index.ts b/sdk/education/arm-education/src/api/joinRequests/index.ts new file mode 100644 index 000000000000..cd072ee121b7 --- /dev/null +++ b/sdk/education/arm-education/src/api/joinRequests/index.ts @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { deny, approve, list, get } from "./operations.js"; +export type { + JoinRequestsDenyOptionalParams, + JoinRequestsApproveOptionalParams, + JoinRequestsListOptionalParams, + JoinRequestsGetOptionalParams, +} from "./options.js"; diff --git a/sdk/education/arm-education/src/api/joinRequests/operations.ts b/sdk/education/arm-education/src/api/joinRequests/operations.ts new file mode 100644 index 000000000000..d65b7f0d61b7 --- /dev/null +++ b/sdk/education/arm-education/src/api/joinRequests/operations.ts @@ -0,0 +1,258 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { EducationManagementContext as Client } from "../index.js"; +import { + errorResponseBodyDeserializer, + JoinRequestDetails, + joinRequestDetailsDeserializer, + _JoinRequestList, + _joinRequestListDeserializer, +} from "../../models/models.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import { + JoinRequestsDenyOptionalParams, + JoinRequestsApproveOptionalParams, + JoinRequestsListOptionalParams, + JoinRequestsGetOptionalParams, +} from "./options.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; + +export function _denySend( + context: Client, + billingAccountName: string, + billingProfileName: string, + invoiceSectionName: string, + joinRequestName: string, + options: JoinRequestsDenyOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Education/labs/default/joinRequests/{joinRequestName}/deny{?api%2Dversion}", + { + billingAccountName: billingAccountName, + billingProfileName: billingProfileName, + invoiceSectionName: invoiceSectionName, + joinRequestName: joinRequestName, + "api%2Dversion": context.apiVersion ?? "2021-12-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _denyDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseBodyDeserializer(result.body); + + throw error; + } + + return; +} + +/** Deny student joining the redeemable lab */ +export async function deny( + context: Client, + billingAccountName: string, + billingProfileName: string, + invoiceSectionName: string, + joinRequestName: string, + options: JoinRequestsDenyOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _denySend( + context, + billingAccountName, + billingProfileName, + invoiceSectionName, + joinRequestName, + options, + ); + return _denyDeserialize(result); +} + +export function _approveSend( + context: Client, + billingAccountName: string, + billingProfileName: string, + invoiceSectionName: string, + joinRequestName: string, + options: JoinRequestsApproveOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Education/labs/default/joinRequests/{joinRequestName}/approve{?api%2Dversion}", + { + billingAccountName: billingAccountName, + billingProfileName: billingProfileName, + invoiceSectionName: invoiceSectionName, + joinRequestName: joinRequestName, + "api%2Dversion": context.apiVersion ?? "2021-12-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _approveDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseBodyDeserializer(result.body); + + throw error; + } + + return; +} + +/** Approve student joining the redeemable lab */ +export async function approve( + context: Client, + billingAccountName: string, + billingProfileName: string, + invoiceSectionName: string, + joinRequestName: string, + options: JoinRequestsApproveOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _approveSend( + context, + billingAccountName, + billingProfileName, + invoiceSectionName, + joinRequestName, + options, + ); + return _approveDeserialize(result); +} + +export function _listSend( + context: Client, + billingAccountName: string, + billingProfileName: string, + invoiceSectionName: string, + options: JoinRequestsListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Education/labs/default/joinRequests{?api%2Dversion,includeDenied}", + { + billingAccountName: billingAccountName, + billingProfileName: billingProfileName, + invoiceSectionName: invoiceSectionName, + "api%2Dversion": context.apiVersion ?? "2021-12-01-preview", + includeDenied: options?.includeDenied, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listDeserialize(result: PathUncheckedResponse): Promise<_JoinRequestList> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseBodyDeserializer(result.body); + + throw error; + } + + return _joinRequestListDeserializer(result.body); +} + +/** get student join requests */ +export function list( + context: Client, + billingAccountName: string, + billingProfileName: string, + invoiceSectionName: string, + options: JoinRequestsListOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listSend(context, billingAccountName, billingProfileName, invoiceSectionName, options), + _listDeserialize, + ["200"], + { + itemName: "value", + nextLinkName: "nextLink", + apiVersion: context.apiVersion ?? "2021-12-01-preview", + }, + ); +} + +export function _getSend( + context: Client, + billingAccountName: string, + billingProfileName: string, + invoiceSectionName: string, + joinRequestName: string, + options: JoinRequestsGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Education/labs/default/joinRequests/{joinRequestName}{?api%2Dversion}", + { + billingAccountName: billingAccountName, + billingProfileName: billingProfileName, + invoiceSectionName: invoiceSectionName, + joinRequestName: joinRequestName, + "api%2Dversion": context.apiVersion ?? "2021-12-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _getDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseBodyDeserializer(result.body); + + throw error; + } + + return joinRequestDetailsDeserializer(result.body); +} + +/** get student join requests */ +export async function get( + context: Client, + billingAccountName: string, + billingProfileName: string, + invoiceSectionName: string, + joinRequestName: string, + options: JoinRequestsGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend( + context, + billingAccountName, + billingProfileName, + invoiceSectionName, + joinRequestName, + options, + ); + return _getDeserialize(result); +} diff --git a/sdk/education/arm-education/src/api/joinRequests/options.ts b/sdk/education/arm-education/src/api/joinRequests/options.ts new file mode 100644 index 000000000000..a73c11d2c0a1 --- /dev/null +++ b/sdk/education/arm-education/src/api/joinRequests/options.ts @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface JoinRequestsDenyOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface JoinRequestsApproveOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface JoinRequestsListOptionalParams extends OperationOptions { + /** Include denied */ + includeDenied?: boolean; +} + +/** Optional parameters. */ +export interface JoinRequestsGetOptionalParams extends OperationOptions {} diff --git a/sdk/education/arm-education/src/api/labs/index.ts b/sdk/education/arm-education/src/api/labs/index.ts new file mode 100644 index 000000000000..0799bf387034 --- /dev/null +++ b/sdk/education/arm-education/src/api/labs/index.ts @@ -0,0 +1,12 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { generateInviteCode, listAll, list, $delete, createOrUpdate, get } from "./operations.js"; +export type { + LabsGenerateInviteCodeOptionalParams, + LabsListAllOptionalParams, + LabsListOptionalParams, + LabsDeleteOptionalParams, + LabsCreateOrUpdateOptionalParams, + LabsGetOptionalParams, +} from "./options.js"; diff --git a/sdk/education/arm-education/src/api/labs/operations.ts b/sdk/education/arm-education/src/api/labs/operations.ts new file mode 100644 index 000000000000..e9743a60374e --- /dev/null +++ b/sdk/education/arm-education/src/api/labs/operations.ts @@ -0,0 +1,382 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { EducationManagementContext as Client } from "../index.js"; +import { + errorResponseBodyDeserializer, + LabDetails, + labDetailsSerializer, + labDetailsDeserializer, + _LabListResult, + _labListResultDeserializer, + InviteCodeGenerateRequest, + inviteCodeGenerateRequestSerializer, +} from "../../models/models.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import { + LabsGenerateInviteCodeOptionalParams, + LabsListAllOptionalParams, + LabsListOptionalParams, + LabsDeleteOptionalParams, + LabsCreateOrUpdateOptionalParams, + LabsGetOptionalParams, +} from "./options.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; + +export function _generateInviteCodeSend( + context: Client, + billingAccountName: string, + billingProfileName: string, + invoiceSectionName: string, + parameters: InviteCodeGenerateRequest, + options: LabsGenerateInviteCodeOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Education/labs/default/generateInviteCode{?api%2Dversion,onlyUpdateStudentCountParameter}", + { + billingAccountName: billingAccountName, + billingProfileName: billingProfileName, + invoiceSectionName: invoiceSectionName, + "api%2Dversion": context.apiVersion ?? "2021-12-01-preview", + onlyUpdateStudentCountParameter: options?.onlyUpdateStudentCountParameter, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { accept: "application/json", ...options.requestOptions?.headers }, + body: inviteCodeGenerateRequestSerializer(parameters), + }); +} + +export async function _generateInviteCodeDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseBodyDeserializer(result.body); + + throw error; + } + + return labDetailsDeserializer(result.body); +} + +/** Generate invite code for a lab */ +export async function generateInviteCode( + context: Client, + billingAccountName: string, + billingProfileName: string, + invoiceSectionName: string, + parameters: InviteCodeGenerateRequest, + options: LabsGenerateInviteCodeOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _generateInviteCodeSend( + context, + billingAccountName, + billingProfileName, + invoiceSectionName, + parameters, + options, + ); + return _generateInviteCodeDeserialize(result); +} + +export function _listAllSend( + context: Client, + billingAccountName: string, + billingProfileName: string, + options: LabsListAllOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.Education/labs{?api%2Dversion,includeBudget,includeDeleted}", + { + billingAccountName: billingAccountName, + billingProfileName: billingProfileName, + "api%2Dversion": context.apiVersion ?? "2021-12-01-preview", + includeBudget: options?.includeBudget, + includeDeleted: options?.includeDeleted, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listAllDeserialize(result: PathUncheckedResponse): Promise<_LabListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseBodyDeserializer(result.body); + + throw error; + } + + return _labListResultDeserializer(result.body); +} + +/** Get a list of labs associated with the provided billing account name and billing profile name. */ +export function listAll( + context: Client, + billingAccountName: string, + billingProfileName: string, + options: LabsListAllOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listAllSend(context, billingAccountName, billingProfileName, options), + _listAllDeserialize, + ["200"], + { + itemName: "value", + nextLinkName: "nextLink", + apiVersion: context.apiVersion ?? "2021-12-01-preview", + }, + ); +} + +export function _listSend( + context: Client, + billingAccountName: string, + billingProfileName: string, + invoiceSectionName: string, + options: LabsListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Education/labs{?api%2Dversion,includeBudget}", + { + billingAccountName: billingAccountName, + billingProfileName: billingProfileName, + invoiceSectionName: invoiceSectionName, + "api%2Dversion": context.apiVersion ?? "2021-12-01-preview", + includeBudget: options?.includeBudget, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listDeserialize(result: PathUncheckedResponse): Promise<_LabListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseBodyDeserializer(result.body); + + throw error; + } + + return _labListResultDeserializer(result.body); +} + +/** Get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. */ +export function list( + context: Client, + billingAccountName: string, + billingProfileName: string, + invoiceSectionName: string, + options: LabsListOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listSend(context, billingAccountName, billingProfileName, invoiceSectionName, options), + _listDeserialize, + ["200"], + { + itemName: "value", + nextLinkName: "nextLink", + apiVersion: context.apiVersion ?? "2021-12-01-preview", + }, + ); +} + +export function _$deleteSend( + context: Client, + billingAccountName: string, + billingProfileName: string, + invoiceSectionName: string, + options: LabsDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Education/labs/default{?api%2Dversion}", + { + billingAccountName: billingAccountName, + billingProfileName: billingProfileName, + invoiceSectionName: invoiceSectionName, + "api%2Dversion": context.apiVersion ?? "2021-12-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).delete({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _$deleteDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200", "204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseBodyDeserializer(result.body); + + throw error; + } + + return; +} + +/** Delete a specific lab associated with the provided billing account name, billing profile name, and invoice section name. Note all students must be removed from the lab in order to delete the lab. */ +export async function $delete( + context: Client, + billingAccountName: string, + billingProfileName: string, + invoiceSectionName: string, + options: LabsDeleteOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _$deleteSend( + context, + billingAccountName, + billingProfileName, + invoiceSectionName, + options, + ); + return _$deleteDeserialize(result); +} + +export function _createOrUpdateSend( + context: Client, + billingAccountName: string, + billingProfileName: string, + invoiceSectionName: string, + parameters: LabDetails, + options: LabsCreateOrUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Education/labs/default{?api%2Dversion}", + { + billingAccountName: billingAccountName, + billingProfileName: billingProfileName, + invoiceSectionName: invoiceSectionName, + "api%2Dversion": context.apiVersion ?? "2021-12-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { accept: "application/json", ...options.requestOptions?.headers }, + body: labDetailsSerializer(parameters), + }); +} + +export async function _createOrUpdateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseBodyDeserializer(result.body); + + throw error; + } + + return labDetailsDeserializer(result.body); +} + +/** Create a new lab or update a previously created lab. */ +export async function createOrUpdate( + context: Client, + billingAccountName: string, + billingProfileName: string, + invoiceSectionName: string, + parameters: LabDetails, + options: LabsCreateOrUpdateOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _createOrUpdateSend( + context, + billingAccountName, + billingProfileName, + invoiceSectionName, + parameters, + options, + ); + return _createOrUpdateDeserialize(result); +} + +export function _getSend( + context: Client, + billingAccountName: string, + billingProfileName: string, + invoiceSectionName: string, + options: LabsGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Education/labs/default{?api%2Dversion,includeBudget}", + { + billingAccountName: billingAccountName, + billingProfileName: billingProfileName, + invoiceSectionName: invoiceSectionName, + "api%2Dversion": context.apiVersion ?? "2021-12-01-preview", + includeBudget: options?.includeBudget, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _getDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseBodyDeserializer(result.body); + + throw error; + } + + return labDetailsDeserializer(result.body); +} + +/** Get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. */ +export async function get( + context: Client, + billingAccountName: string, + billingProfileName: string, + invoiceSectionName: string, + options: LabsGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend( + context, + billingAccountName, + billingProfileName, + invoiceSectionName, + options, + ); + return _getDeserialize(result); +} diff --git a/sdk/education/arm-education/src/api/labs/options.ts b/sdk/education/arm-education/src/api/labs/options.ts new file mode 100644 index 000000000000..82e9c8a9e156 --- /dev/null +++ b/sdk/education/arm-education/src/api/labs/options.ts @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface LabsGenerateInviteCodeOptionalParams extends OperationOptions { + /** set this flag to true if you want to update student count without generating a new invite code */ + onlyUpdateStudentCountParameter?: boolean; +} + +/** Optional parameters. */ +export interface LabsListAllOptionalParams extends OperationOptions { + /** May be used to include budget information. */ + includeBudget?: boolean; + /** May be used to show deleted items. */ + includeDeleted?: boolean; +} + +/** Optional parameters. */ +export interface LabsListOptionalParams extends OperationOptions { + /** May be used to include budget information. */ + includeBudget?: boolean; +} + +/** Optional parameters. */ +export interface LabsDeleteOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface LabsCreateOrUpdateOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface LabsGetOptionalParams extends OperationOptions { + /** May be used to include budget information. */ + includeBudget?: boolean; +} diff --git a/sdk/education/arm-education/src/api/operations.ts b/sdk/education/arm-education/src/api/operations.ts new file mode 100644 index 000000000000..9761aa272782 --- /dev/null +++ b/sdk/education/arm-education/src/api/operations.ts @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { EducationManagementContext as Client } from "./index.js"; +import { + RedeemRequest, + redeemRequestSerializer, + errorResponseBodyDeserializer, +} from "../models/models.js"; +import { expandUrlTemplate } from "../static-helpers/urlTemplate.js"; +import { RedeemInvitationCodeOptionalParams } from "./options.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; + +export function _redeemInvitationCodeSend( + context: Client, + parameters: RedeemRequest, + options: RedeemInvitationCodeOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/Microsoft.Education/redeemInvitationCode{?api%2Dversion}", + { + "api%2Dversion": context.apiVersion ?? "2021-12-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + body: redeemRequestSerializer(parameters), + }); +} + +export async function _redeemInvitationCodeDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseBodyDeserializer(result.body); + + throw error; + } + + return; +} + +/** Redeem invite code to join a redeemable lab */ +export async function redeemInvitationCode( + context: Client, + parameters: RedeemRequest, + options: RedeemInvitationCodeOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _redeemInvitationCodeSend(context, parameters, options); + return _redeemInvitationCodeDeserialize(result); +} diff --git a/sdk/education/arm-education/src/api/operations/index.ts b/sdk/education/arm-education/src/api/operations/index.ts new file mode 100644 index 000000000000..de883c05d2f1 --- /dev/null +++ b/sdk/education/arm-education/src/api/operations/index.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { list } from "./operations.js"; +export type { OperationsListOptionalParams } from "./options.js"; diff --git a/sdk/education/arm-education/src/api/operations/operations.ts b/sdk/education/arm-education/src/api/operations/operations.ts new file mode 100644 index 000000000000..d1b12dfcbd09 --- /dev/null +++ b/sdk/education/arm-education/src/api/operations/operations.ts @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { EducationManagementContext as Client } from "../index.js"; +import { + errorResponseBodyDeserializer, + OperationListResult, + operationListResultDeserializer, +} from "../../models/models.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import { OperationsListOptionalParams } from "./options.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; + +export function _listSend( + context: Client, + options: OperationsListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/Microsoft.Education/operations{?api%2Dversion}", + { + "api%2Dversion": context.apiVersion ?? "2021-12-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseBodyDeserializer(result.body); + + throw error; + } + + return operationListResultDeserializer(result.body); +} + +/** Lists all of the available Microsoft.Education API operations. */ +export async function list( + context: Client, + options: OperationsListOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _listSend(context, options); + return _listDeserialize(result); +} diff --git a/sdk/education/arm-education/src/api/operations/options.ts b/sdk/education/arm-education/src/api/operations/options.ts new file mode 100644 index 000000000000..c461016ad1c5 --- /dev/null +++ b/sdk/education/arm-education/src/api/operations/options.ts @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface OperationsListOptionalParams extends OperationOptions {} diff --git a/sdk/education/arm-education/src/api/options.ts b/sdk/education/arm-education/src/api/options.ts new file mode 100644 index 000000000000..6e971f08ce90 --- /dev/null +++ b/sdk/education/arm-education/src/api/options.ts @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface RedeemInvitationCodeOptionalParams extends OperationOptions {} diff --git a/sdk/education/arm-education/src/api/studentLabs/index.ts b/sdk/education/arm-education/src/api/studentLabs/index.ts new file mode 100644 index 000000000000..53b26e2f0794 --- /dev/null +++ b/sdk/education/arm-education/src/api/studentLabs/index.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { listAll, get } from "./operations.js"; +export type { StudentLabsListAllOptionalParams, StudentLabsGetOptionalParams } from "./options.js"; diff --git a/sdk/education/arm-education/src/api/studentLabs/operations.ts b/sdk/education/arm-education/src/api/studentLabs/operations.ts new file mode 100644 index 000000000000..de2e969e33a3 --- /dev/null +++ b/sdk/education/arm-education/src/api/studentLabs/operations.ts @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { EducationManagementContext as Client } from "../index.js"; +import { + errorResponseBodyDeserializer, + StudentLabDetails, + studentLabDetailsDeserializer, + _StudentLabListResult, + _studentLabListResultDeserializer, +} from "../../models/models.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import { StudentLabsListAllOptionalParams, StudentLabsGetOptionalParams } from "./options.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; + +export function _listAllSend( + context: Client, + options: StudentLabsListAllOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/Microsoft.Education/studentLabs{?api%2Dversion}", + { + "api%2Dversion": context.apiVersion ?? "2021-12-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listAllDeserialize( + result: PathUncheckedResponse, +): Promise<_StudentLabListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseBodyDeserializer(result.body); + + throw error; + } + + return _studentLabListResultDeserializer(result.body); +} + +/** Get a list of all labs associated with the caller of the API. */ +export function listAll( + context: Client, + options: StudentLabsListAllOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listAllSend(context, options), + _listAllDeserialize, + ["200"], + { + itemName: "value", + nextLinkName: "nextLink", + apiVersion: context.apiVersion ?? "2021-12-01-preview", + }, + ); +} + +export function _getSend( + context: Client, + studentLabName: string, + options: StudentLabsGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/Microsoft.Education/studentLabs/{studentLabName}{?api%2Dversion}", + { + studentLabName: studentLabName, + "api%2Dversion": context.apiVersion ?? "2021-12-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _getDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseBodyDeserializer(result.body); + + throw error; + } + + return studentLabDetailsDeserializer(result.body); +} + +/** Get the details for a specified lab associated with the student lab. */ +export async function get( + context: Client, + studentLabName: string, + options: StudentLabsGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend(context, studentLabName, options); + return _getDeserialize(result); +} diff --git a/sdk/education/arm-education/src/api/studentLabs/options.ts b/sdk/education/arm-education/src/api/studentLabs/options.ts new file mode 100644 index 000000000000..02557a2901f0 --- /dev/null +++ b/sdk/education/arm-education/src/api/studentLabs/options.ts @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface StudentLabsListAllOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface StudentLabsGetOptionalParams extends OperationOptions {} diff --git a/sdk/education/arm-education/src/api/students/index.ts b/sdk/education/arm-education/src/api/students/index.ts new file mode 100644 index 000000000000..16bcb344f88c --- /dev/null +++ b/sdk/education/arm-education/src/api/students/index.ts @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { list, $delete, createOrUpdate, get } from "./operations.js"; +export type { + StudentsListOptionalParams, + StudentsDeleteOptionalParams, + StudentsCreateOrUpdateOptionalParams, + StudentsGetOptionalParams, +} from "./options.js"; diff --git a/sdk/education/arm-education/src/api/students/operations.ts b/sdk/education/arm-education/src/api/students/operations.ts new file mode 100644 index 000000000000..5d1ee257ffd3 --- /dev/null +++ b/sdk/education/arm-education/src/api/students/operations.ts @@ -0,0 +1,269 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { EducationManagementContext as Client } from "../index.js"; +import { + errorResponseBodyDeserializer, + StudentDetails, + studentDetailsSerializer, + studentDetailsDeserializer, + _StudentListResult, + _studentListResultDeserializer, +} from "../../models/models.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import { + StudentsListOptionalParams, + StudentsDeleteOptionalParams, + StudentsCreateOrUpdateOptionalParams, + StudentsGetOptionalParams, +} from "./options.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; + +export function _listSend( + context: Client, + billingAccountName: string, + billingProfileName: string, + invoiceSectionName: string, + options: StudentsListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Education/labs/default/students{?api%2Dversion,includeDeleted}", + { + billingAccountName: billingAccountName, + billingProfileName: billingProfileName, + invoiceSectionName: invoiceSectionName, + "api%2Dversion": context.apiVersion ?? "2021-12-01-preview", + includeDeleted: options?.includeDeleted, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listDeserialize(result: PathUncheckedResponse): Promise<_StudentListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseBodyDeserializer(result.body); + + throw error; + } + + return _studentListResultDeserializer(result.body); +} + +/** Get a list of details about students that are associated with the specified lab. */ +export function list( + context: Client, + billingAccountName: string, + billingProfileName: string, + invoiceSectionName: string, + options: StudentsListOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listSend(context, billingAccountName, billingProfileName, invoiceSectionName, options), + _listDeserialize, + ["200"], + { + itemName: "value", + nextLinkName: "nextLink", + apiVersion: context.apiVersion ?? "2021-12-01-preview", + }, + ); +} + +export function _$deleteSend( + context: Client, + billingAccountName: string, + billingProfileName: string, + invoiceSectionName: string, + studentAlias: string, + options: StudentsDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Education/labs/default/students/{studentAlias}{?api%2Dversion}", + { + billingAccountName: billingAccountName, + billingProfileName: billingProfileName, + invoiceSectionName: invoiceSectionName, + studentAlias: studentAlias, + "api%2Dversion": context.apiVersion ?? "2021-12-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).delete({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _$deleteDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200", "204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseBodyDeserializer(result.body); + + throw error; + } + + return; +} + +/** Delete the specified student based on the student alias. */ +export async function $delete( + context: Client, + billingAccountName: string, + billingProfileName: string, + invoiceSectionName: string, + studentAlias: string, + options: StudentsDeleteOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _$deleteSend( + context, + billingAccountName, + billingProfileName, + invoiceSectionName, + studentAlias, + options, + ); + return _$deleteDeserialize(result); +} + +export function _createOrUpdateSend( + context: Client, + billingAccountName: string, + billingProfileName: string, + invoiceSectionName: string, + studentAlias: string, + parameters: StudentDetails, + options: StudentsCreateOrUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Education/labs/default/students/{studentAlias}{?api%2Dversion}", + { + billingAccountName: billingAccountName, + billingProfileName: billingProfileName, + invoiceSectionName: invoiceSectionName, + studentAlias: studentAlias, + "api%2Dversion": context.apiVersion ?? "2021-12-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { accept: "application/json", ...options.requestOptions?.headers }, + body: studentDetailsSerializer(parameters), + }); +} + +export async function _createOrUpdateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseBodyDeserializer(result.body); + + throw error; + } + + return studentDetailsDeserializer(result.body); +} + +/** Create and add a new student to the specified lab or update the details of an existing student in a lab. Note the student must have a valid tenant to accept the lab after they have been added to lab. */ +export async function createOrUpdate( + context: Client, + billingAccountName: string, + billingProfileName: string, + invoiceSectionName: string, + studentAlias: string, + parameters: StudentDetails, + options: StudentsCreateOrUpdateOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _createOrUpdateSend( + context, + billingAccountName, + billingProfileName, + invoiceSectionName, + studentAlias, + parameters, + options, + ); + return _createOrUpdateDeserialize(result); +} + +export function _getSend( + context: Client, + billingAccountName: string, + billingProfileName: string, + invoiceSectionName: string, + studentAlias: string, + options: StudentsGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Education/labs/default/students/{studentAlias}{?api%2Dversion}", + { + billingAccountName: billingAccountName, + billingProfileName: billingProfileName, + invoiceSectionName: invoiceSectionName, + studentAlias: studentAlias, + "api%2Dversion": context.apiVersion ?? "2021-12-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _getDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseBodyDeserializer(result.body); + + throw error; + } + + return studentDetailsDeserializer(result.body); +} + +/** Get the details for a specific student in the specified lab by student alias */ +export async function get( + context: Client, + billingAccountName: string, + billingProfileName: string, + invoiceSectionName: string, + studentAlias: string, + options: StudentsGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend( + context, + billingAccountName, + billingProfileName, + invoiceSectionName, + studentAlias, + options, + ); + return _getDeserialize(result); +} diff --git a/sdk/education/arm-education/src/api/students/options.ts b/sdk/education/arm-education/src/api/students/options.ts new file mode 100644 index 000000000000..d1b93d64933a --- /dev/null +++ b/sdk/education/arm-education/src/api/students/options.ts @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface StudentsListOptionalParams extends OperationOptions { + /** May be used to show deleted items. */ + includeDeleted?: boolean; +} + +/** Optional parameters. */ +export interface StudentsDeleteOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface StudentsCreateOrUpdateOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface StudentsGetOptionalParams extends OperationOptions {} diff --git a/sdk/education/arm-education/src/classic/grants/index.ts b/sdk/education/arm-education/src/classic/grants/index.ts new file mode 100644 index 000000000000..cbddb777b8a9 --- /dev/null +++ b/sdk/education/arm-education/src/classic/grants/index.ts @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { EducationManagementContext } from "../../api/educationManagementContext.js"; +import { listAll, list, get } from "../../api/grants/operations.js"; +import { + GrantsListAllOptionalParams, + GrantsListOptionalParams, + GrantsGetOptionalParams, +} from "../../api/grants/options.js"; +import { GrantDetails } from "../../models/models.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; + +/** Interface representing a Grants operations. */ +export interface GrantsOperations { + /** Get a list of grants that Microsoft has provided. */ + listAll: (options?: GrantsListAllOptionalParams) => PagedAsyncIterableIterator; + /** Get details for a specific grant linked to the provided billing account and billing profile. */ + list: ( + billingAccountName: string, + billingProfileName: string, + options?: GrantsListOptionalParams, + ) => PagedAsyncIterableIterator; + /** Get details for a specific grant linked to the provided billing account and billing profile. */ + get: ( + billingAccountName: string, + billingProfileName: string, + options?: GrantsGetOptionalParams, + ) => Promise; +} + +function _getGrants(context: EducationManagementContext) { + return { + listAll: (options?: GrantsListAllOptionalParams) => listAll(context, options), + list: ( + billingAccountName: string, + billingProfileName: string, + options?: GrantsListOptionalParams, + ) => list(context, billingAccountName, billingProfileName, options), + get: ( + billingAccountName: string, + billingProfileName: string, + options?: GrantsGetOptionalParams, + ) => get(context, billingAccountName, billingProfileName, options), + }; +} + +export function _getGrantsOperations(context: EducationManagementContext): GrantsOperations { + return { + ..._getGrants(context), + }; +} diff --git a/sdk/education/arm-education/src/classic/index.ts b/sdk/education/arm-education/src/classic/index.ts new file mode 100644 index 000000000000..b16e5057302e --- /dev/null +++ b/sdk/education/arm-education/src/classic/index.ts @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export type { GrantsOperations } from "./grants/index.js"; +export type { JoinRequestsOperations } from "./joinRequests/index.js"; +export type { LabsOperations } from "./labs/index.js"; +export type { OperationsOperations } from "./operations/index.js"; +export type { StudentLabsOperations } from "./studentLabs/index.js"; +export type { StudentsOperations } from "./students/index.js"; diff --git a/sdk/education/arm-education/src/classic/joinRequests/index.ts b/sdk/education/arm-education/src/classic/joinRequests/index.ts new file mode 100644 index 000000000000..c837aabbb52c --- /dev/null +++ b/sdk/education/arm-education/src/classic/joinRequests/index.ts @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { EducationManagementContext } from "../../api/educationManagementContext.js"; +import { deny, approve, list, get } from "../../api/joinRequests/operations.js"; +import { + JoinRequestsDenyOptionalParams, + JoinRequestsApproveOptionalParams, + JoinRequestsListOptionalParams, + JoinRequestsGetOptionalParams, +} from "../../api/joinRequests/options.js"; +import { JoinRequestDetails } from "../../models/models.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; + +/** Interface representing a JoinRequests operations. */ +export interface JoinRequestsOperations { + /** Deny student joining the redeemable lab */ + deny: ( + billingAccountName: string, + billingProfileName: string, + invoiceSectionName: string, + joinRequestName: string, + options?: JoinRequestsDenyOptionalParams, + ) => Promise; + /** Approve student joining the redeemable lab */ + approve: ( + billingAccountName: string, + billingProfileName: string, + invoiceSectionName: string, + joinRequestName: string, + options?: JoinRequestsApproveOptionalParams, + ) => Promise; + /** get student join requests */ + list: ( + billingAccountName: string, + billingProfileName: string, + invoiceSectionName: string, + options?: JoinRequestsListOptionalParams, + ) => PagedAsyncIterableIterator; + /** get student join requests */ + get: ( + billingAccountName: string, + billingProfileName: string, + invoiceSectionName: string, + joinRequestName: string, + options?: JoinRequestsGetOptionalParams, + ) => Promise; +} + +function _getJoinRequests(context: EducationManagementContext) { + return { + deny: ( + billingAccountName: string, + billingProfileName: string, + invoiceSectionName: string, + joinRequestName: string, + options?: JoinRequestsDenyOptionalParams, + ) => + deny( + context, + billingAccountName, + billingProfileName, + invoiceSectionName, + joinRequestName, + options, + ), + approve: ( + billingAccountName: string, + billingProfileName: string, + invoiceSectionName: string, + joinRequestName: string, + options?: JoinRequestsApproveOptionalParams, + ) => + approve( + context, + billingAccountName, + billingProfileName, + invoiceSectionName, + joinRequestName, + options, + ), + list: ( + billingAccountName: string, + billingProfileName: string, + invoiceSectionName: string, + options?: JoinRequestsListOptionalParams, + ) => list(context, billingAccountName, billingProfileName, invoiceSectionName, options), + get: ( + billingAccountName: string, + billingProfileName: string, + invoiceSectionName: string, + joinRequestName: string, + options?: JoinRequestsGetOptionalParams, + ) => + get( + context, + billingAccountName, + billingProfileName, + invoiceSectionName, + joinRequestName, + options, + ), + }; +} + +export function _getJoinRequestsOperations( + context: EducationManagementContext, +): JoinRequestsOperations { + return { + ..._getJoinRequests(context), + }; +} diff --git a/sdk/education/arm-education/src/classic/labs/index.ts b/sdk/education/arm-education/src/classic/labs/index.ts new file mode 100644 index 000000000000..52ac4526fd82 --- /dev/null +++ b/sdk/education/arm-education/src/classic/labs/index.ts @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { EducationManagementContext } from "../../api/educationManagementContext.js"; +import { + generateInviteCode, + listAll, + list, + $delete, + createOrUpdate, + get, +} from "../../api/labs/operations.js"; +import { + LabsGenerateInviteCodeOptionalParams, + LabsListAllOptionalParams, + LabsListOptionalParams, + LabsDeleteOptionalParams, + LabsCreateOrUpdateOptionalParams, + LabsGetOptionalParams, +} from "../../api/labs/options.js"; +import { LabDetails, InviteCodeGenerateRequest } from "../../models/models.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; + +/** Interface representing a Labs operations. */ +export interface LabsOperations { + /** Generate invite code for a lab */ + generateInviteCode: ( + billingAccountName: string, + billingProfileName: string, + invoiceSectionName: string, + parameters: InviteCodeGenerateRequest, + options?: LabsGenerateInviteCodeOptionalParams, + ) => Promise; + /** Get a list of labs associated with the provided billing account name and billing profile name. */ + listAll: ( + billingAccountName: string, + billingProfileName: string, + options?: LabsListAllOptionalParams, + ) => PagedAsyncIterableIterator; + /** Get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. */ + list: ( + billingAccountName: string, + billingProfileName: string, + invoiceSectionName: string, + options?: LabsListOptionalParams, + ) => PagedAsyncIterableIterator; + /** Delete a specific lab associated with the provided billing account name, billing profile name, and invoice section name. Note all students must be removed from the lab in order to delete the lab. */ + delete: ( + billingAccountName: string, + billingProfileName: string, + invoiceSectionName: string, + options?: LabsDeleteOptionalParams, + ) => Promise; + /** Create a new lab or update a previously created lab. */ + createOrUpdate: ( + billingAccountName: string, + billingProfileName: string, + invoiceSectionName: string, + parameters: LabDetails, + options?: LabsCreateOrUpdateOptionalParams, + ) => Promise; + /** Get the details for a specific lab associated with the provided billing account name, billing profile name, and invoice section name. */ + get: ( + billingAccountName: string, + billingProfileName: string, + invoiceSectionName: string, + options?: LabsGetOptionalParams, + ) => Promise; +} + +function _getLabs(context: EducationManagementContext) { + return { + generateInviteCode: ( + billingAccountName: string, + billingProfileName: string, + invoiceSectionName: string, + parameters: InviteCodeGenerateRequest, + options?: LabsGenerateInviteCodeOptionalParams, + ) => + generateInviteCode( + context, + billingAccountName, + billingProfileName, + invoiceSectionName, + parameters, + options, + ), + listAll: ( + billingAccountName: string, + billingProfileName: string, + options?: LabsListAllOptionalParams, + ) => listAll(context, billingAccountName, billingProfileName, options), + list: ( + billingAccountName: string, + billingProfileName: string, + invoiceSectionName: string, + options?: LabsListOptionalParams, + ) => list(context, billingAccountName, billingProfileName, invoiceSectionName, options), + delete: ( + billingAccountName: string, + billingProfileName: string, + invoiceSectionName: string, + options?: LabsDeleteOptionalParams, + ) => $delete(context, billingAccountName, billingProfileName, invoiceSectionName, options), + createOrUpdate: ( + billingAccountName: string, + billingProfileName: string, + invoiceSectionName: string, + parameters: LabDetails, + options?: LabsCreateOrUpdateOptionalParams, + ) => + createOrUpdate( + context, + billingAccountName, + billingProfileName, + invoiceSectionName, + parameters, + options, + ), + get: ( + billingAccountName: string, + billingProfileName: string, + invoiceSectionName: string, + options?: LabsGetOptionalParams, + ) => get(context, billingAccountName, billingProfileName, invoiceSectionName, options), + }; +} + +export function _getLabsOperations(context: EducationManagementContext): LabsOperations { + return { + ..._getLabs(context), + }; +} diff --git a/sdk/education/arm-education/src/classic/operations/index.ts b/sdk/education/arm-education/src/classic/operations/index.ts new file mode 100644 index 000000000000..2de42e48d26f --- /dev/null +++ b/sdk/education/arm-education/src/classic/operations/index.ts @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { EducationManagementContext } from "../../api/educationManagementContext.js"; +import { list } from "../../api/operations/operations.js"; +import { OperationsListOptionalParams } from "../../api/operations/options.js"; +import { OperationListResult } from "../../models/models.js"; + +/** Interface representing a Operations operations. */ +export interface OperationsOperations { + /** Lists all of the available Microsoft.Education API operations. */ + list: (options?: OperationsListOptionalParams) => Promise; +} + +function _getOperations(context: EducationManagementContext) { + return { + list: (options?: OperationsListOptionalParams) => list(context, options), + }; +} + +export function _getOperationsOperations( + context: EducationManagementContext, +): OperationsOperations { + return { + ..._getOperations(context), + }; +} diff --git a/sdk/education/arm-education/src/classic/studentLabs/index.ts b/sdk/education/arm-education/src/classic/studentLabs/index.ts new file mode 100644 index 000000000000..75625834d1d2 --- /dev/null +++ b/sdk/education/arm-education/src/classic/studentLabs/index.ts @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { EducationManagementContext } from "../../api/educationManagementContext.js"; +import { listAll, get } from "../../api/studentLabs/operations.js"; +import { + StudentLabsListAllOptionalParams, + StudentLabsGetOptionalParams, +} from "../../api/studentLabs/options.js"; +import { StudentLabDetails } from "../../models/models.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; + +/** Interface representing a StudentLabs operations. */ +export interface StudentLabsOperations { + /** Get a list of all labs associated with the caller of the API. */ + listAll: ( + options?: StudentLabsListAllOptionalParams, + ) => PagedAsyncIterableIterator; + /** Get the details for a specified lab associated with the student lab. */ + get: ( + studentLabName: string, + options?: StudentLabsGetOptionalParams, + ) => Promise; +} + +function _getStudentLabs(context: EducationManagementContext) { + return { + listAll: (options?: StudentLabsListAllOptionalParams) => listAll(context, options), + get: (studentLabName: string, options?: StudentLabsGetOptionalParams) => + get(context, studentLabName, options), + }; +} + +export function _getStudentLabsOperations( + context: EducationManagementContext, +): StudentLabsOperations { + return { + ..._getStudentLabs(context), + }; +} diff --git a/sdk/education/arm-education/src/classic/students/index.ts b/sdk/education/arm-education/src/classic/students/index.ts new file mode 100644 index 000000000000..09846ef92f1d --- /dev/null +++ b/sdk/education/arm-education/src/classic/students/index.ts @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { EducationManagementContext } from "../../api/educationManagementContext.js"; +import { list, $delete, createOrUpdate, get } from "../../api/students/operations.js"; +import { + StudentsListOptionalParams, + StudentsDeleteOptionalParams, + StudentsCreateOrUpdateOptionalParams, + StudentsGetOptionalParams, +} from "../../api/students/options.js"; +import { StudentDetails } from "../../models/models.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; + +/** Interface representing a Students operations. */ +export interface StudentsOperations { + /** Get a list of details about students that are associated with the specified lab. */ + list: ( + billingAccountName: string, + billingProfileName: string, + invoiceSectionName: string, + options?: StudentsListOptionalParams, + ) => PagedAsyncIterableIterator; + /** Delete the specified student based on the student alias. */ + delete: ( + billingAccountName: string, + billingProfileName: string, + invoiceSectionName: string, + studentAlias: string, + options?: StudentsDeleteOptionalParams, + ) => Promise; + /** Create and add a new student to the specified lab or update the details of an existing student in a lab. Note the student must have a valid tenant to accept the lab after they have been added to lab. */ + createOrUpdate: ( + billingAccountName: string, + billingProfileName: string, + invoiceSectionName: string, + studentAlias: string, + parameters: StudentDetails, + options?: StudentsCreateOrUpdateOptionalParams, + ) => Promise; + /** Get the details for a specific student in the specified lab by student alias */ + get: ( + billingAccountName: string, + billingProfileName: string, + invoiceSectionName: string, + studentAlias: string, + options?: StudentsGetOptionalParams, + ) => Promise; +} + +function _getStudents(context: EducationManagementContext) { + return { + list: ( + billingAccountName: string, + billingProfileName: string, + invoiceSectionName: string, + options?: StudentsListOptionalParams, + ) => list(context, billingAccountName, billingProfileName, invoiceSectionName, options), + delete: ( + billingAccountName: string, + billingProfileName: string, + invoiceSectionName: string, + studentAlias: string, + options?: StudentsDeleteOptionalParams, + ) => + $delete( + context, + billingAccountName, + billingProfileName, + invoiceSectionName, + studentAlias, + options, + ), + createOrUpdate: ( + billingAccountName: string, + billingProfileName: string, + invoiceSectionName: string, + studentAlias: string, + parameters: StudentDetails, + options?: StudentsCreateOrUpdateOptionalParams, + ) => + createOrUpdate( + context, + billingAccountName, + billingProfileName, + invoiceSectionName, + studentAlias, + parameters, + options, + ), + get: ( + billingAccountName: string, + billingProfileName: string, + invoiceSectionName: string, + studentAlias: string, + options?: StudentsGetOptionalParams, + ) => + get( + context, + billingAccountName, + billingProfileName, + invoiceSectionName, + studentAlias, + options, + ), + }; +} + +export function _getStudentsOperations(context: EducationManagementContext): StudentsOperations { + return { + ..._getStudents(context), + }; +} diff --git a/sdk/education/arm-education/src/educationManagementClient.ts b/sdk/education/arm-education/src/educationManagementClient.ts index e3194c9cb726..e952ce0ae509 100644 --- a/sdk/education/arm-education/src/educationManagementClient.ts +++ b/sdk/education/arm-education/src/educationManagementClient.ts @@ -1,196 +1,70 @@ -/* - * 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 * 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, - GrantsImpl, - LabsImpl, - JoinRequestsImpl, - StudentsImpl, - StudentLabsImpl -} from "./operations/index.js"; -import { - Operations, - Grants, - Labs, - JoinRequests, - Students, - StudentLabs -} from "./operationsInterfaces/index.js"; -import * as Parameters from "./models/parameters.js"; -import * as Mappers from "./models/mappers.js"; import { + EducationManagementContext, EducationManagementClientOptionalParams, - RedeemRequest, - RedeemInvitationCodeOptionalParams -} from "./models/index.js"; - -export class EducationManagementClient extends coreClient.ServiceClient { - $host: string; - apiVersion: string; - - /** - * Initializes a new instance of the EducationManagementClient class. - * @param credentials Subscription credentials which uniquely identify client subscription. - * @param options The parameter options - */ - constructor( - credentials: coreAuth.TokenCredential, - options?: EducationManagementClientOptionalParams - ) { - if (credentials === undefined) { - throw new Error("'credentials' cannot be null"); - } + createEducationManagement, +} from "./api/index.js"; +import { redeemInvitationCode } from "./api/operations.js"; +import { RedeemInvitationCodeOptionalParams } from "./api/options.js"; +import { GrantsOperations, _getGrantsOperations } from "./classic/grants/index.js"; +import { + JoinRequestsOperations, + _getJoinRequestsOperations, +} from "./classic/joinRequests/index.js"; +import { LabsOperations, _getLabsOperations } from "./classic/labs/index.js"; +import { OperationsOperations, _getOperationsOperations } from "./classic/operations/index.js"; +import { StudentLabsOperations, _getStudentLabsOperations } from "./classic/studentLabs/index.js"; +import { StudentsOperations, _getStudentsOperations } from "./classic/students/index.js"; +import { RedeemRequest } from "./models/models.js"; +import { TokenCredential } from "@azure/core-auth"; +import { Pipeline } from "@azure/core-rest-pipeline"; - // Initializing default values for options - if (!options) { - options = {}; - } - const defaults: EducationManagementClientOptionalParams = { - requestContentType: "application/json; charset=utf-8", - credential: credentials - }; +export type { EducationManagementClientOptionalParams } from "./api/educationManagementContext.js"; - const packageDetails = `azsdk-js-arm-education/1.0.0-beta.5`; - const userAgentPrefix = - options.userAgentOptions && options.userAgentOptions.userAgentPrefix - ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` - : `${packageDetails}`; +export class EducationManagementClient { + private _client: EducationManagementContext; + /** The pipeline used by this client to make requests */ + public readonly pipeline: Pipeline; - const optionsWithDefaults = { - ...defaults, + /** Education client provides access to education resources for Azure subscriptions. */ + constructor(credential: TokenCredential, options: EducationManagementClientOptionalParams = {}) { + const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; + const userAgentPrefix = prefixFromOptions + ? `${prefixFromOptions} azsdk-js-client` + : `azsdk-js-client`; + this._client = createEducationManagement(credential, { ...options, - userAgentOptions: { - userAgentPrefix - }, - endpoint: - options.endpoint ?? options.baseUri ?? "https://management.azure.com" - }; - super(optionsWithDefaults); - - let bearerTokenAuthenticationPolicyFound: boolean = false; - if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) { - const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies(); - bearerTokenAuthenticationPolicyFound = pipelinePolicies.some( - (pipelinePolicy) => - pipelinePolicy.name === - coreRestPipeline.bearerTokenAuthenticationPolicyName - ); - } - if ( - !options || - !options.pipeline || - options.pipeline.getOrderedPolicies().length == 0 || - !bearerTokenAuthenticationPolicyFound - ) { - this.pipeline.removePolicy({ - name: coreRestPipeline.bearerTokenAuthenticationPolicyName - }); - this.pipeline.addPolicy( - coreRestPipeline.bearerTokenAuthenticationPolicy({ - credential: credentials, - scopes: - optionsWithDefaults.credentialScopes ?? - `${optionsWithDefaults.endpoint}/.default`, - challengeCallbacks: { - authorizeRequestOnChallenge: - coreClient.authorizeRequestOnClaimChallenge - } - }) - ); - } - - // Assigning values to Constant parameters - this.$host = options.$host || "https://management.azure.com"; - this.apiVersion = options.apiVersion || "2021-12-01-preview"; - this.operations = new OperationsImpl(this); - this.grants = new GrantsImpl(this); - this.labs = new LabsImpl(this); - this.joinRequests = new JoinRequestsImpl(this); - this.students = new StudentsImpl(this); - this.studentLabs = new StudentLabsImpl(this); - this.addCustomApiVersionPolicy(options.apiVersion); + userAgentOptions: { userAgentPrefix }, + }); + this.pipeline = this._client.pipeline; + this.studentLabs = _getStudentLabsOperations(this._client); + this.students = _getStudentsOperations(this._client); + this.joinRequests = _getJoinRequestsOperations(this._client); + this.labs = _getLabsOperations(this._client); + this.grants = _getGrantsOperations(this._client); + this.operations = _getOperationsOperations(this._client); } - /** 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); - } - - /** - * Redeem invite code to join a redeemable lab - * @param parameters Request parameters to provide redeem code. - * @param options The options parameters. - */ + /** Redeem invite code to join a redeemable lab */ redeemInvitationCode( parameters: RedeemRequest, - options?: RedeemInvitationCodeOptionalParams + options: RedeemInvitationCodeOptionalParams = { requestOptions: {} }, ): Promise { - return this.sendOperationRequest( - { parameters, options }, - redeemInvitationCodeOperationSpec - ); + return redeemInvitationCode(this._client, parameters, options); } - operations: Operations; - grants: Grants; - labs: Labs; - joinRequests: JoinRequests; - students: Students; - studentLabs: StudentLabs; + /** The operation groups for studentLabs */ + public readonly studentLabs: StudentLabsOperations; + /** The operation groups for students */ + public readonly students: StudentsOperations; + /** The operation groups for joinRequests */ + public readonly joinRequests: JoinRequestsOperations; + /** The operation groups for labs */ + public readonly labs: LabsOperations; + /** The operation groups for grants */ + public readonly grants: GrantsOperations; + /** The operation groups for operations */ + public readonly operations: OperationsOperations; } -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const redeemInvitationCodeOperationSpec: coreClient.OperationSpec = { - path: "/providers/Microsoft.Education/redeemInvitationCode", - httpMethod: "POST", - responses: { - 200: {}, - default: { - bodyMapper: Mappers.ErrorResponseBody - } - }, - requestBody: Parameters.parameters2, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer -}; diff --git a/sdk/education/arm-education/src/index.ts b/sdk/education/arm-education/src/index.ts index 30c3219de159..0a6aa8bc5d11 100644 --- a/sdk/education/arm-education/src/index.ts +++ b/sdk/education/arm-education/src/index.ts @@ -1,13 +1,101 @@ -/* - * 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 { AzureClouds, AzureSupportedClouds } from "./static-helpers/cloudSettingHelpers.js"; +import { + PageSettings, + ContinuablePage, + PagedAsyncIterableIterator, +} from "./static-helpers/pagingHelpers.js"; -/// -export { getContinuationToken } from "./pagingHelper.js"; -export * from "./models/index.js"; export { EducationManagementClient } from "./educationManagementClient.js"; -export * from "./operationsInterfaces/index.js"; +export type { + RedeemRequest, + ErrorResponseBody, + ErrorResponse, + OperationListResult, + Operation, + OperationDisplay, + Origin, + ActionType, + GrantDetails, + GrantDetailProperties, + Amount, + GrantType, + GrantStatus, + ProxyResource, + Resource, + SystemData, + CreatedByType, + LabDetails, + LabProperties, + LabStatus, + InviteCodeGenerateRequest, + JoinRequestDetails, + JoinRequestProperties, + JoinRequestStatus, + StudentDetails, + StudentProperties, + StudentRole, + StudentLabStatus, + StudentLabDetails, + StudentLabProperties, +} from "./models/index.js"; +export { + KnownOrigin, + KnownActionType, + KnownGrantType, + KnownGrantStatus, + KnownCreatedByType, + KnownLabStatus, + KnownJoinRequestStatus, + KnownStudentRole, + KnownStudentLabStatus, + KnownVersions, +} from "./models/index.js"; +export type { + EducationManagementClientOptionalParams, + RedeemInvitationCodeOptionalParams, +} from "./api/index.js"; +export type { + GrantsListAllOptionalParams, + GrantsListOptionalParams, + GrantsGetOptionalParams, +} from "./api/grants/index.js"; +export type { + JoinRequestsDenyOptionalParams, + JoinRequestsApproveOptionalParams, + JoinRequestsListOptionalParams, + JoinRequestsGetOptionalParams, +} from "./api/joinRequests/index.js"; +export type { + LabsGenerateInviteCodeOptionalParams, + LabsListAllOptionalParams, + LabsListOptionalParams, + LabsDeleteOptionalParams, + LabsCreateOrUpdateOptionalParams, + LabsGetOptionalParams, +} from "./api/labs/index.js"; +export type { OperationsListOptionalParams } from "./api/operations/index.js"; +export type { + StudentLabsListAllOptionalParams, + StudentLabsGetOptionalParams, +} from "./api/studentLabs/index.js"; +export type { + StudentsListOptionalParams, + StudentsDeleteOptionalParams, + StudentsCreateOrUpdateOptionalParams, + StudentsGetOptionalParams, +} from "./api/students/index.js"; +export type { + GrantsOperations, + JoinRequestsOperations, + LabsOperations, + OperationsOperations, + StudentLabsOperations, + StudentsOperations, +} from "./classic/index.js"; +export type { PageSettings, ContinuablePage, PagedAsyncIterableIterator }; +export { AzureClouds }; +export type { AzureSupportedClouds }; +export { RestError, isRestError } from "@azure/core-rest-pipeline"; diff --git a/sdk/education/arm-education/src/logger.ts b/sdk/education/arm-education/src/logger.ts new file mode 100644 index 000000000000..4e3b60d3bf2b --- /dev/null +++ b/sdk/education/arm-education/src/logger.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { createClientLogger } from "@azure/logger"; +export const logger = createClientLogger("arm-education"); diff --git a/sdk/education/arm-education/src/models/index.ts b/sdk/education/arm-education/src/models/index.ts index 2366e19aded7..50914347b2de 100644 --- a/sdk/education/arm-education/src/models/index.ts +++ b/sdk/education/arm-education/src/models/index.ts @@ -1,786 +1,47 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import * as coreClient from "@azure/core-client"; - -/** A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. */ -export interface OperationListResult { - /** - * List of operations supported by the resource provider - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly value?: Operation[]; - /** - * URL to get the next set of operation list results (if there are any). - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly nextLink?: string; -} - -/** Details of a REST API operation, returned from the Resource Provider Operations API */ -export interface Operation { - /** - * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly name?: string; - /** - * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane operations. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly isDataAction?: boolean; - /** Localized display information for this particular operation. */ - display?: OperationDisplay; - /** - * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly origin?: Origin; - /** - * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly actionType?: ActionType; -} - -/** Localized display information for this particular operation. */ -export interface OperationDisplay { - /** - * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly provider?: string; - /** - * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly resource?: string; - /** - * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly operation?: string; - /** - * The short, localized friendly description of the operation; suitable for tool tips and detailed views. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly description?: string; -} - -/** Error response indicates that the service is not able to process the incoming request. The reason is provided in the error message. */ -export interface ErrorResponseBody { - /** The details of the error. */ - error?: ErrorResponse; -} - -/** Describes the format of Error response. */ -export interface ErrorResponse { - /** Error code */ - code?: string; - /** Error message indicating why the operation failed. */ - message?: string; -} - -/** List of Grants info. */ -export interface GrantListResponse { - /** - * The list of labs. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly value?: GrantDetails[]; - /** - * The link (url) to the next page of results. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly nextLink?: string; -} - -/** The amount. */ -export interface Amount { - /** The type of currency being used for the value. */ - currency?: string; - /** Amount value. */ - value?: number; -} - -/** Common fields that are returned in the response for all Azure Resource Manager resources */ -export interface Resource { - /** - * Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly id?: string; - /** - * The name of the resource - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly name?: string; - /** - * The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly type?: string; - /** - * Azure Resource Manager metadata containing createdBy and modifiedBy information. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly systemData?: SystemData; -} - -/** Metadata pertaining to creation and last modification of the resource. */ -export interface SystemData { - /** The identity that created the resource. */ - createdBy?: string; - /** The type of identity that created the resource. */ - createdByType?: CreatedByType; - /** The timestamp of resource creation (UTC). */ - createdAt?: Date; - /** The identity that last modified the resource. */ - lastModifiedBy?: string; - /** The type of identity that last modified the resource. */ - lastModifiedByType?: CreatedByType; - /** The timestamp of resource last modification (UTC) */ - lastModifiedAt?: Date; -} - -/** List of labs. */ -export interface LabListResult { - /** - * The list of labs. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly value?: LabDetails[]; - /** - * The link (url) to the next page of results. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly nextLink?: string; -} - -/** invite code generate request. */ -export interface InviteCodeGenerateRequest { - /** the total number of students that can be accepted to the lab. */ - maxStudentCount?: number; -} - -/** list of join requests. */ -export interface JoinRequestList { - /** - * The list of requests. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly value?: JoinRequestDetails[]; - /** - * the link (url) to the next page of results. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly nextLink?: string; -} - -/** redeem request. */ -export interface RedeemRequest { - /** redeem code */ - redeemCode: string; - /** first name of requester */ - firstName: string; - /** last name of requester */ - lastName: string; -} - -/** List of students. */ -export interface StudentListResult { - /** - * The list of students. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly value?: StudentDetails[]; - /** - * The link (url) to the next page of results. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly nextLink?: string; -} - -/** List of labs. */ -export interface StudentLabListResult { - /** - * The list of labs. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly value?: StudentLabDetails[]; - /** - * The link (url) to the next page of results. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly nextLink?: string; -} - -/** Grant details. */ -export interface GrantDetails extends Resource { - /** - * Offer Cap - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly offerCap?: Amount; - /** - * Grant Effective Date - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly effectiveDate?: Date; - /** - * Grant Offer Type - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly offerType?: GrantType; - /** - * Expiration Date - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly expirationDate?: Date; - /** - * Grant status - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly status?: GrantStatus; - /** - * allocated budget - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly allocatedBudget?: Amount; -} - -/** Lab details. */ -export interface LabDetails extends Resource { - /** Lab Display Name */ - displayName?: string; - /** Default monetary cap for each student in this lab */ - budgetPerStudent?: Amount; - /** Detail description of this lab */ - description?: string; - /** Default expiration date for each student in this lab */ - expirationDate?: Date; - /** - * Lab creation date - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly effectiveDate?: Date; - /** - * The status of this lab - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly status?: LabStatus; - /** - * the total number of students that can be accepted to the lab. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly maxStudentCount?: number; - /** - * invitation code for redeemable lab - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly invitationCode?: string; - /** The type of currency being used for the value. */ - currencyPropertiesTotalAllocatedBudgetCurrency?: string; - /** Amount value. */ - valuePropertiesTotalAllocatedBudgetValue?: number; - /** The type of currency being used for the value. */ - currencyPropertiesTotalBudgetCurrency?: string; - /** Amount value. */ - valuePropertiesTotalBudgetValue?: number; -} - -/** join requests. */ -export interface JoinRequestDetails extends Resource { - /** First Name */ - firstName?: string; - /** Last Name */ - lastName?: string; - /** join request email */ - email?: string; - /** Join request status */ - status?: JoinRequestStatus; -} - -/** Student details. */ -export interface StudentDetails extends Resource { - /** First Name */ - firstName?: string; - /** Last Name */ - lastName?: string; - /** Student Email */ - email?: string; - /** Student Role */ - role?: StudentRole; - /** Student Budget */ - budget?: Amount; - /** - * Subscription Id - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly subscriptionId?: string; - /** Date this student is set to expire from the lab. */ - expirationDate?: Date; - /** - * Student Lab Status - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly status?: StudentLabStatus; - /** - * Date student was added to the lab - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly effectiveDate?: Date; - /** Subscription alias */ - subscriptionAlias?: string; - /** subscription invite last sent date */ - subscriptionInviteLastSentDate?: Date; -} - -/** Student lab details. */ -export interface StudentLabDetails extends Resource { - /** - * Student lab Display Name - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly displayName?: string; - /** - * Detail description of this lab - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly description?: string; - /** - * Date the lab will expire and by default will be the expiration date for each student in this lab - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly expirationDate?: Date; - /** - * Student Role - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly role?: StudentRole; - /** - * Student Budget - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly budget?: Amount; - /** - * Subscription Id - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly subscriptionId?: string; - /** - * Student Lab Status - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly status?: StudentLabStatus; - /** - * User Added Date - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly effectiveDate?: Date; - /** - * Lab Scope. /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Education/labs/default - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly labScope?: string; -} - -/** Known values of {@link Origin} that the service accepts. */ -export enum KnownOrigin { - /** User */ - User = "user", - /** System */ - System = "system", - /** UserSystem */ - UserSystem = "user,system" -} - -/** - * Defines values for Origin. \ - * {@link KnownOrigin} can be used interchangeably with Origin, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **user** \ - * **system** \ - * **user,system** - */ -export type Origin = string; - -/** Known values of {@link ActionType} that the service accepts. */ -export enum KnownActionType { - /** Internal */ - Internal = "Internal" -} - -/** - * Defines values for ActionType. \ - * {@link KnownActionType} can be used interchangeably with ActionType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Internal** - */ -export type ActionType = string; - -/** Known values of {@link GrantType} that the service accepts. */ -export enum KnownGrantType { - /** Student */ - Student = "Student", - /** Academic */ - Academic = "Academic" -} - -/** - * Defines values for GrantType. \ - * {@link KnownGrantType} can be used interchangeably with GrantType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Student** \ - * **Academic** - */ -export type GrantType = string; - -/** Known values of {@link GrantStatus} that the service accepts. */ -export enum KnownGrantStatus { - /** Active */ - Active = "Active", - /** Inactive */ - Inactive = "Inactive" -} - -/** - * Defines values for GrantStatus. \ - * {@link KnownGrantStatus} can be used interchangeably with GrantStatus, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Active** \ - * **Inactive** - */ -export type GrantStatus = string; - -/** Known values of {@link CreatedByType} that the service accepts. */ -export enum KnownCreatedByType { - /** User */ - User = "User", - /** Application */ - Application = "Application", - /** ManagedIdentity */ - ManagedIdentity = "ManagedIdentity", - /** Key */ - Key = "Key" -} - -/** - * Defines values for CreatedByType. \ - * {@link KnownCreatedByType} can be used interchangeably with CreatedByType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **User** \ - * **Application** \ - * **ManagedIdentity** \ - * **Key** - */ -export type CreatedByType = string; - -/** Known values of {@link LabStatus} that the service accepts. */ -export enum KnownLabStatus { - /** Active */ - Active = "Active", - /** Deleted */ - Deleted = "Deleted", - /** Pending */ - Pending = "Pending" -} - -/** - * Defines values for LabStatus. \ - * {@link KnownLabStatus} can be used interchangeably with LabStatus, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Active** \ - * **Deleted** \ - * **Pending** - */ -export type LabStatus = string; - -/** Known values of {@link JoinRequestStatus} that the service accepts. */ -export enum KnownJoinRequestStatus { - /** Pending */ - Pending = "Pending", - /** Denied */ - Denied = "Denied" -} - -/** - * Defines values for JoinRequestStatus. \ - * {@link KnownJoinRequestStatus} can be used interchangeably with JoinRequestStatus, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Pending** \ - * **Denied** - */ -export type JoinRequestStatus = string; - -/** Known values of {@link StudentRole} that the service accepts. */ -export enum KnownStudentRole { - /** Student */ - Student = "Student", - /** Admin */ - Admin = "Admin" -} - -/** - * Defines values for StudentRole. \ - * {@link KnownStudentRole} can be used interchangeably with StudentRole, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Student** \ - * **Admin** - */ -export type StudentRole = string; - -/** Known values of {@link StudentLabStatus} that the service accepts. */ -export enum KnownStudentLabStatus { - /** Active */ - Active = "Active", - /** Disabled */ - Disabled = "Disabled", - /** Expired */ - Expired = "Expired", - /** Pending */ - Pending = "Pending", - /** Deleted */ - Deleted = "Deleted" -} - -/** - * Defines values for StudentLabStatus. \ - * {@link KnownStudentLabStatus} can be used interchangeably with StudentLabStatus, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Active** \ - * **Disabled** \ - * **Expired** \ - * **Pending** \ - * **Deleted** - */ -export type StudentLabStatus = string; - -/** Optional parameters. */ -export interface OperationsListOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the list operation. */ -export type OperationsListResponse = OperationListResult; - -/** Optional parameters. */ -export interface GrantsListAllOptionalParams - extends coreClient.OperationOptions { - /** May be used to include information about budget that has been allocated. */ - includeAllocatedBudget?: boolean; -} - -/** Contains response data for the listAll operation. */ -export type GrantsListAllResponse = GrantListResponse; - -/** Optional parameters. */ -export interface GrantsListOptionalParams extends coreClient.OperationOptions { - /** May be used to include information about budget that has been allocated. */ - includeAllocatedBudget?: boolean; -} - -/** Contains response data for the list operation. */ -export type GrantsListResponse = GrantListResponse; - -/** Optional parameters. */ -export interface GrantsGetOptionalParams extends coreClient.OperationOptions { - /** May be used to include information about budget that has been allocated. */ - includeAllocatedBudget?: boolean; -} - -/** Contains response data for the get operation. */ -export type GrantsGetResponse = GrantDetails; - -/** Optional parameters. */ -export interface GrantsListAllNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listAllNext operation. */ -export type GrantsListAllNextResponse = GrantListResponse; - -/** Optional parameters. */ -export interface GrantsListNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listNext operation. */ -export type GrantsListNextResponse = GrantListResponse; - -/** Optional parameters. */ -export interface LabsListAllOptionalParams extends coreClient.OperationOptions { - /** May be used to include budget information. */ - includeBudget?: boolean; - /** May be used to show deleted items. */ - includeDeleted?: boolean; -} - -/** Contains response data for the listAll operation. */ -export type LabsListAllResponse = LabListResult; - -/** Optional parameters. */ -export interface LabsListOptionalParams extends coreClient.OperationOptions { - /** May be used to include budget information. */ - includeBudget?: boolean; -} - -/** Contains response data for the list operation. */ -export type LabsListResponse = LabListResult; - -/** Optional parameters. */ -export interface LabsGetOptionalParams extends coreClient.OperationOptions { - /** May be used to include budget information. */ - includeBudget?: boolean; -} - -/** Contains response data for the get operation. */ -export type LabsGetResponse = LabDetails; - -/** Optional parameters. */ -export interface LabsDeleteOptionalParams extends coreClient.OperationOptions {} - -/** Optional parameters. */ -export interface LabsCreateOrUpdateOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the createOrUpdate operation. */ -export type LabsCreateOrUpdateResponse = LabDetails; - -/** Optional parameters. */ -export interface LabsGenerateInviteCodeOptionalParams - extends coreClient.OperationOptions { - /** set this flag to true if you want to update student count without generating a new invite code */ - onlyUpdateStudentCountParameter?: boolean; -} - -/** Contains response data for the generateInviteCode operation. */ -export type LabsGenerateInviteCodeResponse = LabDetails; - -/** Optional parameters. */ -export interface LabsListAllNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listAllNext operation. */ -export type LabsListAllNextResponse = LabListResult; - -/** Optional parameters. */ -export interface LabsListNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listNext operation. */ -export type LabsListNextResponse = LabListResult; - -/** Optional parameters. */ -export interface JoinRequestsListOptionalParams - extends coreClient.OperationOptions { - /** Include denied */ - includeDenied?: boolean; -} - -/** Contains response data for the list operation. */ -export type JoinRequestsListResponse = JoinRequestList; - -/** Optional parameters. */ -export interface JoinRequestsGetOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the get operation. */ -export type JoinRequestsGetResponse = JoinRequestDetails; - -/** Optional parameters. */ -export interface JoinRequestsApproveOptionalParams - extends coreClient.OperationOptions {} - -/** Optional parameters. */ -export interface JoinRequestsDenyOptionalParams - extends coreClient.OperationOptions {} - -/** Optional parameters. */ -export interface JoinRequestsListNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listNext operation. */ -export type JoinRequestsListNextResponse = JoinRequestList; - -/** Optional parameters. */ -export interface RedeemInvitationCodeOptionalParams - extends coreClient.OperationOptions {} - -/** Optional parameters. */ -export interface StudentsListOptionalParams - extends coreClient.OperationOptions { - /** May be used to show deleted items. */ - includeDeleted?: boolean; -} - -/** Contains response data for the list operation. */ -export type StudentsListResponse = StudentListResult; - -/** Optional parameters. */ -export interface StudentsGetOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the get operation. */ -export type StudentsGetResponse = StudentDetails; - -/** Optional parameters. */ -export interface StudentsDeleteOptionalParams - extends coreClient.OperationOptions {} - -/** Optional parameters. */ -export interface StudentsCreateOrUpdateOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the createOrUpdate operation. */ -export type StudentsCreateOrUpdateResponse = StudentDetails; - -/** Optional parameters. */ -export interface StudentsListNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listNext operation. */ -export type StudentsListNextResponse = StudentListResult; - -/** Optional parameters. */ -export interface StudentLabsListAllOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listAll operation. */ -export type StudentLabsListAllResponse = StudentLabListResult; - -/** Optional parameters. */ -export interface StudentLabsGetOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the get operation. */ -export type StudentLabsGetResponse = StudentLabDetails; - -/** Optional parameters. */ -export interface StudentLabsListAllNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listAllNext operation. */ -export type StudentLabsListAllNextResponse = StudentLabListResult; - -/** Optional parameters. */ -export interface EducationManagementClientOptionalParams - extends coreClient.ServiceClientOptions { - /** server parameter */ - $host?: string; - /** Api Version */ - apiVersion?: string; - /** Overrides client endpoint. */ - endpoint?: string; -} +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export type { + RedeemRequest, + ErrorResponseBody, + ErrorResponse, + OperationListResult, + Operation, + OperationDisplay, + Origin, + ActionType, + GrantDetails, + GrantDetailProperties, + Amount, + GrantType, + GrantStatus, + ProxyResource, + Resource, + SystemData, + CreatedByType, + LabDetails, + LabProperties, + LabStatus, + InviteCodeGenerateRequest, + JoinRequestDetails, + JoinRequestProperties, + JoinRequestStatus, + StudentDetails, + StudentProperties, + StudentRole, + StudentLabStatus, + StudentLabDetails, + StudentLabProperties, +} from "./models.js"; +export { + KnownOrigin, + KnownActionType, + KnownGrantType, + KnownGrantStatus, + KnownCreatedByType, + KnownLabStatus, + KnownJoinRequestStatus, + KnownStudentRole, + KnownStudentLabStatus, + KnownVersions, +} from "./models.js"; diff --git a/sdk/education/arm-education/src/models/mappers.ts b/sdk/education/arm-education/src/models/mappers.ts deleted file mode 100644 index 16623dc61e13..000000000000 --- a/sdk/education/arm-education/src/models/mappers.ts +++ /dev/null @@ -1,775 +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. - */ - -import * as coreClient from "@azure/core-client"; - -export const OperationListResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "OperationListResult", - modelProperties: { - value: { - serializedName: "value", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "Operation" - } - } - } - }, - nextLink: { - serializedName: "nextLink", - readOnly: true, - type: { - name: "String" - } - } - } - } -}; - -export const Operation: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "Operation", - modelProperties: { - name: { - serializedName: "name", - readOnly: true, - type: { - name: "String" - } - }, - isDataAction: { - serializedName: "isDataAction", - readOnly: true, - type: { - name: "Boolean" - } - }, - display: { - serializedName: "display", - type: { - name: "Composite", - className: "OperationDisplay" - } - }, - origin: { - serializedName: "origin", - readOnly: true, - type: { - name: "String" - } - }, - actionType: { - serializedName: "actionType", - readOnly: true, - type: { - name: "String" - } - } - } - } -}; - -export const OperationDisplay: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "OperationDisplay", - modelProperties: { - provider: { - serializedName: "provider", - readOnly: true, - type: { - name: "String" - } - }, - resource: { - serializedName: "resource", - readOnly: true, - type: { - name: "String" - } - }, - operation: { - serializedName: "operation", - readOnly: true, - type: { - name: "String" - } - }, - description: { - serializedName: "description", - readOnly: true, - type: { - name: "String" - } - } - } - } -}; - -export const ErrorResponseBody: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ErrorResponseBody", - modelProperties: { - error: { - serializedName: "error", - type: { - name: "Composite", - className: "ErrorResponse" - } - } - } - } -}; - -export const ErrorResponse: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ErrorResponse", - modelProperties: { - code: { - serializedName: "code", - type: { - name: "String" - } - }, - message: { - serializedName: "message", - type: { - name: "String" - } - } - } - } -}; - -export const GrantListResponse: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "GrantListResponse", - modelProperties: { - value: { - serializedName: "value", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "GrantDetails" - } - } - } - }, - nextLink: { - serializedName: "nextLink", - readOnly: true, - type: { - name: "String" - } - } - } - } -}; - -export const Amount: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "Amount", - modelProperties: { - currency: { - serializedName: "currency", - type: { - name: "String" - } - }, - value: { - serializedName: "value", - type: { - name: "Number" - } - } - } - } -}; - -export const Resource: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "Resource", - modelProperties: { - id: { - serializedName: "id", - readOnly: true, - type: { - name: "String" - } - }, - name: { - serializedName: "name", - readOnly: true, - type: { - name: "String" - } - }, - type: { - serializedName: "type", - readOnly: true, - type: { - name: "String" - } - }, - systemData: { - serializedName: "systemData", - type: { - name: "Composite", - className: "SystemData" - } - } - } - } -}; - -export const SystemData: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "SystemData", - modelProperties: { - createdBy: { - serializedName: "createdBy", - type: { - name: "String" - } - }, - createdByType: { - serializedName: "createdByType", - type: { - name: "String" - } - }, - createdAt: { - serializedName: "createdAt", - type: { - name: "DateTime" - } - }, - lastModifiedBy: { - serializedName: "lastModifiedBy", - type: { - name: "String" - } - }, - lastModifiedByType: { - serializedName: "lastModifiedByType", - type: { - name: "String" - } - }, - lastModifiedAt: { - serializedName: "lastModifiedAt", - type: { - name: "DateTime" - } - } - } - } -}; - -export const LabListResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "LabListResult", - modelProperties: { - value: { - serializedName: "value", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "LabDetails" - } - } - } - }, - nextLink: { - serializedName: "nextLink", - readOnly: true, - type: { - name: "String" - } - } - } - } -}; - -export const InviteCodeGenerateRequest: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "InviteCodeGenerateRequest", - modelProperties: { - maxStudentCount: { - serializedName: "maxStudentCount", - type: { - name: "Number" - } - } - } - } -}; - -export const JoinRequestList: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "JoinRequestList", - modelProperties: { - value: { - serializedName: "value", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "JoinRequestDetails" - } - } - } - }, - nextLink: { - serializedName: "nextLink", - readOnly: true, - type: { - name: "String" - } - } - } - } -}; - -export const RedeemRequest: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "RedeemRequest", - modelProperties: { - redeemCode: { - serializedName: "redeemCode", - required: true, - type: { - name: "String" - } - }, - firstName: { - serializedName: "firstName", - required: true, - type: { - name: "String" - } - }, - lastName: { - serializedName: "lastName", - required: true, - type: { - name: "String" - } - } - } - } -}; - -export const StudentListResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "StudentListResult", - modelProperties: { - value: { - serializedName: "value", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "StudentDetails" - } - } - } - }, - nextLink: { - serializedName: "nextLink", - readOnly: true, - type: { - name: "String" - } - } - } - } -}; - -export const StudentLabListResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "StudentLabListResult", - modelProperties: { - value: { - serializedName: "value", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "StudentLabDetails" - } - } - } - }, - nextLink: { - serializedName: "nextLink", - readOnly: true, - type: { - name: "String" - } - } - } - } -}; - -export const GrantDetails: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "GrantDetails", - modelProperties: { - ...Resource.type.modelProperties, - offerCap: { - serializedName: "properties.offerCap", - type: { - name: "Composite", - className: "Amount" - } - }, - effectiveDate: { - serializedName: "properties.effectiveDate", - readOnly: true, - type: { - name: "DateTime" - } - }, - offerType: { - serializedName: "properties.offerType", - readOnly: true, - type: { - name: "String" - } - }, - expirationDate: { - serializedName: "properties.expirationDate", - readOnly: true, - type: { - name: "DateTime" - } - }, - status: { - serializedName: "properties.status", - readOnly: true, - type: { - name: "String" - } - }, - allocatedBudget: { - serializedName: "properties.allocatedBudget", - type: { - name: "Composite", - className: "Amount" - } - } - } - } -}; - -export const LabDetails: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "LabDetails", - modelProperties: { - ...Resource.type.modelProperties, - displayName: { - serializedName: "properties.displayName", - type: { - name: "String" - } - }, - budgetPerStudent: { - serializedName: "properties.budgetPerStudent", - type: { - name: "Composite", - className: "Amount" - } - }, - description: { - serializedName: "properties.description", - type: { - name: "String" - } - }, - expirationDate: { - serializedName: "properties.expirationDate", - type: { - name: "DateTime" - } - }, - effectiveDate: { - serializedName: "properties.effectiveDate", - readOnly: true, - type: { - name: "DateTime" - } - }, - status: { - serializedName: "properties.status", - readOnly: true, - type: { - name: "String" - } - }, - maxStudentCount: { - serializedName: "properties.maxStudentCount", - readOnly: true, - type: { - name: "Number" - } - }, - invitationCode: { - serializedName: "properties.invitationCode", - readOnly: true, - type: { - name: "String" - } - }, - currencyPropertiesTotalAllocatedBudgetCurrency: { - serializedName: "properties.totalAllocatedBudget.currency", - type: { - name: "String" - } - }, - valuePropertiesTotalAllocatedBudgetValue: { - serializedName: "properties.totalAllocatedBudget.value", - type: { - name: "Number" - } - }, - currencyPropertiesTotalBudgetCurrency: { - serializedName: "properties.totalBudget.currency", - type: { - name: "String" - } - }, - valuePropertiesTotalBudgetValue: { - serializedName: "properties.totalBudget.value", - type: { - name: "Number" - } - } - } - } -}; - -export const JoinRequestDetails: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "JoinRequestDetails", - modelProperties: { - ...Resource.type.modelProperties, - firstName: { - serializedName: "properties.firstName", - type: { - name: "String" - } - }, - lastName: { - serializedName: "properties.lastName", - type: { - name: "String" - } - }, - email: { - serializedName: "properties.email", - type: { - name: "String" - } - }, - status: { - serializedName: "properties.status", - type: { - name: "String" - } - } - } - } -}; - -export const StudentDetails: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "StudentDetails", - modelProperties: { - ...Resource.type.modelProperties, - firstName: { - serializedName: "properties.firstName", - type: { - name: "String" - } - }, - lastName: { - serializedName: "properties.lastName", - type: { - name: "String" - } - }, - email: { - serializedName: "properties.email", - type: { - name: "String" - } - }, - role: { - serializedName: "properties.role", - type: { - name: "String" - } - }, - budget: { - serializedName: "properties.budget", - type: { - name: "Composite", - className: "Amount" - } - }, - subscriptionId: { - serializedName: "properties.subscriptionId", - readOnly: true, - type: { - name: "String" - } - }, - expirationDate: { - serializedName: "properties.expirationDate", - type: { - name: "DateTime" - } - }, - status: { - serializedName: "properties.status", - readOnly: true, - type: { - name: "String" - } - }, - effectiveDate: { - serializedName: "properties.effectiveDate", - readOnly: true, - type: { - name: "DateTime" - } - }, - subscriptionAlias: { - serializedName: "properties.subscriptionAlias", - type: { - name: "String" - } - }, - subscriptionInviteLastSentDate: { - serializedName: "properties.subscriptionInviteLastSentDate", - type: { - name: "DateTime" - } - } - } - } -}; - -export const StudentLabDetails: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "StudentLabDetails", - modelProperties: { - ...Resource.type.modelProperties, - displayName: { - serializedName: "properties.displayName", - readOnly: true, - type: { - name: "String" - } - }, - description: { - serializedName: "properties.description", - readOnly: true, - type: { - name: "String" - } - }, - expirationDate: { - serializedName: "properties.expirationDate", - readOnly: true, - type: { - name: "DateTime" - } - }, - role: { - serializedName: "properties.role", - readOnly: true, - type: { - name: "String" - } - }, - budget: { - serializedName: "properties.budget", - type: { - name: "Composite", - className: "Amount" - } - }, - subscriptionId: { - serializedName: "properties.subscriptionId", - readOnly: true, - type: { - name: "String" - } - }, - status: { - serializedName: "properties.status", - readOnly: true, - type: { - name: "String" - } - }, - effectiveDate: { - serializedName: "properties.effectiveDate", - readOnly: true, - type: { - name: "DateTime" - } - }, - labScope: { - serializedName: "properties.labScope", - readOnly: true, - type: { - name: "String" - } - } - } - } -}; diff --git a/sdk/education/arm-education/src/models/models.ts b/sdk/education/arm-education/src/models/models.ts new file mode 100644 index 000000000000..d4a21ea66130 --- /dev/null +++ b/sdk/education/arm-education/src/models/models.ts @@ -0,0 +1,1070 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { areAllPropsUndefined } from "../static-helpers/serialization/check-prop-undefined.js"; + +/** + * This file contains only generated model types and their (de)serializers. + * Disable the following rules for internal models with '_' prefix and deserializers which require 'any' for raw JSON input. + */ +/* eslint-disable @typescript-eslint/naming-convention */ +/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ +/** redeem request. */ +export interface RedeemRequest { + /** redeem code */ + redeemCode: string; + /** first name of requester */ + firstName: string; + /** last name of requester */ + lastName: string; +} + +export function redeemRequestSerializer(item: RedeemRequest): any { + return { + redeemCode: item["redeemCode"], + firstName: item["firstName"], + lastName: item["lastName"], + }; +} + +/** Error response indicates that the service is not able to process the incoming request. The reason is provided in the error message. */ +export interface ErrorResponseBody { + /** The details of the error. */ + error?: ErrorResponse; +} + +export function errorResponseBodyDeserializer(item: any): ErrorResponseBody { + return { + error: !item["error"] ? item["error"] : errorResponseDeserializer(item["error"]), + }; +} + +/** Describes the format of Error response. */ +export interface ErrorResponse { + /** Error code */ + code?: string; + /** Error message indicating why the operation failed. */ + message?: string; +} + +export function errorResponseDeserializer(item: any): ErrorResponse { + return { + code: item["code"], + message: item["message"], + }; +} + +/** A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. */ +export interface OperationListResult { + /** The Operation items on this page */ + readonly value: Operation[]; + /** The link to the next page of items */ + readonly nextLink?: string; +} + +export function operationListResultDeserializer(item: any): OperationListResult { + return { + value: operationArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function operationArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return operationDeserializer(item); + }); +} + +/** Details of a REST API operation, returned from the Resource Provider Operations API */ +export interface Operation { + /** The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" */ + readonly name?: string; + /** Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure Resource Manager/control-plane operations. */ + readonly isDataAction?: boolean; + /** Localized display information for this particular operation. */ + display?: OperationDisplay; + /** The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" */ + readonly origin?: Origin; + /** Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. */ + readonly actionType?: ActionType; +} + +export function operationDeserializer(item: any): Operation { + return { + name: item["name"], + isDataAction: item["isDataAction"], + display: !item["display"] ? item["display"] : operationDisplayDeserializer(item["display"]), + origin: item["origin"], + actionType: item["actionType"], + }; +} + +/** Localized display information for an operation. */ +export interface OperationDisplay { + /** The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". */ + readonly provider?: string; + /** The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". */ + readonly resource?: string; + /** The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". */ + readonly operation?: string; + /** The short, localized friendly description of the operation; suitable for tool tips and detailed views. */ + readonly description?: string; +} + +export function operationDisplayDeserializer(item: any): OperationDisplay { + return { + provider: item["provider"], + resource: item["resource"], + operation: item["operation"], + description: item["description"], + }; +} + +/** The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" */ +export enum KnownOrigin { + /** Indicates the operation is initiated by a user. */ + User = "user", + /** Indicates the operation is initiated by a system. */ + System = "system", + /** Indicates the operation is initiated by a user or system. */ + UserSystem = "user,system", +} + +/** + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" \ + * {@link KnownOrigin} can be used interchangeably with Origin, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **user**: Indicates the operation is initiated by a user. \ + * **system**: Indicates the operation is initiated by a system. \ + * **user,system**: Indicates the operation is initiated by a user or system. + */ +export type Origin = string; + +/** Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. */ +export enum KnownActionType { + /** Actions are for internal-only APIs. */ + Internal = "Internal", +} + +/** + * Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. \ + * {@link KnownActionType} can be used interchangeably with ActionType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Internal**: Actions are for internal-only APIs. + */ +export type ActionType = string; + +/** Grant details. */ +export interface GrantDetails extends ProxyResource { + /** Offer Cap */ + readonly offerCap?: Amount; + /** Grant Effective Date */ + readonly effectiveDate?: Date; + /** Grant Offer Type */ + readonly offerType?: GrantType; + /** Expiration Date */ + readonly expirationDate?: Date; + /** Grant status */ + readonly status?: GrantStatus; + /** allocated budget */ + readonly allocatedBudget?: Amount; +} + +export function grantDetailsDeserializer(item: any): GrantDetails { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + ...(!item["properties"] + ? item["properties"] + : _grantDetailsPropertiesDeserializer(item["properties"])), + }; +} + +/** Grant detail properties */ +export interface GrantDetailProperties { + /** Offer Cap */ + readonly offerCap?: Amount; + /** Grant Effective Date */ + readonly effectiveDate?: Date; + /** Grant Offer Type */ + readonly offerType?: GrantType; + /** Expiration Date */ + readonly expirationDate?: Date; + /** Grant status */ + readonly status?: GrantStatus; + /** allocated budget */ + readonly allocatedBudget?: Amount; +} + +export function grantDetailPropertiesDeserializer(item: any): GrantDetailProperties { + return { + offerCap: !item["offerCap"] ? item["offerCap"] : amountDeserializer(item["offerCap"]), + effectiveDate: !item["effectiveDate"] ? item["effectiveDate"] : new Date(item["effectiveDate"]), + offerType: item["offerType"], + expirationDate: !item["expirationDate"] + ? item["expirationDate"] + : new Date(item["expirationDate"]), + status: item["status"], + allocatedBudget: !item["allocatedBudget"] + ? item["allocatedBudget"] + : amountDeserializer(item["allocatedBudget"]), + }; +} + +/** The amount. */ +export interface Amount { + /** The type of currency being used for the value. */ + currency?: string; + /** Amount value. */ + value?: number; +} + +export function amountSerializer(item: Amount): any { + return { currency: item["currency"], value: item["value"] }; +} + +export function amountDeserializer(item: any): Amount { + return { + currency: item["currency"], + value: item["value"], + }; +} + +/** Grant Offer Type */ +export enum KnownGrantType { + /** Student */ + Student = "Student", + /** Academic */ + Academic = "Academic", +} + +/** + * Grant Offer Type \ + * {@link KnownGrantType} can be used interchangeably with GrantType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Student**: Student \ + * **Academic**: Academic + */ +export type GrantType = string; + +/** Grant status */ +export enum KnownGrantStatus { + /** Active */ + Active = "Active", + /** Inactive */ + Inactive = "Inactive", +} + +/** + * Grant status \ + * {@link KnownGrantStatus} can be used interchangeably with GrantStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Active**: Active \ + * **Inactive**: Inactive + */ +export type GrantStatus = string; + +/** The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location */ +export interface ProxyResource extends Resource {} + +export function proxyResourceSerializer(_item: ProxyResource): any { + return {}; +} + +export function proxyResourceDeserializer(item: any): ProxyResource { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + }; +} + +/** Common fields that are returned in the response for all Azure Resource Manager resources */ +export interface Resource { + /** Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} */ + readonly id?: string; + /** The name of the resource */ + readonly name?: string; + /** The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" */ + readonly type?: string; + /** Azure Resource Manager metadata containing createdBy and modifiedBy information. */ + readonly systemData?: SystemData; +} + +export function resourceSerializer(_item: Resource): any { + return {}; +} + +export function resourceDeserializer(item: any): Resource { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + }; +} + +/** Metadata pertaining to creation and last modification of the resource. */ +export interface SystemData { + /** The identity that created the resource. */ + createdBy?: string; + /** The type of identity that created the resource. */ + createdByType?: CreatedByType; + /** The timestamp of resource creation (UTC). */ + createdAt?: Date; + /** The identity that last modified the resource. */ + lastModifiedBy?: string; + /** The type of identity that last modified the resource. */ + lastModifiedByType?: CreatedByType; + /** The timestamp of resource last modification (UTC) */ + lastModifiedAt?: Date; +} + +export function systemDataDeserializer(item: any): SystemData { + return { + createdBy: item["createdBy"], + createdByType: item["createdByType"], + createdAt: !item["createdAt"] ? item["createdAt"] : new Date(item["createdAt"]), + lastModifiedBy: item["lastModifiedBy"], + lastModifiedByType: item["lastModifiedByType"], + lastModifiedAt: !item["lastModifiedAt"] + ? item["lastModifiedAt"] + : new Date(item["lastModifiedAt"]), + }; +} + +/** The kind of entity that created the resource. */ +export enum KnownCreatedByType { + /** The entity was created by a user. */ + User = "User", + /** The entity was created by an application. */ + Application = "Application", + /** The entity was created by a managed identity. */ + ManagedIdentity = "ManagedIdentity", + /** The entity was created by a key. */ + Key = "Key", +} + +/** + * The kind of entity that created the resource. \ + * {@link KnownCreatedByType} can be used interchangeably with CreatedByType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **User**: The entity was created by a user. \ + * **Application**: The entity was created by an application. \ + * **ManagedIdentity**: The entity was created by a managed identity. \ + * **Key**: The entity was created by a key. + */ +export type CreatedByType = string; + +/** List of Grants info. */ +export interface _GrantListResponse { + /** The GrantDetails items on this page. */ + readonly value?: GrantDetails[]; + /** The link to the next page of items. */ + nextLink?: string; +} + +export function _grantListResponseDeserializer(item: any): _GrantListResponse { + return { + value: !item["value"] ? item["value"] : grantDetailsArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function grantDetailsArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return grantDetailsDeserializer(item); + }); +} + +/** Lab details. */ +export interface LabDetails extends ProxyResource { + /** Lab Display Name */ + displayName?: string; + /** Default monetary cap for each student in this lab */ + budgetPerStudent?: Amount; + /** Detail description of this lab */ + description?: string; + /** Default expiration date for each student in this lab */ + expirationDate?: Date; + /** Lab creation date */ + readonly effectiveDate?: Date; + /** The status of this lab */ + readonly status?: LabStatus; + /** the total number of students that can be accepted to the lab. */ + readonly maxStudentCount?: number; + /** invitation code for redeemable lab */ + readonly invitationCode?: string; + /** Total budget */ + readonly totalBudget?: Amount; + /** Total allocated budget */ + readonly totalAllocatedBudget?: Amount; +} + +export function labDetailsSerializer(item: LabDetails): any { + return { + properties: areAllPropsUndefined(item, [ + "displayName", + "budgetPerStudent", + "description", + "expirationDate", + ]) + ? undefined + : _labDetailsPropertiesSerializer(item), + }; +} + +export function labDetailsDeserializer(item: any): LabDetails { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + ...(!item["properties"] + ? item["properties"] + : _labDetailsPropertiesDeserializer(item["properties"])), + }; +} + +/** Lab detail result properties. */ +export interface LabProperties { + /** Lab Display Name */ + displayName: string; + /** Default monetary cap for each student in this lab */ + budgetPerStudent: Amount; + /** Detail description of this lab */ + description: string; + /** Default expiration date for each student in this lab */ + expirationDate: Date; + /** Lab creation date */ + readonly effectiveDate?: Date; + /** The status of this lab */ + readonly status?: LabStatus; + /** the total number of students that can be accepted to the lab. */ + readonly maxStudentCount?: number; + /** invitation code for redeemable lab */ + readonly invitationCode?: string; + /** The type of currency being used for the value. */ + currency?: string; + /** Amount value. */ + value?: number; + /** The type of currency being used for the value. */ + currencyTotalAllocatedBudgetCurrency?: string; + /** Amount value. */ + valueTotalAllocatedBudgetValue?: number; +} + +export function labPropertiesSerializer(item: LabProperties): any { + return { + displayName: item["displayName"], + budgetPerStudent: amountSerializer(item["budgetPerStudent"]), + description: item["description"], + expirationDate: item["expirationDate"].toISOString(), + }; +} + +export function labPropertiesDeserializer(item: any): LabProperties { + return { + displayName: item["displayName"], + budgetPerStudent: amountDeserializer(item["budgetPerStudent"]), + description: item["description"], + expirationDate: new Date(item["expirationDate"]), + effectiveDate: !item["effectiveDate"] ? item["effectiveDate"] : new Date(item["effectiveDate"]), + status: item["status"], + maxStudentCount: item["maxStudentCount"], + invitationCode: item["invitationCode"], + ...(!item["totalBudget"] + ? item["totalBudget"] + : _labPropertiesTotalBudgetDeserializer(item["totalBudget"])), + ...(!item["totalAllocatedBudget"] + ? item["totalAllocatedBudget"] + : _labPropertiesTotalAllocatedBudgetDeserializer(item["totalAllocatedBudget"])), + }; +} + +/** The status of this lab */ +export enum KnownLabStatus { + /** Active */ + Active = "Active", + /** Deleted */ + Deleted = "Deleted", + /** Pending */ + Pending = "Pending", +} + +/** + * The status of this lab \ + * {@link KnownLabStatus} can be used interchangeably with LabStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Active**: Active \ + * **Deleted**: Deleted \ + * **Pending**: Pending + */ +export type LabStatus = string; + +/** List of Labs info. */ +export interface _LabListResult { + /** The LabDetails items on this page. */ + readonly value?: LabDetails[]; + /** The link to the next page of items. */ + nextLink?: string; +} + +export function _labListResultDeserializer(item: any): _LabListResult { + return { + value: !item["value"] ? item["value"] : labDetailsArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function labDetailsArraySerializer(result: Array): any[] { + return result.map((item) => { + return labDetailsSerializer(item); + }); +} + +export function labDetailsArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return labDetailsDeserializer(item); + }); +} + +/** invite code generate request. */ +export interface InviteCodeGenerateRequest { + /** the total number of students that can be accepted to the lab. */ + maxStudentCount?: number; +} + +export function inviteCodeGenerateRequestSerializer(item: InviteCodeGenerateRequest): any { + return { maxStudentCount: item["maxStudentCount"] }; +} + +/** join requests. */ +export interface JoinRequestDetails extends ProxyResource { + /** First Name */ + firstName?: string; + /** Last Name */ + lastName?: string; + /** join request email */ + email?: string; + /** Join request status */ + status?: JoinRequestStatus; +} + +export function joinRequestDetailsDeserializer(item: any): JoinRequestDetails { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + ...(!item["properties"] + ? item["properties"] + : _joinRequestDetailsPropertiesDeserializer(item["properties"])), + }; +} + +/** Join request properties. */ +export interface JoinRequestProperties { + /** First Name */ + firstName?: string; + /** Last Name */ + lastName?: string; + /** join request email */ + email?: string; + /** Join request status */ + status?: JoinRequestStatus; +} + +export function joinRequestPropertiesDeserializer(item: any): JoinRequestProperties { + return { + firstName: item["firstName"], + lastName: item["lastName"], + email: item["email"], + status: item["status"], + }; +} + +/** Join request status */ +export enum KnownJoinRequestStatus { + /** Pending */ + Pending = "Pending", + /** Denied */ + Denied = "Denied", +} + +/** + * Join request status \ + * {@link KnownJoinRequestStatus} can be used interchangeably with JoinRequestStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Pending**: Pending \ + * **Denied**: Denied + */ +export type JoinRequestStatus = string; + +/** list of join requests. */ +export interface _JoinRequestList { + /** The JoinRequestDetails items on this page. */ + readonly value?: JoinRequestDetails[]; + /** The link to the next page of items. */ + nextLink?: string; +} + +export function _joinRequestListDeserializer(item: any): _JoinRequestList { + return { + value: !item["value"] ? item["value"] : joinRequestDetailsArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function joinRequestDetailsArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return joinRequestDetailsDeserializer(item); + }); +} + +/** Student details. */ +export interface StudentDetails extends ProxyResource { + /** First Name */ + firstName?: string; + /** Last Name */ + lastName?: string; + /** Student Email */ + email?: string; + /** Student Role */ + role?: StudentRole; + /** Student Budget */ + budget?: Amount; + /** Subscription Id */ + readonly subscriptionId?: string; + /** Date this student is set to expire from the lab. */ + expirationDate?: Date; + /** Student Lab Status */ + readonly status?: StudentLabStatus; + /** Date student was added to the lab */ + readonly effectiveDate?: Date; + /** Subscription alias */ + subscriptionAlias?: string; + /** subscription invite last sent date */ + subscriptionInviteLastSentDate?: Date; +} + +export function studentDetailsSerializer(item: StudentDetails): any { + return { + properties: areAllPropsUndefined(item, [ + "firstName", + "lastName", + "email", + "role", + "budget", + "expirationDate", + "subscriptionAlias", + "subscriptionInviteLastSentDate", + ]) + ? undefined + : _studentDetailsPropertiesSerializer(item), + }; +} + +export function studentDetailsDeserializer(item: any): StudentDetails { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + ...(!item["properties"] + ? item["properties"] + : _studentDetailsPropertiesDeserializer(item["properties"])), + }; +} + +/** Student detail properties */ +export interface StudentProperties { + /** First Name */ + firstName: string; + /** Last Name */ + lastName: string; + /** Student Email */ + email: string; + /** Student Role */ + role: StudentRole; + /** Student Budget */ + budget: Amount; + /** Subscription Id */ + readonly subscriptionId?: string; + /** Date this student is set to expire from the lab. */ + expirationDate: Date; + /** Student Lab Status */ + readonly status?: StudentLabStatus; + /** Date student was added to the lab */ + readonly effectiveDate?: Date; + /** Subscription alias */ + subscriptionAlias?: string; + /** subscription invite last sent date */ + subscriptionInviteLastSentDate?: Date; +} + +export function studentPropertiesSerializer(item: StudentProperties): any { + return { + firstName: item["firstName"], + lastName: item["lastName"], + email: item["email"], + role: item["role"], + budget: amountSerializer(item["budget"]), + expirationDate: item["expirationDate"].toISOString(), + subscriptionAlias: item["subscriptionAlias"], + subscriptionInviteLastSentDate: !item["subscriptionInviteLastSentDate"] + ? item["subscriptionInviteLastSentDate"] + : item["subscriptionInviteLastSentDate"].toISOString(), + }; +} + +export function studentPropertiesDeserializer(item: any): StudentProperties { + return { + firstName: item["firstName"], + lastName: item["lastName"], + email: item["email"], + role: item["role"], + budget: amountDeserializer(item["budget"]), + subscriptionId: item["subscriptionId"], + expirationDate: new Date(item["expirationDate"]), + status: item["status"], + effectiveDate: !item["effectiveDate"] ? item["effectiveDate"] : new Date(item["effectiveDate"]), + subscriptionAlias: item["subscriptionAlias"], + subscriptionInviteLastSentDate: !item["subscriptionInviteLastSentDate"] + ? item["subscriptionInviteLastSentDate"] + : new Date(item["subscriptionInviteLastSentDate"]), + }; +} + +/** Student Role */ +export enum KnownStudentRole { + /** Student */ + Student = "Student", + /** Admin */ + Admin = "Admin", +} + +/** + * Student Role \ + * {@link KnownStudentRole} can be used interchangeably with StudentRole, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Student**: Student \ + * **Admin**: Admin + */ +export type StudentRole = string; + +/** Student Lab Status */ +export enum KnownStudentLabStatus { + /** Active */ + Active = "Active", + /** Disabled */ + Disabled = "Disabled", + /** Expired */ + Expired = "Expired", + /** Pending */ + Pending = "Pending", + /** Deleted */ + Deleted = "Deleted", +} + +/** + * Student Lab Status \ + * {@link KnownStudentLabStatus} can be used interchangeably with StudentLabStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Active**: Active \ + * **Disabled**: Disabled \ + * **Expired**: Expired \ + * **Pending**: Pending \ + * **Deleted**: Deleted + */ +export type StudentLabStatus = string; + +/** List of Students info. */ +export interface _StudentListResult { + /** The StudentDetails items on this page. */ + readonly value?: StudentDetails[]; + /** The link to the next page of items. */ + nextLink?: string; +} + +export function _studentListResultDeserializer(item: any): _StudentListResult { + return { + value: !item["value"] ? item["value"] : studentDetailsArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function studentDetailsArraySerializer(result: Array): any[] { + return result.map((item) => { + return studentDetailsSerializer(item); + }); +} + +export function studentDetailsArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return studentDetailsDeserializer(item); + }); +} + +/** Student lab details. */ +export interface StudentLabDetails extends ProxyResource { + /** Student lab Display Name */ + readonly displayName?: string; + /** Detail description of this lab */ + readonly description?: string; + /** Date the lab will expire and by default will be the expiration date for each student in this lab */ + readonly expirationDate?: Date; + /** Student Role */ + readonly role?: StudentRole; + /** Student Budget */ + readonly budget?: Amount; + /** Subscription Id */ + readonly subscriptionId?: string; + /** Student Lab Status */ + readonly status?: StudentLabStatus; + /** User Added Date */ + readonly effectiveDate?: Date; + /** Lab Scope. /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Education/labs/default */ + readonly labScope?: string; +} + +export function studentLabDetailsDeserializer(item: any): StudentLabDetails { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + ...(!item["properties"] + ? item["properties"] + : _studentLabDetailsPropertiesDeserializer(item["properties"])), + }; +} + +/** Student lab detail properties */ +export interface StudentLabProperties { + /** Student lab Display Name */ + readonly displayName?: string; + /** Detail description of this lab */ + readonly description?: string; + /** Date the lab will expire and by default will be the expiration date for each student in this lab */ + readonly expirationDate?: Date; + /** Student Role */ + readonly role?: StudentRole; + /** Student Budget */ + readonly budget?: Amount; + /** Subscription Id */ + readonly subscriptionId?: string; + /** Student Lab Status */ + readonly status?: StudentLabStatus; + /** User Added Date */ + readonly effectiveDate?: Date; + /** Lab Scope. /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Education/labs/default */ + readonly labScope?: string; +} + +export function studentLabPropertiesDeserializer(item: any): StudentLabProperties { + return { + displayName: item["displayName"], + description: item["description"], + expirationDate: !item["expirationDate"] + ? item["expirationDate"] + : new Date(item["expirationDate"]), + role: item["role"], + budget: !item["budget"] ? item["budget"] : amountDeserializer(item["budget"]), + subscriptionId: item["subscriptionId"], + status: item["status"], + effectiveDate: !item["effectiveDate"] ? item["effectiveDate"] : new Date(item["effectiveDate"]), + labScope: item["labScope"], + }; +} + +/** List of Student Labs info. */ +export interface _StudentLabListResult { + /** The StudentLabDetails items on this page. */ + readonly value?: StudentLabDetails[]; + /** The link to the next page of items. */ + nextLink?: string; +} + +export function _studentLabListResultDeserializer(item: any): _StudentLabListResult { + return { + value: !item["value"] ? item["value"] : studentLabDetailsArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function studentLabDetailsArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return studentLabDetailsDeserializer(item); + }); +} + +/** The available API versions. */ +export enum KnownVersions { + /** The 2021-12-01-preview API version. */ + V20211201Preview = "2021-12-01-preview", +} + +export function _grantDetailsPropertiesDeserializer(item: any) { + return { + offerCap: !item["offerCap"] ? item["offerCap"] : amountDeserializer(item["offerCap"]), + effectiveDate: !item["effectiveDate"] ? item["effectiveDate"] : new Date(item["effectiveDate"]), + offerType: item["offerType"], + expirationDate: !item["expirationDate"] + ? item["expirationDate"] + : new Date(item["expirationDate"]), + status: item["status"], + allocatedBudget: !item["allocatedBudget"] + ? item["allocatedBudget"] + : amountDeserializer(item["allocatedBudget"]), + }; +} + +export function _labPropertiesTotalBudgetSerializer(item: LabProperties): any { + return { currency: item["currency"], value: item["value"] }; +} + +export function _labPropertiesTotalBudgetDeserializer(item: any) { + return { + currency: item["currency"], + value: item["value"], + }; +} + +export function _labPropertiesTotalAllocatedBudgetSerializer(item: LabProperties): any { + return { + currency: item["currencyTotalAllocatedBudgetCurrency"], + value: item["valueTotalAllocatedBudgetValue"], + }; +} + +export function _labPropertiesTotalAllocatedBudgetDeserializer(item: any) { + return { + currencyTotalAllocatedBudgetCurrency: item["currency"], + valueTotalAllocatedBudgetValue: item["value"], + }; +} + +export function _labDetailsPropertiesSerializer(item: LabDetails): any { + return { + displayName: item["displayName"], + budgetPerStudent: !item["budgetPerStudent"] + ? item["budgetPerStudent"] + : amountSerializer(item["budgetPerStudent"]), + description: item["description"], + expirationDate: !item["expirationDate"] + ? item["expirationDate"] + : item["expirationDate"].toISOString(), + }; +} + +export function _labDetailsPropertiesDeserializer(item: any) { + return { + displayName: item["displayName"], + budgetPerStudent: !item["budgetPerStudent"] + ? item["budgetPerStudent"] + : amountDeserializer(item["budgetPerStudent"]), + description: item["description"], + expirationDate: !item["expirationDate"] + ? item["expirationDate"] + : new Date(item["expirationDate"]), + effectiveDate: !item["effectiveDate"] ? item["effectiveDate"] : new Date(item["effectiveDate"]), + status: item["status"], + maxStudentCount: item["maxStudentCount"], + invitationCode: item["invitationCode"], + totalBudget: !item["totalBudget"] + ? item["totalBudget"] + : amountDeserializer(item["totalBudget"]), + totalAllocatedBudget: !item["totalAllocatedBudget"] + ? item["totalAllocatedBudget"] + : amountDeserializer(item["totalAllocatedBudget"]), + }; +} + +export function _joinRequestDetailsPropertiesDeserializer(item: any) { + return { + firstName: item["firstName"], + lastName: item["lastName"], + email: item["email"], + status: item["status"], + }; +} + +export function _studentDetailsPropertiesSerializer(item: StudentDetails): any { + return { + firstName: item["firstName"], + lastName: item["lastName"], + email: item["email"], + role: item["role"], + budget: !item["budget"] ? item["budget"] : amountSerializer(item["budget"]), + expirationDate: !item["expirationDate"] + ? item["expirationDate"] + : item["expirationDate"].toISOString(), + subscriptionAlias: item["subscriptionAlias"], + subscriptionInviteLastSentDate: !item["subscriptionInviteLastSentDate"] + ? item["subscriptionInviteLastSentDate"] + : item["subscriptionInviteLastSentDate"].toISOString(), + }; +} + +export function _studentDetailsPropertiesDeserializer(item: any) { + return { + firstName: item["firstName"], + lastName: item["lastName"], + email: item["email"], + role: item["role"], + budget: !item["budget"] ? item["budget"] : amountDeserializer(item["budget"]), + subscriptionId: item["subscriptionId"], + expirationDate: !item["expirationDate"] + ? item["expirationDate"] + : new Date(item["expirationDate"]), + status: item["status"], + effectiveDate: !item["effectiveDate"] ? item["effectiveDate"] : new Date(item["effectiveDate"]), + subscriptionAlias: item["subscriptionAlias"], + subscriptionInviteLastSentDate: !item["subscriptionInviteLastSentDate"] + ? item["subscriptionInviteLastSentDate"] + : new Date(item["subscriptionInviteLastSentDate"]), + }; +} + +export function _studentLabDetailsPropertiesDeserializer(item: any) { + return { + displayName: item["displayName"], + description: item["description"], + expirationDate: !item["expirationDate"] + ? item["expirationDate"] + : new Date(item["expirationDate"]), + role: item["role"], + budget: !item["budget"] ? item["budget"] : amountDeserializer(item["budget"]), + subscriptionId: item["subscriptionId"], + status: item["status"], + effectiveDate: !item["effectiveDate"] ? item["effectiveDate"] : new Date(item["effectiveDate"]), + labScope: item["labScope"], + }; +} diff --git a/sdk/education/arm-education/src/models/parameters.ts b/sdk/education/arm-education/src/models/parameters.ts deleted file mode 100644 index dec580096aca..000000000000 --- a/sdk/education/arm-education/src/models/parameters.ts +++ /dev/null @@ -1,215 +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. - */ - -import { - OperationParameter, - OperationURLParameter, - OperationQueryParameter -} from "@azure/core-client"; -import { - LabDetails as LabDetailsMapper, - InviteCodeGenerateRequest as InviteCodeGenerateRequestMapper, - RedeemRequest as RedeemRequestMapper, - StudentDetails as StudentDetailsMapper -} from "../models/mappers.js"; - -export const accept: OperationParameter = { - parameterPath: "accept", - mapper: { - defaultValue: "application/json", - isConstant: true, - serializedName: "Accept", - type: { - name: "String" - } - } -}; - -export const $host: OperationURLParameter = { - parameterPath: "$host", - mapper: { - serializedName: "$host", - required: true, - type: { - name: "String" - } - }, - skipEncoding: true -}; - -export const apiVersion: OperationQueryParameter = { - parameterPath: "apiVersion", - mapper: { - defaultValue: "2021-12-01-preview", - isConstant: true, - serializedName: "api-version", - type: { - name: "String" - } - } -}; - -export const includeAllocatedBudget: OperationQueryParameter = { - parameterPath: ["options", "includeAllocatedBudget"], - mapper: { - serializedName: "includeAllocatedBudget", - type: { - name: "Boolean" - } - } -}; - -export const billingAccountName: OperationURLParameter = { - parameterPath: "billingAccountName", - mapper: { - serializedName: "billingAccountName", - required: true, - type: { - name: "String" - } - } -}; - -export const billingProfileName: OperationURLParameter = { - parameterPath: "billingProfileName", - mapper: { - serializedName: "billingProfileName", - required: true, - type: { - name: "String" - } - } -}; - -export const nextLink: OperationURLParameter = { - parameterPath: "nextLink", - mapper: { - serializedName: "nextLink", - required: true, - type: { - name: "String" - } - }, - skipEncoding: true -}; - -export const includeBudget: OperationQueryParameter = { - parameterPath: ["options", "includeBudget"], - mapper: { - serializedName: "includeBudget", - type: { - name: "Boolean" - } - } -}; - -export const includeDeleted: OperationQueryParameter = { - parameterPath: ["options", "includeDeleted"], - mapper: { - serializedName: "includeDeleted", - type: { - name: "Boolean" - } - } -}; - -export const invoiceSectionName: OperationURLParameter = { - parameterPath: "invoiceSectionName", - mapper: { - serializedName: "invoiceSectionName", - required: true, - type: { - name: "String" - } - } -}; - -export const contentType: OperationParameter = { - parameterPath: ["options", "contentType"], - mapper: { - defaultValue: "application/json", - isConstant: true, - serializedName: "Content-Type", - type: { - name: "String" - } - } -}; - -export const parameters: OperationParameter = { - parameterPath: "parameters", - mapper: LabDetailsMapper -}; - -export const parameters1: OperationParameter = { - parameterPath: "parameters", - mapper: InviteCodeGenerateRequestMapper -}; - -export const onlyUpdateStudentCountParameter: OperationQueryParameter = { - parameterPath: ["options", "onlyUpdateStudentCountParameter"], - mapper: { - serializedName: "onlyUpdateStudentCountParameter", - type: { - name: "Boolean" - } - } -}; - -export const includeDenied: OperationQueryParameter = { - parameterPath: ["options", "includeDenied"], - mapper: { - serializedName: "includeDenied", - type: { - name: "Boolean" - } - } -}; - -export const joinRequestName: OperationURLParameter = { - parameterPath: "joinRequestName", - mapper: { - serializedName: "joinRequestName", - required: true, - type: { - name: "String" - } - } -}; - -export const parameters2: OperationParameter = { - parameterPath: "parameters", - mapper: RedeemRequestMapper -}; - -export const studentAlias: OperationURLParameter = { - parameterPath: "studentAlias", - mapper: { - serializedName: "studentAlias", - required: true, - type: { - name: "String" - } - } -}; - -export const parameters3: OperationParameter = { - parameterPath: "parameters", - mapper: StudentDetailsMapper -}; - -export const studentLabName: OperationURLParameter = { - parameterPath: "studentLabName", - mapper: { - serializedName: "studentLabName", - required: true, - type: { - name: "String" - } - } -}; diff --git a/sdk/education/arm-education/src/operations/grants.ts b/sdk/education/arm-education/src/operations/grants.ts deleted file mode 100644 index 6de6789f3497..000000000000 --- a/sdk/education/arm-education/src/operations/grants.ts +++ /dev/null @@ -1,354 +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. - */ - -import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper.js"; -import { Grants } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import { EducationManagementClient } from "../educationManagementClient.js"; -import { - GrantDetails, - GrantsListAllNextOptionalParams, - GrantsListAllOptionalParams, - GrantsListAllResponse, - GrantsListNextOptionalParams, - GrantsListOptionalParams, - GrantsListResponse, - GrantsGetOptionalParams, - GrantsGetResponse, - GrantsListAllNextResponse, - GrantsListNextResponse -} from "../models/index.js"; - -/// -/** Class containing Grants operations. */ -export class GrantsImpl implements Grants { - private readonly client: EducationManagementClient; - - /** - * Initialize a new instance of the class Grants class. - * @param client Reference to the service client - */ - constructor(client: EducationManagementClient) { - this.client = client; - } - - /** - * Get a list of grants that Microsoft has provided. - * @param options The options parameters. - */ - public listAll( - options?: GrantsListAllOptionalParams - ): PagedAsyncIterableIterator { - const iter = this.listAllPagingAll(options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listAllPagingPage(options, settings); - } - }; - } - - private async *listAllPagingPage( - options?: GrantsListAllOptionalParams, - settings?: PageSettings - ): AsyncIterableIterator { - let result: GrantsListAllResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listAll(options); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listAllNext(continuationToken, options); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listAllPagingAll( - options?: GrantsListAllOptionalParams - ): AsyncIterableIterator { - for await (const page of this.listAllPagingPage(options)) { - yield* page; - } - } - - /** - * Get details for a specific grant linked to the provided billing account and billing profile. - * @param billingAccountName Billing account name. - * @param billingProfileName Billing profile name. - * @param options The options parameters. - */ - public list( - billingAccountName: string, - billingProfileName: string, - options?: GrantsListOptionalParams - ): PagedAsyncIterableIterator { - const iter = this.listPagingAll( - billingAccountName, - billingProfileName, - options - ); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listPagingPage( - billingAccountName, - billingProfileName, - options, - settings - ); - } - }; - } - - private async *listPagingPage( - billingAccountName: string, - billingProfileName: string, - options?: GrantsListOptionalParams, - settings?: PageSettings - ): AsyncIterableIterator { - let result: GrantsListResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._list( - billingAccountName, - billingProfileName, - options - ); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listNext( - billingAccountName, - billingProfileName, - continuationToken, - options - ); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listPagingAll( - billingAccountName: string, - billingProfileName: string, - options?: GrantsListOptionalParams - ): AsyncIterableIterator { - for await (const page of this.listPagingPage( - billingAccountName, - billingProfileName, - options - )) { - yield* page; - } - } - - /** - * Get a list of grants that Microsoft has provided. - * @param options The options parameters. - */ - private _listAll( - options?: GrantsListAllOptionalParams - ): Promise { - return this.client.sendOperationRequest({ options }, listAllOperationSpec); - } - - /** - * Get details for a specific grant linked to the provided billing account and billing profile. - * @param billingAccountName Billing account name. - * @param billingProfileName Billing profile name. - * @param options The options parameters. - */ - private _list( - billingAccountName: string, - billingProfileName: string, - options?: GrantsListOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { billingAccountName, billingProfileName, options }, - listOperationSpec - ); - } - - /** - * Get details for a specific grant linked to the provided billing account and billing profile. - * @param billingAccountName Billing account name. - * @param billingProfileName Billing profile name. - * @param options The options parameters. - */ - get( - billingAccountName: string, - billingProfileName: string, - options?: GrantsGetOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { billingAccountName, billingProfileName, options }, - getOperationSpec - ); - } - - /** - * ListAllNext - * @param nextLink The nextLink from the previous successful call to the ListAll method. - * @param options The options parameters. - */ - private _listAllNext( - nextLink: string, - options?: GrantsListAllNextOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { nextLink, options }, - listAllNextOperationSpec - ); - } - - /** - * ListNext - * @param billingAccountName Billing account name. - * @param billingProfileName Billing profile name. - * @param nextLink The nextLink from the previous successful call to the List method. - * @param options The options parameters. - */ - private _listNext( - billingAccountName: string, - billingProfileName: string, - nextLink: string, - options?: GrantsListNextOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { billingAccountName, billingProfileName, nextLink, options }, - listNextOperationSpec - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listAllOperationSpec: coreClient.OperationSpec = { - path: "/providers/Microsoft.Education/grants", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.GrantListResponse - }, - default: { - bodyMapper: Mappers.ErrorResponseBody - } - }, - queryParameters: [Parameters.apiVersion, Parameters.includeAllocatedBudget], - urlParameters: [Parameters.$host], - headerParameters: [Parameters.accept], - serializer -}; -const listOperationSpec: coreClient.OperationSpec = { - path: - "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.Education/grants", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.GrantListResponse - }, - default: { - bodyMapper: Mappers.ErrorResponseBody - } - }, - queryParameters: [Parameters.apiVersion, Parameters.includeAllocatedBudget], - urlParameters: [ - Parameters.$host, - Parameters.billingAccountName, - Parameters.billingProfileName - ], - headerParameters: [Parameters.accept], - serializer -}; -const getOperationSpec: coreClient.OperationSpec = { - path: - "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.Education/grants/default", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.GrantDetails - }, - default: { - bodyMapper: Mappers.ErrorResponseBody - } - }, - queryParameters: [Parameters.apiVersion, Parameters.includeAllocatedBudget], - urlParameters: [ - Parameters.$host, - Parameters.billingAccountName, - Parameters.billingProfileName - ], - headerParameters: [Parameters.accept], - serializer -}; -const listAllNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.GrantListResponse - }, - default: { - bodyMapper: Mappers.ErrorResponseBody - } - }, - urlParameters: [Parameters.$host, Parameters.nextLink], - headerParameters: [Parameters.accept], - serializer -}; -const listNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.GrantListResponse - }, - default: { - bodyMapper: Mappers.ErrorResponseBody - } - }, - urlParameters: [ - Parameters.$host, - Parameters.billingAccountName, - Parameters.billingProfileName, - Parameters.nextLink - ], - headerParameters: [Parameters.accept], - serializer -}; diff --git a/sdk/education/arm-education/src/operations/index.ts b/sdk/education/arm-education/src/operations/index.ts deleted file mode 100644 index 3ca857312f5c..000000000000 --- a/sdk/education/arm-education/src/operations/index.ts +++ /dev/null @@ -1,14 +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. - */ - -export * from "./operations.js"; -export * from "./grants.js"; -export * from "./labs.js"; -export * from "./joinRequests.js"; -export * from "./students.js"; -export * from "./studentLabs.js"; diff --git a/sdk/education/arm-education/src/operations/joinRequests.ts b/sdk/education/arm-education/src/operations/joinRequests.ts deleted file mode 100644 index 498df9600792..000000000000 --- a/sdk/education/arm-education/src/operations/joinRequests.ts +++ /dev/null @@ -1,371 +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. - */ - -import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper.js"; -import { JoinRequests } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import { EducationManagementClient } from "../educationManagementClient.js"; -import { - JoinRequestDetails, - JoinRequestsListNextOptionalParams, - JoinRequestsListOptionalParams, - JoinRequestsListResponse, - JoinRequestsGetOptionalParams, - JoinRequestsGetResponse, - JoinRequestsApproveOptionalParams, - JoinRequestsDenyOptionalParams, - JoinRequestsListNextResponse -} from "../models/index.js"; - -/// -/** Class containing JoinRequests operations. */ -export class JoinRequestsImpl implements JoinRequests { - private readonly client: EducationManagementClient; - - /** - * Initialize a new instance of the class JoinRequests class. - * @param client Reference to the service client - */ - constructor(client: EducationManagementClient) { - this.client = client; - } - - /** - * get student join requests - * @param billingAccountName Billing account name. - * @param billingProfileName Billing profile name. - * @param invoiceSectionName Invoice section name. - * @param options The options parameters. - */ - public list( - billingAccountName: string, - billingProfileName: string, - invoiceSectionName: string, - options?: JoinRequestsListOptionalParams - ): PagedAsyncIterableIterator { - const iter = this.listPagingAll( - billingAccountName, - billingProfileName, - invoiceSectionName, - options - ); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listPagingPage( - billingAccountName, - billingProfileName, - invoiceSectionName, - options, - settings - ); - } - }; - } - - private async *listPagingPage( - billingAccountName: string, - billingProfileName: string, - invoiceSectionName: string, - options?: JoinRequestsListOptionalParams, - settings?: PageSettings - ): AsyncIterableIterator { - let result: JoinRequestsListResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._list( - billingAccountName, - billingProfileName, - invoiceSectionName, - options - ); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listNext( - billingAccountName, - billingProfileName, - invoiceSectionName, - continuationToken, - options - ); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listPagingAll( - billingAccountName: string, - billingProfileName: string, - invoiceSectionName: string, - options?: JoinRequestsListOptionalParams - ): AsyncIterableIterator { - for await (const page of this.listPagingPage( - billingAccountName, - billingProfileName, - invoiceSectionName, - options - )) { - yield* page; - } - } - - /** - * get student join requests - * @param billingAccountName Billing account name. - * @param billingProfileName Billing profile name. - * @param invoiceSectionName Invoice section name. - * @param options The options parameters. - */ - private _list( - billingAccountName: string, - billingProfileName: string, - invoiceSectionName: string, - options?: JoinRequestsListOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { billingAccountName, billingProfileName, invoiceSectionName, options }, - listOperationSpec - ); - } - - /** - * get student join requests - * @param billingAccountName Billing account name. - * @param billingProfileName Billing profile name. - * @param invoiceSectionName Invoice section name. - * @param joinRequestName Join name - * @param options The options parameters. - */ - get( - billingAccountName: string, - billingProfileName: string, - invoiceSectionName: string, - joinRequestName: string, - options?: JoinRequestsGetOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { - billingAccountName, - billingProfileName, - invoiceSectionName, - joinRequestName, - options - }, - getOperationSpec - ); - } - - /** - * Approve student joining the redeemable lab - * @param billingAccountName Billing account name. - * @param billingProfileName Billing profile name. - * @param invoiceSectionName Invoice section name. - * @param joinRequestName Join name - * @param options The options parameters. - */ - approve( - billingAccountName: string, - billingProfileName: string, - invoiceSectionName: string, - joinRequestName: string, - options?: JoinRequestsApproveOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { - billingAccountName, - billingProfileName, - invoiceSectionName, - joinRequestName, - options - }, - approveOperationSpec - ); - } - - /** - * Deny student joining the redeemable lab - * @param billingAccountName Billing account name. - * @param billingProfileName Billing profile name. - * @param invoiceSectionName Invoice section name. - * @param joinRequestName Join name - * @param options The options parameters. - */ - deny( - billingAccountName: string, - billingProfileName: string, - invoiceSectionName: string, - joinRequestName: string, - options?: JoinRequestsDenyOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { - billingAccountName, - billingProfileName, - invoiceSectionName, - joinRequestName, - options - }, - denyOperationSpec - ); - } - - /** - * ListNext - * @param billingAccountName Billing account name. - * @param billingProfileName Billing profile name. - * @param invoiceSectionName Invoice section name. - * @param nextLink The nextLink from the previous successful call to the List method. - * @param options The options parameters. - */ - private _listNext( - billingAccountName: string, - billingProfileName: string, - invoiceSectionName: string, - nextLink: string, - options?: JoinRequestsListNextOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { - billingAccountName, - billingProfileName, - invoiceSectionName, - nextLink, - options - }, - listNextOperationSpec - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listOperationSpec: coreClient.OperationSpec = { - path: - "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Education/labs/default/joinRequests", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.JoinRequestList - }, - default: { - bodyMapper: Mappers.ErrorResponseBody - } - }, - queryParameters: [Parameters.apiVersion, Parameters.includeDenied], - urlParameters: [ - Parameters.$host, - Parameters.billingAccountName, - Parameters.billingProfileName, - Parameters.invoiceSectionName - ], - headerParameters: [Parameters.accept], - serializer -}; -const getOperationSpec: coreClient.OperationSpec = { - path: - "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Education/labs/default/joinRequests/{joinRequestName}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.JoinRequestDetails - }, - default: { - bodyMapper: Mappers.ErrorResponseBody - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.billingAccountName, - Parameters.billingProfileName, - Parameters.invoiceSectionName, - Parameters.joinRequestName - ], - headerParameters: [Parameters.accept], - serializer -}; -const approveOperationSpec: coreClient.OperationSpec = { - path: - "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Education/labs/default/joinRequests/{joinRequestName}/approve", - httpMethod: "POST", - responses: { - 200: {}, - default: { - bodyMapper: Mappers.ErrorResponseBody - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.billingAccountName, - Parameters.billingProfileName, - Parameters.invoiceSectionName, - Parameters.joinRequestName - ], - headerParameters: [Parameters.accept], - serializer -}; -const denyOperationSpec: coreClient.OperationSpec = { - path: - "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Education/labs/default/joinRequests/{joinRequestName}/deny", - httpMethod: "POST", - responses: { - 200: {}, - default: { - bodyMapper: Mappers.ErrorResponseBody - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.billingAccountName, - Parameters.billingProfileName, - Parameters.invoiceSectionName, - Parameters.joinRequestName - ], - headerParameters: [Parameters.accept], - serializer -}; -const listNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.JoinRequestList - }, - default: { - bodyMapper: Mappers.ErrorResponseBody - } - }, - urlParameters: [ - Parameters.$host, - Parameters.billingAccountName, - Parameters.billingProfileName, - Parameters.nextLink, - Parameters.invoiceSectionName - ], - headerParameters: [Parameters.accept], - serializer -}; diff --git a/sdk/education/arm-education/src/operations/labs.ts b/sdk/education/arm-education/src/operations/labs.ts deleted file mode 100644 index 577b722735aa..000000000000 --- a/sdk/education/arm-education/src/operations/labs.ts +++ /dev/null @@ -1,591 +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. - */ - -import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper.js"; -import { Labs } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import { EducationManagementClient } from "../educationManagementClient.js"; -import { - LabDetails, - LabsListAllNextOptionalParams, - LabsListAllOptionalParams, - LabsListAllResponse, - LabsListNextOptionalParams, - LabsListOptionalParams, - LabsListResponse, - LabsGetOptionalParams, - LabsGetResponse, - LabsDeleteOptionalParams, - LabsCreateOrUpdateOptionalParams, - LabsCreateOrUpdateResponse, - InviteCodeGenerateRequest, - LabsGenerateInviteCodeOptionalParams, - LabsGenerateInviteCodeResponse, - LabsListAllNextResponse, - LabsListNextResponse -} from "../models/index.js"; - -/// -/** Class containing Labs operations. */ -export class LabsImpl implements Labs { - private readonly client: EducationManagementClient; - - /** - * Initialize a new instance of the class Labs class. - * @param client Reference to the service client - */ - constructor(client: EducationManagementClient) { - this.client = client; - } - - /** - * Get a list of labs associated with the provided billing account name and billing profile name. - * @param billingAccountName Billing account name. - * @param billingProfileName Billing profile name. - * @param options The options parameters. - */ - public listAll( - billingAccountName: string, - billingProfileName: string, - options?: LabsListAllOptionalParams - ): PagedAsyncIterableIterator { - const iter = this.listAllPagingAll( - billingAccountName, - billingProfileName, - options - ); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listAllPagingPage( - billingAccountName, - billingProfileName, - options, - settings - ); - } - }; - } - - private async *listAllPagingPage( - billingAccountName: string, - billingProfileName: string, - options?: LabsListAllOptionalParams, - settings?: PageSettings - ): AsyncIterableIterator { - let result: LabsListAllResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listAll( - billingAccountName, - billingProfileName, - options - ); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listAllNext( - billingAccountName, - billingProfileName, - continuationToken, - options - ); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listAllPagingAll( - billingAccountName: string, - billingProfileName: string, - options?: LabsListAllOptionalParams - ): AsyncIterableIterator { - for await (const page of this.listAllPagingPage( - billingAccountName, - billingProfileName, - options - )) { - yield* page; - } - } - - /** - * Get the details for a specific lab associated with the provided billing account name, billing - * profile name, and invoice section name. - * @param billingAccountName Billing account name. - * @param billingProfileName Billing profile name. - * @param invoiceSectionName Invoice section name. - * @param options The options parameters. - */ - public list( - billingAccountName: string, - billingProfileName: string, - invoiceSectionName: string, - options?: LabsListOptionalParams - ): PagedAsyncIterableIterator { - const iter = this.listPagingAll( - billingAccountName, - billingProfileName, - invoiceSectionName, - options - ); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listPagingPage( - billingAccountName, - billingProfileName, - invoiceSectionName, - options, - settings - ); - } - }; - } - - private async *listPagingPage( - billingAccountName: string, - billingProfileName: string, - invoiceSectionName: string, - options?: LabsListOptionalParams, - settings?: PageSettings - ): AsyncIterableIterator { - let result: LabsListResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._list( - billingAccountName, - billingProfileName, - invoiceSectionName, - options - ); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listNext( - billingAccountName, - billingProfileName, - invoiceSectionName, - continuationToken, - options - ); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listPagingAll( - billingAccountName: string, - billingProfileName: string, - invoiceSectionName: string, - options?: LabsListOptionalParams - ): AsyncIterableIterator { - for await (const page of this.listPagingPage( - billingAccountName, - billingProfileName, - invoiceSectionName, - options - )) { - yield* page; - } - } - - /** - * Get a list of labs associated with the provided billing account name and billing profile name. - * @param billingAccountName Billing account name. - * @param billingProfileName Billing profile name. - * @param options The options parameters. - */ - private _listAll( - billingAccountName: string, - billingProfileName: string, - options?: LabsListAllOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { billingAccountName, billingProfileName, options }, - listAllOperationSpec - ); - } - - /** - * Get the details for a specific lab associated with the provided billing account name, billing - * profile name, and invoice section name. - * @param billingAccountName Billing account name. - * @param billingProfileName Billing profile name. - * @param invoiceSectionName Invoice section name. - * @param options The options parameters. - */ - private _list( - billingAccountName: string, - billingProfileName: string, - invoiceSectionName: string, - options?: LabsListOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { billingAccountName, billingProfileName, invoiceSectionName, options }, - listOperationSpec - ); - } - - /** - * Get the details for a specific lab associated with the provided billing account name, billing - * profile name, and invoice section name. - * @param billingAccountName Billing account name. - * @param billingProfileName Billing profile name. - * @param invoiceSectionName Invoice section name. - * @param options The options parameters. - */ - get( - billingAccountName: string, - billingProfileName: string, - invoiceSectionName: string, - options?: LabsGetOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { billingAccountName, billingProfileName, invoiceSectionName, options }, - getOperationSpec - ); - } - - /** - * Delete a specific lab associated with the provided billing account name, billing profile name, and - * invoice section name. Note all students must be removed from the lab in order to delete the lab. - * @param billingAccountName Billing account name. - * @param billingProfileName Billing profile name. - * @param invoiceSectionName Invoice section name. - * @param options The options parameters. - */ - delete( - billingAccountName: string, - billingProfileName: string, - invoiceSectionName: string, - options?: LabsDeleteOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { billingAccountName, billingProfileName, invoiceSectionName, options }, - deleteOperationSpec - ); - } - - /** - * Create a new lab or update a previously created lab. - * @param billingAccountName Billing account name. - * @param billingProfileName Billing profile name. - * @param invoiceSectionName Invoice section name. - * @param parameters Request parameters that are provided to create lab resource. - * @param options The options parameters. - */ - createOrUpdate( - billingAccountName: string, - billingProfileName: string, - invoiceSectionName: string, - parameters: LabDetails, - options?: LabsCreateOrUpdateOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { - billingAccountName, - billingProfileName, - invoiceSectionName, - parameters, - options - }, - createOrUpdateOperationSpec - ); - } - - /** - * Generate invite code for a lab - * @param billingAccountName Billing account name. - * @param billingProfileName Billing profile name. - * @param invoiceSectionName Invoice section name. - * @param parameters Request parameters that are provided to generate invite code. - * @param options The options parameters. - */ - generateInviteCode( - billingAccountName: string, - billingProfileName: string, - invoiceSectionName: string, - parameters: InviteCodeGenerateRequest, - options?: LabsGenerateInviteCodeOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { - billingAccountName, - billingProfileName, - invoiceSectionName, - parameters, - options - }, - generateInviteCodeOperationSpec - ); - } - - /** - * ListAllNext - * @param billingAccountName Billing account name. - * @param billingProfileName Billing profile name. - * @param nextLink The nextLink from the previous successful call to the ListAll method. - * @param options The options parameters. - */ - private _listAllNext( - billingAccountName: string, - billingProfileName: string, - nextLink: string, - options?: LabsListAllNextOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { billingAccountName, billingProfileName, nextLink, options }, - listAllNextOperationSpec - ); - } - - /** - * ListNext - * @param billingAccountName Billing account name. - * @param billingProfileName Billing profile name. - * @param invoiceSectionName Invoice section name. - * @param nextLink The nextLink from the previous successful call to the List method. - * @param options The options parameters. - */ - private _listNext( - billingAccountName: string, - billingProfileName: string, - invoiceSectionName: string, - nextLink: string, - options?: LabsListNextOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { - billingAccountName, - billingProfileName, - invoiceSectionName, - nextLink, - options - }, - listNextOperationSpec - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listAllOperationSpec: coreClient.OperationSpec = { - path: - "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.Education/labs", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.LabListResult - }, - default: { - bodyMapper: Mappers.ErrorResponseBody - } - }, - queryParameters: [ - Parameters.apiVersion, - Parameters.includeBudget, - Parameters.includeDeleted - ], - urlParameters: [ - Parameters.$host, - Parameters.billingAccountName, - Parameters.billingProfileName - ], - headerParameters: [Parameters.accept], - serializer -}; -const listOperationSpec: coreClient.OperationSpec = { - path: - "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Education/labs", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.LabListResult - }, - default: { - bodyMapper: Mappers.ErrorResponseBody - } - }, - queryParameters: [Parameters.apiVersion, Parameters.includeBudget], - urlParameters: [ - Parameters.$host, - Parameters.billingAccountName, - Parameters.billingProfileName, - Parameters.invoiceSectionName - ], - headerParameters: [Parameters.accept], - serializer -}; -const getOperationSpec: coreClient.OperationSpec = { - path: - "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Education/labs/default", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.LabDetails - }, - default: { - bodyMapper: Mappers.ErrorResponseBody - } - }, - queryParameters: [Parameters.apiVersion, Parameters.includeBudget], - urlParameters: [ - Parameters.$host, - Parameters.billingAccountName, - Parameters.billingProfileName, - Parameters.invoiceSectionName - ], - headerParameters: [Parameters.accept], - serializer -}; -const deleteOperationSpec: coreClient.OperationSpec = { - path: - "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Education/labs/default", - httpMethod: "DELETE", - responses: { - 200: {}, - 204: {}, - default: { - bodyMapper: Mappers.ErrorResponseBody - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.billingAccountName, - Parameters.billingProfileName, - Parameters.invoiceSectionName - ], - headerParameters: [Parameters.accept], - serializer -}; -const createOrUpdateOperationSpec: coreClient.OperationSpec = { - path: - "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Education/labs/default", - httpMethod: "PUT", - responses: { - 200: { - bodyMapper: Mappers.LabDetails - }, - 201: { - bodyMapper: Mappers.LabDetails - }, - default: { - bodyMapper: Mappers.ErrorResponseBody - } - }, - requestBody: Parameters.parameters, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.billingAccountName, - Parameters.billingProfileName, - Parameters.invoiceSectionName - ], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer -}; -const generateInviteCodeOperationSpec: coreClient.OperationSpec = { - path: - "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Education/labs/default/generateInviteCode", - httpMethod: "POST", - responses: { - 200: { - bodyMapper: Mappers.LabDetails - }, - default: { - bodyMapper: Mappers.ErrorResponseBody - } - }, - requestBody: Parameters.parameters1, - queryParameters: [ - Parameters.apiVersion, - Parameters.onlyUpdateStudentCountParameter - ], - urlParameters: [ - Parameters.$host, - Parameters.billingAccountName, - Parameters.billingProfileName, - Parameters.invoiceSectionName - ], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer -}; -const listAllNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.LabListResult - }, - default: { - bodyMapper: Mappers.ErrorResponseBody - } - }, - urlParameters: [ - Parameters.$host, - Parameters.billingAccountName, - Parameters.billingProfileName, - Parameters.nextLink - ], - headerParameters: [Parameters.accept], - serializer -}; -const listNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.LabListResult - }, - default: { - bodyMapper: Mappers.ErrorResponseBody - } - }, - urlParameters: [ - Parameters.$host, - Parameters.billingAccountName, - Parameters.billingProfileName, - Parameters.nextLink, - Parameters.invoiceSectionName - ], - headerParameters: [Parameters.accept], - serializer -}; diff --git a/sdk/education/arm-education/src/operations/operations.ts b/sdk/education/arm-education/src/operations/operations.ts deleted file mode 100644 index e2e2c5cb608d..000000000000 --- a/sdk/education/arm-education/src/operations/operations.ts +++ /dev/null @@ -1,59 +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. - */ - -import { Operations } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import { EducationManagementClient } from "../educationManagementClient.js"; -import { - OperationsListOptionalParams, - OperationsListResponse -} from "../models/index.js"; - -/** Class containing Operations operations. */ -export class OperationsImpl implements Operations { - private readonly client: EducationManagementClient; - - /** - * Initialize a new instance of the class Operations class. - * @param client Reference to the service client - */ - constructor(client: EducationManagementClient) { - this.client = client; - } - - /** - * Lists all of the available Microsoft.Education API operations. - * @param options The options parameters. - */ - list( - options?: OperationsListOptionalParams - ): Promise { - return this.client.sendOperationRequest({ options }, listOperationSpec); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listOperationSpec: coreClient.OperationSpec = { - path: "/providers/Microsoft.Education/operations", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.OperationListResult - }, - default: { - bodyMapper: Mappers.ErrorResponseBody - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host], - headerParameters: [Parameters.accept], - serializer -}; diff --git a/sdk/education/arm-education/src/operations/studentLabs.ts b/sdk/education/arm-education/src/operations/studentLabs.ts deleted file mode 100644 index a318324f8cfd..000000000000 --- a/sdk/education/arm-education/src/operations/studentLabs.ts +++ /dev/null @@ -1,182 +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. - */ - -import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper.js"; -import { StudentLabs } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import { EducationManagementClient } from "../educationManagementClient.js"; -import { - StudentLabDetails, - StudentLabsListAllNextOptionalParams, - StudentLabsListAllOptionalParams, - StudentLabsListAllResponse, - StudentLabsGetOptionalParams, - StudentLabsGetResponse, - StudentLabsListAllNextResponse -} from "../models/index.js"; - -/// -/** Class containing StudentLabs operations. */ -export class StudentLabsImpl implements StudentLabs { - private readonly client: EducationManagementClient; - - /** - * Initialize a new instance of the class StudentLabs class. - * @param client Reference to the service client - */ - constructor(client: EducationManagementClient) { - this.client = client; - } - - /** - * Get a list of all labs associated with the caller of the API. - * @param options The options parameters. - */ - public listAll( - options?: StudentLabsListAllOptionalParams - ): PagedAsyncIterableIterator { - const iter = this.listAllPagingAll(options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listAllPagingPage(options, settings); - } - }; - } - - private async *listAllPagingPage( - options?: StudentLabsListAllOptionalParams, - settings?: PageSettings - ): AsyncIterableIterator { - let result: StudentLabsListAllResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listAll(options); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listAllNext(continuationToken, options); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listAllPagingAll( - options?: StudentLabsListAllOptionalParams - ): AsyncIterableIterator { - for await (const page of this.listAllPagingPage(options)) { - yield* page; - } - } - - /** - * Get a list of all labs associated with the caller of the API. - * @param options The options parameters. - */ - private _listAll( - options?: StudentLabsListAllOptionalParams - ): Promise { - return this.client.sendOperationRequest({ options }, listAllOperationSpec); - } - - /** - * Get the details for a specified lab associated with the student lab. - * @param studentLabName Student lab name. - * @param options The options parameters. - */ - get( - studentLabName: string, - options?: StudentLabsGetOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { studentLabName, options }, - getOperationSpec - ); - } - - /** - * ListAllNext - * @param nextLink The nextLink from the previous successful call to the ListAll method. - * @param options The options parameters. - */ - private _listAllNext( - nextLink: string, - options?: StudentLabsListAllNextOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { nextLink, options }, - listAllNextOperationSpec - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listAllOperationSpec: coreClient.OperationSpec = { - path: "/providers/Microsoft.Education/studentLabs", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.StudentLabListResult - }, - default: { - bodyMapper: Mappers.ErrorResponseBody - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host], - headerParameters: [Parameters.accept], - serializer -}; -const getOperationSpec: coreClient.OperationSpec = { - path: "/providers/Microsoft.Education/studentLabs/{studentLabName}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.StudentLabDetails - }, - default: { - bodyMapper: Mappers.ErrorResponseBody - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.studentLabName], - headerParameters: [Parameters.accept], - serializer -}; -const listAllNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.StudentLabListResult - }, - default: { - bodyMapper: Mappers.ErrorResponseBody - } - }, - urlParameters: [Parameters.$host, Parameters.nextLink], - headerParameters: [Parameters.accept], - serializer -}; diff --git a/sdk/education/arm-education/src/operations/students.ts b/sdk/education/arm-education/src/operations/students.ts deleted file mode 100644 index 6d1277300456..000000000000 --- a/sdk/education/arm-education/src/operations/students.ts +++ /dev/null @@ -1,384 +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. - */ - -import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper.js"; -import { Students } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import { EducationManagementClient } from "../educationManagementClient.js"; -import { - StudentDetails, - StudentsListNextOptionalParams, - StudentsListOptionalParams, - StudentsListResponse, - StudentsGetOptionalParams, - StudentsGetResponse, - StudentsDeleteOptionalParams, - StudentsCreateOrUpdateOptionalParams, - StudentsCreateOrUpdateResponse, - StudentsListNextResponse -} from "../models/index.js"; - -/// -/** Class containing Students operations. */ -export class StudentsImpl implements Students { - private readonly client: EducationManagementClient; - - /** - * Initialize a new instance of the class Students class. - * @param client Reference to the service client - */ - constructor(client: EducationManagementClient) { - this.client = client; - } - - /** - * Get a list of details about students that are associated with the specified lab. - * @param billingAccountName Billing account name. - * @param billingProfileName Billing profile name. - * @param invoiceSectionName Invoice section name. - * @param options The options parameters. - */ - public list( - billingAccountName: string, - billingProfileName: string, - invoiceSectionName: string, - options?: StudentsListOptionalParams - ): PagedAsyncIterableIterator { - const iter = this.listPagingAll( - billingAccountName, - billingProfileName, - invoiceSectionName, - options - ); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listPagingPage( - billingAccountName, - billingProfileName, - invoiceSectionName, - options, - settings - ); - } - }; - } - - private async *listPagingPage( - billingAccountName: string, - billingProfileName: string, - invoiceSectionName: string, - options?: StudentsListOptionalParams, - settings?: PageSettings - ): AsyncIterableIterator { - let result: StudentsListResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._list( - billingAccountName, - billingProfileName, - invoiceSectionName, - options - ); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listNext( - billingAccountName, - billingProfileName, - invoiceSectionName, - continuationToken, - options - ); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listPagingAll( - billingAccountName: string, - billingProfileName: string, - invoiceSectionName: string, - options?: StudentsListOptionalParams - ): AsyncIterableIterator { - for await (const page of this.listPagingPage( - billingAccountName, - billingProfileName, - invoiceSectionName, - options - )) { - yield* page; - } - } - - /** - * Get a list of details about students that are associated with the specified lab. - * @param billingAccountName Billing account name. - * @param billingProfileName Billing profile name. - * @param invoiceSectionName Invoice section name. - * @param options The options parameters. - */ - private _list( - billingAccountName: string, - billingProfileName: string, - invoiceSectionName: string, - options?: StudentsListOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { billingAccountName, billingProfileName, invoiceSectionName, options }, - listOperationSpec - ); - } - - /** - * Get the details for a specific student in the specified lab by student alias - * @param billingAccountName Billing account name. - * @param billingProfileName Billing profile name. - * @param invoiceSectionName Invoice section name. - * @param studentAlias Student alias. - * @param options The options parameters. - */ - get( - billingAccountName: string, - billingProfileName: string, - invoiceSectionName: string, - studentAlias: string, - options?: StudentsGetOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { - billingAccountName, - billingProfileName, - invoiceSectionName, - studentAlias, - options - }, - getOperationSpec - ); - } - - /** - * Delete the specified student based on the student alias. - * @param billingAccountName Billing account name. - * @param billingProfileName Billing profile name. - * @param invoiceSectionName Invoice section name. - * @param studentAlias Student alias. - * @param options The options parameters. - */ - delete( - billingAccountName: string, - billingProfileName: string, - invoiceSectionName: string, - studentAlias: string, - options?: StudentsDeleteOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { - billingAccountName, - billingProfileName, - invoiceSectionName, - studentAlias, - options - }, - deleteOperationSpec - ); - } - - /** - * Create and add a new student to the specified lab or update the details of an existing student in a - * lab. Note the student must have a valid tenant to accept the lab after they have been added to lab. - * @param billingAccountName Billing account name. - * @param billingProfileName Billing profile name. - * @param invoiceSectionName Invoice section name. - * @param studentAlias Student alias. - * @param parameters Request parameters that are provided to update student properties. - * @param options The options parameters. - */ - createOrUpdate( - billingAccountName: string, - billingProfileName: string, - invoiceSectionName: string, - studentAlias: string, - parameters: StudentDetails, - options?: StudentsCreateOrUpdateOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { - billingAccountName, - billingProfileName, - invoiceSectionName, - studentAlias, - parameters, - options - }, - createOrUpdateOperationSpec - ); - } - - /** - * ListNext - * @param billingAccountName Billing account name. - * @param billingProfileName Billing profile name. - * @param invoiceSectionName Invoice section name. - * @param nextLink The nextLink from the previous successful call to the List method. - * @param options The options parameters. - */ - private _listNext( - billingAccountName: string, - billingProfileName: string, - invoiceSectionName: string, - nextLink: string, - options?: StudentsListNextOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { - billingAccountName, - billingProfileName, - invoiceSectionName, - nextLink, - options - }, - listNextOperationSpec - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listOperationSpec: coreClient.OperationSpec = { - path: - "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Education/labs/default/students", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.StudentListResult - }, - default: { - bodyMapper: Mappers.ErrorResponseBody - } - }, - queryParameters: [Parameters.apiVersion, Parameters.includeDeleted], - urlParameters: [ - Parameters.$host, - Parameters.billingAccountName, - Parameters.billingProfileName, - Parameters.invoiceSectionName - ], - headerParameters: [Parameters.accept], - serializer -}; -const getOperationSpec: coreClient.OperationSpec = { - path: - "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Education/labs/default/students/{studentAlias}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.StudentDetails - }, - default: { - bodyMapper: Mappers.ErrorResponseBody - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.billingAccountName, - Parameters.billingProfileName, - Parameters.invoiceSectionName, - Parameters.studentAlias - ], - headerParameters: [Parameters.accept], - serializer -}; -const deleteOperationSpec: coreClient.OperationSpec = { - path: - "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Education/labs/default/students/{studentAlias}", - httpMethod: "DELETE", - responses: { - 200: {}, - 204: {}, - default: { - bodyMapper: Mappers.ErrorResponseBody - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.billingAccountName, - Parameters.billingProfileName, - Parameters.invoiceSectionName, - Parameters.studentAlias - ], - headerParameters: [Parameters.accept], - serializer -}; -const createOrUpdateOperationSpec: coreClient.OperationSpec = { - path: - "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Education/labs/default/students/{studentAlias}", - httpMethod: "PUT", - responses: { - 200: { - bodyMapper: Mappers.StudentDetails - }, - 201: { - bodyMapper: Mappers.StudentDetails - }, - default: { - bodyMapper: Mappers.ErrorResponseBody - } - }, - requestBody: Parameters.parameters3, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.billingAccountName, - Parameters.billingProfileName, - Parameters.invoiceSectionName, - Parameters.studentAlias - ], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer -}; -const listNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.StudentListResult - }, - default: { - bodyMapper: Mappers.ErrorResponseBody - } - }, - urlParameters: [ - Parameters.$host, - Parameters.billingAccountName, - Parameters.billingProfileName, - Parameters.nextLink, - Parameters.invoiceSectionName - ], - headerParameters: [Parameters.accept], - serializer -}; diff --git a/sdk/education/arm-education/src/operationsInterfaces/grants.ts b/sdk/education/arm-education/src/operationsInterfaces/grants.ts deleted file mode 100644 index c9d6af5dc93c..000000000000 --- a/sdk/education/arm-education/src/operationsInterfaces/grants.ts +++ /dev/null @@ -1,50 +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. - */ - -import { PagedAsyncIterableIterator } from "@azure/core-paging"; -import { - GrantDetails, - GrantsListAllOptionalParams, - GrantsListOptionalParams, - GrantsGetOptionalParams, - GrantsGetResponse -} from "../models/index.js"; - -/// -/** Interface representing a Grants. */ -export interface Grants { - /** - * Get a list of grants that Microsoft has provided. - * @param options The options parameters. - */ - listAll( - options?: GrantsListAllOptionalParams - ): PagedAsyncIterableIterator; - /** - * Get details for a specific grant linked to the provided billing account and billing profile. - * @param billingAccountName Billing account name. - * @param billingProfileName Billing profile name. - * @param options The options parameters. - */ - list( - billingAccountName: string, - billingProfileName: string, - options?: GrantsListOptionalParams - ): PagedAsyncIterableIterator; - /** - * Get details for a specific grant linked to the provided billing account and billing profile. - * @param billingAccountName Billing account name. - * @param billingProfileName Billing profile name. - * @param options The options parameters. - */ - get( - billingAccountName: string, - billingProfileName: string, - options?: GrantsGetOptionalParams - ): Promise; -} diff --git a/sdk/education/arm-education/src/operationsInterfaces/index.ts b/sdk/education/arm-education/src/operationsInterfaces/index.ts deleted file mode 100644 index 3ca857312f5c..000000000000 --- a/sdk/education/arm-education/src/operationsInterfaces/index.ts +++ /dev/null @@ -1,14 +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. - */ - -export * from "./operations.js"; -export * from "./grants.js"; -export * from "./labs.js"; -export * from "./joinRequests.js"; -export * from "./students.js"; -export * from "./studentLabs.js"; diff --git a/sdk/education/arm-education/src/operationsInterfaces/joinRequests.ts b/sdk/education/arm-education/src/operationsInterfaces/joinRequests.ts deleted file mode 100644 index 1ec85d8c3227..000000000000 --- a/sdk/education/arm-education/src/operationsInterfaces/joinRequests.ts +++ /dev/null @@ -1,80 +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. - */ - -import { PagedAsyncIterableIterator } from "@azure/core-paging"; -import { - JoinRequestDetails, - JoinRequestsListOptionalParams, - JoinRequestsGetOptionalParams, - JoinRequestsGetResponse, - JoinRequestsApproveOptionalParams, - JoinRequestsDenyOptionalParams -} from "../models/index.js"; - -/// -/** Interface representing a JoinRequests. */ -export interface JoinRequests { - /** - * get student join requests - * @param billingAccountName Billing account name. - * @param billingProfileName Billing profile name. - * @param invoiceSectionName Invoice section name. - * @param options The options parameters. - */ - list( - billingAccountName: string, - billingProfileName: string, - invoiceSectionName: string, - options?: JoinRequestsListOptionalParams - ): PagedAsyncIterableIterator; - /** - * get student join requests - * @param billingAccountName Billing account name. - * @param billingProfileName Billing profile name. - * @param invoiceSectionName Invoice section name. - * @param joinRequestName Join name - * @param options The options parameters. - */ - get( - billingAccountName: string, - billingProfileName: string, - invoiceSectionName: string, - joinRequestName: string, - options?: JoinRequestsGetOptionalParams - ): Promise; - /** - * Approve student joining the redeemable lab - * @param billingAccountName Billing account name. - * @param billingProfileName Billing profile name. - * @param invoiceSectionName Invoice section name. - * @param joinRequestName Join name - * @param options The options parameters. - */ - approve( - billingAccountName: string, - billingProfileName: string, - invoiceSectionName: string, - joinRequestName: string, - options?: JoinRequestsApproveOptionalParams - ): Promise; - /** - * Deny student joining the redeemable lab - * @param billingAccountName Billing account name. - * @param billingProfileName Billing profile name. - * @param invoiceSectionName Invoice section name. - * @param joinRequestName Join name - * @param options The options parameters. - */ - deny( - billingAccountName: string, - billingProfileName: string, - invoiceSectionName: string, - joinRequestName: string, - options?: JoinRequestsDenyOptionalParams - ): Promise; -} diff --git a/sdk/education/arm-education/src/operationsInterfaces/labs.ts b/sdk/education/arm-education/src/operationsInterfaces/labs.ts deleted file mode 100644 index 2b45423acb20..000000000000 --- a/sdk/education/arm-education/src/operationsInterfaces/labs.ts +++ /dev/null @@ -1,110 +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. - */ - -import { PagedAsyncIterableIterator } from "@azure/core-paging"; -import { - LabDetails, - LabsListAllOptionalParams, - LabsListOptionalParams, - LabsGetOptionalParams, - LabsGetResponse, - LabsDeleteOptionalParams, - LabsCreateOrUpdateOptionalParams, - LabsCreateOrUpdateResponse, - InviteCodeGenerateRequest, - LabsGenerateInviteCodeOptionalParams, - LabsGenerateInviteCodeResponse -} from "../models/index.js"; - -/// -/** Interface representing a Labs. */ -export interface Labs { - /** - * Get a list of labs associated with the provided billing account name and billing profile name. - * @param billingAccountName Billing account name. - * @param billingProfileName Billing profile name. - * @param options The options parameters. - */ - listAll( - billingAccountName: string, - billingProfileName: string, - options?: LabsListAllOptionalParams - ): PagedAsyncIterableIterator; - /** - * Get the details for a specific lab associated with the provided billing account name, billing - * profile name, and invoice section name. - * @param billingAccountName Billing account name. - * @param billingProfileName Billing profile name. - * @param invoiceSectionName Invoice section name. - * @param options The options parameters. - */ - list( - billingAccountName: string, - billingProfileName: string, - invoiceSectionName: string, - options?: LabsListOptionalParams - ): PagedAsyncIterableIterator; - /** - * Get the details for a specific lab associated with the provided billing account name, billing - * profile name, and invoice section name. - * @param billingAccountName Billing account name. - * @param billingProfileName Billing profile name. - * @param invoiceSectionName Invoice section name. - * @param options The options parameters. - */ - get( - billingAccountName: string, - billingProfileName: string, - invoiceSectionName: string, - options?: LabsGetOptionalParams - ): Promise; - /** - * Delete a specific lab associated with the provided billing account name, billing profile name, and - * invoice section name. Note all students must be removed from the lab in order to delete the lab. - * @param billingAccountName Billing account name. - * @param billingProfileName Billing profile name. - * @param invoiceSectionName Invoice section name. - * @param options The options parameters. - */ - delete( - billingAccountName: string, - billingProfileName: string, - invoiceSectionName: string, - options?: LabsDeleteOptionalParams - ): Promise; - /** - * Create a new lab or update a previously created lab. - * @param billingAccountName Billing account name. - * @param billingProfileName Billing profile name. - * @param invoiceSectionName Invoice section name. - * @param parameters Request parameters that are provided to create lab resource. - * @param options The options parameters. - */ - createOrUpdate( - billingAccountName: string, - billingProfileName: string, - invoiceSectionName: string, - parameters: LabDetails, - options?: LabsCreateOrUpdateOptionalParams - ): Promise; - /** - * Generate invite code for a lab - * @param billingAccountName Billing account name. - * @param billingProfileName Billing profile name. - * @param invoiceSectionName Invoice section name. - * @param parameters Request parameters that are provided to generate invite code. - * @param options The options parameters. - */ - generateInviteCode( - billingAccountName: string, - billingProfileName: string, - invoiceSectionName: string, - parameters: InviteCodeGenerateRequest, - options?: LabsGenerateInviteCodeOptionalParams - ): Promise; -} diff --git a/sdk/education/arm-education/src/operationsInterfaces/operations.ts b/sdk/education/arm-education/src/operationsInterfaces/operations.ts deleted file mode 100644 index 05c6d2c4bfec..000000000000 --- a/sdk/education/arm-education/src/operationsInterfaces/operations.ts +++ /dev/null @@ -1,21 +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. - */ - -import { - OperationsListOptionalParams, - OperationsListResponse -} from "../models/index.js"; - -/** Interface representing a Operations. */ -export interface Operations { - /** - * Lists all of the available Microsoft.Education API operations. - * @param options The options parameters. - */ - list(options?: OperationsListOptionalParams): Promise; -} diff --git a/sdk/education/arm-education/src/operationsInterfaces/studentLabs.ts b/sdk/education/arm-education/src/operationsInterfaces/studentLabs.ts deleted file mode 100644 index 7837ff723943..000000000000 --- a/sdk/education/arm-education/src/operationsInterfaces/studentLabs.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. - */ - -import { PagedAsyncIterableIterator } from "@azure/core-paging"; -import { - StudentLabDetails, - StudentLabsListAllOptionalParams, - StudentLabsGetOptionalParams, - StudentLabsGetResponse -} from "../models/index.js"; - -/// -/** Interface representing a StudentLabs. */ -export interface StudentLabs { - /** - * Get a list of all labs associated with the caller of the API. - * @param options The options parameters. - */ - listAll( - options?: StudentLabsListAllOptionalParams - ): PagedAsyncIterableIterator; - /** - * Get the details for a specified lab associated with the student lab. - * @param studentLabName Student lab name. - * @param options The options parameters. - */ - get( - studentLabName: string, - options?: StudentLabsGetOptionalParams - ): Promise; -} diff --git a/sdk/education/arm-education/src/operationsInterfaces/students.ts b/sdk/education/arm-education/src/operationsInterfaces/students.ts deleted file mode 100644 index 81cf19d98241..000000000000 --- a/sdk/education/arm-education/src/operationsInterfaces/students.ts +++ /dev/null @@ -1,84 +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. - */ - -import { PagedAsyncIterableIterator } from "@azure/core-paging"; -import { - StudentDetails, - StudentsListOptionalParams, - StudentsGetOptionalParams, - StudentsGetResponse, - StudentsDeleteOptionalParams, - StudentsCreateOrUpdateOptionalParams, - StudentsCreateOrUpdateResponse -} from "../models/index.js"; - -/// -/** Interface representing a Students. */ -export interface Students { - /** - * Get a list of details about students that are associated with the specified lab. - * @param billingAccountName Billing account name. - * @param billingProfileName Billing profile name. - * @param invoiceSectionName Invoice section name. - * @param options The options parameters. - */ - list( - billingAccountName: string, - billingProfileName: string, - invoiceSectionName: string, - options?: StudentsListOptionalParams - ): PagedAsyncIterableIterator; - /** - * Get the details for a specific student in the specified lab by student alias - * @param billingAccountName Billing account name. - * @param billingProfileName Billing profile name. - * @param invoiceSectionName Invoice section name. - * @param studentAlias Student alias. - * @param options The options parameters. - */ - get( - billingAccountName: string, - billingProfileName: string, - invoiceSectionName: string, - studentAlias: string, - options?: StudentsGetOptionalParams - ): Promise; - /** - * Delete the specified student based on the student alias. - * @param billingAccountName Billing account name. - * @param billingProfileName Billing profile name. - * @param invoiceSectionName Invoice section name. - * @param studentAlias Student alias. - * @param options The options parameters. - */ - delete( - billingAccountName: string, - billingProfileName: string, - invoiceSectionName: string, - studentAlias: string, - options?: StudentsDeleteOptionalParams - ): Promise; - /** - * Create and add a new student to the specified lab or update the details of an existing student in a - * lab. Note the student must have a valid tenant to accept the lab after they have been added to lab. - * @param billingAccountName Billing account name. - * @param billingProfileName Billing profile name. - * @param invoiceSectionName Invoice section name. - * @param studentAlias Student alias. - * @param parameters Request parameters that are provided to update student properties. - * @param options The options parameters. - */ - createOrUpdate( - billingAccountName: string, - billingProfileName: string, - invoiceSectionName: string, - studentAlias: string, - parameters: StudentDetails, - options?: StudentsCreateOrUpdateOptionalParams - ): Promise; -} diff --git a/sdk/education/arm-education/src/pagingHelper.ts b/sdk/education/arm-education/src/pagingHelper.ts deleted file mode 100644 index 269a2b9814b5..000000000000 --- a/sdk/education/arm-education/src/pagingHelper.ts +++ /dev/null @@ -1,39 +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. - */ - -export interface PageInfo { - continuationToken?: string; -} - -const pageMap = new WeakMap(); - -/** - * Given the last `.value` produced by the `byPage` iterator, - * returns a continuation token that can be used to begin paging from - * that point later. - * @param page An object from accessing `value` on the IteratorResult from a `byPage` iterator. - * @returns The continuation token that can be passed into byPage() during future calls. - */ -export function getContinuationToken(page: unknown): string | undefined { - if (typeof page !== "object" || page === null) { - return undefined; - } - return pageMap.get(page)?.continuationToken; -} - -export function setContinuationToken( - page: unknown, - continuationToken: string | undefined -): void { - if (typeof page !== "object" || page === null || !continuationToken) { - return; - } - const pageInfo = pageMap.get(page) ?? {}; - pageInfo.continuationToken = continuationToken; - pageMap.set(page, pageInfo); -} diff --git a/sdk/education/arm-education/src/static-helpers/cloudSettingHelpers.ts b/sdk/education/arm-education/src/static-helpers/cloudSettingHelpers.ts new file mode 100644 index 000000000000..613112c6e397 --- /dev/null +++ b/sdk/education/arm-education/src/static-helpers/cloudSettingHelpers.ts @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** + * An enum to describe Azure Cloud environments. + * @enum {string} + */ +export enum AzureClouds { + /** Azure public cloud, which is the default cloud for Azure SDKs. */ + AZURE_PUBLIC_CLOUD = "AZURE_PUBLIC_CLOUD", + /** Azure China cloud */ + AZURE_CHINA_CLOUD = "AZURE_CHINA_CLOUD", + /** Azure US government cloud */ + AZURE_US_GOVERNMENT = "AZURE_US_GOVERNMENT", +} + +/** The supported values for cloud setting as a string literal type */ +export type AzureSupportedClouds = `${AzureClouds}`; + +/** + * Gets the Azure Resource Manager endpoint URL for the specified cloud setting. + * @param cloudSetting - The Azure cloud environment setting. Use one of the AzureClouds enum values. + * @returns The ARM endpoint URL for the specified cloud, or undefined if cloudSetting is undefined. + * @throws {Error} Throws an error if an unknown cloud setting is provided. + */ +export function getArmEndpoint(cloudSetting?: AzureSupportedClouds): string | undefined { + if (cloudSetting === undefined) { + return undefined; + } + const cloudEndpoints: Record = { + AZURE_CHINA_CLOUD: "https://management.chinacloudapi.cn/", + AZURE_US_GOVERNMENT: "https://management.usgovcloudapi.net/", + AZURE_PUBLIC_CLOUD: "https://management.azure.com/", + }; + if (cloudSetting in cloudEndpoints) { + return cloudEndpoints[cloudSetting]; + } else { + throw new Error( + `Unknown cloud setting: ${cloudSetting}. Please refer to the enum AzureClouds for possible values.`, + ); + } +} diff --git a/sdk/education/arm-education/src/static-helpers/pagingHelpers.ts b/sdk/education/arm-education/src/static-helpers/pagingHelpers.ts new file mode 100644 index 000000000000..5545e8e42a92 --- /dev/null +++ b/sdk/education/arm-education/src/static-helpers/pagingHelpers.ts @@ -0,0 +1,267 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { Client, createRestError, PathUncheckedResponse } from "@azure-rest/core-client"; +import { RestError } from "@azure/core-rest-pipeline"; + +/** + * Options for the byPage method + */ +export interface PageSettings { + /** + * A reference to a specific page to start iterating from. + */ + continuationToken?: string; +} + +/** + * An interface that describes a page of results. + */ +export type ContinuablePage = TPage & { + /** + * The token that keeps track of where to continue the iterator + */ + continuationToken?: string; +}; + +/** + * An interface that allows async iterable iteration both to completion and by page. + */ +export interface PagedAsyncIterableIterator< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, +> { + /** + * The next method, part of the iteration protocol + */ + next(): Promise>; + /** + * The connection to the async iterator, part of the iteration protocol + */ + [Symbol.asyncIterator](): PagedAsyncIterableIterator; + /** + * Return an AsyncIterableIterator that works a page at a time + */ + byPage: (settings?: TPageSettings) => AsyncIterableIterator>; +} + +/** + * An interface that describes how to communicate with the service. + */ +export interface PagedResult< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, +> { + /** + * Link to the first page of results. + */ + firstPageLink?: string; + /** + * A method that returns a page of results. + */ + getPage: (pageLink?: string) => Promise<{ page: TPage; nextPageLink?: string } | undefined>; + /** + * a function to implement the `byPage` method on the paged async iterator. + */ + byPage?: (settings?: TPageSettings) => AsyncIterableIterator>; + + /** + * A function to extract elements from a page. + */ + toElements?: (page: TPage) => TElement[]; +} + +/** + * Options for the paging helper + */ +export interface BuildPagedAsyncIteratorOptions { + itemName?: string; + nextLinkName?: string; + nextLinkMethod?: "GET" | "POST"; + apiVersion?: string; +} + +/** + * Helper to paginate results in a generic way and return a PagedAsyncIterableIterator + */ +export function buildPagedAsyncIterator< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, + TResponse extends PathUncheckedResponse = PathUncheckedResponse, +>( + client: Client, + getInitialResponse: () => PromiseLike, + processResponseBody: (result: TResponse) => PromiseLike, + expectedStatuses: string[], + options: BuildPagedAsyncIteratorOptions = {}, +): PagedAsyncIterableIterator { + const itemName = options.itemName ?? "value"; + const nextLinkName = options.nextLinkName ?? "nextLink"; + const nextLinkMethod = options.nextLinkMethod ?? "GET"; + const apiVersion = options.apiVersion; + const pagedResult: PagedResult = { + getPage: async (pageLink?: string) => { + let result; + if (pageLink === undefined) { + result = await getInitialResponse(); + } else { + const resolvedPageLink = apiVersion ? addApiVersionToUrl(pageLink, apiVersion) : pageLink; + result = + nextLinkMethod === "POST" + ? await client.pathUnchecked(resolvedPageLink).post() + : await client.pathUnchecked(resolvedPageLink).get(); + } + checkPagingRequest(result, expectedStatuses); + const results = await processResponseBody(result as TResponse); + const nextLink = getNextLink(results, nextLinkName); + const values = getElements(results, itemName) as TPage; + return { + page: values, + nextPageLink: nextLink, + }; + }, + byPage: (settings?: TPageSettings) => { + const { continuationToken } = settings ?? {}; + return getPageAsyncIterator(pagedResult, { + pageLink: continuationToken, + }); + }, + }; + return getPagedAsyncIterator(pagedResult); +} + +/** + * returns an async iterator that iterates over results. It also has a `byPage` + * method that returns pages of items at once. + * + * @param pagedResult - an object that specifies how to get pages. + * @returns a paged async iterator that iterates over results. + */ + +function getPagedAsyncIterator< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, +>( + pagedResult: PagedResult, +): PagedAsyncIterableIterator { + const iter = getItemAsyncIterator(pagedResult); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: + pagedResult?.byPage ?? + ((settings?: TPageSettings) => { + const { continuationToken } = settings ?? {}; + return getPageAsyncIterator(pagedResult, { + pageLink: continuationToken, + }); + }), + }; +} + +async function* getItemAsyncIterator( + pagedResult: PagedResult, +): AsyncIterableIterator { + const pages = getPageAsyncIterator(pagedResult); + for await (const page of pages) { + yield* page as unknown as TElement[]; + } +} + +async function* getPageAsyncIterator( + pagedResult: PagedResult, + options: { + pageLink?: string; + } = {}, +): AsyncIterableIterator> { + const { pageLink } = options; + let response = await pagedResult.getPage(pageLink ?? pagedResult.firstPageLink); + if (!response) { + return; + } + let result = response.page as ContinuablePage; + result.continuationToken = response.nextPageLink; + yield result; + while (response.nextPageLink) { + response = await pagedResult.getPage(response.nextPageLink); + if (!response) { + return; + } + result = response.page as ContinuablePage; + result.continuationToken = response.nextPageLink; + yield result; + } +} + +/** + * Gets for the value of nextLink in the body + */ +function getNextLink(body: unknown, nextLinkName?: string): string | undefined { + if (!nextLinkName) { + return undefined; + } + + const nextLink = (body as Record)[nextLinkName]; + + if (typeof nextLink !== "string" && typeof nextLink !== "undefined" && nextLink !== null) { + throw new RestError( + `Body Property ${nextLinkName} should be a string or undefined or null but got ${typeof nextLink}`, + ); + } + + if (nextLink === null) { + return undefined; + } + + return nextLink; +} + +/** + * Gets the elements of the current request in the body. + */ +function getElements(body: unknown, itemName: string): T[] { + const value = (body as Record)[itemName] as T[]; + if (!Array.isArray(value)) { + throw new RestError( + `Couldn't paginate response\n Body doesn't contain an array property with name: ${itemName}`, + ); + } + + return value ?? []; +} + +/** + * Checks if a request failed + */ +function checkPagingRequest(response: PathUncheckedResponse, expectedStatuses: string[]): void { + if (!expectedStatuses.includes(response.status)) { + throw createRestError( + `Pagination failed with unexpected statusCode ${response.status}`, + response, + ); + } +} + +/** + * Adds the api-version query parameter on a URL if it's not present. + * @param url - the URL to modify + * @param apiVersion - the API version to set + * @returns - the URL with the api-version query parameter set + */ +function addApiVersionToUrl(url: string, apiVersion: string): string { + // The base URL is only used for parsing and won't appear in the returned URL + const urlObj = new URL(url, "https://microsoft.com"); + if (!urlObj.searchParams.get("api-version")) { + // Append one if there is no apiVersion + return `${url}${urlObj.search ? "&" : "?"}api-version=${apiVersion}`; + } + return url; +} diff --git a/sdk/education/arm-education/src/static-helpers/serialization/check-prop-undefined.ts b/sdk/education/arm-education/src/static-helpers/serialization/check-prop-undefined.ts new file mode 100644 index 000000000000..50f78829e491 --- /dev/null +++ b/sdk/education/arm-education/src/static-helpers/serialization/check-prop-undefined.ts @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** + * Returns true if all specified properties of the item are undefined. + * @param item The object to check. + * @param properties The list of property names to check on the item. + * @returns True if all specified properties are undefined, otherwise false. + */ +export function areAllPropsUndefined(item: Record, properties: string[]): boolean { + for (const property of properties) { + if (item[property] !== undefined) { + return false; + } + } + return true; +} diff --git a/sdk/education/arm-education/src/static-helpers/urlTemplate.ts b/sdk/education/arm-education/src/static-helpers/urlTemplate.ts new file mode 100644 index 000000000000..e8af8cd3ab73 --- /dev/null +++ b/sdk/education/arm-education/src/static-helpers/urlTemplate.ts @@ -0,0 +1,227 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +// --------------------- +// interfaces +// --------------------- +interface ValueOptions { + isFirst: boolean; // is first value in the expression + op?: string; // operator + varValue?: any; // variable value + varName?: string; // variable name + modifier?: string; // modifier e.g * + reserved?: boolean; // if true we'll keep reserved words with not encoding +} + +export interface UrlTemplateOptions { + // if set to true, reserved characters will not be encoded + allowReserved?: boolean; +} + +// --------------------- +// helpers +// --------------------- +function encodeComponent(val: string, reserved?: boolean, op?: string): string { + return (reserved ?? op === "+") || op === "#" + ? encodeReservedComponent(val) + : encodeRFC3986URIComponent(val); +} + +function encodeReservedComponent(str: string): string { + return str + .split(/(%[0-9A-Fa-f]{2})/g) + .map((part) => (!/%[0-9A-Fa-f]/.test(part) ? encodeURI(part) : part)) + .join(""); +} + +function encodeRFC3986URIComponent(str: string): string { + return encodeURIComponent(str).replace( + /[!'()*]/g, + (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`, + ); +} + +function isDefined(val: any): boolean { + return val !== undefined && val !== null; +} + +function getNamedAndIfEmpty(op?: string): [boolean, string] { + return [!!op && [";", "?", "&"].includes(op), !!op && ["?", "&"].includes(op) ? "=" : ""]; +} + +function getFirstOrSep(op?: string, isFirst = false): string { + if (isFirst) { + return !op || op === "+" ? "" : op; + } else if (!op || op === "+" || op === "#") { + return ","; + } else if (op === "?") { + return "&"; + } else { + return op; + } +} + +function getExpandedValue(option: ValueOptions): string { + let isFirst = option.isFirst; + const { op, varName, varValue: value, reserved } = option; + const vals: string[] = []; + const [named, ifEmpty] = getNamedAndIfEmpty(op); + + if (Array.isArray(value)) { + for (const val of value.filter(isDefined)) { + // prepare the following parts: separator, varName, value + vals.push(`${getFirstOrSep(op, isFirst)}`); + if (named && varName) { + vals.push(`${encodeURIComponent(varName)}`); + if (val === "") { + vals.push(ifEmpty); + } else { + vals.push("="); + } + } + vals.push(encodeComponent(val, reserved, op)); + isFirst = false; + } + } else if (typeof value === "object") { + for (const key of Object.keys(value)) { + const val = value[key]; + if (!isDefined(val)) { + continue; + } + // prepare the following parts: separator, key, value + vals.push(`${getFirstOrSep(op, isFirst)}`); + if (key) { + vals.push(`${encodeURIComponent(key)}`); + if (named && val === "") { + vals.push(ifEmpty); + } else { + vals.push("="); + } + } + vals.push(encodeComponent(val, reserved, op)); + isFirst = false; + } + } + return vals.join(""); +} + +function getNonExpandedValue(option: ValueOptions): string | undefined { + const { op, varName, varValue: value, isFirst, reserved } = option; + const vals: string[] = []; + const first = getFirstOrSep(op, isFirst); + const [named, ifEmpty] = getNamedAndIfEmpty(op); + if (named && varName) { + vals.push(encodeComponent(varName, reserved, op)); + if (value === "") { + if (!ifEmpty) { + vals.push(ifEmpty); + } + return !vals.join("") ? undefined : `${first}${vals.join("")}`; + } + vals.push("="); + } + + const items = []; + if (Array.isArray(value)) { + for (const val of value.filter(isDefined)) { + items.push(encodeComponent(val, reserved, op)); + } + } else if (typeof value === "object") { + for (const key of Object.keys(value)) { + if (!isDefined(value[key])) { + continue; + } + items.push(encodeRFC3986URIComponent(key)); + items.push(encodeComponent(value[key], reserved, op)); + } + } + vals.push(items.join(",")); + return !vals.join(",") ? undefined : `${first}${vals.join("")}`; +} + +function getVarValue(option: ValueOptions): string | undefined { + const { op, varName, modifier, isFirst, reserved, varValue: value } = option; + + if (!isDefined(value)) { + return undefined; + } else if (["string", "number", "boolean"].includes(typeof value)) { + let val = value.toString(); + const [named, ifEmpty] = getNamedAndIfEmpty(op); + const vals: string[] = [getFirstOrSep(op, isFirst)]; + if (named && varName) { + // No need to encode varName considering it is already encoded + vals.push(varName); + if (val === "") { + vals.push(ifEmpty); + } else { + vals.push("="); + } + } + if (modifier && modifier !== "*") { + val = val.substring(0, parseInt(modifier, 10)); + } + vals.push(encodeComponent(val, reserved, op)); + return vals.join(""); + } else if (modifier === "*") { + return getExpandedValue(option); + } else { + return getNonExpandedValue(option); + } +} + +// --------------------------------------------------------------------------------------------------- +// This is an implementation of RFC 6570 URI Template: https://datatracker.ietf.org/doc/html/rfc6570. +// --------------------------------------------------------------------------------------------------- +export function expandUrlTemplate( + template: string, + context: Record, + option?: UrlTemplateOptions, +): string { + const result = template.replace(/\{([^{}]+)\}|([^{}]+)/g, (_, expr, text) => { + if (!expr) { + return encodeReservedComponent(text); + } + let op; + if (["+", "#", ".", "/", ";", "?", "&"].includes(expr[0])) { + op = expr[0]; + expr = expr.slice(1); + } + const varList = expr.split(/,/g); + const innerResult = []; + for (const varSpec of varList) { + const varMatch = /([^:*]*)(?::(\d+)|(\*))?/.exec(varSpec); + if (!varMatch || !varMatch[1]) { + continue; + } + const varValue = getVarValue({ + isFirst: innerResult.length === 0, + op, + varValue: context[varMatch[1]], + varName: varMatch[1], + modifier: varMatch[2] || varMatch[3], + reserved: option?.allowReserved, + }); + if (varValue) { + innerResult.push(varValue); + } + } + return innerResult.join(""); + }); + + return normalizeUnreserved(result); +} + +/** + * Normalize an expanded URI by decoding percent-encoded unreserved characters. + * RFC 3986 unreserved: "-" / "." / "~" + */ +function normalizeUnreserved(uri: string): string { + return uri.replace(/%([0-9A-Fa-f]{2})/g, (match, hex) => { + const char = String.fromCharCode(parseInt(hex, 16)); + // Decode only if it's unreserved + if (/[.~-]/.test(char)) { + return char; + } + return match; // leave other encodings intact + }); +} diff --git a/sdk/education/arm-education/test/snippets.spec.ts b/sdk/education/arm-education/test/snippets.spec.ts index e605fcd0d748..c5821abf4101 100644 --- a/sdk/education/arm-education/test/snippets.spec.ts +++ b/sdk/education/arm-education/test/snippets.spec.ts @@ -8,17 +8,15 @@ import { describe, it } from "vitest"; describe("snippets", () => { it("ReadmeSampleCreateClient_Node", async () => { - const subscriptionId = "00000000-0000-0000-0000-000000000000"; - const client = new EducationManagementClient(new DefaultAzureCredential(), subscriptionId); + const client = new EducationManagementClient(new DefaultAzureCredential()); }); it("ReadmeSampleCreateClient_Browser", async () => { - const subscriptionId = "00000000-0000-0000-0000-000000000000"; const credential = new InteractiveBrowserCredential({ tenantId: "", clientId: "", }); - const client = new EducationManagementClient(credential, subscriptionId); + const client = new EducationManagementClient(credential); }); it("SetLogLevel", async () => { diff --git a/sdk/education/arm-education/tsconfig.json b/sdk/education/arm-education/tsconfig.json index 4f50981fb333..d0a44aae0734 100644 --- a/sdk/education/arm-education/tsconfig.json +++ b/sdk/education/arm-education/tsconfig.json @@ -4,19 +4,22 @@ "path": "./config/tsconfig.src.esm.json" }, { - "path": "./config/tsconfig.src.cjs.json" + "path": "./config/tsconfig.src.browser.json" }, { - "path": "./config/tsconfig.src.browser.json" + "path": "./config/tsconfig.src.cjs.json" }, { "path": "./config/tsconfig.test.node.json" }, { - "path": "./config/tsconfig.snippets.json" + "path": "./config/tsconfig.test.browser.json" }, { "path": "./config/tsconfig.samples.json" + }, + { + "path": "./config/tsconfig.snippets.json" } ], "files": [] diff --git a/sdk/education/arm-education/tsp-location.yaml b/sdk/education/arm-education/tsp-location.yaml new file mode 100644 index 000000000000..b745a937b252 --- /dev/null +++ b/sdk/education/arm-education/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/education/resource-manager/Microsoft.Education/Education +commit: 5a45c68db967ced0736a2f91a74774a65771dadc +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/education/arm-education/warp.config.yml b/sdk/education/arm-education/warp.config.yml index 326e6c0415c8..1c8791a27a4f 100644 --- a/sdk/education/arm-education/warp.config.yml +++ b/sdk/education/arm-education/warp.config.yml @@ -1,5 +1,16 @@ +# warp.config.yml — build configuration -extends: ../../../warp.base.config.yml +exports: + "./package.json": "./package.json" + ".": "./src/index.ts" + "./api": "./src/api/index.ts" + "./api/studentLabs": "./src/api/studentLabs/index.ts" + "./api/students": "./src/api/students/index.ts" + "./api/joinRequests": "./src/api/joinRequests/index.ts" + "./api/labs": "./src/api/labs/index.ts" + "./api/grants": "./src/api/grants/index.ts" + "./api/operations": "./src/api/operations/index.ts" + "./models": "./src/models/index.ts" targets: - name: browser diff --git a/sdk/education/ci.mgmt.yml b/sdk/education/ci.mgmt.yml index 85021ac44215..48f202794fef 100644 --- a/sdk/education/ci.mgmt.yml +++ b/sdk/education/ci.mgmt.yml @@ -1,5 +1,5 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. - + trigger: branches: include: @@ -13,7 +13,6 @@ trigger: include: - sdk/education/arm-education - sdk/education/ci.mgmt.yml - pr: branches: include: @@ -27,7 +26,6 @@ pr: include: - sdk/education/arm-education - sdk/education/ci.mgmt.yml - extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: @@ -35,4 +33,3 @@ extends: Artifacts: - name: azure-arm-education safeName: azurearmeducation - \ No newline at end of file From 1545ee40477211a097c359b8b13b75012db3e461 Mon Sep 17 00:00:00 2001 From: "Jiao Di (MSFT)" Date: Wed, 27 May 2026 17:45:40 +0800 Subject: [PATCH 2/3] update --- .../arm-education/config/tsconfig.lint.json | 7 +++++ sdk/education/arm-education/eslint.config.mjs | 29 +++++++++++++------ sdk/education/arm-education/package.json | 4 +-- 3 files changed, 29 insertions(+), 11 deletions(-) create mode 100644 sdk/education/arm-education/config/tsconfig.lint.json diff --git a/sdk/education/arm-education/config/tsconfig.lint.json b/sdk/education/arm-education/config/tsconfig.lint.json new file mode 100644 index 000000000000..8431a95cbcb1 --- /dev/null +++ b/sdk/education/arm-education/config/tsconfig.lint.json @@ -0,0 +1,7 @@ +{ + "extends": "../../../../tsconfig.json", + "include": [ + "../src", + "../test" + ] +} diff --git a/sdk/education/arm-education/eslint.config.mjs b/sdk/education/arm-education/eslint.config.mjs index 6d2f8a5914c3..93322da715ec 100644 --- a/sdk/education/arm-education/eslint.config.mjs +++ b/sdk/education/arm-education/eslint.config.mjs @@ -1,14 +1,25 @@ import azsdkEslint from "@azure/eslint-plugin-azure-sdk"; -export default azsdkEslint.config([ +export default [ + ...azsdkEslint.config([ + { + rules: { + "@azure/azure-sdk/ts-modules-only-named": "warn", + "@azure/azure-sdk/ts-package-json-types": "warn", + "@azure/azure-sdk/ts-package-json-engine-is-present": "warn", + "@azure/azure-sdk/ts-package-json-files-required": "off", + "@azure/azure-sdk/ts-package-json-main-is-cjs": "off", + "tsdoc/syntax": "warn", + }, + }, + ]), { - rules: { - "@azure/azure-sdk/ts-modules-only-named": "warn", - "@azure/azure-sdk/ts-package-json-types": "warn", - "@azure/azure-sdk/ts-package-json-engine-is-present": "warn", - "@azure/azure-sdk/ts-package-json-files-required": "off", - "@azure/azure-sdk/ts-package-json-main-is-cjs": "off", - "tsdoc/syntax": "warn", + files: ["src/**/*.ts", "src/**/*.mts", "test/**/*.ts"], + languageOptions: { + parserOptions: { + projectService: false, + project: "./config/tsconfig.lint.json", + }, }, }, -]); +]; diff --git a/sdk/education/arm-education/package.json b/sdk/education/arm-education/package.json index 49fc44bead87..6ca2f74ad855 100644 --- a/sdk/education/arm-education/package.json +++ b/sdk/education/arm-education/package.json @@ -220,11 +220,11 @@ "execute:samples": "dev-tool samples run samples-dev", "format": "prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\" \"samples-dev/*.ts\"", "generate:client": "echo skipped", - "test:browser": "dev-tool run build-test && dev-tool run test:vitest --browser", + "test:browser": "dev-tool run test:vitest --browser", "build": "npm run clean && dev-tool run build-package && dev-tool run extract-api", "test:node": "dev-tool run test:vitest", "test:node:esm": "dev-tool run test:vitest --esm", - "test": "npm run test:node && npm run test:browser", + "test": "tsc -b --noEmit && npm run test:node && npm run test:browser", "update-snippets": "dev-tool run update-snippets" }, "//sampleConfiguration": { From 4d72ed806170a58d0c947aed01ea19ed77866f61 Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Thu, 28 May 2026 16:06:01 +0800 Subject: [PATCH 3/3] Update assets.json --- sdk/education/arm-education/assets.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/education/arm-education/assets.json b/sdk/education/arm-education/assets.json index a3aa5591d6ca..181db78ccde7 100644 --- a/sdk/education/arm-education/assets.json +++ b/sdk/education/arm-education/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "js", "TagPrefix": "js/education/arm-education", - "Tag": "js/education/arm-education_2ea0c101ca" + "Tag": "js/education/arm-education_8498838361" }