From dc86b674778c3783285f941883ee6530e4edc822 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 24 Sep 2024 06:45:59 +0000 Subject: [PATCH] CodeGen from PR 30671 in Azure/azure-rest-api-specs Merge 82d88b2f5b3ce64fa5b6e9025067a18eefb04131 into 399cbac2de1bc0acbed4c9a0a864a9c84da3692e --- common/config/rush/pnpm-lock.yaml | 93 +- rush.json | 17 +- .../arm-computeschedule/CHANGELOG.md | 7 + .../arm-computeschedule/LICENSE | 21 + .../arm-computeschedule/README.md | 109 ++ .../arm-computeschedule/_meta.json | 8 + .../arm-computeschedule/api-extractor.json | 31 + .../arm-computeschedule/package.json | 108 ++ .../review/arm-computeschedule.api.md | 414 +++++++ .../arm-computeschedule/sample.env | 4 + .../arm-computeschedule/src/index.ts | 13 + .../src/microsoftComputeSchedule.ts | 143 +++ .../arm-computeschedule/src/models/index.ts | 610 ++++++++++ .../arm-computeschedule/src/models/mappers.ts | 1014 +++++++++++++++++ .../src/models/parameters.ts | 154 +++ .../src/operations/index.ts | 10 + .../src/operations/operations.ts | 149 +++ .../src/operations/scheduledActions.ts | 413 +++++++ .../src/operationsInterfaces/index.ts | 10 + .../src/operationsInterfaces/operations.ts | 22 + .../operationsInterfaces/scheduledActions.ts | 141 +++ .../arm-computeschedule/src/pagingHelper.ts | 39 + .../arm-computeschedule/test/sampleTest.ts | 43 + .../arm-computeschedule/tsconfig.json | 27 + sdk/computeschedule/ci.mgmt.yml | 38 + 25 files changed, 3619 insertions(+), 19 deletions(-) create mode 100644 sdk/computeschedule/arm-computeschedule/CHANGELOG.md create mode 100644 sdk/computeschedule/arm-computeschedule/LICENSE create mode 100644 sdk/computeschedule/arm-computeschedule/README.md create mode 100644 sdk/computeschedule/arm-computeschedule/_meta.json create mode 100644 sdk/computeschedule/arm-computeschedule/api-extractor.json create mode 100644 sdk/computeschedule/arm-computeschedule/package.json create mode 100644 sdk/computeschedule/arm-computeschedule/review/arm-computeschedule.api.md create mode 100644 sdk/computeschedule/arm-computeschedule/sample.env create mode 100644 sdk/computeschedule/arm-computeschedule/src/index.ts create mode 100644 sdk/computeschedule/arm-computeschedule/src/microsoftComputeSchedule.ts create mode 100644 sdk/computeschedule/arm-computeschedule/src/models/index.ts create mode 100644 sdk/computeschedule/arm-computeschedule/src/models/mappers.ts create mode 100644 sdk/computeschedule/arm-computeschedule/src/models/parameters.ts create mode 100644 sdk/computeschedule/arm-computeschedule/src/operations/index.ts create mode 100644 sdk/computeschedule/arm-computeschedule/src/operations/operations.ts create mode 100644 sdk/computeschedule/arm-computeschedule/src/operations/scheduledActions.ts create mode 100644 sdk/computeschedule/arm-computeschedule/src/operationsInterfaces/index.ts create mode 100644 sdk/computeschedule/arm-computeschedule/src/operationsInterfaces/operations.ts create mode 100644 sdk/computeschedule/arm-computeschedule/src/operationsInterfaces/scheduledActions.ts create mode 100644 sdk/computeschedule/arm-computeschedule/src/pagingHelper.ts create mode 100644 sdk/computeschedule/arm-computeschedule/test/sampleTest.ts create mode 100644 sdk/computeschedule/arm-computeschedule/tsconfig.json create mode 100644 sdk/computeschedule/ci.mgmt.yml diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 07a389eaa442..75a6ad71197b 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -188,6 +188,9 @@ dependencies: '@rush-temp/arm-computefleet': specifier: file:./projects/arm-computefleet.tgz version: file:projects/arm-computefleet.tgz + '@rush-temp/arm-computeschedule': + specifier: file:./projects/arm-computeschedule.tgz + version: file:projects/arm-computeschedule.tgz '@rush-temp/arm-confidentialledger': specifier: file:./projects/arm-confidentialledger.tgz version: file:projects/arm-confidentialledger.tgz @@ -3809,7 +3812,7 @@ packages: /@types/bunyan@1.8.9: resolution: {integrity: sha512-ZqS9JGpBxVOvsawzmVt30sP++gSQMTejCkIAQ3VdadOcRE8izTyW66hufvwLeH+YEGP6Js2AW7Gz+RMyvrEbmw==} dependencies: - '@types/node': 18.19.50 + '@types/node': 22.5.5 dev: false /@types/chai-as-promised@7.1.8: @@ -3839,7 +3842,7 @@ packages: /@types/cors@2.8.17: resolution: {integrity: sha512-8CGDvrBj1zgo2qE+oS3pOCyYNqCPryMWY2bGfwA0dcfopWGgxs+78df0Rs3rc9THP4JkOhLsAa+15VdpAqkcUA==} dependencies: - '@types/node': 18.19.50 + '@types/node': 22.5.5 dev: false /@types/debug@4.1.12: @@ -3882,7 +3885,7 @@ packages: /@types/express-serve-static-core@4.19.5: resolution: {integrity: sha512-y6W03tvrACO72aijJ5uF02FRq5cgDR9lUxddQ8vyF+GvmjJQqbzDcJngEjURc+ZsG31VI3hODNZJ2URj86pzmg==} dependencies: - '@types/node': 18.19.50 + '@types/node': 22.5.5 '@types/qs': 6.9.16 '@types/range-parser': 1.2.7 '@types/send': 0.17.4 @@ -3901,7 +3904,7 @@ packages: resolution: {integrity: sha512-yTbItCNreRooED33qjunPthRcSjERP1r4MqCZc7wv0u2sUkzTFp45tgUfS5+r7FrZPdmCCNflLhVSP/o+SemsQ==} dependencies: '@types/jsonfile': 6.1.4 - '@types/node': 18.19.50 + '@types/node': 22.5.5 dev: false /@types/http-errors@2.0.4: @@ -3918,7 +3921,7 @@ packages: /@types/is-buffer@2.0.2: resolution: {integrity: sha512-G6OXy83Va+xEo8XgqAJYOuvOMxeey9xM5XKkvwJNmN8rVdcB+r15HvHsG86hl86JvU0y1aa7Z2ERkNFYWw9ySg==} dependencies: - '@types/node': 18.19.50 + '@types/node': 22.5.5 dev: false /@types/json-schema@7.0.15: @@ -3928,7 +3931,7 @@ packages: /@types/jsonfile@6.1.4: resolution: {integrity: sha512-D5qGUYwjvnNNextdU59/+fI+spnwtTFmyQP0h+PfIOSkNfpU6AOICUOkm4i0OnSk+NyjdPJrxCDro0sJsWlRpQ==} dependencies: - '@types/node': 18.19.50 + '@types/node': 22.5.5 dev: false /@types/jsonwebtoken@9.0.7: @@ -3993,13 +3996,13 @@ packages: /@types/mysql@2.15.26: resolution: {integrity: sha512-DSLCOXhkvfS5WNNPbfn2KdICAmk8lLc+/PNvnPnF7gOdMZCxopXduqv0OQ13y/yA/zXTSikZZqVgybUxOEg6YQ==} dependencies: - '@types/node': 18.19.50 + '@types/node': 22.5.5 dev: false /@types/node-fetch@2.6.11: resolution: {integrity: sha512-24xFj9R5+rfQJLRyM56qh+wnVSYhyXC2tkoBndtY0U+vubqNsYXGjufB2nn8Q6gt0LrARwL6UBtMCSVCwl4B1g==} dependencies: - '@types/node': 18.19.50 + '@types/node': 22.5.5 form-data: 4.0.0 dev: false @@ -4044,7 +4047,7 @@ packages: /@types/pg@8.6.1: resolution: {integrity: sha512-1Kc4oAGzAl7uqUStZCDvaLFqZrW9qWSjXOmBfdgyBP5La7Us6Mg4GBvRlSoaZMhQF/zSj1C8CtKMBkoiT8eL8w==} dependencies: - '@types/node': 18.19.50 + '@types/node': 22.5.5 pg-protocol: 1.7.0 pg-types: 2.2.0 dev: false @@ -4071,7 +4074,7 @@ packages: /@types/readdir-glob@1.1.5: resolution: {integrity: sha512-raiuEPUYqXu+nvtY2Pe8s8FEmZ3x5yAH4VkLdihcPdalvsHltomrRC9BzuStrJ9yk06470hS0Crw0f1pXqD+Hg==} dependencies: - '@types/node': 18.19.50 + '@types/node': 22.5.5 dev: false /@types/resolve@1.20.2: @@ -4090,7 +4093,7 @@ packages: resolution: {integrity: sha512-x2EM6TJOybec7c52BX0ZspPodMsQUd5L6PRwOunVyVUhXiBSKf3AezDL8Dgvgt5o0UfKNfuA0eMLr2wLT4AiBA==} dependencies: '@types/mime': 1.3.5 - '@types/node': 18.19.50 + '@types/node': 22.5.5 dev: false /@types/serve-static@1.15.7: @@ -4128,7 +4131,7 @@ packages: /@types/through@0.0.33: resolution: {integrity: sha512-HsJ+z3QuETzP3cswwtzt2vEIiHBk/dCcHGhbmG5X3ecnwFD/lPrMpliGXxSCg03L9AhrdwA4Oz/qfspkDW+xGQ==} dependencies: - '@types/node': 18.19.50 + '@types/node': 22.5.5 dev: false /@types/tough-cookie@4.0.5: @@ -4185,7 +4188,7 @@ packages: resolution: {integrity: sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q==} requiresBuild: true dependencies: - '@types/node': 18.19.50 + '@types/node': 22.5.5 dev: false optional: true @@ -5915,7 +5918,7 @@ packages: dependencies: '@types/cookie': 0.4.1 '@types/cors': 2.8.17 - '@types/node': 18.19.50 + '@types/node': 22.5.5 accepts: 1.3.8 base64id: 2.0.0 cookie: 0.4.2 @@ -9246,7 +9249,7 @@ packages: '@protobufjs/path': 1.1.2 '@protobufjs/pool': 1.1.0 '@protobufjs/utf8': 1.1.0 - '@types/node': 18.19.50 + '@types/node': 22.5.5 long: 5.2.3 dev: false @@ -10488,6 +10491,37 @@ packages: yn: 3.1.1 dev: false + /ts-node@10.9.2(@types/node@18.19.50)(typescript@5.5.4): + resolution: {integrity: sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==} + hasBin: true + peerDependencies: + '@swc/core': '>=1.2.50' + '@swc/wasm': '>=1.2.50' + '@types/node': '*' + typescript: '>=2.7' + peerDependenciesMeta: + '@swc/core': + optional: true + '@swc/wasm': + optional: true + dependencies: + '@cspotcode/source-map-support': 0.8.1 + '@tsconfig/node10': 1.0.11 + '@tsconfig/node12': 1.0.11 + '@tsconfig/node14': 1.0.3 + '@tsconfig/node16': 1.0.4 + '@types/node': 18.19.50 + acorn: 8.12.1 + acorn-walk: 8.3.4 + arg: 4.1.3 + create-require: 1.1.1 + diff: 4.0.2 + make-error: 1.3.6 + typescript: 5.5.4 + v8-compile-cache-lib: 3.0.1 + yn: 3.1.1 + dev: false + /ts-node@10.9.2(@types/node@18.19.50)(typescript@5.6.2): resolution: {integrity: sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==} hasBin: true @@ -13562,6 +13596,35 @@ packages: - webdriverio dev: false + file:projects/arm-computeschedule.tgz: + resolution: {integrity: sha512-Z+tuHSW+xm607lS7cXiM7WzlZXEG1kDFQk3i6CxZAy4SUf3sOI0WeDStFfGdjfo+OSeHo97eaPrNA57703zZaw==, tarball: file:projects/arm-computeschedule.tgz} + name: '@rush-temp/arm-computeschedule' + version: 0.0.0 + dependencies: + '@azure-tools/test-credential': 1.3.1 + '@azure-tools/test-recorder': 3.5.2 + '@azure/identity': 4.4.1 + '@microsoft/api-extractor': 7.47.9(@types/node@18.19.50) + '@types/chai': 4.3.19 + '@types/mocha': 10.0.8 + '@types/node': 18.19.50 + chai: 4.3.10 + cross-env: 7.0.3 + dotenv: 16.4.5 + mkdirp: 3.0.1 + mocha: 10.7.3 + rimraf: 5.0.10 + ts-node: 10.9.2(@types/node@18.19.50)(typescript@5.5.4) + tslib: 2.7.0 + tsx: 4.19.1 + typescript: 5.5.4 + uglify-js: 3.19.3 + transitivePeerDependencies: + - '@swc/core' + - '@swc/wasm' + - supports-color + dev: false + file:projects/arm-confidentialledger.tgz: resolution: {integrity: sha512-r9C2B39MoV92dpUTX6LewfFjQVl6xt1XbfA8tTUMgeBx7XckJ9PdrQaUX4/a/Wu3fQQVAs8KJxxLpP6/jcd8tA==, tarball: file:projects/arm-confidentialledger.tgz} name: '@rush-temp/arm-confidentialledger' diff --git a/rush.json b/rush.json index de2153e7fe5f..0b899148e4a7 100644 --- a/rush.json +++ b/rush.json @@ -1,7 +1,7 @@ /** * This is the main configuration file for Rush. * For full documentation, please see https://rushjs.io - */ { + */{ "$schema": "https://developer.microsoft.com/json-schemas/rush/v5/rush.schema.json", /** * (Required) This specifies the version of the Rush engine to be used in this repo. @@ -570,7 +570,9 @@ "projectFolder": "common/tools/dev-tool", "versionPolicyName": "utility", // Add Identity to decoupledLocalDependencies so that dev-tool uses the package from npm, avoiding a cyclic dependency. - "decoupledLocalDependencies": ["@azure/identity"] + "decoupledLocalDependencies": [ + "@azure/identity" + ] }, { "packageName": "@azure/eventgrid", @@ -610,7 +612,9 @@ { "packageName": "@azure/identity", "projectFolder": "sdk/identity/identity", - "decoupledLocalDependencies": ["@azure/keyvault-keys"], + "decoupledLocalDependencies": [ + "@azure/keyvault-keys" + ], "versionPolicyName": "client" }, { @@ -2272,6 +2276,11 @@ "packageName": "@azure-rest/batch", "projectFolder": "sdk/batch/batch-rest", "versionPolicyName": "client" + }, + { + "packageName": "@azure/arm-computeschedule", + "projectFolder": "sdk/computeschedule/arm-computeschedule", + "versionPolicyName": "management" } ] -} +} \ No newline at end of file diff --git a/sdk/computeschedule/arm-computeschedule/CHANGELOG.md b/sdk/computeschedule/arm-computeschedule/CHANGELOG.md new file mode 100644 index 000000000000..d721a294b14f --- /dev/null +++ b/sdk/computeschedule/arm-computeschedule/CHANGELOG.md @@ -0,0 +1,7 @@ +# Release History + +## 1.0.0-beta.1 (2024-09-24) + +### Features Added + +The package of @azure/arm-computeschedule 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/computeschedule/arm-computeschedule/LICENSE b/sdk/computeschedule/arm-computeschedule/LICENSE new file mode 100644 index 000000000000..7d5934740965 --- /dev/null +++ b/sdk/computeschedule/arm-computeschedule/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2024 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/computeschedule/arm-computeschedule/README.md b/sdk/computeschedule/arm-computeschedule/README.md new file mode 100644 index 000000000000..fc3b40c15fcc --- /dev/null +++ b/sdk/computeschedule/arm-computeschedule/README.md @@ -0,0 +1,109 @@ +# Azure MicrosoftComputeSchedule client library for JavaScript + +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure MicrosoftComputeSchedule client. + +Microsoft.ComputeSchedule Resource Provider management API. + +[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/computeschedule/arm-computeschedule) | +[Package (NPM)](https://www.npmjs.com/package/@azure/arm-computeschedule) | +[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-computeschedule?view=azure-node-preview) | +[Samples](https://github.com/Azure-Samples/azure-samples-js-management) + +## Getting started + +### Currently supported environments + +- [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule) +- Latest versions of Safari, Chrome, Edge and Firefox. + +See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details. + +### Prerequisites + +- An [Azure subscription][azure_sub]. + +### Install the `@azure/arm-computeschedule` package + +Install the Azure MicrosoftComputeSchedule client library for JavaScript with `npm`: + +```bash +npm install @azure/arm-computeschedule +``` + +### Create and authenticate a `MicrosoftComputeSchedule` + +To create a client object to access the Azure MicrosoftComputeSchedule API, you will need the `endpoint` of your Azure MicrosoftComputeSchedule resource and a `credential`. The Azure MicrosoftComputeSchedule client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your Azure MicrosoftComputeSchedule resource in the [Azure Portal][azure_portal]. + +You can authenticate with Azure Active Directory using a credential from the [@azure/identity][azure_identity] library or [an existing AAD Token](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token). + +To use the [DefaultAzureCredential][defaultazurecredential] provider shown below, or other credential providers provided with the Azure SDK, please install the `@azure/identity` package: + +```bash +npm install @azure/identity +``` + +You will also need to **register a new AAD application and grant access to Azure MicrosoftComputeSchedule** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions). +Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`. + +For more information about how to create an Azure AD Application check out [this guide](https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal). + +```javascript +const { MicrosoftComputeSchedule } = require("@azure/arm-computeschedule"); +const { DefaultAzureCredential } = require("@azure/identity"); +// For client-side applications running in the browser, use InteractiveBrowserCredential instead of DefaultAzureCredential. See https://aka.ms/azsdk/js/identity/examples for more details. + +const subscriptionId = "00000000-0000-0000-0000-000000000000"; +const client = new MicrosoftComputeSchedule(new DefaultAzureCredential(), subscriptionId); + +// For client-side applications running in the browser, use this code instead: +// const credential = new InteractiveBrowserCredential({ +// tenantId: "", +// clientId: "" +// }); +// const client = new MicrosoftComputeSchedule(credential, subscriptionId); +``` + + +### JavaScript Bundle +To use this client library in the browser, first you need to use a bundler. For details on how to do this, please refer to our [bundling documentation](https://aka.ms/AzureSDKBundling). + +## Key concepts + +### MicrosoftComputeSchedule + +`MicrosoftComputeSchedule` is the primary interface for developers using the Azure MicrosoftComputeSchedule client library. Explore the methods on this client object to understand the different features of the Azure MicrosoftComputeSchedule service that you can access. + +## Troubleshooting + +### Logging + +Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`: + +```javascript +const { setLogLevel } = require("@azure/logger"); +setLogLevel("info"); +``` + +For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger). + +## Next steps + +Please take a look at the [samples](https://github.com/Azure-Samples/azure-samples-js-management) directory for detailed examples on how to use this library. + +## Contributing + +If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code. + +## Related projects + +- [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js) + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fcomputeschedule%2Farm-computeschedule%2FREADME.png) + +[azure_cli]: https://docs.microsoft.com/cli/azure +[azure_sub]: https://azure.microsoft.com/free/ +[azure_sub]: https://azure.microsoft.com/free/ +[azure_portal]: https://portal.azure.com +[azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity +[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential diff --git a/sdk/computeschedule/arm-computeschedule/_meta.json b/sdk/computeschedule/arm-computeschedule/_meta.json new file mode 100644 index 000000000000..4faedc8513b1 --- /dev/null +++ b/sdk/computeschedule/arm-computeschedule/_meta.json @@ -0,0 +1,8 @@ +{ + "commit": "e6d487a031c060d5d333c1ee745032205def6680", + "readme": "specification/computeschedule/resource-manager/readme.md", + "autorest_command": "autorest --version=3.9.7 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-js ../azure-rest-api-specs/specification/computeschedule/resource-manager/readme.md --use=@autorest/typescript@^6.0.12", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "release_tool": "@azure-tools/js-sdk-release-tools@2.7.14", + "use": "@autorest/typescript@^6.0.12" +} \ No newline at end of file diff --git a/sdk/computeschedule/arm-computeschedule/api-extractor.json b/sdk/computeschedule/arm-computeschedule/api-extractor.json new file mode 100644 index 000000000000..a7020d75bc00 --- /dev/null +++ b/sdk/computeschedule/arm-computeschedule/api-extractor.json @@ -0,0 +1,31 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "mainEntryPointFilePath": "./dist-esm/src/index.d.ts", + "docModel": { + "enabled": true + }, + "apiReport": { + "enabled": true, + "reportFolder": "./review" + }, + "dtsRollup": { + "enabled": true, + "untrimmedFilePath": "", + "publicTrimmedFilePath": "./types/arm-computeschedule.d.ts" + }, + "messages": { + "tsdocMessageReporting": { + "default": { + "logLevel": "none" + } + }, + "extractorMessageReporting": { + "ae-missing-release-tag": { + "logLevel": "none" + }, + "ae-unresolved-link": { + "logLevel": "none" + } + } + } +} \ No newline at end of file diff --git a/sdk/computeschedule/arm-computeschedule/package.json b/sdk/computeschedule/arm-computeschedule/package.json new file mode 100644 index 000000000000..d53848c6c3a4 --- /dev/null +++ b/sdk/computeschedule/arm-computeschedule/package.json @@ -0,0 +1,108 @@ +{ + "name": "@azure/arm-computeschedule", + "sdk-type": "mgmt", + "author": "Microsoft Corporation", + "description": "A generated SDK for MicrosoftComputeSchedule.", + "version": "1.0.0-beta.1", + "engines": { + "node": ">=18.0.0" + }, + "dependencies": { + "@azure/core-paging": "^1.2.0", + "@azure/core-client": "^1.7.0", + "@azure/core-auth": "^1.6.0", + "@azure/core-rest-pipeline": "^1.14.0", + "tslib": "^2.2.0" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "license": "MIT", + "main": "./dist/index.js", + "module": "./dist-esm/src/index.js", + "types": "./types/arm-computeschedule.d.ts", + "devDependencies": { + "@microsoft/api-extractor": "^7.31.1", + "mkdirp": "^3.0.1", + "typescript": "~5.5.3", + "uglify-js": "^3.4.9", + "rimraf": "^5.0.0", + "dotenv": "^16.0.0", + "@azure/dev-tool": "^1.0.0", + "@azure/identity": "^4.2.1", + "@azure-tools/test-recorder": "^3.0.0", + "@azure-tools/test-credential": "^1.1.0", + "mocha": "^10.0.0", + "@types/mocha": "^10.0.0", + "tsx": "^4.7.1", + "@types/chai": "^4.2.8", + "chai": "^4.2.0", + "cross-env": "^7.0.2", + "@types/node": "^18.0.0", + "ts-node": "^10.0.0" + }, + "repository": { + "type": "git", + "url": "https://github.com/Azure/azure-sdk-for-js.git" + }, + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "files": [ + "dist/**/*.js", + "dist/**/*.js.map", + "dist/**/*.d.ts", + "dist/**/*.d.ts.map", + "dist-esm/**/*.js", + "dist-esm/**/*.js.map", + "dist-esm/**/*.d.ts", + "dist-esm/**/*.d.ts.map", + "src/**/*.ts", + "README.md", + "LICENSE", + "tsconfig.json", + "review/*", + "CHANGELOG.md", + "types/*" + ], + "scripts": { + "build": "npm run clean && tsc && dev-tool run bundle && npm run minify && mkdirp ./review && npm run extract-api", + "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", + "prepack": "npm run build", + "pack": "npm pack 2>&1", + "extract-api": "dev-tool run extract-api", + "lint": "echo skipped", + "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", + "build:node": "echo skipped", + "build:browser": "echo skipped", + "build:test": "echo skipped", + "build:samples": "echo skipped.", + "check-format": "echo skipped", + "execute:samples": "echo skipped", + "format": "echo skipped", + "test": "npm run integration-test", + "test:node": "echo skipped", + "test:browser": "echo skipped", + "unit-test": "npm run unit-test:node && npm run unit-test:browser", + "unit-test:node": "cross-env TEST_MODE=playback npm run integration-test:node", + "unit-test:browser": "echo skipped", + "integration-test": "npm run integration-test:node && npm run integration-test:browser", + "integration-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 'test/*.ts'", + "integration-test:browser": "echo skipped" + }, + "sideEffects": false, + "//metadata": { + "constantPaths": [ + { + "path": "src/microsoftComputeSchedule.ts", + "prefix": "packageDetails" + } + ] + }, + "autoPublish": true, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/computeschedule/arm-computeschedule" +} \ No newline at end of file diff --git a/sdk/computeschedule/arm-computeschedule/review/arm-computeschedule.api.md b/sdk/computeschedule/arm-computeschedule/review/arm-computeschedule.api.md new file mode 100644 index 000000000000..b5a6b01429c5 --- /dev/null +++ b/sdk/computeschedule/arm-computeschedule/review/arm-computeschedule.api.md @@ -0,0 +1,414 @@ +## API Report File for "@azure/arm-computeschedule" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import * as coreAuth from '@azure/core-auth'; +import * as coreClient from '@azure/core-client'; +import { PagedAsyncIterableIterator } from '@azure/core-paging'; + +// @public +export type ActionType = string; + +// @public +export interface CancelOperationsRequest { + correlationid: string; + operationIds: string[]; +} + +// @public +export interface CancelOperationsResponse { + results: ResourceOperation[]; +} + +// @public +export type DeadlineType = string; + +// @public +export interface DeallocateResourceOperationResponse { + description: string; + location: string; + results?: ResourceOperation[]; + type: string; +} + +// @public +export interface ErrorAdditionalInfo { + readonly info?: Record; + readonly type?: string; +} + +// @public +export interface ErrorDetail { + readonly additionalInfo?: ErrorAdditionalInfo[]; + readonly code?: string; + readonly details?: ErrorDetail[]; + readonly message?: string; + readonly target?: string; +} + +// @public +export interface ErrorResponse { + error?: ErrorDetail; +} + +// @public +export interface ExecuteDeallocateRequest { + correlationid: string; + executionParameters: ExecutionParameters; + resources: Resources; +} + +// @public +export interface ExecuteHibernateRequest { + correlationid: string; + executionParameters: ExecutionParameters; + resources: Resources; +} + +// @public +export interface ExecuteStartRequest { + correlationid: string; + executionParameters: ExecutionParameters; + resources: Resources; +} + +// @public +export interface ExecutionParameters { + optimizationPreference?: OptimizationPreference; + retryPolicy?: RetryPolicy; +} + +// @public +export function getContinuationToken(page: unknown): string | undefined; + +// @public +export interface GetOperationErrorsRequest { + operationIds: string[]; +} + +// @public +export interface GetOperationErrorsResponse { + results: OperationErrorsResult[]; +} + +// @public +export interface GetOperationStatusRequest { + correlationid: string; + operationIds: string[]; +} + +// @public +export interface GetOperationStatusResponse { + results: ResourceOperation[]; +} + +// @public +export interface HibernateResourceOperationResponse { + description: string; + location: string; + results?: ResourceOperation[]; + type: string; +} + +// @public +export enum KnownActionType { + Internal = "Internal" +} + +// @public +export enum KnownDeadlineType { + CompleteBy = "CompleteBy", + InitiateAt = "InitiateAt", + Unknown = "Unknown" +} + +// @public +export enum KnownOperationState { + Blocked = "Blocked", + Cancelled = "Cancelled", + Executing = "Executing", + Failed = "Failed", + PendingExecution = "PendingExecution", + PendingScheduling = "PendingScheduling", + Scheduled = "Scheduled", + Succeeded = "Succeeded", + Unknown = "Unknown" +} + +// @public +export enum KnownOptimizationPreference { + Availability = "Availability", + Cost = "Cost", + CostAvailabilityBalanced = "CostAvailabilityBalanced" +} + +// @public +export enum KnownOrigin { + System = "system", + User = "user", + UserSystem = "user,system" +} + +// @public +export enum KnownResourceOperationType { + Deallocate = "Deallocate", + Hibernate = "Hibernate", + Start = "Start", + Unknown = "Unknown" +} + +// @public (undocumented) +export class MicrosoftComputeSchedule extends coreClient.ServiceClient { + // (undocumented) + $host: string; + constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: MicrosoftComputeScheduleOptionalParams); + // (undocumented) + apiVersion: string; + // (undocumented) + operations: Operations; + // (undocumented) + scheduledActions: ScheduledActions; + // (undocumented) + subscriptionId: string; +} + +// @public +export interface MicrosoftComputeScheduleOptionalParams extends coreClient.ServiceClientOptions { + $host?: string; + apiVersion?: string; + endpoint?: string; +} + +// @public +export interface Operation { + readonly actionType?: ActionType; + display?: OperationDisplay; + readonly isDataAction?: boolean; + readonly name?: string; + readonly origin?: Origin; +} + +// @public +export interface OperationDisplay { + readonly description?: string; + readonly operation?: string; + readonly provider?: string; + readonly resource?: string; +} + +// @public +export interface OperationErrorDetails { + crpOperationId: string; + errorCode: string; + errorDetails: Date; + timeStamp: Date; +} + +// @public +export interface OperationErrorsResult { + activationTime?: Date; + completedAt?: Date; + creationTime?: Date; + operationErrors?: OperationErrorDetails[]; + operationId?: string; + requestErrorCode?: string; + requestErrorDetails?: string; +} + +// @public +export interface OperationListResult { + readonly nextLink?: string; + readonly value?: Operation[]; +} + +// @public +export interface Operations { + list(options?: OperationsListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface OperationsListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type OperationsListNextResponse = OperationListResult; + +// @public +export interface OperationsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type OperationsListResponse = OperationListResult; + +// @public +export type OperationState = string; + +// @public +export type OptimizationPreference = string; + +// @public +export type Origin = string; + +// @public +export interface ResourceOperation { + errorCode?: string; + errorDetails?: string; + operation?: ResourceOperationDetails; + resourceId?: string; +} + +// @public +export interface ResourceOperationDetails { + completedAt?: Date; + deadline: Date; + deadlineType: DeadlineType; + operationId: string; + opType: ResourceOperationType; + resourceId: string; + resourceOperationError?: ResourceOperationError; + retryPolicy?: RetryPolicy; + state: OperationState; + subscriptionId: string; + timeZone?: string; +} + +// @public +export interface ResourceOperationError { + errorCode: string; + errorDetails: string; +} + +// @public +export type ResourceOperationType = string; + +// @public +export interface Resources { + ids: string[]; +} + +// @public +export interface RetryPolicy { + retryCount?: number; + retryWindowInMinutes?: number; +} + +// @public +export interface Schedule { + deadLine: Date; + deadlineType: DeadlineType; + timeZone: string; +} + +// @public +export interface ScheduledActions { + virtualMachinesCancelOperations(locationparameter: string, requestBody: CancelOperationsRequest, options?: ScheduledActionsVirtualMachinesCancelOperationsOptionalParams): Promise; + virtualMachinesExecuteDeallocate(locationparameter: string, requestBody: ExecuteDeallocateRequest, options?: ScheduledActionsVirtualMachinesExecuteDeallocateOptionalParams): Promise; + virtualMachinesExecuteHibernate(locationparameter: string, requestBody: ExecuteHibernateRequest, options?: ScheduledActionsVirtualMachinesExecuteHibernateOptionalParams): Promise; + virtualMachinesExecuteStart(locationparameter: string, requestBody: ExecuteStartRequest, options?: ScheduledActionsVirtualMachinesExecuteStartOptionalParams): Promise; + virtualMachinesGetOperationErrors(locationparameter: string, requestBody: GetOperationErrorsRequest, options?: ScheduledActionsVirtualMachinesGetOperationErrorsOptionalParams): Promise; + virtualMachinesGetOperationStatus(locationparameter: string, requestBody: GetOperationStatusRequest, options?: ScheduledActionsVirtualMachinesGetOperationStatusOptionalParams): Promise; + virtualMachinesSubmitDeallocate(locationparameter: string, requestBody: SubmitDeallocateRequest, options?: ScheduledActionsVirtualMachinesSubmitDeallocateOptionalParams): Promise; + virtualMachinesSubmitHibernate(locationparameter: string, requestBody: SubmitHibernateRequest, options?: ScheduledActionsVirtualMachinesSubmitHibernateOptionalParams): Promise; + virtualMachinesSubmitStart(locationparameter: string, requestBody: SubmitStartRequest, options?: ScheduledActionsVirtualMachinesSubmitStartOptionalParams): Promise; +} + +// @public +export interface ScheduledActionsVirtualMachinesCancelOperationsOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ScheduledActionsVirtualMachinesCancelOperationsResponse = CancelOperationsResponse; + +// @public +export interface ScheduledActionsVirtualMachinesExecuteDeallocateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ScheduledActionsVirtualMachinesExecuteDeallocateResponse = DeallocateResourceOperationResponse; + +// @public +export interface ScheduledActionsVirtualMachinesExecuteHibernateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ScheduledActionsVirtualMachinesExecuteHibernateResponse = HibernateResourceOperationResponse; + +// @public +export interface ScheduledActionsVirtualMachinesExecuteStartOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ScheduledActionsVirtualMachinesExecuteStartResponse = StartResourceOperationResponse; + +// @public +export interface ScheduledActionsVirtualMachinesGetOperationErrorsOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ScheduledActionsVirtualMachinesGetOperationErrorsResponse = GetOperationErrorsResponse; + +// @public +export interface ScheduledActionsVirtualMachinesGetOperationStatusOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ScheduledActionsVirtualMachinesGetOperationStatusResponse = GetOperationStatusResponse; + +// @public +export interface ScheduledActionsVirtualMachinesSubmitDeallocateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ScheduledActionsVirtualMachinesSubmitDeallocateResponse = DeallocateResourceOperationResponse; + +// @public +export interface ScheduledActionsVirtualMachinesSubmitHibernateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ScheduledActionsVirtualMachinesSubmitHibernateResponse = HibernateResourceOperationResponse; + +// @public +export interface ScheduledActionsVirtualMachinesSubmitStartOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ScheduledActionsVirtualMachinesSubmitStartResponse = StartResourceOperationResponse; + +// @public +export interface StartResourceOperationResponse { + description: string; + location: string; + results?: ResourceOperation[]; + type: string; +} + +// @public +export interface SubmitDeallocateRequest { + correlationid: string; + executionParameters: ExecutionParameters; + resources: Resources; + schedule: Schedule; +} + +// @public +export interface SubmitHibernateRequest { + correlationid: string; + executionParameters: ExecutionParameters; + resources: Resources; + schedule: Schedule; +} + +// @public +export interface SubmitStartRequest { + correlationid: string; + executionParameters: ExecutionParameters; + resources: Resources; + schedule: Schedule; +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/computeschedule/arm-computeschedule/sample.env b/sdk/computeschedule/arm-computeschedule/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/computeschedule/arm-computeschedule/sample.env @@ -0,0 +1,4 @@ +# App registration secret for AAD authentication +AZURE_CLIENT_SECRET= +AZURE_CLIENT_ID= +AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/computeschedule/arm-computeschedule/src/index.ts b/sdk/computeschedule/arm-computeschedule/src/index.ts new file mode 100644 index 000000000000..47f0e4374031 --- /dev/null +++ b/sdk/computeschedule/arm-computeschedule/src/index.ts @@ -0,0 +1,13 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +/// +export { getContinuationToken } from "./pagingHelper"; +export * from "./models"; +export { MicrosoftComputeSchedule } from "./microsoftComputeSchedule"; +export * from "./operationsInterfaces"; diff --git a/sdk/computeschedule/arm-computeschedule/src/microsoftComputeSchedule.ts b/sdk/computeschedule/arm-computeschedule/src/microsoftComputeSchedule.ts new file mode 100644 index 000000000000..2e1a66af8ed3 --- /dev/null +++ b/sdk/computeschedule/arm-computeschedule/src/microsoftComputeSchedule.ts @@ -0,0 +1,143 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import * as coreClient from "@azure/core-client"; +import * as coreRestPipeline from "@azure/core-rest-pipeline"; +import { + PipelineRequest, + PipelineResponse, + SendRequest, +} from "@azure/core-rest-pipeline"; +import * as coreAuth from "@azure/core-auth"; +import { OperationsImpl, ScheduledActionsImpl } from "./operations"; +import { Operations, ScheduledActions } from "./operationsInterfaces"; +import { MicrosoftComputeScheduleOptionalParams } from "./models"; + +export class MicrosoftComputeSchedule extends coreClient.ServiceClient { + $host: string; + apiVersion: string; + subscriptionId: string; + + /** + * Initializes a new instance of the MicrosoftComputeSchedule class. + * @param credentials Subscription credentials which uniquely identify client subscription. + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param options The parameter options + */ + constructor( + credentials: coreAuth.TokenCredential, + subscriptionId: string, + options?: MicrosoftComputeScheduleOptionalParams, + ) { + if (credentials === undefined) { + throw new Error("'credentials' cannot be null"); + } + if (subscriptionId === undefined) { + throw new Error("'subscriptionId' cannot be null"); + } + + // Initializing default values for options + if (!options) { + options = {}; + } + const defaults: MicrosoftComputeScheduleOptionalParams = { + requestContentType: "application/json; charset=utf-8", + credential: credentials, + }; + + const packageDetails = `azsdk-js-arm-computeschedule/1.0.0-beta.1`; + const userAgentPrefix = + options.userAgentOptions && options.userAgentOptions.userAgentPrefix + ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` + : `${packageDetails}`; + + const optionsWithDefaults = { + ...defaults, + ...options, + userAgentOptions: { + userAgentPrefix, + }, + endpoint: + options.endpoint ?? options.baseUri ?? "https://management.azure.com", + }; + super(optionsWithDefaults); + + let bearerTokenAuthenticationPolicyFound: boolean = false; + if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) { + const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = + options.pipeline.getOrderedPolicies(); + bearerTokenAuthenticationPolicyFound = pipelinePolicies.some( + (pipelinePolicy) => + pipelinePolicy.name === + coreRestPipeline.bearerTokenAuthenticationPolicyName, + ); + } + if ( + !options || + !options.pipeline || + options.pipeline.getOrderedPolicies().length == 0 || + !bearerTokenAuthenticationPolicyFound + ) { + this.pipeline.removePolicy({ + name: coreRestPipeline.bearerTokenAuthenticationPolicyName, + }); + this.pipeline.addPolicy( + coreRestPipeline.bearerTokenAuthenticationPolicy({ + credential: credentials, + scopes: + optionsWithDefaults.credentialScopes ?? + `${optionsWithDefaults.endpoint}/.default`, + challengeCallbacks: { + authorizeRequestOnChallenge: + coreClient.authorizeRequestOnClaimChallenge, + }, + }), + ); + } + // Parameter assignments + this.subscriptionId = subscriptionId; + + // Assigning values to Constant parameters + this.$host = options.$host || "https://management.azure.com"; + this.apiVersion = options.apiVersion || "2024-08-15-preview"; + this.operations = new OperationsImpl(this); + this.scheduledActions = new ScheduledActionsImpl(this); + this.addCustomApiVersionPolicy(options.apiVersion); + } + + /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */ + private addCustomApiVersionPolicy(apiVersion?: string) { + if (!apiVersion) { + return; + } + const apiVersionPolicy = { + name: "CustomApiVersionPolicy", + async sendRequest( + request: PipelineRequest, + next: SendRequest, + ): Promise { + const param = request.url.split("?"); + if (param.length > 1) { + const newParams = param[1].split("&").map((item) => { + if (item.indexOf("api-version") > -1) { + return "api-version=" + apiVersion; + } else { + return item; + } + }); + request.url = param[0] + "?" + newParams.join("&"); + } + return next(request); + }, + }; + this.pipeline.addPolicy(apiVersionPolicy); + } + + operations: Operations; + scheduledActions: ScheduledActions; +} diff --git a/sdk/computeschedule/arm-computeschedule/src/models/index.ts b/sdk/computeschedule/arm-computeschedule/src/models/index.ts new file mode 100644 index 000000000000..2e19100704ea --- /dev/null +++ b/sdk/computeschedule/arm-computeschedule/src/models/index.ts @@ -0,0 +1,610 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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; +} + +/** Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). */ +export interface ErrorResponse { + /** The error object. */ + error?: ErrorDetail; +} + +/** The error detail. */ +export interface ErrorDetail { + /** + * The error code. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly code?: string; + /** + * The error message. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly message?: string; + /** + * The error target. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly target?: string; + /** + * The error details. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly details?: ErrorDetail[]; + /** + * The error additional info. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly additionalInfo?: ErrorAdditionalInfo[]; +} + +/** The resource management error additional info. */ +export interface ErrorAdditionalInfo { + /** + * The additional info type. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; + /** + * The additional info. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly info?: Record; +} + +/** This is the request to cancel running operations in scheduled actions using the operation ids */ +export interface CancelOperationsRequest { + /** The list of operation ids to cancel operations on */ + operationIds: string[]; + /** Correlationid item */ + correlationid: string; +} + +/** This is the response from a cancel operations request */ +export interface CancelOperationsResponse { + /** An array of resource operations that were successfully cancelled */ + results: ResourceOperation[]; +} + +/** High level response from an operation on a resource */ +export interface ResourceOperation { + /** Unique identifier for the resource involved in the operation, eg ArmId */ + resourceId?: string; + /** Resource level error code if it exists */ + errorCode?: string; + /** Resource level error details if they exist */ + errorDetails?: string; + /** Details of the operation performed on a resource */ + operation?: ResourceOperationDetails; +} + +/** The details of a response from an operation on a resource */ +export interface ResourceOperationDetails { + /** Operation identifier for the unique operation */ + operationId: string; + /** Unique identifier for the resource involved in the operation, eg ArmId */ + resourceId: string; + /** Type of operation performed on the resources */ + opType: ResourceOperationType; + /** Subscription id attached to the request */ + subscriptionId: string; + /** Deadline for the operation */ + deadline: Date; + /** Type of deadline of the operation */ + deadlineType: DeadlineType; + /** Current state of the operation */ + state: OperationState; + /** Timezone for the operation */ + timeZone?: string; + /** Operation level errors if they exist */ + resourceOperationError?: ResourceOperationError; + /** Time the operation was complete if errors are null */ + completedAt?: Date; + /** Retry policy the user can pass */ + retryPolicy?: RetryPolicy; +} + +/** These describe errors that occur at the resource level */ +export interface ResourceOperationError { + /** Code for the error eg 404, 500 */ + errorCode: string; + /** Detailed message about the error */ + errorDetails: string; +} + +/** The retry policy for the user request */ +export interface RetryPolicy { + /** Retry count for user request */ + retryCount?: number; + /** Retry window in minutes for user request */ + retryWindowInMinutes?: number; +} + +/** The ExecuteDeallocateRequest request for executeDeallocate operations */ +export interface ExecuteDeallocateRequest { + /** The execution parameters for the request */ + executionParameters: ExecutionParameters; + /** The resources for the request */ + resources: Resources; + /** Correlationid item */ + correlationid: string; +} + +/** Extra details needed to run the user's request */ +export interface ExecutionParameters { + /** Details that could optimize the user's request */ + optimizationPreference?: OptimizationPreference; + /** Retry policy the user can pass */ + retryPolicy?: RetryPolicy; +} + +/** The resources needed for the user request */ +export interface Resources { + /** The resource ids used for the request */ + ids: string[]; +} + +/** The response from a deallocate request */ +export interface DeallocateResourceOperationResponse { + /** The description of the operation response */ + description: string; + /** The type of resources used in the deallocate request eg virtual machines */ + type: string; + /** The location of the deallocate request eg westus */ + location: string; + /** The results from the deallocate request if no errors exist */ + results?: ResourceOperation[]; +} + +/** The ExecuteHibernateRequest request for executeHibernate operations */ +export interface ExecuteHibernateRequest { + /** The execution parameters for the request */ + executionParameters: ExecutionParameters; + /** The resources for the request */ + resources: Resources; + /** Correlationid item */ + correlationid: string; +} + +/** The response from a Hibernate request */ +export interface HibernateResourceOperationResponse { + /** The description of the operation response */ + description: string; + /** The type of resources used in the Hibernate request eg virtual machines */ + type: string; + /** The location of the Hibernate request eg westus */ + location: string; + /** The results from the Hibernate request if no errors exist */ + results?: ResourceOperation[]; +} + +/** The ExecuteStartRequest request for executeStart operations */ +export interface ExecuteStartRequest { + /** The execution parameters for the request */ + executionParameters: ExecutionParameters; + /** The resources for the request */ + resources: Resources; + /** Correlationid item */ + correlationid: string; +} + +/** The response from a start request */ +export interface StartResourceOperationResponse { + /** The description of the operation response */ + description: string; + /** The type of resources used in the start request eg virtual machines */ + type: string; + /** The location of the start request eg westus */ + location: string; + /** The results from the start request if no errors exist */ + results?: ResourceOperation[]; +} + +/** This is the request to get errors per vm operations */ +export interface GetOperationErrorsRequest { + /** The list of operation ids to query errors of */ + operationIds: string[]; +} + +/** This is the response from a get operations errors request */ +export interface GetOperationErrorsResponse { + /** An array of operationids and their corresponding errors if any */ + results: OperationErrorsResult[]; +} + +/** This is the first level of operation errors from the request when clients get errors per vm operation */ +export interface OperationErrorsResult { + /** The operationId identifying a vm operation */ + operationId?: string; + /** The creation time of the error result */ + creationTime?: Date; + /** The activation time of a vm operation */ + activationTime?: Date; + /** The completion time of the operation if the operation was completed */ + completedAt?: Date; + /** A list of errors associated with the operationid */ + operationErrors?: OperationErrorDetails[]; + /** Request level error code */ + requestErrorCode?: string; + /** Request level error details */ + requestErrorDetails?: string; +} + +/** This defines a list of operation errors associated with a unique operationId */ +export interface OperationErrorDetails { + /** The error code of the operation */ + errorCode: string; + /** The error details of the operation */ + errorDetails: Date; + /** The timestamp of the error occurence */ + timeStamp: Date; + /** CRP operationid of the operation for deeper analysis */ + crpOperationId: string; +} + +/** This is the request to get operation status using operationids */ +export interface GetOperationStatusRequest { + /** The list of operation ids to get the status of */ + operationIds: string[]; + /** Correlationid item */ + correlationid: string; +} + +/** This is the response from a get operations status request */ +export interface GetOperationStatusResponse { + /** An array of resource operations based on their operation ids */ + results: ResourceOperation[]; +} + +/** The deallocate request for resources */ +export interface SubmitDeallocateRequest { + /** The schedule for the request */ + schedule: Schedule; + /** The execution parameters for the request */ + executionParameters: ExecutionParameters; + /** The resources for the request */ + resources: Resources; + /** Correlationid item */ + correlationid: string; +} + +/** The schedule details for the user request */ +export interface Schedule { + /** The deadline for the operation */ + deadLine: Date; + /** The timezone for the operation */ + timeZone: string; + /** The deadlinetype of the operation, this can either be InitiateAt or CompleteBy */ + deadlineType: DeadlineType; +} + +/** This is the request for hibernate */ +export interface SubmitHibernateRequest { + /** The schedule for the request */ + schedule: Schedule; + /** The execution parameters for the request */ + executionParameters: ExecutionParameters; + /** The resources for the request */ + resources: Resources; + /** Correlationid item */ + correlationid: string; +} + +/** This is the request for start */ +export interface SubmitStartRequest { + /** The schedule for the request */ + schedule: Schedule; + /** The execution parameters for the request */ + executionParameters: ExecutionParameters; + /** The resources for the request */ + resources: Resources; + /** Correlationid item */ + correlationid: 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 ResourceOperationType} that the service accepts. */ +export enum KnownResourceOperationType { + /** The default value for this enum type */ + Unknown = "Unknown", + /** Start operations on the resources */ + Start = "Start", + /** Deallocate operations on the resources */ + Deallocate = "Deallocate", + /** Hibernate operations on the resources */ + Hibernate = "Hibernate", +} + +/** + * Defines values for ResourceOperationType. \ + * {@link KnownResourceOperationType} can be used interchangeably with ResourceOperationType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Unknown**: The default value for this enum type \ + * **Start**: Start operations on the resources \ + * **Deallocate**: Deallocate operations on the resources \ + * **Hibernate**: Hibernate operations on the resources + */ +export type ResourceOperationType = string; + +/** Known values of {@link DeadlineType} that the service accepts. */ +export enum KnownDeadlineType { + /** Default value of Unknown. */ + Unknown = "Unknown", + /** Initiate the operation at the given deadline. */ + InitiateAt = "InitiateAt", + /** Complete the operation by the given deadline. */ + CompleteBy = "CompleteBy", +} + +/** + * Defines values for DeadlineType. \ + * {@link KnownDeadlineType} can be used interchangeably with DeadlineType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Unknown**: Default value of Unknown. \ + * **InitiateAt**: Initiate the operation at the given deadline. \ + * **CompleteBy**: Complete the operation by the given deadline. + */ +export type DeadlineType = string; + +/** Known values of {@link OperationState} that the service accepts. */ +export enum KnownOperationState { + /** The default value for the operation state enum */ + Unknown = "Unknown", + /** Operations that are pending scheduling */ + PendingScheduling = "PendingScheduling", + /** Operations that have been scheduled */ + Scheduled = "Scheduled", + /** Operations that are waiting to be executed */ + PendingExecution = "PendingExecution", + /** Operations that are in the process of being executed */ + Executing = "Executing", + /** Operations that suceeded */ + Succeeded = "Succeeded", + /** Operations that have failed */ + Failed = "Failed", + /** Operations that have been cancelled by the user */ + Cancelled = "Cancelled", + /** Operations that are blocked */ + Blocked = "Blocked", +} + +/** + * Defines values for OperationState. \ + * {@link KnownOperationState} can be used interchangeably with OperationState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Unknown**: The default value for the operation state enum \ + * **PendingScheduling**: Operations that are pending scheduling \ + * **Scheduled**: Operations that have been scheduled \ + * **PendingExecution**: Operations that are waiting to be executed \ + * **Executing**: Operations that are in the process of being executed \ + * **Succeeded**: Operations that suceeded \ + * **Failed**: Operations that have failed \ + * **Cancelled**: Operations that have been cancelled by the user \ + * **Blocked**: Operations that are blocked + */ +export type OperationState = string; + +/** Known values of {@link OptimizationPreference} that the service accepts. */ +export enum KnownOptimizationPreference { + /** Optimize while considering cost savings */ + Cost = "Cost", + /** Optimize while considering availability of resources */ + Availability = "Availability", + /** Optimize while considering a balance of cost and availability */ + CostAvailabilityBalanced = "CostAvailabilityBalanced", +} + +/** + * Defines values for OptimizationPreference. \ + * {@link KnownOptimizationPreference} can be used interchangeably with OptimizationPreference, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Cost**: Optimize while considering cost savings \ + * **Availability**: Optimize while considering availability of resources \ + * **CostAvailabilityBalanced**: Optimize while considering a balance of cost and availability + */ +export type OptimizationPreference = string; + +/** Optional parameters. */ +export interface OperationsListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type OperationsListResponse = OperationListResult; + +/** Optional parameters. */ +export interface OperationsListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type OperationsListNextResponse = OperationListResult; + +/** Optional parameters. */ +export interface ScheduledActionsVirtualMachinesCancelOperationsOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the virtualMachinesCancelOperations operation. */ +export type ScheduledActionsVirtualMachinesCancelOperationsResponse = + CancelOperationsResponse; + +/** Optional parameters. */ +export interface ScheduledActionsVirtualMachinesExecuteDeallocateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the virtualMachinesExecuteDeallocate operation. */ +export type ScheduledActionsVirtualMachinesExecuteDeallocateResponse = + DeallocateResourceOperationResponse; + +/** Optional parameters. */ +export interface ScheduledActionsVirtualMachinesExecuteHibernateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the virtualMachinesExecuteHibernate operation. */ +export type ScheduledActionsVirtualMachinesExecuteHibernateResponse = + HibernateResourceOperationResponse; + +/** Optional parameters. */ +export interface ScheduledActionsVirtualMachinesExecuteStartOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the virtualMachinesExecuteStart operation. */ +export type ScheduledActionsVirtualMachinesExecuteStartResponse = + StartResourceOperationResponse; + +/** Optional parameters. */ +export interface ScheduledActionsVirtualMachinesGetOperationErrorsOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the virtualMachinesGetOperationErrors operation. */ +export type ScheduledActionsVirtualMachinesGetOperationErrorsResponse = + GetOperationErrorsResponse; + +/** Optional parameters. */ +export interface ScheduledActionsVirtualMachinesGetOperationStatusOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the virtualMachinesGetOperationStatus operation. */ +export type ScheduledActionsVirtualMachinesGetOperationStatusResponse = + GetOperationStatusResponse; + +/** Optional parameters. */ +export interface ScheduledActionsVirtualMachinesSubmitDeallocateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the virtualMachinesSubmitDeallocate operation. */ +export type ScheduledActionsVirtualMachinesSubmitDeallocateResponse = + DeallocateResourceOperationResponse; + +/** Optional parameters. */ +export interface ScheduledActionsVirtualMachinesSubmitHibernateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the virtualMachinesSubmitHibernate operation. */ +export type ScheduledActionsVirtualMachinesSubmitHibernateResponse = + HibernateResourceOperationResponse; + +/** Optional parameters. */ +export interface ScheduledActionsVirtualMachinesSubmitStartOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the virtualMachinesSubmitStart operation. */ +export type ScheduledActionsVirtualMachinesSubmitStartResponse = + StartResourceOperationResponse; + +/** Optional parameters. */ +export interface MicrosoftComputeScheduleOptionalParams + extends coreClient.ServiceClientOptions { + /** server parameter */ + $host?: string; + /** Api Version */ + apiVersion?: string; + /** Overrides client endpoint. */ + endpoint?: string; +} diff --git a/sdk/computeschedule/arm-computeschedule/src/models/mappers.ts b/sdk/computeschedule/arm-computeschedule/src/models/mappers.ts new file mode 100644 index 000000000000..3979d15180b0 --- /dev/null +++ b/sdk/computeschedule/arm-computeschedule/src/models/mappers.ts @@ -0,0 +1,1014 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import * as coreClient from "@azure/core-client"; + +export const OperationListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationListResult", + modelProperties: { + value: { + serializedName: "value", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Operation", + }, + }, + }, + }, + nextLink: { + serializedName: "nextLink", + readOnly: true, + type: { + name: "String", + }, + }, + }, + }, +}; + +export const Operation: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Operation", + modelProperties: { + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String", + }, + }, + isDataAction: { + serializedName: "isDataAction", + readOnly: true, + type: { + name: "Boolean", + }, + }, + display: { + serializedName: "display", + type: { + name: "Composite", + className: "OperationDisplay", + }, + }, + origin: { + serializedName: "origin", + readOnly: true, + type: { + name: "String", + }, + }, + actionType: { + serializedName: "actionType", + readOnly: true, + type: { + name: "String", + }, + }, + }, + }, +}; + +export const OperationDisplay: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationDisplay", + modelProperties: { + provider: { + serializedName: "provider", + readOnly: true, + type: { + name: "String", + }, + }, + resource: { + serializedName: "resource", + readOnly: true, + type: { + name: "String", + }, + }, + operation: { + serializedName: "operation", + readOnly: true, + type: { + name: "String", + }, + }, + description: { + serializedName: "description", + readOnly: true, + type: { + name: "String", + }, + }, + }, + }, +}; + +export const ErrorResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorResponse", + modelProperties: { + error: { + serializedName: "error", + type: { + name: "Composite", + className: "ErrorDetail", + }, + }, + }, + }, +}; + +export const ErrorDetail: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorDetail", + modelProperties: { + code: { + serializedName: "code", + readOnly: true, + type: { + name: "String", + }, + }, + message: { + serializedName: "message", + readOnly: true, + type: { + name: "String", + }, + }, + target: { + serializedName: "target", + readOnly: true, + type: { + name: "String", + }, + }, + details: { + serializedName: "details", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorDetail", + }, + }, + }, + }, + additionalInfo: { + serializedName: "additionalInfo", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorAdditionalInfo", + }, + }, + }, + }, + }, + }, +}; + +export const ErrorAdditionalInfo: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorAdditionalInfo", + modelProperties: { + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String", + }, + }, + info: { + serializedName: "info", + readOnly: true, + type: { + name: "Dictionary", + value: { type: { name: "any" } }, + }, + }, + }, + }, +}; + +export const CancelOperationsRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CancelOperationsRequest", + modelProperties: { + operationIds: { + serializedName: "operationIds", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "String", + }, + }, + }, + }, + correlationid: { + serializedName: "correlationid", + required: true, + type: { + name: "String", + }, + }, + }, + }, +}; + +export const CancelOperationsResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CancelOperationsResponse", + modelProperties: { + results: { + serializedName: "results", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ResourceOperation", + }, + }, + }, + }, + }, + }, +}; + +export const ResourceOperation: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ResourceOperation", + modelProperties: { + resourceId: { + serializedName: "resourceId", + type: { + name: "String", + }, + }, + errorCode: { + serializedName: "errorCode", + type: { + name: "String", + }, + }, + errorDetails: { + serializedName: "errorDetails", + type: { + name: "String", + }, + }, + operation: { + serializedName: "operation", + type: { + name: "Composite", + className: "ResourceOperationDetails", + }, + }, + }, + }, +}; + +export const ResourceOperationDetails: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ResourceOperationDetails", + modelProperties: { + operationId: { + serializedName: "operationId", + required: true, + type: { + name: "String", + }, + }, + resourceId: { + serializedName: "resourceId", + required: true, + type: { + name: "String", + }, + }, + opType: { + serializedName: "opType", + required: true, + type: { + name: "String", + }, + }, + subscriptionId: { + serializedName: "subscriptionId", + required: true, + type: { + name: "String", + }, + }, + deadline: { + serializedName: "deadline", + required: true, + type: { + name: "DateTime", + }, + }, + deadlineType: { + serializedName: "deadlineType", + required: true, + type: { + name: "String", + }, + }, + state: { + serializedName: "state", + required: true, + type: { + name: "String", + }, + }, + timeZone: { + serializedName: "timeZone", + type: { + name: "String", + }, + }, + resourceOperationError: { + serializedName: "resourceOperationError", + type: { + name: "Composite", + className: "ResourceOperationError", + }, + }, + completedAt: { + serializedName: "completedAt", + type: { + name: "DateTime", + }, + }, + retryPolicy: { + serializedName: "retryPolicy", + type: { + name: "Composite", + className: "RetryPolicy", + }, + }, + }, + }, +}; + +export const ResourceOperationError: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ResourceOperationError", + modelProperties: { + errorCode: { + serializedName: "errorCode", + required: true, + type: { + name: "String", + }, + }, + errorDetails: { + serializedName: "errorDetails", + required: true, + type: { + name: "String", + }, + }, + }, + }, +}; + +export const RetryPolicy: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "RetryPolicy", + modelProperties: { + retryCount: { + serializedName: "retryCount", + type: { + name: "Number", + }, + }, + retryWindowInMinutes: { + serializedName: "retryWindowInMinutes", + type: { + name: "Number", + }, + }, + }, + }, +}; + +export const ExecuteDeallocateRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ExecuteDeallocateRequest", + modelProperties: { + executionParameters: { + serializedName: "executionParameters", + type: { + name: "Composite", + className: "ExecutionParameters", + }, + }, + resources: { + serializedName: "resources", + type: { + name: "Composite", + className: "Resources", + }, + }, + correlationid: { + serializedName: "correlationid", + required: true, + type: { + name: "String", + }, + }, + }, + }, +}; + +export const ExecutionParameters: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ExecutionParameters", + modelProperties: { + optimizationPreference: { + serializedName: "optimizationPreference", + type: { + name: "String", + }, + }, + retryPolicy: { + serializedName: "retryPolicy", + type: { + name: "Composite", + className: "RetryPolicy", + }, + }, + }, + }, +}; + +export const Resources: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Resources", + modelProperties: { + ids: { + serializedName: "ids", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "String", + }, + }, + }, + }, + }, + }, +}; + +export const DeallocateResourceOperationResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeallocateResourceOperationResponse", + modelProperties: { + description: { + serializedName: "description", + required: true, + type: { + name: "String", + }, + }, + type: { + serializedName: "type", + required: true, + type: { + name: "String", + }, + }, + location: { + serializedName: "location", + required: true, + type: { + name: "String", + }, + }, + results: { + serializedName: "results", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ResourceOperation", + }, + }, + }, + }, + }, + }, +}; + +export const ExecuteHibernateRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ExecuteHibernateRequest", + modelProperties: { + executionParameters: { + serializedName: "executionParameters", + type: { + name: "Composite", + className: "ExecutionParameters", + }, + }, + resources: { + serializedName: "resources", + type: { + name: "Composite", + className: "Resources", + }, + }, + correlationid: { + serializedName: "correlationid", + required: true, + type: { + name: "String", + }, + }, + }, + }, +}; + +export const HibernateResourceOperationResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "HibernateResourceOperationResponse", + modelProperties: { + description: { + serializedName: "description", + required: true, + type: { + name: "String", + }, + }, + type: { + serializedName: "type", + required: true, + type: { + name: "String", + }, + }, + location: { + serializedName: "location", + required: true, + type: { + name: "String", + }, + }, + results: { + serializedName: "results", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ResourceOperation", + }, + }, + }, + }, + }, + }, +}; + +export const ExecuteStartRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ExecuteStartRequest", + modelProperties: { + executionParameters: { + serializedName: "executionParameters", + type: { + name: "Composite", + className: "ExecutionParameters", + }, + }, + resources: { + serializedName: "resources", + type: { + name: "Composite", + className: "Resources", + }, + }, + correlationid: { + serializedName: "correlationid", + required: true, + type: { + name: "String", + }, + }, + }, + }, +}; + +export const StartResourceOperationResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "StartResourceOperationResponse", + modelProperties: { + description: { + serializedName: "description", + required: true, + type: { + name: "String", + }, + }, + type: { + serializedName: "type", + required: true, + type: { + name: "String", + }, + }, + location: { + serializedName: "location", + required: true, + type: { + name: "String", + }, + }, + results: { + serializedName: "results", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ResourceOperation", + }, + }, + }, + }, + }, + }, +}; + +export const GetOperationErrorsRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "GetOperationErrorsRequest", + modelProperties: { + operationIds: { + serializedName: "operationIds", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "String", + }, + }, + }, + }, + }, + }, +}; + +export const GetOperationErrorsResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "GetOperationErrorsResponse", + modelProperties: { + results: { + serializedName: "results", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "OperationErrorsResult", + }, + }, + }, + }, + }, + }, +}; + +export const OperationErrorsResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationErrorsResult", + modelProperties: { + operationId: { + serializedName: "operationId", + type: { + name: "String", + }, + }, + creationTime: { + serializedName: "creationTime", + type: { + name: "DateTime", + }, + }, + activationTime: { + serializedName: "activationTime", + type: { + name: "DateTime", + }, + }, + completedAt: { + serializedName: "completedAt", + type: { + name: "DateTime", + }, + }, + operationErrors: { + serializedName: "operationErrors", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "OperationErrorDetails", + }, + }, + }, + }, + requestErrorCode: { + serializedName: "requestErrorCode", + type: { + name: "String", + }, + }, + requestErrorDetails: { + serializedName: "requestErrorDetails", + type: { + name: "String", + }, + }, + }, + }, +}; + +export const OperationErrorDetails: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationErrorDetails", + modelProperties: { + errorCode: { + serializedName: "errorCode", + required: true, + type: { + name: "String", + }, + }, + errorDetails: { + serializedName: "errorDetails", + required: true, + type: { + name: "DateTime", + }, + }, + timeStamp: { + serializedName: "timeStamp", + required: true, + type: { + name: "DateTime", + }, + }, + crpOperationId: { + serializedName: "crpOperationId", + required: true, + type: { + name: "String", + }, + }, + }, + }, +}; + +export const GetOperationStatusRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "GetOperationStatusRequest", + modelProperties: { + operationIds: { + serializedName: "operationIds", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "String", + }, + }, + }, + }, + correlationid: { + serializedName: "correlationid", + required: true, + type: { + name: "String", + }, + }, + }, + }, +}; + +export const GetOperationStatusResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "GetOperationStatusResponse", + modelProperties: { + results: { + serializedName: "results", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ResourceOperation", + }, + }, + }, + }, + }, + }, +}; + +export const SubmitDeallocateRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SubmitDeallocateRequest", + modelProperties: { + schedule: { + serializedName: "schedule", + type: { + name: "Composite", + className: "Schedule", + }, + }, + executionParameters: { + serializedName: "executionParameters", + type: { + name: "Composite", + className: "ExecutionParameters", + }, + }, + resources: { + serializedName: "resources", + type: { + name: "Composite", + className: "Resources", + }, + }, + correlationid: { + serializedName: "correlationid", + required: true, + type: { + name: "String", + }, + }, + }, + }, +}; + +export const Schedule: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Schedule", + modelProperties: { + deadLine: { + serializedName: "deadLine", + required: true, + type: { + name: "DateTime", + }, + }, + timeZone: { + serializedName: "timeZone", + required: true, + type: { + name: "String", + }, + }, + deadlineType: { + serializedName: "deadlineType", + required: true, + type: { + name: "String", + }, + }, + }, + }, +}; + +export const SubmitHibernateRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SubmitHibernateRequest", + modelProperties: { + schedule: { + serializedName: "schedule", + type: { + name: "Composite", + className: "Schedule", + }, + }, + executionParameters: { + serializedName: "executionParameters", + type: { + name: "Composite", + className: "ExecutionParameters", + }, + }, + resources: { + serializedName: "resources", + type: { + name: "Composite", + className: "Resources", + }, + }, + correlationid: { + serializedName: "correlationid", + required: true, + type: { + name: "String", + }, + }, + }, + }, +}; + +export const SubmitStartRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SubmitStartRequest", + modelProperties: { + schedule: { + serializedName: "schedule", + type: { + name: "Composite", + className: "Schedule", + }, + }, + executionParameters: { + serializedName: "executionParameters", + type: { + name: "Composite", + className: "ExecutionParameters", + }, + }, + resources: { + serializedName: "resources", + type: { + name: "Composite", + className: "Resources", + }, + }, + correlationid: { + serializedName: "correlationid", + required: true, + type: { + name: "String", + }, + }, + }, + }, +}; diff --git a/sdk/computeschedule/arm-computeschedule/src/models/parameters.ts b/sdk/computeschedule/arm-computeschedule/src/models/parameters.ts new file mode 100644 index 000000000000..41f1ad443afd --- /dev/null +++ b/sdk/computeschedule/arm-computeschedule/src/models/parameters.ts @@ -0,0 +1,154 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { + CancelOperationsRequest as CancelOperationsRequestMapper, + ExecuteDeallocateRequest as ExecuteDeallocateRequestMapper, + ExecuteHibernateRequest as ExecuteHibernateRequestMapper, + ExecuteStartRequest as ExecuteStartRequestMapper, + GetOperationErrorsRequest as GetOperationErrorsRequestMapper, + GetOperationStatusRequest as GetOperationStatusRequestMapper, + SubmitDeallocateRequest as SubmitDeallocateRequestMapper, + SubmitHibernateRequest as SubmitHibernateRequestMapper, + SubmitStartRequest as SubmitStartRequestMapper, +} from "../models/mappers"; + +export const accept: OperationParameter = { + parameterPath: "accept", + mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Accept", + type: { + name: "String", + }, + }, +}; + +export const $host: OperationURLParameter = { + parameterPath: "$host", + mapper: { + serializedName: "$host", + required: true, + type: { + name: "String", + }, + }, + skipEncoding: true, +}; + +export const apiVersion: OperationQueryParameter = { + parameterPath: "apiVersion", + mapper: { + defaultValue: "2024-08-15-preview", + isConstant: true, + serializedName: "api-version", + type: { + name: "String", + }, + }, +}; + +export const nextLink: OperationURLParameter = { + parameterPath: "nextLink", + mapper: { + serializedName: "nextLink", + required: true, + type: { + name: "String", + }, + }, + skipEncoding: true, +}; + +export const contentType: OperationParameter = { + parameterPath: ["options", "contentType"], + mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Content-Type", + type: { + name: "String", + }, + }, +}; + +export const requestBody: OperationParameter = { + parameterPath: "requestBody", + mapper: CancelOperationsRequestMapper, +}; + +export const subscriptionId: OperationURLParameter = { + parameterPath: "subscriptionId", + mapper: { + serializedName: "subscriptionId", + required: true, + type: { + name: "Uuid", + }, + }, +}; + +export const locationparameter: OperationURLParameter = { + parameterPath: "locationparameter", + mapper: { + constraints: { + MinLength: 1, + }, + serializedName: "locationparameter", + required: true, + type: { + name: "String", + }, + }, +}; + +export const requestBody1: OperationParameter = { + parameterPath: "requestBody", + mapper: ExecuteDeallocateRequestMapper, +}; + +export const requestBody2: OperationParameter = { + parameterPath: "requestBody", + mapper: ExecuteHibernateRequestMapper, +}; + +export const requestBody3: OperationParameter = { + parameterPath: "requestBody", + mapper: ExecuteStartRequestMapper, +}; + +export const requestBody4: OperationParameter = { + parameterPath: "requestBody", + mapper: GetOperationErrorsRequestMapper, +}; + +export const requestBody5: OperationParameter = { + parameterPath: "requestBody", + mapper: GetOperationStatusRequestMapper, +}; + +export const requestBody6: OperationParameter = { + parameterPath: "requestBody", + mapper: SubmitDeallocateRequestMapper, +}; + +export const requestBody7: OperationParameter = { + parameterPath: "requestBody", + mapper: SubmitHibernateRequestMapper, +}; + +export const requestBody8: OperationParameter = { + parameterPath: "requestBody", + mapper: SubmitStartRequestMapper, +}; diff --git a/sdk/computeschedule/arm-computeschedule/src/operations/index.ts b/sdk/computeschedule/arm-computeschedule/src/operations/index.ts new file mode 100644 index 000000000000..3f53f74234e7 --- /dev/null +++ b/sdk/computeschedule/arm-computeschedule/src/operations/index.ts @@ -0,0 +1,10 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export * from "./operations"; +export * from "./scheduledActions"; diff --git a/sdk/computeschedule/arm-computeschedule/src/operations/operations.ts b/sdk/computeschedule/arm-computeschedule/src/operations/operations.ts new file mode 100644 index 000000000000..242a813daebb --- /dev/null +++ b/sdk/computeschedule/arm-computeschedule/src/operations/operations.ts @@ -0,0 +1,149 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; +import { Operations } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { MicrosoftComputeSchedule } from "../microsoftComputeSchedule"; +import { + Operation, + OperationsListNextOptionalParams, + OperationsListOptionalParams, + OperationsListResponse, + OperationsListNextResponse, +} from "../models"; + +/// +/** Class containing Operations operations. */ +export class OperationsImpl implements Operations { + private readonly client: MicrosoftComputeSchedule; + + /** + * Initialize a new instance of the class Operations class. + * @param client Reference to the service client + */ + constructor(client: MicrosoftComputeSchedule) { + this.client = client; + } + + /** + * List the operations for the provider + * @param options The options parameters. + */ + public list( + options?: OperationsListOptionalParams, + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(options, settings); + }, + }; + } + + private async *listPagingPage( + options?: OperationsListOptionalParams, + settings?: PageSettings, + ): AsyncIterableIterator { + let result: OperationsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listNext(continuationToken, options); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listPagingAll( + options?: OperationsListOptionalParams, + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(options)) { + yield* page; + } + } + + /** + * List the operations for the provider + * @param options The options parameters. + */ + private _list( + options?: OperationsListOptionalParams, + ): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); + } + + /** + * ListNext + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + nextLink: string, + options?: OperationsListNextOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listNextOperationSpec, + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.ComputeSchedule/operations", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.OperationListResult, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host], + headerParameters: [Parameters.accept], + serializer, +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.OperationListResult, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + urlParameters: [Parameters.$host, Parameters.nextLink], + headerParameters: [Parameters.accept], + serializer, +}; diff --git a/sdk/computeschedule/arm-computeschedule/src/operations/scheduledActions.ts b/sdk/computeschedule/arm-computeschedule/src/operations/scheduledActions.ts new file mode 100644 index 000000000000..61c2e476dfea --- /dev/null +++ b/sdk/computeschedule/arm-computeschedule/src/operations/scheduledActions.ts @@ -0,0 +1,413 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { ScheduledActions } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { MicrosoftComputeSchedule } from "../microsoftComputeSchedule"; +import { + CancelOperationsRequest, + ScheduledActionsVirtualMachinesCancelOperationsOptionalParams, + ScheduledActionsVirtualMachinesCancelOperationsResponse, + ExecuteDeallocateRequest, + ScheduledActionsVirtualMachinesExecuteDeallocateOptionalParams, + ScheduledActionsVirtualMachinesExecuteDeallocateResponse, + ExecuteHibernateRequest, + ScheduledActionsVirtualMachinesExecuteHibernateOptionalParams, + ScheduledActionsVirtualMachinesExecuteHibernateResponse, + ExecuteStartRequest, + ScheduledActionsVirtualMachinesExecuteStartOptionalParams, + ScheduledActionsVirtualMachinesExecuteStartResponse, + GetOperationErrorsRequest, + ScheduledActionsVirtualMachinesGetOperationErrorsOptionalParams, + ScheduledActionsVirtualMachinesGetOperationErrorsResponse, + GetOperationStatusRequest, + ScheduledActionsVirtualMachinesGetOperationStatusOptionalParams, + ScheduledActionsVirtualMachinesGetOperationStatusResponse, + SubmitDeallocateRequest, + ScheduledActionsVirtualMachinesSubmitDeallocateOptionalParams, + ScheduledActionsVirtualMachinesSubmitDeallocateResponse, + SubmitHibernateRequest, + ScheduledActionsVirtualMachinesSubmitHibernateOptionalParams, + ScheduledActionsVirtualMachinesSubmitHibernateResponse, + SubmitStartRequest, + ScheduledActionsVirtualMachinesSubmitStartOptionalParams, + ScheduledActionsVirtualMachinesSubmitStartResponse, +} from "../models"; + +/** Class containing ScheduledActions operations. */ +export class ScheduledActionsImpl implements ScheduledActions { + private readonly client: MicrosoftComputeSchedule; + + /** + * Initialize a new instance of the class ScheduledActions class. + * @param client Reference to the service client + */ + constructor(client: MicrosoftComputeSchedule) { + this.client = client; + } + + /** + * virtualMachinesCancelOperations: cancelOperations for a virtual machine + * @param locationparameter The location name. + * @param requestBody The request body + * @param options The options parameters. + */ + virtualMachinesCancelOperations( + locationparameter: string, + requestBody: CancelOperationsRequest, + options?: ScheduledActionsVirtualMachinesCancelOperationsOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { locationparameter, requestBody, options }, + virtualMachinesCancelOperationsOperationSpec, + ); + } + + /** + * virtualMachinesExecuteDeallocate: executeDeallocate for a virtual machine + * @param locationparameter The location name. + * @param requestBody The request body + * @param options The options parameters. + */ + virtualMachinesExecuteDeallocate( + locationparameter: string, + requestBody: ExecuteDeallocateRequest, + options?: ScheduledActionsVirtualMachinesExecuteDeallocateOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { locationparameter, requestBody, options }, + virtualMachinesExecuteDeallocateOperationSpec, + ); + } + + /** + * virtualMachinesExecuteHibernate: executeHibernate for a virtual machine + * @param locationparameter The location name. + * @param requestBody The request body + * @param options The options parameters. + */ + virtualMachinesExecuteHibernate( + locationparameter: string, + requestBody: ExecuteHibernateRequest, + options?: ScheduledActionsVirtualMachinesExecuteHibernateOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { locationparameter, requestBody, options }, + virtualMachinesExecuteHibernateOperationSpec, + ); + } + + /** + * virtualMachinesExecuteStart: executeStart for a virtual machine + * @param locationparameter The location name. + * @param requestBody The request body + * @param options The options parameters. + */ + virtualMachinesExecuteStart( + locationparameter: string, + requestBody: ExecuteStartRequest, + options?: ScheduledActionsVirtualMachinesExecuteStartOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { locationparameter, requestBody, options }, + virtualMachinesExecuteStartOperationSpec, + ); + } + + /** + * virtualMachinesGetOperationErrors: getOperationErrors associated with an operation on a virtual + * machine + * @param locationparameter The location name. + * @param requestBody The request body + * @param options The options parameters. + */ + virtualMachinesGetOperationErrors( + locationparameter: string, + requestBody: GetOperationErrorsRequest, + options?: ScheduledActionsVirtualMachinesGetOperationErrorsOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { locationparameter, requestBody, options }, + virtualMachinesGetOperationErrorsOperationSpec, + ); + } + + /** + * virtualMachinesGetOperationStatus: getOperationStatus for a virtual machine + * @param locationparameter The location name. + * @param requestBody The request body + * @param options The options parameters. + */ + virtualMachinesGetOperationStatus( + locationparameter: string, + requestBody: GetOperationStatusRequest, + options?: ScheduledActionsVirtualMachinesGetOperationStatusOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { locationparameter, requestBody, options }, + virtualMachinesGetOperationStatusOperationSpec, + ); + } + + /** + * virtualMachinesSubmitDeallocate: submitDeallocate for a virtual machine + * @param locationparameter The location name. + * @param requestBody The request body + * @param options The options parameters. + */ + virtualMachinesSubmitDeallocate( + locationparameter: string, + requestBody: SubmitDeallocateRequest, + options?: ScheduledActionsVirtualMachinesSubmitDeallocateOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { locationparameter, requestBody, options }, + virtualMachinesSubmitDeallocateOperationSpec, + ); + } + + /** + * virtualMachinesSubmitHibernate: submitHibernate for a virtual machine + * @param locationparameter The location name. + * @param requestBody The request body + * @param options The options parameters. + */ + virtualMachinesSubmitHibernate( + locationparameter: string, + requestBody: SubmitHibernateRequest, + options?: ScheduledActionsVirtualMachinesSubmitHibernateOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { locationparameter, requestBody, options }, + virtualMachinesSubmitHibernateOperationSpec, + ); + } + + /** + * virtualMachinesSubmitStart: submitStart for a virtual machine + * @param locationparameter The location name. + * @param requestBody The request body + * @param options The options parameters. + */ + virtualMachinesSubmitStart( + locationparameter: string, + requestBody: SubmitStartRequest, + options?: ScheduledActionsVirtualMachinesSubmitStartOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { locationparameter, requestBody, options }, + virtualMachinesSubmitStartOperationSpec, + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const virtualMachinesCancelOperationsOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesCancelOperations", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.CancelOperationsResponse, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + requestBody: Parameters.requestBody, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.locationparameter, + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer, +}; +const virtualMachinesExecuteDeallocateOperationSpec: coreClient.OperationSpec = + { + path: "/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesExecuteDeallocate", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.DeallocateResourceOperationResponse, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + requestBody: Parameters.requestBody1, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.locationparameter, + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer, + }; +const virtualMachinesExecuteHibernateOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesExecuteHibernate", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.HibernateResourceOperationResponse, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + requestBody: Parameters.requestBody2, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.locationparameter, + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer, +}; +const virtualMachinesExecuteStartOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesExecuteStart", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.StartResourceOperationResponse, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + requestBody: Parameters.requestBody3, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.locationparameter, + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer, +}; +const virtualMachinesGetOperationErrorsOperationSpec: coreClient.OperationSpec = + { + path: "/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesGetOperationErrors", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.GetOperationErrorsResponse, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + requestBody: Parameters.requestBody4, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.locationparameter, + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer, + }; +const virtualMachinesGetOperationStatusOperationSpec: coreClient.OperationSpec = + { + path: "/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesGetOperationStatus", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.GetOperationStatusResponse, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + requestBody: Parameters.requestBody5, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.locationparameter, + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer, + }; +const virtualMachinesSubmitDeallocateOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesSubmitDeallocate", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.DeallocateResourceOperationResponse, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + requestBody: Parameters.requestBody6, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.locationparameter, + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer, +}; +const virtualMachinesSubmitHibernateOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesSubmitHibernate", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.HibernateResourceOperationResponse, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + requestBody: Parameters.requestBody7, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.locationparameter, + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer, +}; +const virtualMachinesSubmitStartOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesSubmitStart", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.StartResourceOperationResponse, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + requestBody: Parameters.requestBody8, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.locationparameter, + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer, +}; diff --git a/sdk/computeschedule/arm-computeschedule/src/operationsInterfaces/index.ts b/sdk/computeschedule/arm-computeschedule/src/operationsInterfaces/index.ts new file mode 100644 index 000000000000..3f53f74234e7 --- /dev/null +++ b/sdk/computeschedule/arm-computeschedule/src/operationsInterfaces/index.ts @@ -0,0 +1,10 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export * from "./operations"; +export * from "./scheduledActions"; diff --git a/sdk/computeschedule/arm-computeschedule/src/operationsInterfaces/operations.ts b/sdk/computeschedule/arm-computeschedule/src/operationsInterfaces/operations.ts new file mode 100644 index 000000000000..251f5f582e64 --- /dev/null +++ b/sdk/computeschedule/arm-computeschedule/src/operationsInterfaces/operations.ts @@ -0,0 +1,22 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { Operation, OperationsListOptionalParams } from "../models"; + +/// +/** Interface representing a Operations. */ +export interface Operations { + /** + * List the operations for the provider + * @param options The options parameters. + */ + list( + options?: OperationsListOptionalParams, + ): PagedAsyncIterableIterator; +} diff --git a/sdk/computeschedule/arm-computeschedule/src/operationsInterfaces/scheduledActions.ts b/sdk/computeschedule/arm-computeschedule/src/operationsInterfaces/scheduledActions.ts new file mode 100644 index 000000000000..96ab3e85e1a9 --- /dev/null +++ b/sdk/computeschedule/arm-computeschedule/src/operationsInterfaces/scheduledActions.ts @@ -0,0 +1,141 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { + CancelOperationsRequest, + ScheduledActionsVirtualMachinesCancelOperationsOptionalParams, + ScheduledActionsVirtualMachinesCancelOperationsResponse, + ExecuteDeallocateRequest, + ScheduledActionsVirtualMachinesExecuteDeallocateOptionalParams, + ScheduledActionsVirtualMachinesExecuteDeallocateResponse, + ExecuteHibernateRequest, + ScheduledActionsVirtualMachinesExecuteHibernateOptionalParams, + ScheduledActionsVirtualMachinesExecuteHibernateResponse, + ExecuteStartRequest, + ScheduledActionsVirtualMachinesExecuteStartOptionalParams, + ScheduledActionsVirtualMachinesExecuteStartResponse, + GetOperationErrorsRequest, + ScheduledActionsVirtualMachinesGetOperationErrorsOptionalParams, + ScheduledActionsVirtualMachinesGetOperationErrorsResponse, + GetOperationStatusRequest, + ScheduledActionsVirtualMachinesGetOperationStatusOptionalParams, + ScheduledActionsVirtualMachinesGetOperationStatusResponse, + SubmitDeallocateRequest, + ScheduledActionsVirtualMachinesSubmitDeallocateOptionalParams, + ScheduledActionsVirtualMachinesSubmitDeallocateResponse, + SubmitHibernateRequest, + ScheduledActionsVirtualMachinesSubmitHibernateOptionalParams, + ScheduledActionsVirtualMachinesSubmitHibernateResponse, + SubmitStartRequest, + ScheduledActionsVirtualMachinesSubmitStartOptionalParams, + ScheduledActionsVirtualMachinesSubmitStartResponse, +} from "../models"; + +/** Interface representing a ScheduledActions. */ +export interface ScheduledActions { + /** + * virtualMachinesCancelOperations: cancelOperations for a virtual machine + * @param locationparameter The location name. + * @param requestBody The request body + * @param options The options parameters. + */ + virtualMachinesCancelOperations( + locationparameter: string, + requestBody: CancelOperationsRequest, + options?: ScheduledActionsVirtualMachinesCancelOperationsOptionalParams, + ): Promise; + /** + * virtualMachinesExecuteDeallocate: executeDeallocate for a virtual machine + * @param locationparameter The location name. + * @param requestBody The request body + * @param options The options parameters. + */ + virtualMachinesExecuteDeallocate( + locationparameter: string, + requestBody: ExecuteDeallocateRequest, + options?: ScheduledActionsVirtualMachinesExecuteDeallocateOptionalParams, + ): Promise; + /** + * virtualMachinesExecuteHibernate: executeHibernate for a virtual machine + * @param locationparameter The location name. + * @param requestBody The request body + * @param options The options parameters. + */ + virtualMachinesExecuteHibernate( + locationparameter: string, + requestBody: ExecuteHibernateRequest, + options?: ScheduledActionsVirtualMachinesExecuteHibernateOptionalParams, + ): Promise; + /** + * virtualMachinesExecuteStart: executeStart for a virtual machine + * @param locationparameter The location name. + * @param requestBody The request body + * @param options The options parameters. + */ + virtualMachinesExecuteStart( + locationparameter: string, + requestBody: ExecuteStartRequest, + options?: ScheduledActionsVirtualMachinesExecuteStartOptionalParams, + ): Promise; + /** + * virtualMachinesGetOperationErrors: getOperationErrors associated with an operation on a virtual + * machine + * @param locationparameter The location name. + * @param requestBody The request body + * @param options The options parameters. + */ + virtualMachinesGetOperationErrors( + locationparameter: string, + requestBody: GetOperationErrorsRequest, + options?: ScheduledActionsVirtualMachinesGetOperationErrorsOptionalParams, + ): Promise; + /** + * virtualMachinesGetOperationStatus: getOperationStatus for a virtual machine + * @param locationparameter The location name. + * @param requestBody The request body + * @param options The options parameters. + */ + virtualMachinesGetOperationStatus( + locationparameter: string, + requestBody: GetOperationStatusRequest, + options?: ScheduledActionsVirtualMachinesGetOperationStatusOptionalParams, + ): Promise; + /** + * virtualMachinesSubmitDeallocate: submitDeallocate for a virtual machine + * @param locationparameter The location name. + * @param requestBody The request body + * @param options The options parameters. + */ + virtualMachinesSubmitDeallocate( + locationparameter: string, + requestBody: SubmitDeallocateRequest, + options?: ScheduledActionsVirtualMachinesSubmitDeallocateOptionalParams, + ): Promise; + /** + * virtualMachinesSubmitHibernate: submitHibernate for a virtual machine + * @param locationparameter The location name. + * @param requestBody The request body + * @param options The options parameters. + */ + virtualMachinesSubmitHibernate( + locationparameter: string, + requestBody: SubmitHibernateRequest, + options?: ScheduledActionsVirtualMachinesSubmitHibernateOptionalParams, + ): Promise; + /** + * virtualMachinesSubmitStart: submitStart for a virtual machine + * @param locationparameter The location name. + * @param requestBody The request body + * @param options The options parameters. + */ + virtualMachinesSubmitStart( + locationparameter: string, + requestBody: SubmitStartRequest, + options?: ScheduledActionsVirtualMachinesSubmitStartOptionalParams, + ): Promise; +} diff --git a/sdk/computeschedule/arm-computeschedule/src/pagingHelper.ts b/sdk/computeschedule/arm-computeschedule/src/pagingHelper.ts new file mode 100644 index 000000000000..205cccc26592 --- /dev/null +++ b/sdk/computeschedule/arm-computeschedule/src/pagingHelper.ts @@ -0,0 +1,39 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export interface PageInfo { + continuationToken?: string; +} + +const pageMap = new WeakMap(); + +/** + * Given the last `.value` produced by the `byPage` iterator, + * returns a continuation token that can be used to begin paging from + * that point later. + * @param page An object from accessing `value` on the IteratorResult from a `byPage` iterator. + * @returns The continuation token that can be passed into byPage() during future calls. + */ +export function getContinuationToken(page: unknown): string | undefined { + if (typeof page !== "object" || page === null) { + return undefined; + } + return pageMap.get(page)?.continuationToken; +} + +export function setContinuationToken( + page: unknown, + continuationToken: string | undefined, +): void { + if (typeof page !== "object" || page === null || !continuationToken) { + return; + } + const pageInfo = pageMap.get(page) ?? {}; + pageInfo.continuationToken = continuationToken; + pageMap.set(page, pageInfo); +} diff --git a/sdk/computeschedule/arm-computeschedule/test/sampleTest.ts b/sdk/computeschedule/arm-computeschedule/test/sampleTest.ts new file mode 100644 index 000000000000..d64be981b694 --- /dev/null +++ b/sdk/computeschedule/arm-computeschedule/test/sampleTest.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + Recorder, + RecorderStartOptions, + env, +} from "@azure-tools/test-recorder"; +import { assert } from "chai"; +import { Context } from "mocha"; + +const replaceableVariables: Record = { + AZURE_CLIENT_ID: "azure_client_id", + AZURE_CLIENT_SECRET: "azure_client_secret", + AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", + SUBSCRIPTION_ID: "azure_subscription_id", +}; + +const recorderOptions: RecorderStartOptions = { + envSetupForPlayback: replaceableVariables, +}; + +describe("My test", () => { + let recorder: Recorder; + + beforeEach(async function (this: Context) { + recorder = new Recorder(this.currentTest); + await recorder.start(recorderOptions); + }); + + afterEach(async function () { + await recorder.stop(); + }); + + it("sample test", async function () { + console.log("Hi, I'm a test!"); + }); +}); diff --git a/sdk/computeschedule/arm-computeschedule/tsconfig.json b/sdk/computeschedule/arm-computeschedule/tsconfig.json new file mode 100644 index 000000000000..3e6ae96443f3 --- /dev/null +++ b/sdk/computeschedule/arm-computeschedule/tsconfig.json @@ -0,0 +1,27 @@ +{ + "compilerOptions": { + "module": "es6", + "moduleResolution": "node", + "strict": true, + "target": "es6", + "sourceMap": true, + "declarationMap": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "forceConsistentCasingInFileNames": true, + "lib": [ + "es6", + "dom" + ], + "declaration": true, + "outDir": "./dist-esm", + "importHelpers": true + }, + "include": [ + "./src/**/*.ts", + "./test/**/*.ts" + ], + "exclude": [ + "node_modules" + ] +} \ No newline at end of file diff --git a/sdk/computeschedule/ci.mgmt.yml b/sdk/computeschedule/ci.mgmt.yml new file mode 100644 index 000000000000..434bc155450a --- /dev/null +++ b/sdk/computeschedule/ci.mgmt.yml @@ -0,0 +1,38 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - feature/* + - release/* + - hotfix/* + exclude: + - feature/v4 + paths: + include: + - sdk/computeschedule/arm-computeschedule + - sdk/computeschedule/ci.mgmt.yml + +pr: + branches: + include: + - main + - feature/* + - release/* + - hotfix/* + exclude: + - feature/v4 + paths: + include: + - sdk/computeschedule/arm-computeschedule + - sdk/computeschedule/ci.mgmt.yml + +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: computeschedule + Artifacts: + - name: azure-arm-computeschedule + safeName: azurearmcomputeschedule + \ No newline at end of file