ZiWei Chen 2024-09-27 19:36:20 +08:00 коммит произвёл GitHub
Родитель e273e73d53
Коммит 742d38b2f8
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
72 изменённых файлов: 5589 добавлений и 17 удалений

Просмотреть файл

@ -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
@ -3855,13 +3858,13 @@ packages:
resolution: {integrity: sha512-fB3Zu92ucau0iQ0JMCFQE7b/dv8Ot07NI3KaZIkIUNXq82k4eBAqUaneXfleGY9JWskeS9y+u0nXMyspcuQrCg==}
dependencies:
'@types/connect': 3.4.38
'@types/node': 18.19.50
'@types/node': 22.5.5
dev: false
/@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:
@ -3877,7 +3880,7 @@ packages:
/@types/connect@3.4.38:
resolution: {integrity: sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==}
dependencies:
'@types/node': 18.19.50
'@types/node': 22.5.5
dev: false
/@types/cookie@0.4.1:
@ -3970,7 +3973,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:
@ -3986,13 +3989,13 @@ packages:
/@types/jsonwebtoken@9.0.7:
resolution: {integrity: sha512-ugo316mmTYBl2g81zDFnZ7cfxlut3o+/EQdaP7J8QN2kY6lJ22hmQYCK5EHcJHbrW+dkCGSCPgbG8JtYj6qSrg==}
dependencies:
'@types/node': 18.19.50
'@types/node': 22.5.5
dev: false
/@types/jws@3.2.10:
resolution: {integrity: sha512-cOevhttJmssERB88/+XvZXvsq5m9JLKZNUiGfgjUb5lcPRdV2ZQciU6dU76D/qXXFYpSqkP3PrSg4hMTiafTZw==}
dependencies:
'@types/node': 18.19.50
'@types/node': 22.5.5
dev: false
/@types/linkify-it@5.0.0:
@ -4045,13 +4048,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
@ -4096,7 +4099,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
@ -4142,14 +4145,14 @@ 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:
resolution: {integrity: sha512-W8Ym+h8nhuRwaKPaDw34QUkwsGi6Rc4yYqvKFo5rm2FUEhCFbzVWrxXUxuKK8TASjWsysJY0nsmNCGhCOIsrOw==}
dependencies:
'@types/http-errors': 2.0.4
'@types/node': 18.19.50
'@types/node': 22.5.5
'@types/send': 0.17.4
dev: false
@ -4174,13 +4177,13 @@ packages:
/@types/stoppable@1.1.3:
resolution: {integrity: sha512-7wGKIBJGE4ZxFjk9NkjAxZMLlIXroETqP1FJCdoSvKmEznwmBxQFmTB1dsCkAvVcNemuSZM5qkkd9HE/NL2JTw==}
dependencies:
'@types/node': 18.19.50
'@types/node': 22.5.5
dev: false
/@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:
@ -4214,7 +4217,7 @@ packages:
/@types/ws@7.4.7:
resolution: {integrity: sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==}
dependencies:
'@types/node': 18.19.50
'@types/node': 22.5.5
dev: false
/@types/ws@8.5.12:
@ -5978,7 +5981,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
@ -9387,7 +9390,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
@ -13763,6 +13766,47 @@ packages:
- webdriverio
dev: false
file:projects/arm-computeschedule.tgz:
resolution: {integrity: sha512-8MHwaRx5A143tiaqXUAg9VoxuCW3ntTOOGyZP1MYLJ0RwBCrAhEQP3qwbr1ebwdM1ggnXtOp1QESXpNPiSTAFg==, tarball: file:projects/arm-computeschedule.tgz}
name: '@rush-temp/arm-computeschedule'
version: 0.0.0
dependencies:
'@azure/identity': 4.4.1
'@microsoft/api-extractor': 7.47.9(@types/node@18.19.50)
'@types/node': 18.19.50
'@vitest/browser': 2.1.1(playwright@1.47.2)(typescript@5.5.4)(vitest@2.1.1)
'@vitest/coverage-istanbul': 2.1.1(vitest@2.1.1)
dotenv: 16.4.5
eslint: 8.57.1
mkdirp: 3.0.1
playwright: 1.47.2
prettier: 3.3.3
rimraf: 5.0.10
tshy: 1.18.0
tslib: 2.7.0
typescript: 5.5.4
vitest: 2.1.1(@types/node@18.19.50)(@vitest/browser@2.1.1)
transitivePeerDependencies:
- '@edge-runtime/vm'
- '@vitest/ui'
- bufferutil
- happy-dom
- jsdom
- less
- lightningcss
- msw
- safaridriver
- sass
- sass-embedded
- stylus
- sugarss
- supports-color
- terser
- utf-8-validate
- vite
- webdriverio
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'
@ -16776,7 +16820,7 @@ packages:
dev: false
file:projects/arm-mongocluster.tgz:
resolution: {integrity: sha512-5qfO0a31+swfnXGpyq3cmrbZ8Bj0tsLzx4frzixKRWNYsjpj3dbGiuLoIQDzcaw7mADeSVcXqduGOLAPxhtsdw==, tarball: file:projects/arm-mongocluster.tgz}
resolution: {integrity: sha512-EU8WPXxVnF2TP9sFdHD+Fhu0oD4WBj2gtulPY6pw393PtU2cp7IyaeETiBLyH2xxw4WRCyX1pjtNxADgOWpq1g==, tarball: file:projects/arm-mongocluster.tgz}
name: '@rush-temp/arm-mongocluster'
version: 0.0.0
dependencies:

Просмотреть файл

@ -6,5 +6,6 @@ https://docs.microsoft.com/javascript/api/@azure/arm-servicefabricmanagedcluster
https://docs.microsoft.com/javascript/api/@azure/arm-redhatopenshift?view=azure-node-preview
https://docs.microsoft.com/javascript/api/@azure/arm-computefleet?view=azure-node-preview
https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md
https://docs.microsoft.com/javascript/api/@azure/arm-computeschedule?view=azure-node-preview
https://docs.microsoft.com/javascript/api/@azure/arm-healthdataaiservices?view=azure-node-preview
https://docs.microsoft.com/javascript/api/@azure/arm-fabric?view=azure-node-preview

Просмотреть файл

@ -2277,6 +2277,11 @@
"projectFolder": "sdk/batch/batch-rest",
"versionPolicyName": "client"
},
{
"packageName": "@azure/arm-computeschedule",
"projectFolder": "sdk/computeschedule/arm-computeschedule",
"versionPolicyName": "management"
},
{
"packageName": "@azure/arm-fabric",
"projectFolder": "sdk/fabric/arm-fabric",

Просмотреть файл

@ -0,0 +1,7 @@
# Release History
## 1.0.0-beta.1 (2024-09-20)
### Features Added
Initial release of the Azure ComputeSchedule package

Просмотреть файл

@ -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.

Просмотреть файл

@ -0,0 +1,100 @@
# Azure ComputeSchedule client library for JavaScript
This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure ComputeSchedule client.
Microsoft.ComputeSchedule Resource Provider management API.
[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) |
## 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 ComputeSchedule client library for JavaScript with `npm`:
```bash
npm install @azure/arm-computeschedule
```
### Create and authenticate a `ComputeScheduleClient`
To create a client object to access the Azure ComputeSchedule API, you will need the `endpoint` of your Azure ComputeSchedule resource and a `credential`. The Azure ComputeSchedule client can use Azure Active Directory credentials to authenticate.
You can find the endpoint for your Azure ComputeSchedule 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 ComputeSchedule** 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 { ComputeScheduleClient } = 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 ComputeScheduleClient(new DefaultAzureCredential(), subscriptionId);
// For client-side applications running in the browser, use this code instead:
// const credential = new InteractiveBrowserCredential({
// tenantId: "<YOUR_TENANT_ID>",
// clientId: "<YOUR_CLIENT_ID>"
// });
// const client = new ComputeScheduleClient(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
### ComputeScheduleClient
`ComputeScheduleClient` is the primary interface for developers using the Azure ComputeSchedule client library. Explore the methods on this client object to understand the different features of the Azure ComputeSchedule 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).
## 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)
[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

Просмотреть файл

@ -0,0 +1,18 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"mainEntryPointFilePath": "./dist/esm/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" }
}
}
}

Просмотреть файл

@ -0,0 +1,6 @@
{
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "js",
"TagPrefix": "js/computeschedule/arm-computeschedule",
"Tag": "js/computeschedule/arm-computeschedule_997bb79613"
}

Просмотреть файл

@ -0,0 +1,17 @@
import azsdkEslint from "@azure/eslint-plugin-azure-sdk";
export default [
...azsdkEslint.configs.recommended,
{
rules: {
"@azure/azure-sdk/ts-modules-only-named": "warn",
"@azure/azure-sdk/ts-apiextractor-json-types": "warn",
"@azure/azure-sdk/ts-package-json-types": "warn",
"@azure/azure-sdk/ts-package-json-engine-is-present": "warn",
"@azure/azure-sdk/ts-package-json-module": "off",
"@azure/azure-sdk/ts-package-json-files-required": "off",
"@azure/azure-sdk/ts-package-json-main-is-cjs": "off",
"tsdoc/syntax": "warn",
},
},
];

Просмотреть файл

@ -0,0 +1,169 @@
{
"name": "@azure/arm-computeschedule",
"version": "1.0.0-beta.1",
"description": "A generated SDK for ComputeScheduleClient.",
"engines": {
"node": ">=18.0.0"
},
"sideEffects": false,
"autoPublish": false,
"tshy": {
"exports": {
"./package.json": "./package.json",
".": "./src/index.ts",
"./models": "./src/models/index.ts"
},
"dialects": [
"esm",
"commonjs"
],
"esmDialects": [
"browser",
"react-native"
],
"selfLink": false
},
"type": "module",
"keywords": [
"node",
"azure",
"cloud",
"typescript",
"browser",
"isomorphic"
],
"author": "Microsoft Corporation",
"license": "MIT",
"files": [
"dist",
"README.md",
"LICENSE",
"review/*",
"CHANGELOG.md"
],
"sdk-type": "mgmt",
"repository": "github:Azure/azure-sdk-for-js",
"bugs": {
"url": "https://github.com/Azure/azure-sdk-for-js/issues"
},
"prettier": "@azure/eslint-plugin-azure-sdk/prettier.json",
"//metadata": {
"constantPaths": [
{
"path": "src/rest/computeScheduleClient.ts",
"prefix": "userAgentInfo"
}
]
},
"dependencies": {
"@azure/core-util": "^1.9.2",
"@azure-rest/core-client": "^2.1.0",
"@azure/core-auth": "^1.6.0",
"@azure/core-rest-pipeline": "^1.5.0",
"@azure/logger": "^1.0.0",
"tslib": "^2.6.2"
},
"devDependencies": {
"dotenv": "^16.0.0",
"@microsoft/api-extractor": "^7.40.3",
"@types/node": "^18.0.0",
"eslint": "^8.55.0",
"prettier": "^3.2.5",
"rimraf": "^5.0.5",
"mkdirp": "^3.0.1",
"typescript": "~5.5.3",
"tshy": "^1.11.1",
"@azure/identity": "^4.2.1",
"@vitest/browser": "^2.0.5",
"@vitest/coverage-istanbul": "^2.0.5",
"playwright": "^1.41.2",
"vitest": "^2.0.5",
"@azure-tools/test-credential": "^2.0.0",
"@azure-tools/test-recorder": "^4.0.0",
"@azure/dev-tool": "^1.0.0",
"@azure/eslint-plugin-azure-sdk": "^3.0.0"
},
"scripts": {
"clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log",
"extract-api": "rimraf review && mkdirp ./review && dev-tool run extract-api",
"pack": "npm pack 2>&1",
"lint": "echo skipped",
"lint:fix": "echo skipped",
"unit-test": "npm run unit-test:node && npm run unit-test:browser",
"unit-test:browser": "npm run build:test && dev-tool run test:vitest --browser",
"unit-test:node": "dev-tool run test:vitest",
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
"integration-test:browser": "echo skipped",
"integration-test:node": "echo skipped",
"audit": "node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit",
"build:samples": "dev-tool run typecheck --paths samples-dev/*.ts && dev-tool samples publish -f",
"check-format": "dev-tool run vendored prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\" \"samples-dev/*.ts\"",
"execute:samples": "dev-tool samples run samples-dev",
"format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\" \"samples-dev/*.ts\"",
"generate:client": "echo skipped",
"test:browser": "npm run clean && npm run build:test && npm run unit-test:browser && npm run integration-test:browser",
"minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js",
"build:test": "npm run clean && tshy && dev-tool run build-test",
"build": "npm run clean && tshy && mkdirp ./review && dev-tool run extract-api",
"test:node": "npm run clean && tshy && npm run unit-test:node && npm run integration-test:node",
"test": "npm run clean && tshy && npm run unit-test:node && dev-tool run bundle && npm run unit-test:browser && npm run integration-test"
},
"//sampleConfiguration": {
"productName": "@azure/arm-computeschedule",
"productSlugs": [
"azure"
],
"disableDocsMs": true,
"apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-computeschedule?view=azure-node-preview"
},
"exports": {
"./package.json": "./package.json",
".": {
"browser": {
"source": "./src/index.ts",
"types": "./dist/browser/index.d.ts",
"default": "./dist/browser/index.js"
},
"react-native": {
"source": "./src/index.ts",
"types": "./dist/react-native/index.d.ts",
"default": "./dist/react-native/index.js"
},
"import": {
"source": "./src/index.ts",
"types": "./dist/esm/index.d.ts",
"default": "./dist/esm/index.js"
},
"require": {
"source": "./src/index.ts",
"types": "./dist/commonjs/index.d.ts",
"default": "./dist/commonjs/index.js"
}
},
"./models": {
"browser": {
"source": "./src/models/index.ts",
"types": "./dist/browser/models/index.d.ts",
"default": "./dist/browser/models/index.js"
},
"react-native": {
"source": "./src/models/index.ts",
"types": "./dist/react-native/models/index.d.ts",
"default": "./dist/react-native/models/index.js"
},
"import": {
"source": "./src/models/index.ts",
"types": "./dist/esm/models/index.d.ts",
"default": "./dist/esm/models/index.js"
},
"require": {
"source": "./src/models/index.ts",
"types": "./dist/commonjs/models/index.d.ts",
"default": "./dist/commonjs/models/index.js"
}
}
},
"main": "./dist/commonjs/index.js",
"types": "./dist/commonjs/index.d.ts",
"module": "./dist/esm/index.js"
}

Просмотреть файл

@ -0,0 +1,306 @@
## 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 { OperationOptions } from '@azure-rest/core-client';
// @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 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 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
export interface Operation {
actionType?: ActionType;
readonly 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: string;
timeStamp: string;
}
// @public
export interface OperationErrorsResult {
activationTime?: string;
completedAt?: string;
creationTime?: string;
operationErrors?: OperationErrorDetails[];
operationId?: string;
requestErrorCode?: string;
requestErrorDetails?: string;
}
// @public
export interface OperationsListOptionalParams extends OperationOptions {
}
// @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?: string;
deadline: string;
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: string;
deadlineType: DeadlineType;
timeZone: string;
}
// @public
export interface ScheduledActionsVirtualMachinesCancelOperationsOptionalParams extends OperationOptions {
}
// @public
export interface ScheduledActionsVirtualMachinesExecuteDeallocateOptionalParams extends OperationOptions {
}
// @public
export interface ScheduledActionsVirtualMachinesExecuteHibernateOptionalParams extends OperationOptions {
}
// @public
export interface ScheduledActionsVirtualMachinesExecuteStartOptionalParams extends OperationOptions {
}
// @public
export interface ScheduledActionsVirtualMachinesGetOperationErrorsOptionalParams extends OperationOptions {
}
// @public
export interface ScheduledActionsVirtualMachinesGetOperationStatusOptionalParams extends OperationOptions {
}
// @public
export interface ScheduledActionsVirtualMachinesSubmitDeallocateOptionalParams extends OperationOptions {
}
// @public
export interface ScheduledActionsVirtualMachinesSubmitHibernateOptionalParams extends OperationOptions {
}
// @public
export interface ScheduledActionsVirtualMachinesSubmitStartOptionalParams extends OperationOptions {
}
// @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)
```

Просмотреть файл

@ -0,0 +1,357 @@
## 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 { ClientOptions } from '@azure-rest/core-client';
import { OperationOptions } from '@azure-rest/core-client';
import { Pipeline } from '@azure/core-rest-pipeline';
import { TokenCredential } from '@azure/core-auth';
// @public
export type ActionType = string;
// @public
export interface CancelOperationsRequest {
correlationid: string;
operationIds: string[];
}
// @public
export interface CancelOperationsResponse {
results: ResourceOperation[];
}
// @public (undocumented)
export class ComputeScheduleClient {
constructor(credential: TokenCredential, subscriptionId: string, options?: ComputeScheduleClientOptionalParams);
readonly operations: OperationsOperations;
readonly pipeline: Pipeline;
readonly scheduledActions: ScheduledActionsOperations;
}
// @public
export interface ComputeScheduleClientOptionalParams extends ClientOptions {
apiVersion?: string;
}
// @public
export type ContinuablePage<TElement, TPage = TElement[]> = TPage & {
continuationToken?: string;
};
// @public
export type DeadlineType = string;
// @public
export interface DeallocateResourceOperationResponse {
description: string;
location: string;
results?: ResourceOperation[];
type: string;
}
// @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 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
export interface Operation {
actionType?: ActionType;
readonly 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: string;
timeStamp: string;
}
// @public
export interface OperationErrorsResult {
activationTime?: string;
completedAt?: string;
creationTime?: string;
operationErrors?: OperationErrorDetails[];
operationId?: string;
requestErrorCode?: string;
requestErrorDetails?: string;
}
// @public
export interface OperationsListOptionalParams extends OperationOptions {
}
// @public
export interface OperationsOperations {
list: (options?: OperationsListOptionalParams) => PagedAsyncIterableIterator<Operation>;
}
// @public
export type OperationState = string;
// @public
export type OptimizationPreference = string;
// @public
export type Origin = string;
// @public
export interface PagedAsyncIterableIterator<TElement, TPage = TElement[], TPageSettings extends PageSettings = PageSettings> {
[Symbol.asyncIterator](): PagedAsyncIterableIterator<TElement, TPage, TPageSettings>;
byPage: (settings?: TPageSettings) => AsyncIterableIterator<ContinuablePage<TElement, TPage>>;
next(): Promise<IteratorResult<TElement>>;
}
// @public
export interface PageSettings {
continuationToken?: string;
}
// @public
export interface ResourceOperation {
errorCode?: string;
errorDetails?: string;
operation?: ResourceOperationDetails;
resourceId?: string;
}
// @public
export interface ResourceOperationDetails {
completedAt?: string;
deadline: string;
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: string;
deadlineType: DeadlineType;
timeZone: string;
}
// @public
export interface ScheduledActionsOperations {
virtualMachinesCancelOperations: (locationparameter: string, requestBody: CancelOperationsRequest, options?: ScheduledActionsVirtualMachinesCancelOperationsOptionalParams) => Promise<CancelOperationsResponse>;
virtualMachinesExecuteDeallocate: (locationparameter: string, requestBody: ExecuteDeallocateRequest, options?: ScheduledActionsVirtualMachinesExecuteDeallocateOptionalParams) => Promise<DeallocateResourceOperationResponse>;
virtualMachinesExecuteHibernate: (locationparameter: string, requestBody: ExecuteHibernateRequest, options?: ScheduledActionsVirtualMachinesExecuteHibernateOptionalParams) => Promise<HibernateResourceOperationResponse>;
virtualMachinesExecuteStart: (locationparameter: string, requestBody: ExecuteStartRequest, options?: ScheduledActionsVirtualMachinesExecuteStartOptionalParams) => Promise<StartResourceOperationResponse>;
virtualMachinesGetOperationErrors: (locationparameter: string, requestBody: GetOperationErrorsRequest, options?: ScheduledActionsVirtualMachinesGetOperationErrorsOptionalParams) => Promise<GetOperationErrorsResponse>;
virtualMachinesGetOperationStatus: (locationparameter: string, requestBody: GetOperationStatusRequest, options?: ScheduledActionsVirtualMachinesGetOperationStatusOptionalParams) => Promise<GetOperationStatusResponse>;
virtualMachinesSubmitDeallocate: (locationparameter: string, requestBody: SubmitDeallocateRequest, options?: ScheduledActionsVirtualMachinesSubmitDeallocateOptionalParams) => Promise<DeallocateResourceOperationResponse>;
virtualMachinesSubmitHibernate: (locationparameter: string, requestBody: SubmitHibernateRequest, options?: ScheduledActionsVirtualMachinesSubmitHibernateOptionalParams) => Promise<HibernateResourceOperationResponse>;
virtualMachinesSubmitStart: (locationparameter: string, requestBody: SubmitStartRequest, options?: ScheduledActionsVirtualMachinesSubmitStartOptionalParams) => Promise<StartResourceOperationResponse>;
}
// @public
export interface ScheduledActionsVirtualMachinesCancelOperationsOptionalParams extends OperationOptions {
}
// @public
export interface ScheduledActionsVirtualMachinesExecuteDeallocateOptionalParams extends OperationOptions {
}
// @public
export interface ScheduledActionsVirtualMachinesExecuteHibernateOptionalParams extends OperationOptions {
}
// @public
export interface ScheduledActionsVirtualMachinesExecuteStartOptionalParams extends OperationOptions {
}
// @public
export interface ScheduledActionsVirtualMachinesGetOperationErrorsOptionalParams extends OperationOptions {
}
// @public
export interface ScheduledActionsVirtualMachinesGetOperationStatusOptionalParams extends OperationOptions {
}
// @public
export interface ScheduledActionsVirtualMachinesSubmitDeallocateOptionalParams extends OperationOptions {
}
// @public
export interface ScheduledActionsVirtualMachinesSubmitHibernateOptionalParams extends OperationOptions {
}
// @public
export interface ScheduledActionsVirtualMachinesSubmitStartOptionalParams extends OperationOptions {
}
// @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)
```

Просмотреть файл

@ -0,0 +1 @@
# Feel free to add your own environment variables.

Просмотреть файл

@ -0,0 +1,48 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { ComputeScheduleClient } from "@azure/arm-computeschedule";
import { DefaultAzureCredential } from "@azure/identity";
/**
* This sample demonstrates how to list the operations for the provider
*
* @summary list the operations for the provider
* x-ms-original-file: 2024-08-15-preview/Operations_List_MaximumSet_Gen.json
*/
async function operationsListMaxGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-0000-0000-0000-00000000000";
const client = new ComputeScheduleClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.operations.list()) {
resArray.push(item);
}
console.log(resArray);
}
/**
* This sample demonstrates how to list the operations for the provider
*
* @summary list the operations for the provider
* x-ms-original-file: 2024-08-15-preview/Operations_List_MinimumSet_Gen.json
*/
async function operationsListMaxGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-0000-0000-0000-00000000000";
const client = new ComputeScheduleClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.operations.list()) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
operationsListMaxGeneratedByMaximumSetRuleGeneratedByMaximumSetRule();
operationsListMaxGeneratedByMaximumSetRuleGeneratedByMinimumSetRule();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,46 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { ComputeScheduleClient } from "@azure/arm-computeschedule";
import { DefaultAzureCredential } from "@azure/identity";
/**
* This sample demonstrates how to virtualMachinesCancelOperations: cancelOperations for a virtual machine
*
* @summary virtualMachinesCancelOperations: cancelOperations for a virtual machine
* x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesCancelOperations_MaximumSet_Gen.json
*/
async function scheduledActionsVirtualMachinesCancelOperationsGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() {
const credential = new DefaultAzureCredential();
const subscriptionId = "DE84A209-5715-43E7-BC76-3E208A9A82C5";
const client = new ComputeScheduleClient(credential, subscriptionId);
const result = await client.scheduledActions.virtualMachinesCancelOperations("tdxypnse", {
operationIds: ["23480d2f-1dca-4610-afb4-dd25eec1f34r"],
correlationid: "01080d2f-1dca-4610-afb4-dd25eec1f3c1",
});
console.log(result);
}
/**
* This sample demonstrates how to virtualMachinesCancelOperations: cancelOperations for a virtual machine
*
* @summary virtualMachinesCancelOperations: cancelOperations for a virtual machine
* x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesCancelOperations_MinimumSet_Gen.json
*/
async function scheduledActionsVirtualMachinesCancelOperationsGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() {
const credential = new DefaultAzureCredential();
const subscriptionId = "DE84A209-5715-43E7-BC76-3E208A9A82C5";
const client = new ComputeScheduleClient(credential, subscriptionId);
const result = await client.scheduledActions.virtualMachinesCancelOperations("lwapkjsbltcqp", {
operationIds: ["23480d2f-1dca-4610-afb4-dd25eec1f34r"],
correlationid: "01080d2f-1dca-4610-afb4-dd25eec1f3c1",
});
console.log(result);
}
async function main() {
scheduledActionsVirtualMachinesCancelOperationsGeneratedByMaximumSetRuleGeneratedByMaximumSetRule();
scheduledActionsVirtualMachinesCancelOperationsGeneratedByMaximumSetRuleGeneratedByMinimumSetRule();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,62 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { ComputeScheduleClient } from "@azure/arm-computeschedule";
import { DefaultAzureCredential } from "@azure/identity";
/**
* This sample demonstrates how to virtualMachinesExecuteDeallocate: executeDeallocate for a virtual machine
*
* @summary virtualMachinesExecuteDeallocate: executeDeallocate for a virtual machine
* x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesExecuteDeallocate_MaximumSet_Gen.json
*/
async function scheduledActionsVirtualMachinesExecuteDeallocateGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() {
const credential = new DefaultAzureCredential();
const subscriptionId = "DE84A209-5715-43E7-BC76-3E208A9A82C5";
const client = new ComputeScheduleClient(credential, subscriptionId);
const result = await client.scheduledActions.virtualMachinesExecuteDeallocate("mklyzgztbivwzo", {
executionParameters: {
optimizationPreference: "Cost",
retryPolicy: { retryCount: 30, retryWindowInMinutes: 27 },
},
resources: {
ids: [
"/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource2",
],
},
correlationid: "01080d2f-1dca-4610-afb4-dd25eddf1f3c1",
});
console.log(result);
}
/**
* This sample demonstrates how to virtualMachinesExecuteDeallocate: executeDeallocate for a virtual machine
*
* @summary virtualMachinesExecuteDeallocate: executeDeallocate for a virtual machine
* x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesExecuteDeallocate_MinimumSet_Gen.json
*/
async function scheduledActionsVirtualMachinesExecuteDeallocateGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() {
const credential = new DefaultAzureCredential();
const subscriptionId = "DE84A209-5715-43E7-BC76-3E208A9A82C5";
const client = new ComputeScheduleClient(credential, subscriptionId);
const result = await client.scheduledActions.virtualMachinesExecuteDeallocate(
"irbtacrhjgfpyvhvjo",
{
executionParameters: {},
resources: {
ids: [
"/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource2",
],
},
correlationid: "01080d2f-1dca-4610-afb4-dd25eddf1f3c1",
},
);
console.log(result);
}
async function main() {
scheduledActionsVirtualMachinesExecuteDeallocateGeneratedByMaximumSetRuleGeneratedByMaximumSetRule();
scheduledActionsVirtualMachinesExecuteDeallocateGeneratedByMaximumSetRuleGeneratedByMinimumSetRule();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,62 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { ComputeScheduleClient } from "@azure/arm-computeschedule";
import { DefaultAzureCredential } from "@azure/identity";
/**
* This sample demonstrates how to virtualMachinesExecuteHibernate: executeHibernate for a virtual machine
*
* @summary virtualMachinesExecuteHibernate: executeHibernate for a virtual machine
* x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesExecuteHibernate_MaximumSet_Gen.json
*/
async function scheduledActionsVirtualMachinesExecuteHibernateGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() {
const credential = new DefaultAzureCredential();
const subscriptionId = "DE84A209-5715-43E7-BC76-3E208A9A82C5";
const client = new ComputeScheduleClient(credential, subscriptionId);
const result = await client.scheduledActions.virtualMachinesExecuteHibernate(
"sejdmamuhhvfpljomwumsplc",
{
executionParameters: {
optimizationPreference: "Cost",
retryPolicy: { retryCount: 30, retryWindowInMinutes: 27 },
},
resources: {
ids: [
"/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3",
],
},
correlationid: "01080d2f-1dca-4610-afb4-dd25eec1f3c1",
},
);
console.log(result);
}
/**
* This sample demonstrates how to virtualMachinesExecuteHibernate: executeHibernate for a virtual machine
*
* @summary virtualMachinesExecuteHibernate: executeHibernate for a virtual machine
* x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesExecuteHibernate_MinimumSet_Gen.json
*/
async function scheduledActionsVirtualMachinesExecuteHibernateGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() {
const credential = new DefaultAzureCredential();
const subscriptionId = "DE84A209-5715-43E7-BC76-3E208A9A82C5";
const client = new ComputeScheduleClient(credential, subscriptionId);
const result = await client.scheduledActions.virtualMachinesExecuteHibernate("kga", {
executionParameters: {},
resources: {
ids: [
"/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3",
],
},
correlationid: "01080d2f-1dca-4610-afb4-dd25eec1f3c1",
});
console.log(result);
}
async function main() {
scheduledActionsVirtualMachinesExecuteHibernateGeneratedByMaximumSetRuleGeneratedByMaximumSetRule();
scheduledActionsVirtualMachinesExecuteHibernateGeneratedByMaximumSetRuleGeneratedByMinimumSetRule();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,62 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { ComputeScheduleClient } from "@azure/arm-computeschedule";
import { DefaultAzureCredential } from "@azure/identity";
/**
* This sample demonstrates how to virtualMachinesExecuteStart: executeStart for a virtual machine
*
* @summary virtualMachinesExecuteStart: executeStart for a virtual machine
* x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesExecuteStart_MaximumSet_Gen.json
*/
async function scheduledActionsVirtualMachinesExecuteStartGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() {
const credential = new DefaultAzureCredential();
const subscriptionId = "DE84A209-5715-43E7-BC76-3E208A9A82C5";
const client = new ComputeScheduleClient(credential, subscriptionId);
const result = await client.scheduledActions.virtualMachinesExecuteStart("ysfrwcfmfsh", {
executionParameters: {
optimizationPreference: "Cost",
retryPolicy: { retryCount: 30, retryWindowInMinutes: 27 },
},
resources: {
ids: [
"/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource4",
],
},
correlationid: "23230d2f-1dca-4610-afb4-dd25eec1f34",
});
console.log(result);
}
/**
* This sample demonstrates how to virtualMachinesExecuteStart: executeStart for a virtual machine
*
* @summary virtualMachinesExecuteStart: executeStart for a virtual machine
* x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesExecuteStart_MinimumSet_Gen.json
*/
async function scheduledActionsVirtualMachinesExecuteStartGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() {
const credential = new DefaultAzureCredential();
const subscriptionId = "DE84A209-5715-43E7-BC76-3E208A9A82C5";
const client = new ComputeScheduleClient(credential, subscriptionId);
const result = await client.scheduledActions.virtualMachinesExecuteStart(
"qegbgjculewswqvnmaclcgpqqidl",
{
executionParameters: {},
resources: {
ids: [
"/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource4",
],
},
correlationid: "23230d2f-1dca-4610-afb4-dd25eec1f34",
},
);
console.log(result);
}
async function main() {
scheduledActionsVirtualMachinesExecuteStartGeneratedByMaximumSetRuleGeneratedByMaximumSetRule();
scheduledActionsVirtualMachinesExecuteStartGeneratedByMaximumSetRuleGeneratedByMinimumSetRule();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,44 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { ComputeScheduleClient } from "@azure/arm-computeschedule";
import { DefaultAzureCredential } from "@azure/identity";
/**
* This sample demonstrates how to virtualMachinesGetOperationErrors: getOperationErrors associated with an operation on a virtual machine
*
* @summary virtualMachinesGetOperationErrors: getOperationErrors associated with an operation on a virtual machine
* x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesGetOperationErrors_MaximumSet_Gen.json
*/
async function csScheduledActionsVirtualMachinesGetOperationErrorsMax() {
const credential = new DefaultAzureCredential();
const subscriptionId = "DE84A209-5715-43E7-BC76-3E208A9A82C5";
const client = new ComputeScheduleClient(credential, subscriptionId);
const result = await client.scheduledActions.virtualMachinesGetOperationErrors("hfsa", {
operationIds: ["DE84A209-5715-43E7-BC76-3E208A9A323"],
});
console.log(result);
}
/**
* This sample demonstrates how to virtualMachinesGetOperationErrors: getOperationErrors associated with an operation on a virtual machine
*
* @summary virtualMachinesGetOperationErrors: getOperationErrors associated with an operation on a virtual machine
* x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesGetOperationErrors_MinimumSet_Gen.json
*/
async function csScheduledActionsVirtualMachinesGetOperationErrorsMin() {
const credential = new DefaultAzureCredential();
const subscriptionId = "DE84A209-5715-43E7-BC76-3E208A9A82C5";
const client = new ComputeScheduleClient(credential, subscriptionId);
const result = await client.scheduledActions.virtualMachinesGetOperationErrors("ggxoaxzxtdbi", {
operationIds: ["qeicik"],
});
console.log(result);
}
async function main() {
csScheduledActionsVirtualMachinesGetOperationErrorsMax();
csScheduledActionsVirtualMachinesGetOperationErrorsMin();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,49 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { ComputeScheduleClient } from "@azure/arm-computeschedule";
import { DefaultAzureCredential } from "@azure/identity";
/**
* This sample demonstrates how to virtualMachinesGetOperationStatus: getOperationStatus for a virtual machine
*
* @summary virtualMachinesGetOperationStatus: getOperationStatus for a virtual machine
* x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesGetOperationStatus_MaximumSet_Gen.json
*/
async function scheduledActionsVirtualMachinesGetOperationStatusGeneratedByMinimumSetRuleGeneratedByMaximumSetRule() {
const credential = new DefaultAzureCredential();
const subscriptionId = "DE84A209-5715-43E7-BC76-3E208A9A82C5";
const client = new ComputeScheduleClient(credential, subscriptionId);
const result = await client.scheduledActions.virtualMachinesGetOperationStatus(
"htxxasfxaesuecem",
{
operationIds: ["01080d2f-1dca-4610-afb4-dd25eec1f3df"],
correlationid: "01080d2f-1dca-4610-afb4-dd25eec1f3c1",
},
);
console.log(result);
}
/**
* This sample demonstrates how to virtualMachinesGetOperationStatus: getOperationStatus for a virtual machine
*
* @summary virtualMachinesGetOperationStatus: getOperationStatus for a virtual machine
* x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesGetOperationStatus_MinimumSet_Gen.json
*/
async function scheduledActionsVirtualMachinesGetOperationStatusGeneratedByMinimumSetRule() {
const credential = new DefaultAzureCredential();
const subscriptionId = "DE84A209-5715-43E7-BC76-3E208A9A82C5";
const client = new ComputeScheduleClient(credential, subscriptionId);
const result = await client.scheduledActions.virtualMachinesGetOperationStatus("csay", {
operationIds: ["01080d2f-1dca-4610-afb4-dd25eec1f3df"],
correlationid: "01080d2f-1dca-4610-afb4-dd25eec1f3c1",
});
console.log(result);
}
async function main() {
scheduledActionsVirtualMachinesGetOperationStatusGeneratedByMinimumSetRuleGeneratedByMaximumSetRule();
scheduledActionsVirtualMachinesGetOperationStatusGeneratedByMinimumSetRule();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,75 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { ComputeScheduleClient } from "@azure/arm-computeschedule";
import { DefaultAzureCredential } from "@azure/identity";
/**
* This sample demonstrates how to virtualMachinesSubmitDeallocate: submitDeallocate for a virtual machine
*
* @summary virtualMachinesSubmitDeallocate: submitDeallocate for a virtual machine
* x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesSubmitDeallocate_MaximumSet_Gen.json
*/
async function scheduledActionsVirtualMachinesSubmitDeallocateGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() {
const credential = new DefaultAzureCredential();
const subscriptionId = "DE84A209-5715-43E7-BC76-3E208A9A82C5";
const client = new ComputeScheduleClient(credential, subscriptionId);
const result = await client.scheduledActions.virtualMachinesSubmitDeallocate(
"ibfxsvilwrgqttuslbduzdtxcckdet",
{
schedule: {
deadLine: "2024-07-12T18:06:53.361Z",
timeZone: "zlcujrtgxtgyik",
deadlineType: "Unknown",
},
executionParameters: {
optimizationPreference: "Cost",
retryPolicy: { retryCount: 30, retryWindowInMinutes: 27 },
},
resources: {
ids: [
"/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource2",
],
},
correlationid: "23519o2f-1dca-4610-afb4-dd25eec1f34",
},
);
console.log(result);
}
/**
* This sample demonstrates how to virtualMachinesSubmitDeallocate: submitDeallocate for a virtual machine
*
* @summary virtualMachinesSubmitDeallocate: submitDeallocate for a virtual machine
* x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesSubmitDeallocate_MinimumSet_Gen.json
*/
async function scheduledActionsVirtualMachinesSubmitDeallocateGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() {
const credential = new DefaultAzureCredential();
const subscriptionId = "DE84A209-5715-43E7-BC76-3E208A9A82C5";
const client = new ComputeScheduleClient(credential, subscriptionId);
const result = await client.scheduledActions.virtualMachinesSubmitDeallocate(
"qwfcdtmshnlownbkyh",
{
schedule: {
deadLine: "2024-07-12T18:06:53.361Z",
timeZone: "zlcujrtgxtgyik",
deadlineType: "Unknown",
},
executionParameters: {},
resources: {
ids: [
"/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource2",
],
},
correlationid: "23519o2f-1dca-4610-afb4-dd25eec1f34",
},
);
console.log(result);
}
async function main() {
scheduledActionsVirtualMachinesSubmitDeallocateGeneratedByMaximumSetRuleGeneratedByMaximumSetRule();
scheduledActionsVirtualMachinesSubmitDeallocateGeneratedByMaximumSetRuleGeneratedByMinimumSetRule();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,72 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { ComputeScheduleClient } from "@azure/arm-computeschedule";
import { DefaultAzureCredential } from "@azure/identity";
/**
* This sample demonstrates how to virtualMachinesSubmitHibernate: submitHibernate for a virtual machine
*
* @summary virtualMachinesSubmitHibernate: submitHibernate for a virtual machine
* x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesSubmitHibernate_MaximumSet_Gen.json
*/
async function scheduledActionsVirtualMachinesSubmitHibernateGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() {
const credential = new DefaultAzureCredential();
const subscriptionId = "DE84A209-5715-43E7-BC76-3E208A9A82C5";
const client = new ComputeScheduleClient(credential, subscriptionId);
const result = await client.scheduledActions.virtualMachinesSubmitHibernate("bgxeayimbxqzev", {
schedule: {
deadLine: "2024-07-12T18:06:53.361Z",
timeZone: "zlcujrtgxtgyik",
deadlineType: "Unknown",
},
executionParameters: {
optimizationPreference: "Cost",
retryPolicy: { retryCount: 30, retryWindowInMinutes: 27 },
},
resources: {
ids: [
"/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3",
],
},
correlationid: "23519o2f-1dca-4610-afb4-dd25eec1f34",
});
console.log(result);
}
/**
* This sample demonstrates how to virtualMachinesSubmitHibernate: submitHibernate for a virtual machine
*
* @summary virtualMachinesSubmitHibernate: submitHibernate for a virtual machine
* x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesSubmitHibernate_MinimumSet_Gen.json
*/
async function scheduledActionsVirtualMachinesSubmitHibernateGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() {
const credential = new DefaultAzureCredential();
const subscriptionId = "DE84A209-5715-43E7-BC76-3E208A9A82C5";
const client = new ComputeScheduleClient(credential, subscriptionId);
const result = await client.scheduledActions.virtualMachinesSubmitHibernate(
"fvjciwudfbndlqumcgqs",
{
schedule: {
deadLine: "2024-07-12T18:06:53.361Z",
timeZone: "zlcujrtgxtgyik",
deadlineType: "Unknown",
},
executionParameters: {},
resources: {
ids: [
"/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3",
],
},
correlationid: "23519o2f-1dca-4610-afb4-dd25eec1f34",
},
);
console.log(result);
}
async function main() {
scheduledActionsVirtualMachinesSubmitHibernateGeneratedByMaximumSetRuleGeneratedByMaximumSetRule();
scheduledActionsVirtualMachinesSubmitHibernateGeneratedByMaximumSetRuleGeneratedByMinimumSetRule();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,72 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { ComputeScheduleClient } from "@azure/arm-computeschedule";
import { DefaultAzureCredential } from "@azure/identity";
/**
* This sample demonstrates how to virtualMachinesSubmitStart: submitStart for a virtual machine
*
* @summary virtualMachinesSubmitStart: submitStart for a virtual machine
* x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesSubmitStart_MaximumSet_Gen.json
*/
async function scheduledActionsVirtualMachinesSubmitStartGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() {
const credential = new DefaultAzureCredential();
const subscriptionId = "DE84A209-5715-43E7-BC76-3E208A9A82C5";
const client = new ComputeScheduleClient(credential, subscriptionId);
const result = await client.scheduledActions.virtualMachinesSubmitStart(
"fxiidszhrokwjmewlahfqjiocnes",
{
schedule: {
deadLine: "2024-07-12T18:06:53.361Z",
timeZone: "zlcujrtgxtgyik",
deadlineType: "Unknown",
},
executionParameters: {
optimizationPreference: "Cost",
retryPolicy: { retryCount: 30, retryWindowInMinutes: 27 },
},
resources: {
ids: [
"/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource4",
],
},
correlationid: "23480d2f-1dca-4610-afb4-dd25eec1f34",
},
);
console.log(result);
}
/**
* This sample demonstrates how to virtualMachinesSubmitStart: submitStart for a virtual machine
*
* @summary virtualMachinesSubmitStart: submitStart for a virtual machine
* x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesSubmitStart_MinimumSet_Gen.json
*/
async function scheduledActionsVirtualMachinesSubmitStartGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() {
const credential = new DefaultAzureCredential();
const subscriptionId = "DE84A209-5715-43E7-BC76-3E208A9A82C5";
const client = new ComputeScheduleClient(credential, subscriptionId);
const result = await client.scheduledActions.virtualMachinesSubmitStart("httzei", {
schedule: {
deadLine: "2024-07-12T18:06:53.361Z",
timeZone: "zlcujrtgxtgyik",
deadlineType: "Unknown",
},
executionParameters: {},
resources: {
ids: [
"/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource4",
],
},
correlationid: "23480d2f-1dca-4610-afb4-dd25eec1f34",
});
console.log(result);
}
async function main() {
scheduledActionsVirtualMachinesSubmitStartGeneratedByMaximumSetRuleGeneratedByMaximumSetRule();
scheduledActionsVirtualMachinesSubmitStartGeneratedByMaximumSetRuleGeneratedByMinimumSetRule();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,68 @@
# @azure/arm-computeschedule client library samples for JavaScript (Beta)
These sample programs show how to use the JavaScript client libraries for @azure/arm-computeschedule in some common scenarios.
| **File Name** | **Description** |
| --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [operationsListSample.js][operationslistsample] | list the operations for the provider x-ms-original-file: 2024-08-15-preview/Operations_List_MaximumSet_Gen.json |
| [scheduledActionsVirtualMachinesCancelOperationsSample.js][scheduledactionsvirtualmachinescanceloperationssample] | virtualMachinesCancelOperations: cancelOperations for a virtual machine x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesCancelOperations_MaximumSet_Gen.json |
| [scheduledActionsVirtualMachinesExecuteDeallocateSample.js][scheduledactionsvirtualmachinesexecutedeallocatesample] | virtualMachinesExecuteDeallocate: executeDeallocate for a virtual machine x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesExecuteDeallocate_MaximumSet_Gen.json |
| [scheduledActionsVirtualMachinesExecuteHibernateSample.js][scheduledactionsvirtualmachinesexecutehibernatesample] | virtualMachinesExecuteHibernate: executeHibernate for a virtual machine x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesExecuteHibernate_MaximumSet_Gen.json |
| [scheduledActionsVirtualMachinesExecuteStartSample.js][scheduledactionsvirtualmachinesexecutestartsample] | virtualMachinesExecuteStart: executeStart for a virtual machine x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesExecuteStart_MaximumSet_Gen.json |
| [scheduledActionsVirtualMachinesGetOperationErrorsSample.js][scheduledactionsvirtualmachinesgetoperationerrorssample] | virtualMachinesGetOperationErrors: getOperationErrors associated with an operation on a virtual machine x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesGetOperationErrors_MaximumSet_Gen.json |
| [scheduledActionsVirtualMachinesGetOperationStatusSample.js][scheduledactionsvirtualmachinesgetoperationstatussample] | virtualMachinesGetOperationStatus: getOperationStatus for a virtual machine x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesGetOperationStatus_MaximumSet_Gen.json |
| [scheduledActionsVirtualMachinesSubmitDeallocateSample.js][scheduledactionsvirtualmachinessubmitdeallocatesample] | virtualMachinesSubmitDeallocate: submitDeallocate for a virtual machine x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesSubmitDeallocate_MaximumSet_Gen.json |
| [scheduledActionsVirtualMachinesSubmitHibernateSample.js][scheduledactionsvirtualmachinessubmithibernatesample] | virtualMachinesSubmitHibernate: submitHibernate for a virtual machine x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesSubmitHibernate_MaximumSet_Gen.json |
| [scheduledActionsVirtualMachinesSubmitStartSample.js][scheduledactionsvirtualmachinessubmitstartsample] | virtualMachinesSubmitStart: submitStart for a virtual machine x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesSubmitStart_MaximumSet_Gen.json |
## Prerequisites
The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule).
You need [an Azure subscription][freesub] to run these sample programs.
Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function.
Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package].
## Setup
To run the samples using the published version of the package:
1. Install the dependencies using `npm`:
```bash
npm install
```
2. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically.
3. Run whichever samples you like (note that some samples may require additional setup, see the table above):
```bash
node operationsListSample.js
```
Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform):
```bash
npx cross-env node operationsListSample.js
```
## Next Steps
Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients.
[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/computeschedule/arm-computeschedule/samples/v1-beta/javascript/operationsListSample.js
[scheduledactionsvirtualmachinescanceloperationssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/computeschedule/arm-computeschedule/samples/v1-beta/javascript/scheduledActionsVirtualMachinesCancelOperationsSample.js
[scheduledactionsvirtualmachinesexecutedeallocatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/computeschedule/arm-computeschedule/samples/v1-beta/javascript/scheduledActionsVirtualMachinesExecuteDeallocateSample.js
[scheduledactionsvirtualmachinesexecutehibernatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/computeschedule/arm-computeschedule/samples/v1-beta/javascript/scheduledActionsVirtualMachinesExecuteHibernateSample.js
[scheduledactionsvirtualmachinesexecutestartsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/computeschedule/arm-computeschedule/samples/v1-beta/javascript/scheduledActionsVirtualMachinesExecuteStartSample.js
[scheduledactionsvirtualmachinesgetoperationerrorssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/computeschedule/arm-computeschedule/samples/v1-beta/javascript/scheduledActionsVirtualMachinesGetOperationErrorsSample.js
[scheduledactionsvirtualmachinesgetoperationstatussample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/computeschedule/arm-computeschedule/samples/v1-beta/javascript/scheduledActionsVirtualMachinesGetOperationStatusSample.js
[scheduledactionsvirtualmachinessubmitdeallocatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/computeschedule/arm-computeschedule/samples/v1-beta/javascript/scheduledActionsVirtualMachinesSubmitDeallocateSample.js
[scheduledactionsvirtualmachinessubmithibernatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/computeschedule/arm-computeschedule/samples/v1-beta/javascript/scheduledActionsVirtualMachinesSubmitHibernateSample.js
[scheduledactionsvirtualmachinessubmitstartsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/computeschedule/arm-computeschedule/samples/v1-beta/javascript/scheduledActionsVirtualMachinesSubmitStartSample.js
[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-computeschedule?view=azure-node-preview
[freesub]: https://azure.microsoft.com/free/
[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/computeschedule/arm-computeschedule/README.md

Просмотреть файл

@ -0,0 +1,48 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { ComputeScheduleClient } = require("@azure/arm-computeschedule");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to list the operations for the provider
*
* @summary list the operations for the provider
* x-ms-original-file: 2024-08-15-preview/Operations_List_MaximumSet_Gen.json
*/
async function operationsListMaxGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-0000-0000-0000-00000000000";
const client = new ComputeScheduleClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.operations.list()) {
resArray.push(item);
}
console.log(resArray);
}
/**
* This sample demonstrates how to list the operations for the provider
*
* @summary list the operations for the provider
* x-ms-original-file: 2024-08-15-preview/Operations_List_MinimumSet_Gen.json
*/
async function operationsListMaxGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-0000-0000-0000-00000000000";
const client = new ComputeScheduleClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.operations.list()) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
operationsListMaxGeneratedByMaximumSetRuleGeneratedByMaximumSetRule();
operationsListMaxGeneratedByMaximumSetRuleGeneratedByMinimumSetRule();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,33 @@
{
"name": "@azure-samples/arm-computeschedule-js-beta",
"private": true,
"version": "1.0.0",
"description": "@azure/arm-computeschedule client library samples for JavaScript (Beta)",
"engines": {
"node": ">=18.0.0"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Azure/azure-sdk-for-js.git",
"directory": "sdk/computeschedule/arm-computeschedule"
},
"keywords": [
"node",
"azure",
"cloud",
"typescript",
"browser",
"isomorphic"
],
"author": "Microsoft Corporation",
"license": "MIT",
"bugs": {
"url": "https://github.com/Azure/azure-sdk-for-js/issues"
},
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/computeschedule/arm-computeschedule",
"dependencies": {
"@azure/arm-computeschedule": "next",
"dotenv": "latest",
"@azure/identity": "^4.2.1"
}
}

Просмотреть файл

@ -0,0 +1 @@
# Feel free to add your own environment variables.

Просмотреть файл

@ -0,0 +1,46 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { ComputeScheduleClient } = require("@azure/arm-computeschedule");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to virtualMachinesCancelOperations: cancelOperations for a virtual machine
*
* @summary virtualMachinesCancelOperations: cancelOperations for a virtual machine
* x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesCancelOperations_MaximumSet_Gen.json
*/
async function scheduledActionsVirtualMachinesCancelOperationsGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() {
const credential = new DefaultAzureCredential();
const subscriptionId = "DE84A209-5715-43E7-BC76-3E208A9A82C5";
const client = new ComputeScheduleClient(credential, subscriptionId);
const result = await client.scheduledActions.virtualMachinesCancelOperations("tdxypnse", {
operationIds: ["23480d2f-1dca-4610-afb4-dd25eec1f34r"],
correlationid: "01080d2f-1dca-4610-afb4-dd25eec1f3c1",
});
console.log(result);
}
/**
* This sample demonstrates how to virtualMachinesCancelOperations: cancelOperations for a virtual machine
*
* @summary virtualMachinesCancelOperations: cancelOperations for a virtual machine
* x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesCancelOperations_MinimumSet_Gen.json
*/
async function scheduledActionsVirtualMachinesCancelOperationsGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() {
const credential = new DefaultAzureCredential();
const subscriptionId = "DE84A209-5715-43E7-BC76-3E208A9A82C5";
const client = new ComputeScheduleClient(credential, subscriptionId);
const result = await client.scheduledActions.virtualMachinesCancelOperations("lwapkjsbltcqp", {
operationIds: ["23480d2f-1dca-4610-afb4-dd25eec1f34r"],
correlationid: "01080d2f-1dca-4610-afb4-dd25eec1f3c1",
});
console.log(result);
}
async function main() {
scheduledActionsVirtualMachinesCancelOperationsGeneratedByMaximumSetRuleGeneratedByMaximumSetRule();
scheduledActionsVirtualMachinesCancelOperationsGeneratedByMaximumSetRuleGeneratedByMinimumSetRule();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,62 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { ComputeScheduleClient } = require("@azure/arm-computeschedule");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to virtualMachinesExecuteDeallocate: executeDeallocate for a virtual machine
*
* @summary virtualMachinesExecuteDeallocate: executeDeallocate for a virtual machine
* x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesExecuteDeallocate_MaximumSet_Gen.json
*/
async function scheduledActionsVirtualMachinesExecuteDeallocateGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() {
const credential = new DefaultAzureCredential();
const subscriptionId = "DE84A209-5715-43E7-BC76-3E208A9A82C5";
const client = new ComputeScheduleClient(credential, subscriptionId);
const result = await client.scheduledActions.virtualMachinesExecuteDeallocate("mklyzgztbivwzo", {
executionParameters: {
optimizationPreference: "Cost",
retryPolicy: { retryCount: 30, retryWindowInMinutes: 27 },
},
resources: {
ids: [
"/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource2",
],
},
correlationid: "01080d2f-1dca-4610-afb4-dd25eddf1f3c1",
});
console.log(result);
}
/**
* This sample demonstrates how to virtualMachinesExecuteDeallocate: executeDeallocate for a virtual machine
*
* @summary virtualMachinesExecuteDeallocate: executeDeallocate for a virtual machine
* x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesExecuteDeallocate_MinimumSet_Gen.json
*/
async function scheduledActionsVirtualMachinesExecuteDeallocateGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() {
const credential = new DefaultAzureCredential();
const subscriptionId = "DE84A209-5715-43E7-BC76-3E208A9A82C5";
const client = new ComputeScheduleClient(credential, subscriptionId);
const result = await client.scheduledActions.virtualMachinesExecuteDeallocate(
"irbtacrhjgfpyvhvjo",
{
executionParameters: {},
resources: {
ids: [
"/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource2",
],
},
correlationid: "01080d2f-1dca-4610-afb4-dd25eddf1f3c1",
},
);
console.log(result);
}
async function main() {
scheduledActionsVirtualMachinesExecuteDeallocateGeneratedByMaximumSetRuleGeneratedByMaximumSetRule();
scheduledActionsVirtualMachinesExecuteDeallocateGeneratedByMaximumSetRuleGeneratedByMinimumSetRule();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,62 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { ComputeScheduleClient } = require("@azure/arm-computeschedule");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to virtualMachinesExecuteHibernate: executeHibernate for a virtual machine
*
* @summary virtualMachinesExecuteHibernate: executeHibernate for a virtual machine
* x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesExecuteHibernate_MaximumSet_Gen.json
*/
async function scheduledActionsVirtualMachinesExecuteHibernateGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() {
const credential = new DefaultAzureCredential();
const subscriptionId = "DE84A209-5715-43E7-BC76-3E208A9A82C5";
const client = new ComputeScheduleClient(credential, subscriptionId);
const result = await client.scheduledActions.virtualMachinesExecuteHibernate(
"sejdmamuhhvfpljomwumsplc",
{
executionParameters: {
optimizationPreference: "Cost",
retryPolicy: { retryCount: 30, retryWindowInMinutes: 27 },
},
resources: {
ids: [
"/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3",
],
},
correlationid: "01080d2f-1dca-4610-afb4-dd25eec1f3c1",
},
);
console.log(result);
}
/**
* This sample demonstrates how to virtualMachinesExecuteHibernate: executeHibernate for a virtual machine
*
* @summary virtualMachinesExecuteHibernate: executeHibernate for a virtual machine
* x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesExecuteHibernate_MinimumSet_Gen.json
*/
async function scheduledActionsVirtualMachinesExecuteHibernateGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() {
const credential = new DefaultAzureCredential();
const subscriptionId = "DE84A209-5715-43E7-BC76-3E208A9A82C5";
const client = new ComputeScheduleClient(credential, subscriptionId);
const result = await client.scheduledActions.virtualMachinesExecuteHibernate("kga", {
executionParameters: {},
resources: {
ids: [
"/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3",
],
},
correlationid: "01080d2f-1dca-4610-afb4-dd25eec1f3c1",
});
console.log(result);
}
async function main() {
scheduledActionsVirtualMachinesExecuteHibernateGeneratedByMaximumSetRuleGeneratedByMaximumSetRule();
scheduledActionsVirtualMachinesExecuteHibernateGeneratedByMaximumSetRuleGeneratedByMinimumSetRule();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,62 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { ComputeScheduleClient } = require("@azure/arm-computeschedule");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to virtualMachinesExecuteStart: executeStart for a virtual machine
*
* @summary virtualMachinesExecuteStart: executeStart for a virtual machine
* x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesExecuteStart_MaximumSet_Gen.json
*/
async function scheduledActionsVirtualMachinesExecuteStartGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() {
const credential = new DefaultAzureCredential();
const subscriptionId = "DE84A209-5715-43E7-BC76-3E208A9A82C5";
const client = new ComputeScheduleClient(credential, subscriptionId);
const result = await client.scheduledActions.virtualMachinesExecuteStart("ysfrwcfmfsh", {
executionParameters: {
optimizationPreference: "Cost",
retryPolicy: { retryCount: 30, retryWindowInMinutes: 27 },
},
resources: {
ids: [
"/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource4",
],
},
correlationid: "23230d2f-1dca-4610-afb4-dd25eec1f34",
});
console.log(result);
}
/**
* This sample demonstrates how to virtualMachinesExecuteStart: executeStart for a virtual machine
*
* @summary virtualMachinesExecuteStart: executeStart for a virtual machine
* x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesExecuteStart_MinimumSet_Gen.json
*/
async function scheduledActionsVirtualMachinesExecuteStartGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() {
const credential = new DefaultAzureCredential();
const subscriptionId = "DE84A209-5715-43E7-BC76-3E208A9A82C5";
const client = new ComputeScheduleClient(credential, subscriptionId);
const result = await client.scheduledActions.virtualMachinesExecuteStart(
"qegbgjculewswqvnmaclcgpqqidl",
{
executionParameters: {},
resources: {
ids: [
"/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource4",
],
},
correlationid: "23230d2f-1dca-4610-afb4-dd25eec1f34",
},
);
console.log(result);
}
async function main() {
scheduledActionsVirtualMachinesExecuteStartGeneratedByMaximumSetRuleGeneratedByMaximumSetRule();
scheduledActionsVirtualMachinesExecuteStartGeneratedByMaximumSetRuleGeneratedByMinimumSetRule();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,44 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { ComputeScheduleClient } = require("@azure/arm-computeschedule");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to virtualMachinesGetOperationErrors: getOperationErrors associated with an operation on a virtual machine
*
* @summary virtualMachinesGetOperationErrors: getOperationErrors associated with an operation on a virtual machine
* x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesGetOperationErrors_MaximumSet_Gen.json
*/
async function csScheduledActionsVirtualMachinesGetOperationErrorsMax() {
const credential = new DefaultAzureCredential();
const subscriptionId = "DE84A209-5715-43E7-BC76-3E208A9A82C5";
const client = new ComputeScheduleClient(credential, subscriptionId);
const result = await client.scheduledActions.virtualMachinesGetOperationErrors("hfsa", {
operationIds: ["DE84A209-5715-43E7-BC76-3E208A9A323"],
});
console.log(result);
}
/**
* This sample demonstrates how to virtualMachinesGetOperationErrors: getOperationErrors associated with an operation on a virtual machine
*
* @summary virtualMachinesGetOperationErrors: getOperationErrors associated with an operation on a virtual machine
* x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesGetOperationErrors_MinimumSet_Gen.json
*/
async function csScheduledActionsVirtualMachinesGetOperationErrorsMin() {
const credential = new DefaultAzureCredential();
const subscriptionId = "DE84A209-5715-43E7-BC76-3E208A9A82C5";
const client = new ComputeScheduleClient(credential, subscriptionId);
const result = await client.scheduledActions.virtualMachinesGetOperationErrors("ggxoaxzxtdbi", {
operationIds: ["qeicik"],
});
console.log(result);
}
async function main() {
csScheduledActionsVirtualMachinesGetOperationErrorsMax();
csScheduledActionsVirtualMachinesGetOperationErrorsMin();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,49 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { ComputeScheduleClient } = require("@azure/arm-computeschedule");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to virtualMachinesGetOperationStatus: getOperationStatus for a virtual machine
*
* @summary virtualMachinesGetOperationStatus: getOperationStatus for a virtual machine
* x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesGetOperationStatus_MaximumSet_Gen.json
*/
async function scheduledActionsVirtualMachinesGetOperationStatusGeneratedByMinimumSetRuleGeneratedByMaximumSetRule() {
const credential = new DefaultAzureCredential();
const subscriptionId = "DE84A209-5715-43E7-BC76-3E208A9A82C5";
const client = new ComputeScheduleClient(credential, subscriptionId);
const result = await client.scheduledActions.virtualMachinesGetOperationStatus(
"htxxasfxaesuecem",
{
operationIds: ["01080d2f-1dca-4610-afb4-dd25eec1f3df"],
correlationid: "01080d2f-1dca-4610-afb4-dd25eec1f3c1",
},
);
console.log(result);
}
/**
* This sample demonstrates how to virtualMachinesGetOperationStatus: getOperationStatus for a virtual machine
*
* @summary virtualMachinesGetOperationStatus: getOperationStatus for a virtual machine
* x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesGetOperationStatus_MinimumSet_Gen.json
*/
async function scheduledActionsVirtualMachinesGetOperationStatusGeneratedByMinimumSetRule() {
const credential = new DefaultAzureCredential();
const subscriptionId = "DE84A209-5715-43E7-BC76-3E208A9A82C5";
const client = new ComputeScheduleClient(credential, subscriptionId);
const result = await client.scheduledActions.virtualMachinesGetOperationStatus("csay", {
operationIds: ["01080d2f-1dca-4610-afb4-dd25eec1f3df"],
correlationid: "01080d2f-1dca-4610-afb4-dd25eec1f3c1",
});
console.log(result);
}
async function main() {
scheduledActionsVirtualMachinesGetOperationStatusGeneratedByMinimumSetRuleGeneratedByMaximumSetRule();
scheduledActionsVirtualMachinesGetOperationStatusGeneratedByMinimumSetRule();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,75 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { ComputeScheduleClient } = require("@azure/arm-computeschedule");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to virtualMachinesSubmitDeallocate: submitDeallocate for a virtual machine
*
* @summary virtualMachinesSubmitDeallocate: submitDeallocate for a virtual machine
* x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesSubmitDeallocate_MaximumSet_Gen.json
*/
async function scheduledActionsVirtualMachinesSubmitDeallocateGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() {
const credential = new DefaultAzureCredential();
const subscriptionId = "DE84A209-5715-43E7-BC76-3E208A9A82C5";
const client = new ComputeScheduleClient(credential, subscriptionId);
const result = await client.scheduledActions.virtualMachinesSubmitDeallocate(
"ibfxsvilwrgqttuslbduzdtxcckdet",
{
schedule: {
deadLine: "2024-07-12T18:06:53.361Z",
timeZone: "zlcujrtgxtgyik",
deadlineType: "Unknown",
},
executionParameters: {
optimizationPreference: "Cost",
retryPolicy: { retryCount: 30, retryWindowInMinutes: 27 },
},
resources: {
ids: [
"/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource2",
],
},
correlationid: "23519o2f-1dca-4610-afb4-dd25eec1f34",
},
);
console.log(result);
}
/**
* This sample demonstrates how to virtualMachinesSubmitDeallocate: submitDeallocate for a virtual machine
*
* @summary virtualMachinesSubmitDeallocate: submitDeallocate for a virtual machine
* x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesSubmitDeallocate_MinimumSet_Gen.json
*/
async function scheduledActionsVirtualMachinesSubmitDeallocateGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() {
const credential = new DefaultAzureCredential();
const subscriptionId = "DE84A209-5715-43E7-BC76-3E208A9A82C5";
const client = new ComputeScheduleClient(credential, subscriptionId);
const result = await client.scheduledActions.virtualMachinesSubmitDeallocate(
"qwfcdtmshnlownbkyh",
{
schedule: {
deadLine: "2024-07-12T18:06:53.361Z",
timeZone: "zlcujrtgxtgyik",
deadlineType: "Unknown",
},
executionParameters: {},
resources: {
ids: [
"/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource2",
],
},
correlationid: "23519o2f-1dca-4610-afb4-dd25eec1f34",
},
);
console.log(result);
}
async function main() {
scheduledActionsVirtualMachinesSubmitDeallocateGeneratedByMaximumSetRuleGeneratedByMaximumSetRule();
scheduledActionsVirtualMachinesSubmitDeallocateGeneratedByMaximumSetRuleGeneratedByMinimumSetRule();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,72 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { ComputeScheduleClient } = require("@azure/arm-computeschedule");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to virtualMachinesSubmitHibernate: submitHibernate for a virtual machine
*
* @summary virtualMachinesSubmitHibernate: submitHibernate for a virtual machine
* x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesSubmitHibernate_MaximumSet_Gen.json
*/
async function scheduledActionsVirtualMachinesSubmitHibernateGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() {
const credential = new DefaultAzureCredential();
const subscriptionId = "DE84A209-5715-43E7-BC76-3E208A9A82C5";
const client = new ComputeScheduleClient(credential, subscriptionId);
const result = await client.scheduledActions.virtualMachinesSubmitHibernate("bgxeayimbxqzev", {
schedule: {
deadLine: "2024-07-12T18:06:53.361Z",
timeZone: "zlcujrtgxtgyik",
deadlineType: "Unknown",
},
executionParameters: {
optimizationPreference: "Cost",
retryPolicy: { retryCount: 30, retryWindowInMinutes: 27 },
},
resources: {
ids: [
"/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3",
],
},
correlationid: "23519o2f-1dca-4610-afb4-dd25eec1f34",
});
console.log(result);
}
/**
* This sample demonstrates how to virtualMachinesSubmitHibernate: submitHibernate for a virtual machine
*
* @summary virtualMachinesSubmitHibernate: submitHibernate for a virtual machine
* x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesSubmitHibernate_MinimumSet_Gen.json
*/
async function scheduledActionsVirtualMachinesSubmitHibernateGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() {
const credential = new DefaultAzureCredential();
const subscriptionId = "DE84A209-5715-43E7-BC76-3E208A9A82C5";
const client = new ComputeScheduleClient(credential, subscriptionId);
const result = await client.scheduledActions.virtualMachinesSubmitHibernate(
"fvjciwudfbndlqumcgqs",
{
schedule: {
deadLine: "2024-07-12T18:06:53.361Z",
timeZone: "zlcujrtgxtgyik",
deadlineType: "Unknown",
},
executionParameters: {},
resources: {
ids: [
"/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3",
],
},
correlationid: "23519o2f-1dca-4610-afb4-dd25eec1f34",
},
);
console.log(result);
}
async function main() {
scheduledActionsVirtualMachinesSubmitHibernateGeneratedByMaximumSetRuleGeneratedByMaximumSetRule();
scheduledActionsVirtualMachinesSubmitHibernateGeneratedByMaximumSetRuleGeneratedByMinimumSetRule();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,72 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { ComputeScheduleClient } = require("@azure/arm-computeschedule");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to virtualMachinesSubmitStart: submitStart for a virtual machine
*
* @summary virtualMachinesSubmitStart: submitStart for a virtual machine
* x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesSubmitStart_MaximumSet_Gen.json
*/
async function scheduledActionsVirtualMachinesSubmitStartGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() {
const credential = new DefaultAzureCredential();
const subscriptionId = "DE84A209-5715-43E7-BC76-3E208A9A82C5";
const client = new ComputeScheduleClient(credential, subscriptionId);
const result = await client.scheduledActions.virtualMachinesSubmitStart(
"fxiidszhrokwjmewlahfqjiocnes",
{
schedule: {
deadLine: "2024-07-12T18:06:53.361Z",
timeZone: "zlcujrtgxtgyik",
deadlineType: "Unknown",
},
executionParameters: {
optimizationPreference: "Cost",
retryPolicy: { retryCount: 30, retryWindowInMinutes: 27 },
},
resources: {
ids: [
"/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource4",
],
},
correlationid: "23480d2f-1dca-4610-afb4-dd25eec1f34",
},
);
console.log(result);
}
/**
* This sample demonstrates how to virtualMachinesSubmitStart: submitStart for a virtual machine
*
* @summary virtualMachinesSubmitStart: submitStart for a virtual machine
* x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesSubmitStart_MinimumSet_Gen.json
*/
async function scheduledActionsVirtualMachinesSubmitStartGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() {
const credential = new DefaultAzureCredential();
const subscriptionId = "DE84A209-5715-43E7-BC76-3E208A9A82C5";
const client = new ComputeScheduleClient(credential, subscriptionId);
const result = await client.scheduledActions.virtualMachinesSubmitStart("httzei", {
schedule: {
deadLine: "2024-07-12T18:06:53.361Z",
timeZone: "zlcujrtgxtgyik",
deadlineType: "Unknown",
},
executionParameters: {},
resources: {
ids: [
"/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource4",
],
},
correlationid: "23480d2f-1dca-4610-afb4-dd25eec1f34",
});
console.log(result);
}
async function main() {
scheduledActionsVirtualMachinesSubmitStartGeneratedByMaximumSetRuleGeneratedByMaximumSetRule();
scheduledActionsVirtualMachinesSubmitStartGeneratedByMaximumSetRuleGeneratedByMinimumSetRule();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,81 @@
# @azure/arm-computeschedule client library samples for TypeScript (Beta)
These sample programs show how to use the TypeScript client libraries for @azure/arm-computeschedule in some common scenarios.
| **File Name** | **Description** |
| --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [operationsListSample.ts][operationslistsample] | list the operations for the provider x-ms-original-file: 2024-08-15-preview/Operations_List_MaximumSet_Gen.json |
| [scheduledActionsVirtualMachinesCancelOperationsSample.ts][scheduledactionsvirtualmachinescanceloperationssample] | virtualMachinesCancelOperations: cancelOperations for a virtual machine x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesCancelOperations_MaximumSet_Gen.json |
| [scheduledActionsVirtualMachinesExecuteDeallocateSample.ts][scheduledactionsvirtualmachinesexecutedeallocatesample] | virtualMachinesExecuteDeallocate: executeDeallocate for a virtual machine x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesExecuteDeallocate_MaximumSet_Gen.json |
| [scheduledActionsVirtualMachinesExecuteHibernateSample.ts][scheduledactionsvirtualmachinesexecutehibernatesample] | virtualMachinesExecuteHibernate: executeHibernate for a virtual machine x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesExecuteHibernate_MaximumSet_Gen.json |
| [scheduledActionsVirtualMachinesExecuteStartSample.ts][scheduledactionsvirtualmachinesexecutestartsample] | virtualMachinesExecuteStart: executeStart for a virtual machine x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesExecuteStart_MaximumSet_Gen.json |
| [scheduledActionsVirtualMachinesGetOperationErrorsSample.ts][scheduledactionsvirtualmachinesgetoperationerrorssample] | virtualMachinesGetOperationErrors: getOperationErrors associated with an operation on a virtual machine x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesGetOperationErrors_MaximumSet_Gen.json |
| [scheduledActionsVirtualMachinesGetOperationStatusSample.ts][scheduledactionsvirtualmachinesgetoperationstatussample] | virtualMachinesGetOperationStatus: getOperationStatus for a virtual machine x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesGetOperationStatus_MaximumSet_Gen.json |
| [scheduledActionsVirtualMachinesSubmitDeallocateSample.ts][scheduledactionsvirtualmachinessubmitdeallocatesample] | virtualMachinesSubmitDeallocate: submitDeallocate for a virtual machine x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesSubmitDeallocate_MaximumSet_Gen.json |
| [scheduledActionsVirtualMachinesSubmitHibernateSample.ts][scheduledactionsvirtualmachinessubmithibernatesample] | virtualMachinesSubmitHibernate: submitHibernate for a virtual machine x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesSubmitHibernate_MaximumSet_Gen.json |
| [scheduledActionsVirtualMachinesSubmitStartSample.ts][scheduledactionsvirtualmachinessubmitstartsample] | virtualMachinesSubmitStart: submitStart for a virtual machine x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesSubmitStart_MaximumSet_Gen.json |
## Prerequisites
The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule).
Before running the samples in Node, they must be compiled to JavaScript using the TypeScript compiler. For more information on TypeScript, see the [TypeScript documentation][typescript]. Install the TypeScript compiler using:
```bash
npm install -g typescript
```
You need [an Azure subscription][freesub] to run these sample programs.
Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function.
Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package].
## Setup
To run the samples using the published version of the package:
1. Install the dependencies using `npm`:
```bash
npm install
```
2. Compile the samples:
```bash
npm run build
```
3. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically.
4. Run whichever samples you like (note that some samples may require additional setup, see the table above):
```bash
node dist/operationsListSample.js
```
Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform):
```bash
npx cross-env node dist/operationsListSample.js
```
## Next Steps
Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients.
[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/computeschedule/arm-computeschedule/samples/v1-beta/typescript/src/operationsListSample.ts
[scheduledactionsvirtualmachinescanceloperationssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/computeschedule/arm-computeschedule/samples/v1-beta/typescript/src/scheduledActionsVirtualMachinesCancelOperationsSample.ts
[scheduledactionsvirtualmachinesexecutedeallocatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/computeschedule/arm-computeschedule/samples/v1-beta/typescript/src/scheduledActionsVirtualMachinesExecuteDeallocateSample.ts
[scheduledactionsvirtualmachinesexecutehibernatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/computeschedule/arm-computeschedule/samples/v1-beta/typescript/src/scheduledActionsVirtualMachinesExecuteHibernateSample.ts
[scheduledactionsvirtualmachinesexecutestartsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/computeschedule/arm-computeschedule/samples/v1-beta/typescript/src/scheduledActionsVirtualMachinesExecuteStartSample.ts
[scheduledactionsvirtualmachinesgetoperationerrorssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/computeschedule/arm-computeschedule/samples/v1-beta/typescript/src/scheduledActionsVirtualMachinesGetOperationErrorsSample.ts
[scheduledactionsvirtualmachinesgetoperationstatussample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/computeschedule/arm-computeschedule/samples/v1-beta/typescript/src/scheduledActionsVirtualMachinesGetOperationStatusSample.ts
[scheduledactionsvirtualmachinessubmitdeallocatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/computeschedule/arm-computeschedule/samples/v1-beta/typescript/src/scheduledActionsVirtualMachinesSubmitDeallocateSample.ts
[scheduledactionsvirtualmachinessubmithibernatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/computeschedule/arm-computeschedule/samples/v1-beta/typescript/src/scheduledActionsVirtualMachinesSubmitHibernateSample.ts
[scheduledactionsvirtualmachinessubmitstartsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/computeschedule/arm-computeschedule/samples/v1-beta/typescript/src/scheduledActionsVirtualMachinesSubmitStartSample.ts
[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-computeschedule?view=azure-node-preview
[freesub]: https://azure.microsoft.com/free/
[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/computeschedule/arm-computeschedule/README.md
[typescript]: https://www.typescriptlang.org/docs/home.html

Просмотреть файл

@ -0,0 +1,42 @@
{
"name": "@azure-samples/arm-computeschedule-ts-beta",
"private": true,
"version": "1.0.0",
"description": "@azure/arm-computeschedule client library samples for TypeScript (Beta)",
"engines": {
"node": ">=18.0.0"
},
"scripts": {
"build": "tsc",
"prebuild": "rimraf dist/"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Azure/azure-sdk-for-js.git",
"directory": "sdk/computeschedule/arm-computeschedule"
},
"keywords": [
"node",
"azure",
"cloud",
"typescript",
"browser",
"isomorphic"
],
"author": "Microsoft Corporation",
"license": "MIT",
"bugs": {
"url": "https://github.com/Azure/azure-sdk-for-js/issues"
},
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/computeschedule/arm-computeschedule",
"dependencies": {
"@azure/arm-computeschedule": "next",
"dotenv": "latest",
"@azure/identity": "^4.2.1"
},
"devDependencies": {
"@types/node": "^18.0.0",
"typescript": "~5.6.2",
"rimraf": "latest"
}
}

Просмотреть файл

@ -0,0 +1 @@
# Feel free to add your own environment variables.

Просмотреть файл

@ -0,0 +1,48 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { ComputeScheduleClient } from "@azure/arm-computeschedule";
import { DefaultAzureCredential } from "@azure/identity";
/**
* This sample demonstrates how to list the operations for the provider
*
* @summary list the operations for the provider
* x-ms-original-file: 2024-08-15-preview/Operations_List_MaximumSet_Gen.json
*/
async function operationsListMaxGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-0000-0000-0000-00000000000";
const client = new ComputeScheduleClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.operations.list()) {
resArray.push(item);
}
console.log(resArray);
}
/**
* This sample demonstrates how to list the operations for the provider
*
* @summary list the operations for the provider
* x-ms-original-file: 2024-08-15-preview/Operations_List_MinimumSet_Gen.json
*/
async function operationsListMaxGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-0000-0000-0000-00000000000";
const client = new ComputeScheduleClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.operations.list()) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
operationsListMaxGeneratedByMaximumSetRuleGeneratedByMaximumSetRule();
operationsListMaxGeneratedByMaximumSetRuleGeneratedByMinimumSetRule();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,46 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { ComputeScheduleClient } from "@azure/arm-computeschedule";
import { DefaultAzureCredential } from "@azure/identity";
/**
* This sample demonstrates how to virtualMachinesCancelOperations: cancelOperations for a virtual machine
*
* @summary virtualMachinesCancelOperations: cancelOperations for a virtual machine
* x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesCancelOperations_MaximumSet_Gen.json
*/
async function scheduledActionsVirtualMachinesCancelOperationsGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() {
const credential = new DefaultAzureCredential();
const subscriptionId = "DE84A209-5715-43E7-BC76-3E208A9A82C5";
const client = new ComputeScheduleClient(credential, subscriptionId);
const result = await client.scheduledActions.virtualMachinesCancelOperations("tdxypnse", {
operationIds: ["23480d2f-1dca-4610-afb4-dd25eec1f34r"],
correlationid: "01080d2f-1dca-4610-afb4-dd25eec1f3c1",
});
console.log(result);
}
/**
* This sample demonstrates how to virtualMachinesCancelOperations: cancelOperations for a virtual machine
*
* @summary virtualMachinesCancelOperations: cancelOperations for a virtual machine
* x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesCancelOperations_MinimumSet_Gen.json
*/
async function scheduledActionsVirtualMachinesCancelOperationsGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() {
const credential = new DefaultAzureCredential();
const subscriptionId = "DE84A209-5715-43E7-BC76-3E208A9A82C5";
const client = new ComputeScheduleClient(credential, subscriptionId);
const result = await client.scheduledActions.virtualMachinesCancelOperations("lwapkjsbltcqp", {
operationIds: ["23480d2f-1dca-4610-afb4-dd25eec1f34r"],
correlationid: "01080d2f-1dca-4610-afb4-dd25eec1f3c1",
});
console.log(result);
}
async function main() {
scheduledActionsVirtualMachinesCancelOperationsGeneratedByMaximumSetRuleGeneratedByMaximumSetRule();
scheduledActionsVirtualMachinesCancelOperationsGeneratedByMaximumSetRuleGeneratedByMinimumSetRule();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,62 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { ComputeScheduleClient } from "@azure/arm-computeschedule";
import { DefaultAzureCredential } from "@azure/identity";
/**
* This sample demonstrates how to virtualMachinesExecuteDeallocate: executeDeallocate for a virtual machine
*
* @summary virtualMachinesExecuteDeallocate: executeDeallocate for a virtual machine
* x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesExecuteDeallocate_MaximumSet_Gen.json
*/
async function scheduledActionsVirtualMachinesExecuteDeallocateGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() {
const credential = new DefaultAzureCredential();
const subscriptionId = "DE84A209-5715-43E7-BC76-3E208A9A82C5";
const client = new ComputeScheduleClient(credential, subscriptionId);
const result = await client.scheduledActions.virtualMachinesExecuteDeallocate("mklyzgztbivwzo", {
executionParameters: {
optimizationPreference: "Cost",
retryPolicy: { retryCount: 30, retryWindowInMinutes: 27 },
},
resources: {
ids: [
"/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource2",
],
},
correlationid: "01080d2f-1dca-4610-afb4-dd25eddf1f3c1",
});
console.log(result);
}
/**
* This sample demonstrates how to virtualMachinesExecuteDeallocate: executeDeallocate for a virtual machine
*
* @summary virtualMachinesExecuteDeallocate: executeDeallocate for a virtual machine
* x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesExecuteDeallocate_MinimumSet_Gen.json
*/
async function scheduledActionsVirtualMachinesExecuteDeallocateGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() {
const credential = new DefaultAzureCredential();
const subscriptionId = "DE84A209-5715-43E7-BC76-3E208A9A82C5";
const client = new ComputeScheduleClient(credential, subscriptionId);
const result = await client.scheduledActions.virtualMachinesExecuteDeallocate(
"irbtacrhjgfpyvhvjo",
{
executionParameters: {},
resources: {
ids: [
"/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource2",
],
},
correlationid: "01080d2f-1dca-4610-afb4-dd25eddf1f3c1",
},
);
console.log(result);
}
async function main() {
scheduledActionsVirtualMachinesExecuteDeallocateGeneratedByMaximumSetRuleGeneratedByMaximumSetRule();
scheduledActionsVirtualMachinesExecuteDeallocateGeneratedByMaximumSetRuleGeneratedByMinimumSetRule();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,62 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { ComputeScheduleClient } from "@azure/arm-computeschedule";
import { DefaultAzureCredential } from "@azure/identity";
/**
* This sample demonstrates how to virtualMachinesExecuteHibernate: executeHibernate for a virtual machine
*
* @summary virtualMachinesExecuteHibernate: executeHibernate for a virtual machine
* x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesExecuteHibernate_MaximumSet_Gen.json
*/
async function scheduledActionsVirtualMachinesExecuteHibernateGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() {
const credential = new DefaultAzureCredential();
const subscriptionId = "DE84A209-5715-43E7-BC76-3E208A9A82C5";
const client = new ComputeScheduleClient(credential, subscriptionId);
const result = await client.scheduledActions.virtualMachinesExecuteHibernate(
"sejdmamuhhvfpljomwumsplc",
{
executionParameters: {
optimizationPreference: "Cost",
retryPolicy: { retryCount: 30, retryWindowInMinutes: 27 },
},
resources: {
ids: [
"/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3",
],
},
correlationid: "01080d2f-1dca-4610-afb4-dd25eec1f3c1",
},
);
console.log(result);
}
/**
* This sample demonstrates how to virtualMachinesExecuteHibernate: executeHibernate for a virtual machine
*
* @summary virtualMachinesExecuteHibernate: executeHibernate for a virtual machine
* x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesExecuteHibernate_MinimumSet_Gen.json
*/
async function scheduledActionsVirtualMachinesExecuteHibernateGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() {
const credential = new DefaultAzureCredential();
const subscriptionId = "DE84A209-5715-43E7-BC76-3E208A9A82C5";
const client = new ComputeScheduleClient(credential, subscriptionId);
const result = await client.scheduledActions.virtualMachinesExecuteHibernate("kga", {
executionParameters: {},
resources: {
ids: [
"/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3",
],
},
correlationid: "01080d2f-1dca-4610-afb4-dd25eec1f3c1",
});
console.log(result);
}
async function main() {
scheduledActionsVirtualMachinesExecuteHibernateGeneratedByMaximumSetRuleGeneratedByMaximumSetRule();
scheduledActionsVirtualMachinesExecuteHibernateGeneratedByMaximumSetRuleGeneratedByMinimumSetRule();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,62 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { ComputeScheduleClient } from "@azure/arm-computeschedule";
import { DefaultAzureCredential } from "@azure/identity";
/**
* This sample demonstrates how to virtualMachinesExecuteStart: executeStart for a virtual machine
*
* @summary virtualMachinesExecuteStart: executeStart for a virtual machine
* x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesExecuteStart_MaximumSet_Gen.json
*/
async function scheduledActionsVirtualMachinesExecuteStartGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() {
const credential = new DefaultAzureCredential();
const subscriptionId = "DE84A209-5715-43E7-BC76-3E208A9A82C5";
const client = new ComputeScheduleClient(credential, subscriptionId);
const result = await client.scheduledActions.virtualMachinesExecuteStart("ysfrwcfmfsh", {
executionParameters: {
optimizationPreference: "Cost",
retryPolicy: { retryCount: 30, retryWindowInMinutes: 27 },
},
resources: {
ids: [
"/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource4",
],
},
correlationid: "23230d2f-1dca-4610-afb4-dd25eec1f34",
});
console.log(result);
}
/**
* This sample demonstrates how to virtualMachinesExecuteStart: executeStart for a virtual machine
*
* @summary virtualMachinesExecuteStart: executeStart for a virtual machine
* x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesExecuteStart_MinimumSet_Gen.json
*/
async function scheduledActionsVirtualMachinesExecuteStartGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() {
const credential = new DefaultAzureCredential();
const subscriptionId = "DE84A209-5715-43E7-BC76-3E208A9A82C5";
const client = new ComputeScheduleClient(credential, subscriptionId);
const result = await client.scheduledActions.virtualMachinesExecuteStart(
"qegbgjculewswqvnmaclcgpqqidl",
{
executionParameters: {},
resources: {
ids: [
"/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource4",
],
},
correlationid: "23230d2f-1dca-4610-afb4-dd25eec1f34",
},
);
console.log(result);
}
async function main() {
scheduledActionsVirtualMachinesExecuteStartGeneratedByMaximumSetRuleGeneratedByMaximumSetRule();
scheduledActionsVirtualMachinesExecuteStartGeneratedByMaximumSetRuleGeneratedByMinimumSetRule();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,44 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { ComputeScheduleClient } from "@azure/arm-computeschedule";
import { DefaultAzureCredential } from "@azure/identity";
/**
* This sample demonstrates how to virtualMachinesGetOperationErrors: getOperationErrors associated with an operation on a virtual machine
*
* @summary virtualMachinesGetOperationErrors: getOperationErrors associated with an operation on a virtual machine
* x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesGetOperationErrors_MaximumSet_Gen.json
*/
async function csScheduledActionsVirtualMachinesGetOperationErrorsMax() {
const credential = new DefaultAzureCredential();
const subscriptionId = "DE84A209-5715-43E7-BC76-3E208A9A82C5";
const client = new ComputeScheduleClient(credential, subscriptionId);
const result = await client.scheduledActions.virtualMachinesGetOperationErrors("hfsa", {
operationIds: ["DE84A209-5715-43E7-BC76-3E208A9A323"],
});
console.log(result);
}
/**
* This sample demonstrates how to virtualMachinesGetOperationErrors: getOperationErrors associated with an operation on a virtual machine
*
* @summary virtualMachinesGetOperationErrors: getOperationErrors associated with an operation on a virtual machine
* x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesGetOperationErrors_MinimumSet_Gen.json
*/
async function csScheduledActionsVirtualMachinesGetOperationErrorsMin() {
const credential = new DefaultAzureCredential();
const subscriptionId = "DE84A209-5715-43E7-BC76-3E208A9A82C5";
const client = new ComputeScheduleClient(credential, subscriptionId);
const result = await client.scheduledActions.virtualMachinesGetOperationErrors("ggxoaxzxtdbi", {
operationIds: ["qeicik"],
});
console.log(result);
}
async function main() {
csScheduledActionsVirtualMachinesGetOperationErrorsMax();
csScheduledActionsVirtualMachinesGetOperationErrorsMin();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,49 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { ComputeScheduleClient } from "@azure/arm-computeschedule";
import { DefaultAzureCredential } from "@azure/identity";
/**
* This sample demonstrates how to virtualMachinesGetOperationStatus: getOperationStatus for a virtual machine
*
* @summary virtualMachinesGetOperationStatus: getOperationStatus for a virtual machine
* x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesGetOperationStatus_MaximumSet_Gen.json
*/
async function scheduledActionsVirtualMachinesGetOperationStatusGeneratedByMinimumSetRuleGeneratedByMaximumSetRule() {
const credential = new DefaultAzureCredential();
const subscriptionId = "DE84A209-5715-43E7-BC76-3E208A9A82C5";
const client = new ComputeScheduleClient(credential, subscriptionId);
const result = await client.scheduledActions.virtualMachinesGetOperationStatus(
"htxxasfxaesuecem",
{
operationIds: ["01080d2f-1dca-4610-afb4-dd25eec1f3df"],
correlationid: "01080d2f-1dca-4610-afb4-dd25eec1f3c1",
},
);
console.log(result);
}
/**
* This sample demonstrates how to virtualMachinesGetOperationStatus: getOperationStatus for a virtual machine
*
* @summary virtualMachinesGetOperationStatus: getOperationStatus for a virtual machine
* x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesGetOperationStatus_MinimumSet_Gen.json
*/
async function scheduledActionsVirtualMachinesGetOperationStatusGeneratedByMinimumSetRule() {
const credential = new DefaultAzureCredential();
const subscriptionId = "DE84A209-5715-43E7-BC76-3E208A9A82C5";
const client = new ComputeScheduleClient(credential, subscriptionId);
const result = await client.scheduledActions.virtualMachinesGetOperationStatus("csay", {
operationIds: ["01080d2f-1dca-4610-afb4-dd25eec1f3df"],
correlationid: "01080d2f-1dca-4610-afb4-dd25eec1f3c1",
});
console.log(result);
}
async function main() {
scheduledActionsVirtualMachinesGetOperationStatusGeneratedByMinimumSetRuleGeneratedByMaximumSetRule();
scheduledActionsVirtualMachinesGetOperationStatusGeneratedByMinimumSetRule();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,75 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { ComputeScheduleClient } from "@azure/arm-computeschedule";
import { DefaultAzureCredential } from "@azure/identity";
/**
* This sample demonstrates how to virtualMachinesSubmitDeallocate: submitDeallocate for a virtual machine
*
* @summary virtualMachinesSubmitDeallocate: submitDeallocate for a virtual machine
* x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesSubmitDeallocate_MaximumSet_Gen.json
*/
async function scheduledActionsVirtualMachinesSubmitDeallocateGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() {
const credential = new DefaultAzureCredential();
const subscriptionId = "DE84A209-5715-43E7-BC76-3E208A9A82C5";
const client = new ComputeScheduleClient(credential, subscriptionId);
const result = await client.scheduledActions.virtualMachinesSubmitDeallocate(
"ibfxsvilwrgqttuslbduzdtxcckdet",
{
schedule: {
deadLine: "2024-07-12T18:06:53.361Z",
timeZone: "zlcujrtgxtgyik",
deadlineType: "Unknown",
},
executionParameters: {
optimizationPreference: "Cost",
retryPolicy: { retryCount: 30, retryWindowInMinutes: 27 },
},
resources: {
ids: [
"/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource2",
],
},
correlationid: "23519o2f-1dca-4610-afb4-dd25eec1f34",
},
);
console.log(result);
}
/**
* This sample demonstrates how to virtualMachinesSubmitDeallocate: submitDeallocate for a virtual machine
*
* @summary virtualMachinesSubmitDeallocate: submitDeallocate for a virtual machine
* x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesSubmitDeallocate_MinimumSet_Gen.json
*/
async function scheduledActionsVirtualMachinesSubmitDeallocateGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() {
const credential = new DefaultAzureCredential();
const subscriptionId = "DE84A209-5715-43E7-BC76-3E208A9A82C5";
const client = new ComputeScheduleClient(credential, subscriptionId);
const result = await client.scheduledActions.virtualMachinesSubmitDeallocate(
"qwfcdtmshnlownbkyh",
{
schedule: {
deadLine: "2024-07-12T18:06:53.361Z",
timeZone: "zlcujrtgxtgyik",
deadlineType: "Unknown",
},
executionParameters: {},
resources: {
ids: [
"/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource2",
],
},
correlationid: "23519o2f-1dca-4610-afb4-dd25eec1f34",
},
);
console.log(result);
}
async function main() {
scheduledActionsVirtualMachinesSubmitDeallocateGeneratedByMaximumSetRuleGeneratedByMaximumSetRule();
scheduledActionsVirtualMachinesSubmitDeallocateGeneratedByMaximumSetRuleGeneratedByMinimumSetRule();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,72 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { ComputeScheduleClient } from "@azure/arm-computeschedule";
import { DefaultAzureCredential } from "@azure/identity";
/**
* This sample demonstrates how to virtualMachinesSubmitHibernate: submitHibernate for a virtual machine
*
* @summary virtualMachinesSubmitHibernate: submitHibernate for a virtual machine
* x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesSubmitHibernate_MaximumSet_Gen.json
*/
async function scheduledActionsVirtualMachinesSubmitHibernateGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() {
const credential = new DefaultAzureCredential();
const subscriptionId = "DE84A209-5715-43E7-BC76-3E208A9A82C5";
const client = new ComputeScheduleClient(credential, subscriptionId);
const result = await client.scheduledActions.virtualMachinesSubmitHibernate("bgxeayimbxqzev", {
schedule: {
deadLine: "2024-07-12T18:06:53.361Z",
timeZone: "zlcujrtgxtgyik",
deadlineType: "Unknown",
},
executionParameters: {
optimizationPreference: "Cost",
retryPolicy: { retryCount: 30, retryWindowInMinutes: 27 },
},
resources: {
ids: [
"/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3",
],
},
correlationid: "23519o2f-1dca-4610-afb4-dd25eec1f34",
});
console.log(result);
}
/**
* This sample demonstrates how to virtualMachinesSubmitHibernate: submitHibernate for a virtual machine
*
* @summary virtualMachinesSubmitHibernate: submitHibernate for a virtual machine
* x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesSubmitHibernate_MinimumSet_Gen.json
*/
async function scheduledActionsVirtualMachinesSubmitHibernateGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() {
const credential = new DefaultAzureCredential();
const subscriptionId = "DE84A209-5715-43E7-BC76-3E208A9A82C5";
const client = new ComputeScheduleClient(credential, subscriptionId);
const result = await client.scheduledActions.virtualMachinesSubmitHibernate(
"fvjciwudfbndlqumcgqs",
{
schedule: {
deadLine: "2024-07-12T18:06:53.361Z",
timeZone: "zlcujrtgxtgyik",
deadlineType: "Unknown",
},
executionParameters: {},
resources: {
ids: [
"/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3",
],
},
correlationid: "23519o2f-1dca-4610-afb4-dd25eec1f34",
},
);
console.log(result);
}
async function main() {
scheduledActionsVirtualMachinesSubmitHibernateGeneratedByMaximumSetRuleGeneratedByMaximumSetRule();
scheduledActionsVirtualMachinesSubmitHibernateGeneratedByMaximumSetRuleGeneratedByMinimumSetRule();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,72 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { ComputeScheduleClient } from "@azure/arm-computeschedule";
import { DefaultAzureCredential } from "@azure/identity";
/**
* This sample demonstrates how to virtualMachinesSubmitStart: submitStart for a virtual machine
*
* @summary virtualMachinesSubmitStart: submitStart for a virtual machine
* x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesSubmitStart_MaximumSet_Gen.json
*/
async function scheduledActionsVirtualMachinesSubmitStartGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() {
const credential = new DefaultAzureCredential();
const subscriptionId = "DE84A209-5715-43E7-BC76-3E208A9A82C5";
const client = new ComputeScheduleClient(credential, subscriptionId);
const result = await client.scheduledActions.virtualMachinesSubmitStart(
"fxiidszhrokwjmewlahfqjiocnes",
{
schedule: {
deadLine: "2024-07-12T18:06:53.361Z",
timeZone: "zlcujrtgxtgyik",
deadlineType: "Unknown",
},
executionParameters: {
optimizationPreference: "Cost",
retryPolicy: { retryCount: 30, retryWindowInMinutes: 27 },
},
resources: {
ids: [
"/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource4",
],
},
correlationid: "23480d2f-1dca-4610-afb4-dd25eec1f34",
},
);
console.log(result);
}
/**
* This sample demonstrates how to virtualMachinesSubmitStart: submitStart for a virtual machine
*
* @summary virtualMachinesSubmitStart: submitStart for a virtual machine
* x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesSubmitStart_MinimumSet_Gen.json
*/
async function scheduledActionsVirtualMachinesSubmitStartGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() {
const credential = new DefaultAzureCredential();
const subscriptionId = "DE84A209-5715-43E7-BC76-3E208A9A82C5";
const client = new ComputeScheduleClient(credential, subscriptionId);
const result = await client.scheduledActions.virtualMachinesSubmitStart("httzei", {
schedule: {
deadLine: "2024-07-12T18:06:53.361Z",
timeZone: "zlcujrtgxtgyik",
deadlineType: "Unknown",
},
executionParameters: {},
resources: {
ids: [
"/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource4",
],
},
correlationid: "23480d2f-1dca-4610-afb4-dd25eec1f34",
});
console.log(result);
}
async function main() {
scheduledActionsVirtualMachinesSubmitStartGeneratedByMaximumSetRuleGeneratedByMaximumSetRule();
scheduledActionsVirtualMachinesSubmitStartGeneratedByMaximumSetRuleGeneratedByMinimumSetRule();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,17 @@
{
"compilerOptions": {
"target": "ES2020",
"module": "commonjs",
"moduleResolution": "node",
"resolveJsonModule": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"alwaysStrict": true,
"outDir": "dist",
"rootDir": "src"
},
"include": [
"src/**/*.ts"
]
}

Просмотреть файл

@ -0,0 +1,52 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { TokenCredential } from "@azure/core-auth";
import { ClientOptions, Client, getClient } from "@azure-rest/core-client";
import { logger } from "../logger.js";
export interface ComputeScheduleContext extends Client {}
/** Optional parameters for the client. */
export interface ComputeScheduleClientOptionalParams extends ClientOptions {
/** The API version to use for this operation. */
apiVersion?: string;
}
/** Microsoft.ComputeSchedule Resource Provider management API. */
export function createComputeSchedule(
credential: TokenCredential,
options: ComputeScheduleClientOptionalParams = {},
): ComputeScheduleContext {
const endpointUrl = options.endpoint ?? options.baseUrl ?? `https://management.azure.com`;
const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix;
const userAgentPrefix = prefixFromOptions ? `${prefixFromOptions} azsdk-js-api` : "azsdk-js-api";
const { apiVersion: _, ...updatedOptions } = {
...options,
userAgentOptions: { userAgentPrefix },
loggingOptions: { logger: options.loggingOptions?.logger ?? logger.info },
credentials: {
scopes: options.credentials?.scopes ?? [`${endpointUrl}/.default`],
},
};
const clientContext = getClient(endpointUrl, credential, updatedOptions);
clientContext.pipeline.removePolicy({ name: "ApiVersionPolicy" });
const apiVersion = options.apiVersion ?? "2024-08-15-preview";
clientContext.pipeline.addPolicy({
name: "ClientApiVersionPolicy",
sendRequest: (req, next) => {
// Use the apiVersion defined in request url directly
// Append one if there is no apiVersion and we have one at client options
const url = new URL(req.url);
if (!url.searchParams.get("api-version")) {
req.url = `${req.url}${
Array.from(url.searchParams.keys()).length > 0 ? "&" : "?"
}api-version=${apiVersion}`;
}
return next(req);
},
});
return clientContext;
}

Просмотреть файл

@ -0,0 +1,20 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
export {
createComputeSchedule,
ComputeScheduleContext,
ComputeScheduleClientOptionalParams,
} from "./computeScheduleContext.js";
export { operationsList } from "./operations/index.js";
export {
scheduledActionsVirtualMachinesSubmitDeallocate,
scheduledActionsVirtualMachinesSubmitHibernate,
scheduledActionsVirtualMachinesSubmitStart,
scheduledActionsVirtualMachinesExecuteDeallocate,
scheduledActionsVirtualMachinesExecuteHibernate,
scheduledActionsVirtualMachinesExecuteStart,
scheduledActionsVirtualMachinesGetOperationStatus,
scheduledActionsVirtualMachinesCancelOperations,
scheduledActionsVirtualMachinesGetOperationErrors,
} from "./scheduledActions/index.js";

Просмотреть файл

@ -0,0 +1,68 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { Operation, _OperationListResult } from "../../models/models.js";
import { ComputeScheduleContext as Client } from "../index.js";
import {
StreamableMethod,
operationOptionsToRequestParameters,
PathUncheckedResponse,
createRestError,
} from "@azure-rest/core-client";
import {
PagedAsyncIterableIterator,
buildPagedAsyncIterator,
} from "../../static-helpers/pagingHelpers.js";
import { OperationsListOptionalParams } from "../../models/options.js";
export function _operationsListSend(
context: Client,
options: OperationsListOptionalParams = { requestOptions: {} },
): StreamableMethod {
return context
.path("/providers/Microsoft.ComputeSchedule/operations")
.get({ ...operationOptionsToRequestParameters(options) });
}
export async function _operationsListDeserialize(
result: PathUncheckedResponse,
): Promise<_OperationListResult> {
const expectedStatuses = ["200"];
if (!expectedStatuses.includes(result.status)) {
throw createRestError(result);
}
return {
value: result.body["value"].map((p: any) => {
return {
name: p["name"],
isDataAction: p["isDataAction"],
display: !p.display
? undefined
: {
provider: p.display?.["provider"],
resource: p.display?.["resource"],
operation: p.display?.["operation"],
description: p.display?.["description"],
},
origin: p["origin"],
actionType: p["actionType"],
};
}),
nextLink: result.body["nextLink"],
};
}
/** List the operations for the provider */
export function operationsList(
context: Client,
options: OperationsListOptionalParams = { requestOptions: {} },
): PagedAsyncIterableIterator<Operation> {
return buildPagedAsyncIterator(
context,
() => _operationsListSend(context, options),
_operationsListDeserialize,
["200"],
{ itemName: "value", nextLinkName: "nextLink" },
);
}

Просмотреть файл

@ -0,0 +1,864 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import {
scheduleSerializer,
executionParametersSerializer,
resourcesSerializer,
SubmitDeallocateRequest,
DeallocateResourceOperationResponse,
SubmitHibernateRequest,
HibernateResourceOperationResponse,
SubmitStartRequest,
StartResourceOperationResponse,
ExecuteDeallocateRequest,
ExecuteHibernateRequest,
ExecuteStartRequest,
GetOperationStatusRequest,
GetOperationStatusResponse,
CancelOperationsRequest,
CancelOperationsResponse,
GetOperationErrorsRequest,
GetOperationErrorsResponse,
} from "../../models/models.js";
import { ComputeScheduleContext as Client } from "../index.js";
import {
StreamableMethod,
operationOptionsToRequestParameters,
PathUncheckedResponse,
createRestError,
} from "@azure-rest/core-client";
import {
ScheduledActionsVirtualMachinesSubmitDeallocateOptionalParams,
ScheduledActionsVirtualMachinesSubmitHibernateOptionalParams,
ScheduledActionsVirtualMachinesSubmitStartOptionalParams,
ScheduledActionsVirtualMachinesExecuteDeallocateOptionalParams,
ScheduledActionsVirtualMachinesExecuteHibernateOptionalParams,
ScheduledActionsVirtualMachinesExecuteStartOptionalParams,
ScheduledActionsVirtualMachinesGetOperationStatusOptionalParams,
ScheduledActionsVirtualMachinesCancelOperationsOptionalParams,
ScheduledActionsVirtualMachinesGetOperationErrorsOptionalParams,
} from "../../models/options.js";
export function _scheduledActionsVirtualMachinesSubmitDeallocateSend(
context: Client,
subscriptionId: string,
locationparameter: string,
requestBody: SubmitDeallocateRequest,
options: ScheduledActionsVirtualMachinesSubmitDeallocateOptionalParams = {
requestOptions: {},
},
): StreamableMethod {
return context
.path(
"/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesSubmitDeallocate",
subscriptionId,
locationparameter,
)
.post({
...operationOptionsToRequestParameters(options),
body: {
schedule: scheduleSerializer(requestBody.schedule),
executionParameters: executionParametersSerializer(requestBody.executionParameters),
resources: resourcesSerializer(requestBody.resources),
correlationid: requestBody["correlationid"],
},
});
}
export async function _scheduledActionsVirtualMachinesSubmitDeallocateDeserialize(
result: PathUncheckedResponse,
): Promise<DeallocateResourceOperationResponse> {
const expectedStatuses = ["200"];
if (!expectedStatuses.includes(result.status)) {
throw createRestError(result);
}
return {
description: result.body["description"],
type: result.body["type"],
location: result.body["location"],
results:
result.body["results"] === undefined
? result.body["results"]
: result.body["results"].map((p: any) => {
return {
resourceId: p["resourceId"],
errorCode: p["errorCode"],
errorDetails: p["errorDetails"],
operation: !p.operation
? undefined
: {
operationId: p.operation?.["operationId"],
resourceId: p.operation?.["resourceId"],
opType: p.operation?.["opType"],
subscriptionId: p.operation?.["subscriptionId"],
deadline: p.operation?.["deadline"],
deadlineType: p.operation?.["deadlineType"],
state: p.operation?.["state"],
timeZone: p.operation?.["timeZone"],
resourceOperationError: !p.operation?.resourceOperationError
? undefined
: {
errorCode: p.operation?.resourceOperationError?.["errorCode"],
errorDetails: p.operation?.resourceOperationError?.["errorDetails"],
},
completedAt: p.operation?.["completedAt"],
retryPolicy: !p.operation?.retryPolicy
? undefined
: {
retryCount: p.operation?.retryPolicy?.["retryCount"],
retryWindowInMinutes: p.operation?.retryPolicy?.["retryWindowInMinutes"],
},
},
};
}),
};
}
/** virtualMachinesSubmitDeallocate: submitDeallocate for a virtual machine */
export async function scheduledActionsVirtualMachinesSubmitDeallocate(
context: Client,
subscriptionId: string,
locationparameter: string,
requestBody: SubmitDeallocateRequest,
options: ScheduledActionsVirtualMachinesSubmitDeallocateOptionalParams = {
requestOptions: {},
},
): Promise<DeallocateResourceOperationResponse> {
const result = await _scheduledActionsVirtualMachinesSubmitDeallocateSend(
context,
subscriptionId,
locationparameter,
requestBody,
options,
);
return _scheduledActionsVirtualMachinesSubmitDeallocateDeserialize(result);
}
export function _scheduledActionsVirtualMachinesSubmitHibernateSend(
context: Client,
subscriptionId: string,
locationparameter: string,
requestBody: SubmitHibernateRequest,
options: ScheduledActionsVirtualMachinesSubmitHibernateOptionalParams = {
requestOptions: {},
},
): StreamableMethod {
return context
.path(
"/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesSubmitHibernate",
subscriptionId,
locationparameter,
)
.post({
...operationOptionsToRequestParameters(options),
body: {
schedule: scheduleSerializer(requestBody.schedule),
executionParameters: executionParametersSerializer(requestBody.executionParameters),
resources: resourcesSerializer(requestBody.resources),
correlationid: requestBody["correlationid"],
},
});
}
export async function _scheduledActionsVirtualMachinesSubmitHibernateDeserialize(
result: PathUncheckedResponse,
): Promise<HibernateResourceOperationResponse> {
const expectedStatuses = ["200"];
if (!expectedStatuses.includes(result.status)) {
throw createRestError(result);
}
return {
description: result.body["description"],
type: result.body["type"],
location: result.body["location"],
results:
result.body["results"] === undefined
? result.body["results"]
: result.body["results"].map((p: any) => {
return {
resourceId: p["resourceId"],
errorCode: p["errorCode"],
errorDetails: p["errorDetails"],
operation: !p.operation
? undefined
: {
operationId: p.operation?.["operationId"],
resourceId: p.operation?.["resourceId"],
opType: p.operation?.["opType"],
subscriptionId: p.operation?.["subscriptionId"],
deadline: p.operation?.["deadline"],
deadlineType: p.operation?.["deadlineType"],
state: p.operation?.["state"],
timeZone: p.operation?.["timeZone"],
resourceOperationError: !p.operation?.resourceOperationError
? undefined
: {
errorCode: p.operation?.resourceOperationError?.["errorCode"],
errorDetails: p.operation?.resourceOperationError?.["errorDetails"],
},
completedAt: p.operation?.["completedAt"],
retryPolicy: !p.operation?.retryPolicy
? undefined
: {
retryCount: p.operation?.retryPolicy?.["retryCount"],
retryWindowInMinutes: p.operation?.retryPolicy?.["retryWindowInMinutes"],
},
},
};
}),
};
}
/** virtualMachinesSubmitHibernate: submitHibernate for a virtual machine */
export async function scheduledActionsVirtualMachinesSubmitHibernate(
context: Client,
subscriptionId: string,
locationparameter: string,
requestBody: SubmitHibernateRequest,
options: ScheduledActionsVirtualMachinesSubmitHibernateOptionalParams = {
requestOptions: {},
},
): Promise<HibernateResourceOperationResponse> {
const result = await _scheduledActionsVirtualMachinesSubmitHibernateSend(
context,
subscriptionId,
locationparameter,
requestBody,
options,
);
return _scheduledActionsVirtualMachinesSubmitHibernateDeserialize(result);
}
export function _scheduledActionsVirtualMachinesSubmitStartSend(
context: Client,
subscriptionId: string,
locationparameter: string,
requestBody: SubmitStartRequest,
options: ScheduledActionsVirtualMachinesSubmitStartOptionalParams = {
requestOptions: {},
},
): StreamableMethod {
return context
.path(
"/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesSubmitStart",
subscriptionId,
locationparameter,
)
.post({
...operationOptionsToRequestParameters(options),
body: {
schedule: scheduleSerializer(requestBody.schedule),
executionParameters: executionParametersSerializer(requestBody.executionParameters),
resources: resourcesSerializer(requestBody.resources),
correlationid: requestBody["correlationid"],
},
});
}
export async function _scheduledActionsVirtualMachinesSubmitStartDeserialize(
result: PathUncheckedResponse,
): Promise<StartResourceOperationResponse> {
const expectedStatuses = ["200"];
if (!expectedStatuses.includes(result.status)) {
throw createRestError(result);
}
return {
description: result.body["description"],
type: result.body["type"],
location: result.body["location"],
results:
result.body["results"] === undefined
? result.body["results"]
: result.body["results"].map((p: any) => {
return {
resourceId: p["resourceId"],
errorCode: p["errorCode"],
errorDetails: p["errorDetails"],
operation: !p.operation
? undefined
: {
operationId: p.operation?.["operationId"],
resourceId: p.operation?.["resourceId"],
opType: p.operation?.["opType"],
subscriptionId: p.operation?.["subscriptionId"],
deadline: p.operation?.["deadline"],
deadlineType: p.operation?.["deadlineType"],
state: p.operation?.["state"],
timeZone: p.operation?.["timeZone"],
resourceOperationError: !p.operation?.resourceOperationError
? undefined
: {
errorCode: p.operation?.resourceOperationError?.["errorCode"],
errorDetails: p.operation?.resourceOperationError?.["errorDetails"],
},
completedAt: p.operation?.["completedAt"],
retryPolicy: !p.operation?.retryPolicy
? undefined
: {
retryCount: p.operation?.retryPolicy?.["retryCount"],
retryWindowInMinutes: p.operation?.retryPolicy?.["retryWindowInMinutes"],
},
},
};
}),
};
}
/** virtualMachinesSubmitStart: submitStart for a virtual machine */
export async function scheduledActionsVirtualMachinesSubmitStart(
context: Client,
subscriptionId: string,
locationparameter: string,
requestBody: SubmitStartRequest,
options: ScheduledActionsVirtualMachinesSubmitStartOptionalParams = {
requestOptions: {},
},
): Promise<StartResourceOperationResponse> {
const result = await _scheduledActionsVirtualMachinesSubmitStartSend(
context,
subscriptionId,
locationparameter,
requestBody,
options,
);
return _scheduledActionsVirtualMachinesSubmitStartDeserialize(result);
}
export function _scheduledActionsVirtualMachinesExecuteDeallocateSend(
context: Client,
subscriptionId: string,
locationparameter: string,
requestBody: ExecuteDeallocateRequest,
options: ScheduledActionsVirtualMachinesExecuteDeallocateOptionalParams = {
requestOptions: {},
},
): StreamableMethod {
return context
.path(
"/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesExecuteDeallocate",
subscriptionId,
locationparameter,
)
.post({
...operationOptionsToRequestParameters(options),
body: {
executionParameters: executionParametersSerializer(requestBody.executionParameters),
resources: resourcesSerializer(requestBody.resources),
correlationid: requestBody["correlationid"],
},
});
}
export async function _scheduledActionsVirtualMachinesExecuteDeallocateDeserialize(
result: PathUncheckedResponse,
): Promise<DeallocateResourceOperationResponse> {
const expectedStatuses = ["200"];
if (!expectedStatuses.includes(result.status)) {
throw createRestError(result);
}
return {
description: result.body["description"],
type: result.body["type"],
location: result.body["location"],
results:
result.body["results"] === undefined
? result.body["results"]
: result.body["results"].map((p: any) => {
return {
resourceId: p["resourceId"],
errorCode: p["errorCode"],
errorDetails: p["errorDetails"],
operation: !p.operation
? undefined
: {
operationId: p.operation?.["operationId"],
resourceId: p.operation?.["resourceId"],
opType: p.operation?.["opType"],
subscriptionId: p.operation?.["subscriptionId"],
deadline: p.operation?.["deadline"],
deadlineType: p.operation?.["deadlineType"],
state: p.operation?.["state"],
timeZone: p.operation?.["timeZone"],
resourceOperationError: !p.operation?.resourceOperationError
? undefined
: {
errorCode: p.operation?.resourceOperationError?.["errorCode"],
errorDetails: p.operation?.resourceOperationError?.["errorDetails"],
},
completedAt: p.operation?.["completedAt"],
retryPolicy: !p.operation?.retryPolicy
? undefined
: {
retryCount: p.operation?.retryPolicy?.["retryCount"],
retryWindowInMinutes: p.operation?.retryPolicy?.["retryWindowInMinutes"],
},
},
};
}),
};
}
/** virtualMachinesExecuteDeallocate: executeDeallocate for a virtual machine */
export async function scheduledActionsVirtualMachinesExecuteDeallocate(
context: Client,
subscriptionId: string,
locationparameter: string,
requestBody: ExecuteDeallocateRequest,
options: ScheduledActionsVirtualMachinesExecuteDeallocateOptionalParams = {
requestOptions: {},
},
): Promise<DeallocateResourceOperationResponse> {
const result = await _scheduledActionsVirtualMachinesExecuteDeallocateSend(
context,
subscriptionId,
locationparameter,
requestBody,
options,
);
return _scheduledActionsVirtualMachinesExecuteDeallocateDeserialize(result);
}
export function _scheduledActionsVirtualMachinesExecuteHibernateSend(
context: Client,
subscriptionId: string,
locationparameter: string,
requestBody: ExecuteHibernateRequest,
options: ScheduledActionsVirtualMachinesExecuteHibernateOptionalParams = {
requestOptions: {},
},
): StreamableMethod {
return context
.path(
"/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesExecuteHibernate",
subscriptionId,
locationparameter,
)
.post({
...operationOptionsToRequestParameters(options),
body: {
executionParameters: executionParametersSerializer(requestBody.executionParameters),
resources: resourcesSerializer(requestBody.resources),
correlationid: requestBody["correlationid"],
},
});
}
export async function _scheduledActionsVirtualMachinesExecuteHibernateDeserialize(
result: PathUncheckedResponse,
): Promise<HibernateResourceOperationResponse> {
const expectedStatuses = ["200"];
if (!expectedStatuses.includes(result.status)) {
throw createRestError(result);
}
return {
description: result.body["description"],
type: result.body["type"],
location: result.body["location"],
results:
result.body["results"] === undefined
? result.body["results"]
: result.body["results"].map((p: any) => {
return {
resourceId: p["resourceId"],
errorCode: p["errorCode"],
errorDetails: p["errorDetails"],
operation: !p.operation
? undefined
: {
operationId: p.operation?.["operationId"],
resourceId: p.operation?.["resourceId"],
opType: p.operation?.["opType"],
subscriptionId: p.operation?.["subscriptionId"],
deadline: p.operation?.["deadline"],
deadlineType: p.operation?.["deadlineType"],
state: p.operation?.["state"],
timeZone: p.operation?.["timeZone"],
resourceOperationError: !p.operation?.resourceOperationError
? undefined
: {
errorCode: p.operation?.resourceOperationError?.["errorCode"],
errorDetails: p.operation?.resourceOperationError?.["errorDetails"],
},
completedAt: p.operation?.["completedAt"],
retryPolicy: !p.operation?.retryPolicy
? undefined
: {
retryCount: p.operation?.retryPolicy?.["retryCount"],
retryWindowInMinutes: p.operation?.retryPolicy?.["retryWindowInMinutes"],
},
},
};
}),
};
}
/** virtualMachinesExecuteHibernate: executeHibernate for a virtual machine */
export async function scheduledActionsVirtualMachinesExecuteHibernate(
context: Client,
subscriptionId: string,
locationparameter: string,
requestBody: ExecuteHibernateRequest,
options: ScheduledActionsVirtualMachinesExecuteHibernateOptionalParams = {
requestOptions: {},
},
): Promise<HibernateResourceOperationResponse> {
const result = await _scheduledActionsVirtualMachinesExecuteHibernateSend(
context,
subscriptionId,
locationparameter,
requestBody,
options,
);
return _scheduledActionsVirtualMachinesExecuteHibernateDeserialize(result);
}
export function _scheduledActionsVirtualMachinesExecuteStartSend(
context: Client,
subscriptionId: string,
locationparameter: string,
requestBody: ExecuteStartRequest,
options: ScheduledActionsVirtualMachinesExecuteStartOptionalParams = {
requestOptions: {},
},
): StreamableMethod {
return context
.path(
"/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesExecuteStart",
subscriptionId,
locationparameter,
)
.post({
...operationOptionsToRequestParameters(options),
body: {
executionParameters: executionParametersSerializer(requestBody.executionParameters),
resources: resourcesSerializer(requestBody.resources),
correlationid: requestBody["correlationid"],
},
});
}
export async function _scheduledActionsVirtualMachinesExecuteStartDeserialize(
result: PathUncheckedResponse,
): Promise<StartResourceOperationResponse> {
const expectedStatuses = ["200"];
if (!expectedStatuses.includes(result.status)) {
throw createRestError(result);
}
return {
description: result.body["description"],
type: result.body["type"],
location: result.body["location"],
results:
result.body["results"] === undefined
? result.body["results"]
: result.body["results"].map((p: any) => {
return {
resourceId: p["resourceId"],
errorCode: p["errorCode"],
errorDetails: p["errorDetails"],
operation: !p.operation
? undefined
: {
operationId: p.operation?.["operationId"],
resourceId: p.operation?.["resourceId"],
opType: p.operation?.["opType"],
subscriptionId: p.operation?.["subscriptionId"],
deadline: p.operation?.["deadline"],
deadlineType: p.operation?.["deadlineType"],
state: p.operation?.["state"],
timeZone: p.operation?.["timeZone"],
resourceOperationError: !p.operation?.resourceOperationError
? undefined
: {
errorCode: p.operation?.resourceOperationError?.["errorCode"],
errorDetails: p.operation?.resourceOperationError?.["errorDetails"],
},
completedAt: p.operation?.["completedAt"],
retryPolicy: !p.operation?.retryPolicy
? undefined
: {
retryCount: p.operation?.retryPolicy?.["retryCount"],
retryWindowInMinutes: p.operation?.retryPolicy?.["retryWindowInMinutes"],
},
},
};
}),
};
}
/** virtualMachinesExecuteStart: executeStart for a virtual machine */
export async function scheduledActionsVirtualMachinesExecuteStart(
context: Client,
subscriptionId: string,
locationparameter: string,
requestBody: ExecuteStartRequest,
options: ScheduledActionsVirtualMachinesExecuteStartOptionalParams = {
requestOptions: {},
},
): Promise<StartResourceOperationResponse> {
const result = await _scheduledActionsVirtualMachinesExecuteStartSend(
context,
subscriptionId,
locationparameter,
requestBody,
options,
);
return _scheduledActionsVirtualMachinesExecuteStartDeserialize(result);
}
export function _scheduledActionsVirtualMachinesGetOperationStatusSend(
context: Client,
subscriptionId: string,
locationparameter: string,
requestBody: GetOperationStatusRequest,
options: ScheduledActionsVirtualMachinesGetOperationStatusOptionalParams = {
requestOptions: {},
},
): StreamableMethod {
return context
.path(
"/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesGetOperationStatus",
subscriptionId,
locationparameter,
)
.post({
...operationOptionsToRequestParameters(options),
body: {
operationIds: requestBody["operationIds"],
correlationid: requestBody["correlationid"],
},
});
}
export async function _scheduledActionsVirtualMachinesGetOperationStatusDeserialize(
result: PathUncheckedResponse,
): Promise<GetOperationStatusResponse> {
const expectedStatuses = ["200"];
if (!expectedStatuses.includes(result.status)) {
throw createRestError(result);
}
return {
results: result.body["results"].map((p: any) => {
return {
resourceId: p["resourceId"],
errorCode: p["errorCode"],
errorDetails: p["errorDetails"],
operation: !p.operation
? undefined
: {
operationId: p.operation?.["operationId"],
resourceId: p.operation?.["resourceId"],
opType: p.operation?.["opType"],
subscriptionId: p.operation?.["subscriptionId"],
deadline: p.operation?.["deadline"],
deadlineType: p.operation?.["deadlineType"],
state: p.operation?.["state"],
timeZone: p.operation?.["timeZone"],
resourceOperationError: !p.operation?.resourceOperationError
? undefined
: {
errorCode: p.operation?.resourceOperationError?.["errorCode"],
errorDetails: p.operation?.resourceOperationError?.["errorDetails"],
},
completedAt: p.operation?.["completedAt"],
retryPolicy: !p.operation?.retryPolicy
? undefined
: {
retryCount: p.operation?.retryPolicy?.["retryCount"],
retryWindowInMinutes: p.operation?.retryPolicy?.["retryWindowInMinutes"],
},
},
};
}),
};
}
/** virtualMachinesGetOperationStatus: getOperationStatus for a virtual machine */
export async function scheduledActionsVirtualMachinesGetOperationStatus(
context: Client,
subscriptionId: string,
locationparameter: string,
requestBody: GetOperationStatusRequest,
options: ScheduledActionsVirtualMachinesGetOperationStatusOptionalParams = {
requestOptions: {},
},
): Promise<GetOperationStatusResponse> {
const result = await _scheduledActionsVirtualMachinesGetOperationStatusSend(
context,
subscriptionId,
locationparameter,
requestBody,
options,
);
return _scheduledActionsVirtualMachinesGetOperationStatusDeserialize(result);
}
export function _scheduledActionsVirtualMachinesCancelOperationsSend(
context: Client,
subscriptionId: string,
locationparameter: string,
requestBody: CancelOperationsRequest,
options: ScheduledActionsVirtualMachinesCancelOperationsOptionalParams = {
requestOptions: {},
},
): StreamableMethod {
return context
.path(
"/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesCancelOperations",
subscriptionId,
locationparameter,
)
.post({
...operationOptionsToRequestParameters(options),
body: {
operationIds: requestBody["operationIds"],
correlationid: requestBody["correlationid"],
},
});
}
export async function _scheduledActionsVirtualMachinesCancelOperationsDeserialize(
result: PathUncheckedResponse,
): Promise<CancelOperationsResponse> {
const expectedStatuses = ["200"];
if (!expectedStatuses.includes(result.status)) {
throw createRestError(result);
}
return {
results: result.body["results"].map((p: any) => {
return {
resourceId: p["resourceId"],
errorCode: p["errorCode"],
errorDetails: p["errorDetails"],
operation: !p.operation
? undefined
: {
operationId: p.operation?.["operationId"],
resourceId: p.operation?.["resourceId"],
opType: p.operation?.["opType"],
subscriptionId: p.operation?.["subscriptionId"],
deadline: p.operation?.["deadline"],
deadlineType: p.operation?.["deadlineType"],
state: p.operation?.["state"],
timeZone: p.operation?.["timeZone"],
resourceOperationError: !p.operation?.resourceOperationError
? undefined
: {
errorCode: p.operation?.resourceOperationError?.["errorCode"],
errorDetails: p.operation?.resourceOperationError?.["errorDetails"],
},
completedAt: p.operation?.["completedAt"],
retryPolicy: !p.operation?.retryPolicy
? undefined
: {
retryCount: p.operation?.retryPolicy?.["retryCount"],
retryWindowInMinutes: p.operation?.retryPolicy?.["retryWindowInMinutes"],
},
},
};
}),
};
}
/** virtualMachinesCancelOperations: cancelOperations for a virtual machine */
export async function scheduledActionsVirtualMachinesCancelOperations(
context: Client,
subscriptionId: string,
locationparameter: string,
requestBody: CancelOperationsRequest,
options: ScheduledActionsVirtualMachinesCancelOperationsOptionalParams = {
requestOptions: {},
},
): Promise<CancelOperationsResponse> {
const result = await _scheduledActionsVirtualMachinesCancelOperationsSend(
context,
subscriptionId,
locationparameter,
requestBody,
options,
);
return _scheduledActionsVirtualMachinesCancelOperationsDeserialize(result);
}
export function _scheduledActionsVirtualMachinesGetOperationErrorsSend(
context: Client,
subscriptionId: string,
locationparameter: string,
requestBody: GetOperationErrorsRequest,
options: ScheduledActionsVirtualMachinesGetOperationErrorsOptionalParams = {
requestOptions: {},
},
): StreamableMethod {
return context
.path(
"/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesGetOperationErrors",
subscriptionId,
locationparameter,
)
.post({
...operationOptionsToRequestParameters(options),
body: { operationIds: requestBody["operationIds"] },
});
}
export async function _scheduledActionsVirtualMachinesGetOperationErrorsDeserialize(
result: PathUncheckedResponse,
): Promise<GetOperationErrorsResponse> {
const expectedStatuses = ["200"];
if (!expectedStatuses.includes(result.status)) {
throw createRestError(result);
}
return {
results: result.body["results"].map((p: any) => {
return {
operationId: p["operationId"],
creationTime: p["creationTime"],
activationTime: p["activationTime"],
completedAt: p["completedAt"],
operationErrors:
p["operationErrors"] === undefined
? p["operationErrors"]
: p["operationErrors"].map((p: any) => {
return {
errorCode: p["errorCode"],
errorDetails: p["errorDetails"],
timeStamp: p["timeStamp"],
crpOperationId: p["crpOperationId"],
};
}),
requestErrorCode: p["requestErrorCode"],
requestErrorDetails: p["requestErrorDetails"],
};
}),
};
}
/** virtualMachinesGetOperationErrors: getOperationErrors associated with an operation on a virtual machine */
export async function scheduledActionsVirtualMachinesGetOperationErrors(
context: Client,
subscriptionId: string,
locationparameter: string,
requestBody: GetOperationErrorsRequest,
options: ScheduledActionsVirtualMachinesGetOperationErrorsOptionalParams = {
requestOptions: {},
},
): Promise<GetOperationErrorsResponse> {
const result = await _scheduledActionsVirtualMachinesGetOperationErrorsSend(
context,
subscriptionId,
locationparameter,
requestBody,
options,
);
return _scheduledActionsVirtualMachinesGetOperationErrorsDeserialize(result);
}

Просмотреть файл

@ -0,0 +1,5 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
export { OperationsOperations } from "./operations/index.js";
export { ScheduledActionsOperations } from "./scheduledActions/index.js";

Просмотреть файл

@ -0,0 +1,26 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { ComputeScheduleContext } from "../../api/computeScheduleContext.js";
import { Operation } from "../../models/models.js";
import { operationsList } from "../../api/operations/index.js";
import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js";
import { OperationsListOptionalParams } from "../../models/options.js";
/** Interface representing a Operations operations. */
export interface OperationsOperations {
/** List the operations for the provider */
list: (options?: OperationsListOptionalParams) => PagedAsyncIterableIterator<Operation>;
}
export function getOperations(context: ComputeScheduleContext) {
return {
list: (options?: OperationsListOptionalParams) => operationsList(context, options),
};
}
export function getOperationsOperations(context: ComputeScheduleContext): OperationsOperations {
return {
...getOperations(context),
};
}

Просмотреть файл

@ -0,0 +1,223 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { ComputeScheduleContext } from "../../api/computeScheduleContext.js";
import {
SubmitDeallocateRequest,
DeallocateResourceOperationResponse,
SubmitHibernateRequest,
HibernateResourceOperationResponse,
SubmitStartRequest,
StartResourceOperationResponse,
ExecuteDeallocateRequest,
ExecuteHibernateRequest,
ExecuteStartRequest,
GetOperationStatusRequest,
GetOperationStatusResponse,
CancelOperationsRequest,
CancelOperationsResponse,
GetOperationErrorsRequest,
GetOperationErrorsResponse,
} from "../../models/models.js";
import {
scheduledActionsVirtualMachinesSubmitDeallocate,
scheduledActionsVirtualMachinesSubmitHibernate,
scheduledActionsVirtualMachinesSubmitStart,
scheduledActionsVirtualMachinesExecuteDeallocate,
scheduledActionsVirtualMachinesExecuteHibernate,
scheduledActionsVirtualMachinesExecuteStart,
scheduledActionsVirtualMachinesGetOperationStatus,
scheduledActionsVirtualMachinesCancelOperations,
scheduledActionsVirtualMachinesGetOperationErrors,
} from "../../api/scheduledActions/index.js";
import {
ScheduledActionsVirtualMachinesSubmitDeallocateOptionalParams,
ScheduledActionsVirtualMachinesSubmitHibernateOptionalParams,
ScheduledActionsVirtualMachinesSubmitStartOptionalParams,
ScheduledActionsVirtualMachinesExecuteDeallocateOptionalParams,
ScheduledActionsVirtualMachinesExecuteHibernateOptionalParams,
ScheduledActionsVirtualMachinesExecuteStartOptionalParams,
ScheduledActionsVirtualMachinesGetOperationStatusOptionalParams,
ScheduledActionsVirtualMachinesCancelOperationsOptionalParams,
ScheduledActionsVirtualMachinesGetOperationErrorsOptionalParams,
} from "../../models/options.js";
/** Interface representing a ScheduledActions operations. */
export interface ScheduledActionsOperations {
/** virtualMachinesSubmitDeallocate: submitDeallocate for a virtual machine */
virtualMachinesSubmitDeallocate: (
locationparameter: string,
requestBody: SubmitDeallocateRequest,
options?: ScheduledActionsVirtualMachinesSubmitDeallocateOptionalParams,
) => Promise<DeallocateResourceOperationResponse>;
/** virtualMachinesSubmitHibernate: submitHibernate for a virtual machine */
virtualMachinesSubmitHibernate: (
locationparameter: string,
requestBody: SubmitHibernateRequest,
options?: ScheduledActionsVirtualMachinesSubmitHibernateOptionalParams,
) => Promise<HibernateResourceOperationResponse>;
/** virtualMachinesSubmitStart: submitStart for a virtual machine */
virtualMachinesSubmitStart: (
locationparameter: string,
requestBody: SubmitStartRequest,
options?: ScheduledActionsVirtualMachinesSubmitStartOptionalParams,
) => Promise<StartResourceOperationResponse>;
/** virtualMachinesExecuteDeallocate: executeDeallocate for a virtual machine */
virtualMachinesExecuteDeallocate: (
locationparameter: string,
requestBody: ExecuteDeallocateRequest,
options?: ScheduledActionsVirtualMachinesExecuteDeallocateOptionalParams,
) => Promise<DeallocateResourceOperationResponse>;
/** virtualMachinesExecuteHibernate: executeHibernate for a virtual machine */
virtualMachinesExecuteHibernate: (
locationparameter: string,
requestBody: ExecuteHibernateRequest,
options?: ScheduledActionsVirtualMachinesExecuteHibernateOptionalParams,
) => Promise<HibernateResourceOperationResponse>;
/** virtualMachinesExecuteStart: executeStart for a virtual machine */
virtualMachinesExecuteStart: (
locationparameter: string,
requestBody: ExecuteStartRequest,
options?: ScheduledActionsVirtualMachinesExecuteStartOptionalParams,
) => Promise<StartResourceOperationResponse>;
/** virtualMachinesGetOperationStatus: getOperationStatus for a virtual machine */
virtualMachinesGetOperationStatus: (
locationparameter: string,
requestBody: GetOperationStatusRequest,
options?: ScheduledActionsVirtualMachinesGetOperationStatusOptionalParams,
) => Promise<GetOperationStatusResponse>;
/** virtualMachinesCancelOperations: cancelOperations for a virtual machine */
virtualMachinesCancelOperations: (
locationparameter: string,
requestBody: CancelOperationsRequest,
options?: ScheduledActionsVirtualMachinesCancelOperationsOptionalParams,
) => Promise<CancelOperationsResponse>;
/** virtualMachinesGetOperationErrors: getOperationErrors associated with an operation on a virtual machine */
virtualMachinesGetOperationErrors: (
locationparameter: string,
requestBody: GetOperationErrorsRequest,
options?: ScheduledActionsVirtualMachinesGetOperationErrorsOptionalParams,
) => Promise<GetOperationErrorsResponse>;
}
export function getScheduledActions(context: ComputeScheduleContext, subscriptionId: string) {
return {
virtualMachinesSubmitDeallocate: (
locationparameter: string,
requestBody: SubmitDeallocateRequest,
options?: ScheduledActionsVirtualMachinesSubmitDeallocateOptionalParams,
) =>
scheduledActionsVirtualMachinesSubmitDeallocate(
context,
subscriptionId,
locationparameter,
requestBody,
options,
),
virtualMachinesSubmitHibernate: (
locationparameter: string,
requestBody: SubmitHibernateRequest,
options?: ScheduledActionsVirtualMachinesSubmitHibernateOptionalParams,
) =>
scheduledActionsVirtualMachinesSubmitHibernate(
context,
subscriptionId,
locationparameter,
requestBody,
options,
),
virtualMachinesSubmitStart: (
locationparameter: string,
requestBody: SubmitStartRequest,
options?: ScheduledActionsVirtualMachinesSubmitStartOptionalParams,
) =>
scheduledActionsVirtualMachinesSubmitStart(
context,
subscriptionId,
locationparameter,
requestBody,
options,
),
virtualMachinesExecuteDeallocate: (
locationparameter: string,
requestBody: ExecuteDeallocateRequest,
options?: ScheduledActionsVirtualMachinesExecuteDeallocateOptionalParams,
) =>
scheduledActionsVirtualMachinesExecuteDeallocate(
context,
subscriptionId,
locationparameter,
requestBody,
options,
),
virtualMachinesExecuteHibernate: (
locationparameter: string,
requestBody: ExecuteHibernateRequest,
options?: ScheduledActionsVirtualMachinesExecuteHibernateOptionalParams,
) =>
scheduledActionsVirtualMachinesExecuteHibernate(
context,
subscriptionId,
locationparameter,
requestBody,
options,
),
virtualMachinesExecuteStart: (
locationparameter: string,
requestBody: ExecuteStartRequest,
options?: ScheduledActionsVirtualMachinesExecuteStartOptionalParams,
) =>
scheduledActionsVirtualMachinesExecuteStart(
context,
subscriptionId,
locationparameter,
requestBody,
options,
),
virtualMachinesGetOperationStatus: (
locationparameter: string,
requestBody: GetOperationStatusRequest,
options?: ScheduledActionsVirtualMachinesGetOperationStatusOptionalParams,
) =>
scheduledActionsVirtualMachinesGetOperationStatus(
context,
subscriptionId,
locationparameter,
requestBody,
options,
),
virtualMachinesCancelOperations: (
locationparameter: string,
requestBody: CancelOperationsRequest,
options?: ScheduledActionsVirtualMachinesCancelOperationsOptionalParams,
) =>
scheduledActionsVirtualMachinesCancelOperations(
context,
subscriptionId,
locationparameter,
requestBody,
options,
),
virtualMachinesGetOperationErrors: (
locationparameter: string,
requestBody: GetOperationErrorsRequest,
options?: ScheduledActionsVirtualMachinesGetOperationErrorsOptionalParams,
) =>
scheduledActionsVirtualMachinesGetOperationErrors(
context,
subscriptionId,
locationparameter,
requestBody,
options,
),
};
}
export function getScheduledActionsOperations(
context: ComputeScheduleContext,
subscriptionId: string,
): ScheduledActionsOperations {
return {
...getScheduledActions(context, subscriptionId),
};
}

Просмотреть файл

@ -0,0 +1,47 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { TokenCredential } from "@azure/core-auth";
import { Pipeline } from "@azure/core-rest-pipeline";
import { getOperationsOperations, OperationsOperations } from "./classic/operations/index.js";
import {
getScheduledActionsOperations,
ScheduledActionsOperations,
} from "./classic/scheduledActions/index.js";
import {
createComputeSchedule,
ComputeScheduleContext,
ComputeScheduleClientOptionalParams,
} from "./api/index.js";
export { ComputeScheduleClientOptionalParams } from "./api/computeScheduleContext.js";
export class ComputeScheduleClient {
private _client: ComputeScheduleContext;
/** The pipeline used by this client to make requests */
public readonly pipeline: Pipeline;
/** Microsoft.ComputeSchedule Resource Provider management API. */
constructor(
credential: TokenCredential,
subscriptionId: string,
options: ComputeScheduleClientOptionalParams = {},
) {
const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix;
const userAgentPrefix = prefixFromOptions
? `${prefixFromOptions} azsdk-js-client`
: "azsdk-js-client";
this._client = createComputeSchedule(credential, {
...options,
userAgentOptions: { userAgentPrefix },
});
this.pipeline = this._client.pipeline;
this.operations = getOperationsOperations(this._client);
this.scheduledActions = getScheduledActionsOperations(this._client, subscriptionId);
}
/** The operation groups for Operations */
public readonly operations: OperationsOperations;
/** The operation groups for ScheduledActions */
public readonly scheduledActions: ScheduledActionsOperations;
}

Просмотреть файл

@ -0,0 +1,36 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
export function serializeRecord<T extends string | number | boolean | Date | null, R>(
item: Record<string, T>,
): Record<string, R>;
export function serializeRecord<T, R>(
item: Record<string, T>,
serializer: (item: T) => R,
): Record<string, R>;
export function serializeRecord<T, R>(
item: Record<string, T>,
serializer?: (item: T) => R,
): Record<string, R> {
return Object.keys(item).reduce(
(acc, key) => {
if (isSupportedRecordType(item[key])) {
acc[key] = item[key] as any;
} else if (serializer) {
const value = item[key];
if (value !== undefined) {
acc[key] = serializer(value);
}
} else {
console.warn(`Don't know how to serialize ${item[key]}`);
acc[key] = item[key] as any;
}
return acc;
},
{} as Record<string, R>,
);
}
function isSupportedRecordType(t: any) {
return ["number", "string", "boolean", "null"].includes(typeof t) || t instanceof Date;
}

Просмотреть файл

@ -0,0 +1,65 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import {
PageSettings,
ContinuablePage,
PagedAsyncIterableIterator,
} from "./static-helpers/pagingHelpers.js";
export {
ComputeScheduleClient,
ComputeScheduleClientOptionalParams,
} from "./computeScheduleClient.js";
export {
SubmitDeallocateRequest,
Schedule,
KnownDeadlineType,
DeadlineType,
ExecutionParameters,
KnownOptimizationPreference,
OptimizationPreference,
RetryPolicy,
Resources,
DeallocateResourceOperationResponse,
ResourceOperation,
ResourceOperationDetails,
KnownResourceOperationType,
ResourceOperationType,
KnownOperationState,
OperationState,
ResourceOperationError,
SubmitHibernateRequest,
HibernateResourceOperationResponse,
SubmitStartRequest,
StartResourceOperationResponse,
ExecuteDeallocateRequest,
ExecuteHibernateRequest,
ExecuteStartRequest,
GetOperationStatusRequest,
GetOperationStatusResponse,
CancelOperationsRequest,
CancelOperationsResponse,
GetOperationErrorsRequest,
GetOperationErrorsResponse,
OperationErrorsResult,
OperationErrorDetails,
Operation,
OperationDisplay,
KnownOrigin,
Origin,
KnownActionType,
ActionType,
OperationsListOptionalParams,
ScheduledActionsVirtualMachinesSubmitDeallocateOptionalParams,
ScheduledActionsVirtualMachinesSubmitHibernateOptionalParams,
ScheduledActionsVirtualMachinesSubmitStartOptionalParams,
ScheduledActionsVirtualMachinesExecuteDeallocateOptionalParams,
ScheduledActionsVirtualMachinesExecuteHibernateOptionalParams,
ScheduledActionsVirtualMachinesExecuteStartOptionalParams,
ScheduledActionsVirtualMachinesGetOperationStatusOptionalParams,
ScheduledActionsVirtualMachinesCancelOperationsOptionalParams,
ScheduledActionsVirtualMachinesGetOperationErrorsOptionalParams,
} from "./models/index.js";
export { OperationsOperations, ScheduledActionsOperations } from "./classic/index.js";
export { PageSettings, ContinuablePage, PagedAsyncIterableIterator };

Просмотреть файл

@ -0,0 +1,5 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { createClientLogger } from "@azure/logger";
export const logger = createClientLogger("arm-computeschedule");

Просмотреть файл

@ -0,0 +1,55 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
export {
SubmitDeallocateRequest,
Schedule,
KnownDeadlineType,
DeadlineType,
ExecutionParameters,
KnownOptimizationPreference,
OptimizationPreference,
RetryPolicy,
Resources,
DeallocateResourceOperationResponse,
ResourceOperation,
ResourceOperationDetails,
KnownResourceOperationType,
ResourceOperationType,
KnownOperationState,
OperationState,
ResourceOperationError,
SubmitHibernateRequest,
HibernateResourceOperationResponse,
SubmitStartRequest,
StartResourceOperationResponse,
ExecuteDeallocateRequest,
ExecuteHibernateRequest,
ExecuteStartRequest,
GetOperationStatusRequest,
GetOperationStatusResponse,
CancelOperationsRequest,
CancelOperationsResponse,
GetOperationErrorsRequest,
GetOperationErrorsResponse,
OperationErrorsResult,
OperationErrorDetails,
Operation,
OperationDisplay,
KnownOrigin,
Origin,
KnownActionType,
ActionType,
} from "./models.js";
export {
OperationsListOptionalParams,
ScheduledActionsVirtualMachinesSubmitDeallocateOptionalParams,
ScheduledActionsVirtualMachinesSubmitHibernateOptionalParams,
ScheduledActionsVirtualMachinesSubmitStartOptionalParams,
ScheduledActionsVirtualMachinesExecuteDeallocateOptionalParams,
ScheduledActionsVirtualMachinesExecuteHibernateOptionalParams,
ScheduledActionsVirtualMachinesExecuteStartOptionalParams,
ScheduledActionsVirtualMachinesGetOperationStatusOptionalParams,
ScheduledActionsVirtualMachinesCancelOperationsOptionalParams,
ScheduledActionsVirtualMachinesGetOperationErrorsOptionalParams,
} from "./options.js";

Просмотреть файл

@ -0,0 +1,540 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
/** 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;
}
export function submitDeallocateRequestSerializer(
item: SubmitDeallocateRequest,
): Record<string, unknown> {
return {
schedule: scheduleSerializer(item.schedule),
executionParameters: executionParametersSerializer(item.executionParameters),
resources: resourcesSerializer(item.resources),
correlationid: item["correlationid"],
};
}
/** The schedule details for the user request */
export interface Schedule {
/** The deadline for the operation */
deadLine: string;
/** The timezone for the operation */
timeZone: string;
/** The deadlinetype of the operation, this can either be InitiateAt or CompleteBy */
deadlineType: DeadlineType;
}
export function scheduleSerializer(item: Schedule): Record<string, unknown> {
return {
deadLine: item["deadLine"],
timeZone: item["timeZone"],
deadlineType: item["deadlineType"],
};
}
/** Known values of {@link DeadlineType} that the service accepts. */
export enum KnownDeadlineType {
/** Unknown */
Unknown = "Unknown",
/** InitiateAt */
InitiateAt = "InitiateAt",
/** CompleteBy */
CompleteBy = "CompleteBy",
}
/**
* The types of deadlines supported by ScheduledActions \
* {@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** \
* **InitiateAt** \
* **CompleteBy**
*/
export type DeadlineType = 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;
}
export function executionParametersSerializer(item: ExecutionParameters): Record<string, unknown> {
return {
optimizationPreference: item["optimizationPreference"],
retryPolicy: !item.retryPolicy ? item.retryPolicy : retryPolicySerializer(item.retryPolicy),
};
}
/** Known values of {@link OptimizationPreference} that the service accepts. */
export enum KnownOptimizationPreference {
/** Cost */
Cost = "Cost",
/** Availability */
Availability = "Availability",
/** CostAvailabilityBalanced */
CostAvailabilityBalanced = "CostAvailabilityBalanced",
}
/**
* The preferences customers can select to optimize their requests to ScheduledActions \
* {@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** \
* **Availability** \
* **CostAvailabilityBalanced**
*/
export type OptimizationPreference = 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;
}
export function retryPolicySerializer(item: RetryPolicy): Record<string, unknown> {
return {
retryCount: item["retryCount"],
retryWindowInMinutes: item["retryWindowInMinutes"],
};
}
/** The resources needed for the user request */
export interface Resources {
/** The resource ids used for the request */
ids: string[];
}
export function resourcesSerializer(item: Resources): Record<string, unknown> {
return {
ids: item["ids"],
};
}
/** 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[];
}
/** 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: string;
/** 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?: string;
/** Retry policy the user can pass */
retryPolicy?: RetryPolicy;
}
/** Known values of {@link ResourceOperationType} that the service accepts. */
export enum KnownResourceOperationType {
/** Unknown */
Unknown = "Unknown",
/** Start */
Start = "Start",
/** Deallocate */
Deallocate = "Deallocate",
/** Hibernate */
Hibernate = "Hibernate",
}
/**
* The kind of operation types that can be performed on resources using ScheduledActions \
* {@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** \
* **Start** \
* **Deallocate** \
* **Hibernate**
*/
export type ResourceOperationType = string;
/** Known values of {@link OperationState} that the service accepts. */
export enum KnownOperationState {
/** Unknown */
Unknown = "Unknown",
/** PendingScheduling */
PendingScheduling = "PendingScheduling",
/** Scheduled */
Scheduled = "Scheduled",
/** PendingExecution */
PendingExecution = "PendingExecution",
/** Executing */
Executing = "Executing",
/** Succeeded */
Succeeded = "Succeeded",
/** Failed */
Failed = "Failed",
/** Cancelled */
Cancelled = "Cancelled",
/** Blocked */
Blocked = "Blocked",
}
/**
* Values that define the states of operations in Scheduled Actions \
* {@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** \
* **PendingScheduling** \
* **Scheduled** \
* **PendingExecution** \
* **Executing** \
* **Succeeded** \
* **Failed** \
* **Cancelled** \
* **Blocked**
*/
export type OperationState = string;
/** 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;
}
/** 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;
}
export function submitHibernateRequestSerializer(
item: SubmitHibernateRequest,
): Record<string, unknown> {
return {
schedule: scheduleSerializer(item.schedule),
executionParameters: executionParametersSerializer(item.executionParameters),
resources: resourcesSerializer(item.resources),
correlationid: item["correlationid"],
};
}
/** 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[];
}
/** 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;
}
export function submitStartRequestSerializer(item: SubmitStartRequest): Record<string, unknown> {
return {
schedule: scheduleSerializer(item.schedule),
executionParameters: executionParametersSerializer(item.executionParameters),
resources: resourcesSerializer(item.resources),
correlationid: item["correlationid"],
};
}
/** 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[];
}
/** 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;
}
export function executeDeallocateRequestSerializer(
item: ExecuteDeallocateRequest,
): Record<string, unknown> {
return {
executionParameters: executionParametersSerializer(item.executionParameters),
resources: resourcesSerializer(item.resources),
correlationid: item["correlationid"],
};
}
/** 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;
}
export function executeHibernateRequestSerializer(
item: ExecuteHibernateRequest,
): Record<string, unknown> {
return {
executionParameters: executionParametersSerializer(item.executionParameters),
resources: resourcesSerializer(item.resources),
correlationid: item["correlationid"],
};
}
/** 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;
}
export function executeStartRequestSerializer(item: ExecuteStartRequest): Record<string, unknown> {
return {
executionParameters: executionParametersSerializer(item.executionParameters),
resources: resourcesSerializer(item.resources),
correlationid: item["correlationid"],
};
}
/** 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;
}
export function getOperationStatusRequestSerializer(
item: GetOperationStatusRequest,
): Record<string, unknown> {
return {
operationIds: item["operationIds"],
correlationid: item["correlationid"],
};
}
/** 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[];
}
/** 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;
}
export function cancelOperationsRequestSerializer(
item: CancelOperationsRequest,
): Record<string, unknown> {
return {
operationIds: item["operationIds"],
correlationid: item["correlationid"],
};
}
/** This is the response from a cancel operations request */
export interface CancelOperationsResponse {
/** An array of resource operations that were successfully cancelled */
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[];
}
export function getOperationErrorsRequestSerializer(
item: GetOperationErrorsRequest,
): Record<string, unknown> {
return {
operationIds: item["operationIds"],
};
}
/** 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?: string;
/** The activation time of a vm operation */
activationTime?: string;
/** The completion time of the operation if the operation was completed */
completedAt?: string;
/** 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: string;
/** The timestamp of the error occurence */
timeStamp: string;
/** CRP operationid of the operation for deeper analysis */
crpOperationId: string;
}
/** A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. */
export interface _OperationListResult {
/** The Operation items on this page */
value: Operation[];
/** The link to the next page of items */
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" */
readonly name?: string;
/** Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure Resource Manager/control-plane operations. */
readonly isDataAction?: boolean;
/** Localized display information for this particular operation. */
readonly display?: OperationDisplay;
/** The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" */
readonly origin?: Origin;
/** Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. */
actionType?: ActionType;
}
/** Localized display information for and operation. */
export interface OperationDisplay {
/** The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". */
readonly provider?: string;
/** The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". */
readonly resource?: string;
/** The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". */
readonly operation?: string;
/** The short, localized friendly description of the operation; suitable for tool tips and detailed views. */
readonly description?: string;
}
/** Known values of {@link Origin} that the service accepts. */
export enum KnownOrigin {
/** user */
User = "user",
/** system */
System = "system",
/** user,system */
UserSystem = "user,system",
}
/**
* The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" \
* {@link KnownOrigin} can be used interchangeably with Origin,
* this enum contains the known values that the service supports.
* ### Known values supported by the service
* **user** \
* **system** \
* **user,system**
*/
export type Origin = string;
/** Known values of {@link ActionType} that the service accepts. */
export enum KnownActionType {
/** Internal */
Internal = "Internal",
}
/**
* Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. \
* {@link KnownActionType} can be used interchangeably with ActionType,
* this enum contains the known values that the service supports.
* ### Known values supported by the service
* **Internal**
*/
export type ActionType = string;

Просмотреть файл

@ -0,0 +1,43 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { OperationOptions } from "@azure-rest/core-client";
/** Optional parameters. */
export interface OperationsListOptionalParams extends OperationOptions {}
/** Optional parameters. */
export interface ScheduledActionsVirtualMachinesSubmitDeallocateOptionalParams
extends OperationOptions {}
/** Optional parameters. */
export interface ScheduledActionsVirtualMachinesSubmitHibernateOptionalParams
extends OperationOptions {}
/** Optional parameters. */
export interface ScheduledActionsVirtualMachinesSubmitStartOptionalParams
extends OperationOptions {}
/** Optional parameters. */
export interface ScheduledActionsVirtualMachinesExecuteDeallocateOptionalParams
extends OperationOptions {}
/** Optional parameters. */
export interface ScheduledActionsVirtualMachinesExecuteHibernateOptionalParams
extends OperationOptions {}
/** Optional parameters. */
export interface ScheduledActionsVirtualMachinesExecuteStartOptionalParams
extends OperationOptions {}
/** Optional parameters. */
export interface ScheduledActionsVirtualMachinesGetOperationStatusOptionalParams
extends OperationOptions {}
/** Optional parameters. */
export interface ScheduledActionsVirtualMachinesCancelOperationsOptionalParams
extends OperationOptions {}
/** Optional parameters. */
export interface ScheduledActionsVirtualMachinesGetOperationErrorsOptionalParams
extends OperationOptions {}

Просмотреть файл

@ -0,0 +1,241 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { Client, createRestError, PathUncheckedResponse } from "@azure-rest/core-client";
import { RestError } from "@azure/core-rest-pipeline";
/**
* Options for the byPage method
*/
export interface PageSettings {
/**
* A reference to a specific page to start iterating from.
*/
continuationToken?: string;
}
/**
* An interface that describes a page of results.
*/
export type ContinuablePage<TElement, TPage = TElement[]> = TPage & {
/**
* The token that keeps track of where to continue the iterator
*/
continuationToken?: string;
};
/**
* An interface that allows async iterable iteration both to completion and by page.
*/
export interface PagedAsyncIterableIterator<
TElement,
TPage = TElement[],
TPageSettings extends PageSettings = PageSettings,
> {
/**
* The next method, part of the iteration protocol
*/
next(): Promise<IteratorResult<TElement>>;
/**
* The connection to the async iterator, part of the iteration protocol
*/
[Symbol.asyncIterator](): PagedAsyncIterableIterator<TElement, TPage, TPageSettings>;
/**
* Return an AsyncIterableIterator that works a page at a time
*/
byPage: (settings?: TPageSettings) => AsyncIterableIterator<ContinuablePage<TElement, TPage>>;
}
/**
* An interface that describes how to communicate with the service.
*/
export interface PagedResult<
TElement,
TPage = TElement[],
TPageSettings extends PageSettings = PageSettings,
> {
/**
* Link to the first page of results.
*/
firstPageLink?: string;
/**
* A method that returns a page of results.
*/
getPage: (pageLink?: string) => Promise<{ page: TPage; nextPageLink?: string } | undefined>;
/**
* a function to implement the `byPage` method on the paged async iterator.
*/
byPage?: (settings?: TPageSettings) => AsyncIterableIterator<ContinuablePage<TElement, TPage>>;
/**
* A function to extract elements from a page.
*/
toElements?: (page: TPage) => TElement[];
}
/**
* Options for the paging helper
*/
export interface BuildPagedAsyncIteratorOptions {
itemName?: string;
nextLinkName?: string;
}
/**
* Helper to paginate results in a generic way and return a PagedAsyncIterableIterator
*/
export function buildPagedAsyncIterator<
TElement,
TPage = TElement[],
TPageSettings extends PageSettings = PageSettings,
TResponse extends PathUncheckedResponse = PathUncheckedResponse,
>(
client: Client,
getInitialResponse: () => PromiseLike<TResponse>,
processResponseBody: (result: TResponse) => PromiseLike<unknown>,
expectedStatuses: string[],
options: BuildPagedAsyncIteratorOptions = {},
): PagedAsyncIterableIterator<TElement, TPage, TPageSettings> {
const itemName = options.itemName ?? "value";
const nextLinkName = options.nextLinkName ?? "nextLink";
const pagedResult: PagedResult<TElement, TPage, TPageSettings> = {
getPage: async (pageLink?: string) => {
const result =
pageLink === undefined
? await getInitialResponse()
: await client.pathUnchecked(pageLink).get();
checkPagingRequest(result, expectedStatuses);
const results = await processResponseBody(result as TResponse);
const nextLink = getNextLink(results, nextLinkName);
const values = getElements<TElement>(results, itemName) as TPage;
return {
page: values,
nextPageLink: nextLink,
};
},
byPage: (settings?: TPageSettings) => {
const { continuationToken } = settings ?? {};
return getPageAsyncIterator(pagedResult, {
pageLink: continuationToken,
});
},
};
return getPagedAsyncIterator(pagedResult);
}
/**
* returns an async iterator that iterates over results. It also has a `byPage`
* method that returns pages of items at once.
*
* @param pagedResult - an object that specifies how to get pages.
* @returns a paged async iterator that iterates over results.
*/
function getPagedAsyncIterator<
TElement,
TPage = TElement[],
TPageSettings extends PageSettings = PageSettings,
>(
pagedResult: PagedResult<TElement, TPage, TPageSettings>,
): PagedAsyncIterableIterator<TElement, TPage, TPageSettings> {
const iter = getItemAsyncIterator<TElement, TPage, TPageSettings>(pagedResult);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage:
pagedResult?.byPage ??
((settings?: TPageSettings) => {
const { continuationToken } = settings ?? {};
return getPageAsyncIterator(pagedResult, {
pageLink: continuationToken,
});
}),
};
}
async function* getItemAsyncIterator<TElement, TPage, TPageSettings extends PageSettings>(
pagedResult: PagedResult<TElement, TPage, TPageSettings>,
): AsyncIterableIterator<TElement> {
const pages = getPageAsyncIterator(pagedResult);
for await (const page of pages) {
yield* page as unknown as TElement[];
}
}
async function* getPageAsyncIterator<TElement, TPage, TPageSettings extends PageSettings>(
pagedResult: PagedResult<TElement, TPage, TPageSettings>,
options: {
pageLink?: string;
} = {},
): AsyncIterableIterator<ContinuablePage<TElement, TPage>> {
const { pageLink } = options;
let response = await pagedResult.getPage(pageLink ?? pagedResult.firstPageLink);
if (!response) {
return;
}
let result = response.page as ContinuablePage<TElement, TPage>;
result.continuationToken = response.nextPageLink;
yield result;
while (response.nextPageLink) {
response = await pagedResult.getPage(response.nextPageLink);
if (!response) {
return;
}
result = response.page as ContinuablePage<TElement, TPage>;
result.continuationToken = response.nextPageLink;
yield result;
}
}
/**
* Gets for the value of nextLink in the body
*/
function getNextLink(body: unknown, nextLinkName?: string): string | undefined {
if (!nextLinkName) {
return undefined;
}
const nextLink = (body as Record<string, unknown>)[nextLinkName];
if (typeof nextLink !== "string" && typeof nextLink !== "undefined" && nextLink !== null) {
throw new RestError(
`Body Property ${nextLinkName} should be a string or undefined or null but got ${typeof nextLink}`,
);
}
if (nextLink === null) {
return undefined;
}
return nextLink;
}
/**
* Gets the elements of the current request in the body.
*/
function getElements<T = unknown>(body: unknown, itemName: string): T[] {
const value = (body as Record<string, unknown>)[itemName] as T[];
if (!Array.isArray(value)) {
throw new RestError(
`Couldn't paginate response\n Body doesn't contain an array property with name: ${itemName}`,
);
}
return value ?? [];
}
/**
* Checks if a request failed
*/
function checkPagingRequest(response: PathUncheckedResponse, expectedStatuses: string[]): void {
if (!expectedStatuses.includes(response.status)) {
throw createRestError(
`Pagination failed with unexpected statusCode ${response.status}`,
response,
);
}
}

Просмотреть файл

@ -0,0 +1,47 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
import { env, Recorder, isPlaybackMode } from "@azure-tools/test-recorder";
import { createTestCredential } from "@azure-tools/test-credential";
import { assert, beforeEach, afterEach, it, describe } from "vitest";
import { createRecorder } from "./utils/recordedClient.js";
import { ComputeScheduleClient } from "../../src/computeScheduleClient.js";
export const testPollingOptions = {
updateIntervalInMs: isPlaybackMode() ? 0 : undefined,
};
describe("ComputeSchedule test", () => {
let recorder: Recorder;
let subscriptionId: string;
let client: ComputeScheduleClient;
beforeEach(async (context) => {
process.env.SystemRoot = process.env.SystemRoot || "C:\\Windows";
recorder = await createRecorder(context);
subscriptionId = env.SUBSCRIPTION_ID || "";
// This is an example of how the environment variables are used
const credential = createTestCredential();
client = new ComputeScheduleClient(
credential,
subscriptionId,
recorder.configureClientOptions({}),
);
});
afterEach(async function () {
await recorder.stop();
});
it("operations list test", async function () {
const resArray = new Array();
for await (let item of client.operations.list()) {
resArray.push(item);
}
assert.notEqual(resArray.length, 0);
});
});

Просмотреть файл

@ -0,0 +1,27 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { Recorder, RecorderStartOptions, VitestTestContext } from "@azure-tools/test-recorder";
const replaceableVariables: Record<string, string> = {
SUBSCRIPTION_ID: "azure_subscription_id",
};
const recorderEnvSetup: RecorderStartOptions = {
envSetupForPlayback: replaceableVariables,
removeCentralSanitizers: [
"AZSDK3493", // .name in the body is not a secret and is listed below in the beforeEach section
"AZSDK3430", // .id in the body is not a secret and is listed below in the beforeEach section
],
};
/**
* creates the recorder and reads the environment variables from the `.env` file.
* Should be called first in the test suite to make sure environment variables are
* read before they are being used.
*/
export async function createRecorder(context: VitestTestContext): Promise<Recorder> {
const recorder = new Recorder(context);
await recorder.start(recorderEnvSetup);
return recorder;
}

Просмотреть файл

@ -0,0 +1,10 @@
{
"extends": "./.tshy/build.json",
"include": ["./src/**/*.ts", "./src/**/*.mts", "./test/**/*.spec.ts"],
"exclude": ["./test/**/node/**/*.ts"],
"compilerOptions": {
"outDir": "./dist-test/browser",
"rootDir": ".",
"skipLibCheck": true
}
}

Просмотреть файл

@ -0,0 +1,18 @@
{
"extends": "../../../tsconfig",
"compilerOptions": {
"module": "NodeNext",
"moduleResolution": "NodeNext",
"rootDir": ".",
"skipLibCheck": true,
"paths": { "@azure/arm-computeschedule": ["./src/index"] }
},
"include": [
"./src/**/*.ts",
"./src/**/*.mts",
"./src/**/*.cts",
"test/**/*.ts",
"./test/**/*.ts",
"samples-dev/**/*.ts"
]
}

Просмотреть файл

@ -0,0 +1,38 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { defineConfig } from "vitest/config";
import { relativeRecordingsPath } from "@azure-tools/test-recorder";
process.env.RECORDINGS_RELATIVE_PATH = relativeRecordingsPath();
export default defineConfig({
define: {
"process.env": process.env,
},
test: {
reporters: ["basic", "junit"],
outputFile: {
junit: "test-results.browser.xml",
},
browser: {
enabled: true,
headless: true,
name: "chromium",
provider: "playwright",
},
fakeTimers: {
toFake: ["setTimeout", "Date"],
},
watch: false,
include: ["dist-test/browser/**/*.spec.js"],
coverage: {
include: ["dist-test/browser/**/*.spec.js"],
provider: "istanbul",
reporter: ["text", "json", "html"],
reportsDirectory: "coverage-browser",
},
testTimeout: 1200000,
hookTimeout: 1200000
},
});

Просмотреть файл

@ -0,0 +1,34 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { defineConfig } from "vitest/config";
import { relativeRecordingsPath } from "@azure-tools/test-recorder";
export default defineConfig({
test: {
reporters: ["basic", "junit"],
outputFile: {
junit: "test-results.browser.xml",
},
fakeTimers: {
toFake: ["setTimeout", "Date"],
},
watch: false,
include: ["test/**/*.spec.ts"],
exclude: ["test/**/browser/*.spec.ts"],
coverage: {
include: ["src/**/*.ts"],
exclude: [
"src/**/*-browser.mts",
"src/**/*-react-native.mts",
"vitest*.config.ts",
"samples-dev/**/*.ts",
],
provider: "istanbul",
reporter: ["text", "json", "html"],
reportsDirectory: "coverage",
},
testTimeout: 1200000,
hookTimeout: 1200000
},
});

Просмотреть файл

@ -0,0 +1,37 @@
# 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