diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 9eecf48ecf51..7eb978800026 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -495,6 +495,9 @@ # PRLabel: %Mgmt /sdk/frontdoor/arm-frontdoor/ @qiaozha @MaryGao +# PRLabel: %Mgmt +/sdk/guestconfiguration/arm-guestconfiguration/ @qiaozha @MaryGao + # PRLabel: %Mgmt /sdk/hanaonazure/arm-hanaonazure/ @qiaozha @MaryGao diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index aaff20982565..1efefef64ea5 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -329,6 +329,9 @@ dependencies: '@rush-temp/arm-graphservices': specifier: file:./projects/arm-graphservices.tgz version: file:projects/arm-graphservices.tgz + '@rush-temp/arm-guestconfiguration': + specifier: file:./projects/arm-guestconfiguration.tgz + version: file:projects/arm-guestconfiguration.tgz '@rush-temp/arm-hanaonazure': specifier: file:./projects/arm-hanaonazure.tgz version: file:projects/arm-hanaonazure.tgz @@ -3502,7 +3505,7 @@ packages: /@types/bunyan@1.8.9: resolution: {integrity: sha512-ZqS9JGpBxVOvsawzmVt30sP++gSQMTejCkIAQ3VdadOcRE8izTyW66hufvwLeH+YEGP6Js2AW7Gz+RMyvrEbmw==} dependencies: - '@types/node': 18.19.31 + '@types/node': 20.10.8 dev: false /@types/chai-as-promised@7.1.8: @@ -3524,7 +3527,7 @@ packages: /@types/connect@3.4.38: resolution: {integrity: sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==} dependencies: - '@types/node': 18.19.31 + '@types/node': 20.10.8 dev: false /@types/cookie@0.4.1: @@ -3534,7 +3537,7 @@ packages: /@types/cors@2.8.17: resolution: {integrity: sha512-8CGDvrBj1zgo2qE+oS3pOCyYNqCPryMWY2bGfwA0dcfopWGgxs+78df0Rs3rc9THP4JkOhLsAa+15VdpAqkcUA==} dependencies: - '@types/node': 18.19.31 + '@types/node': 20.10.8 dev: false /@types/debug@4.1.12: @@ -3688,13 +3691,13 @@ packages: /@types/mysql@2.15.22: resolution: {integrity: sha512-wK1pzsJVVAjYCSZWQoWHziQZbNggXFDUEIGf54g4ZM/ERuP86uGdWeKZWMYlqTPMZfHJJvLPyogXGvCOg87yLQ==} dependencies: - '@types/node': 18.19.31 + '@types/node': 20.10.8 dev: false /@types/node-fetch@2.6.11: resolution: {integrity: sha512-24xFj9R5+rfQJLRyM56qh+wnVSYhyXC2tkoBndtY0U+vubqNsYXGjufB2nn8Q6gt0LrARwL6UBtMCSVCwl4B1g==} dependencies: - '@types/node': 18.19.31 + '@types/node': 20.10.8 form-data: 4.0.0 dev: false @@ -3723,7 +3726,7 @@ packages: /@types/pg@8.6.1: resolution: {integrity: sha512-1Kc4oAGzAl7uqUStZCDvaLFqZrW9qWSjXOmBfdgyBP5La7Us6Mg4GBvRlSoaZMhQF/zSj1C8CtKMBkoiT8eL8w==} dependencies: - '@types/node': 18.19.31 + '@types/node': 20.10.8 pg-protocol: 1.6.1 pg-types: 2.2.0 dev: false @@ -3810,7 +3813,7 @@ packages: /@types/tunnel@0.0.3: resolution: {integrity: sha512-sOUTGn6h1SfQ+gbgqC364jLFBw2lnFqkgF3q0WovEHRLMrVD1sd5aufqi/aJObLekJO+Aq5z646U4Oxy6shXMA==} dependencies: - '@types/node': 18.19.31 + '@types/node': 20.10.8 dev: false /@types/underscore@1.11.15: @@ -3851,7 +3854,7 @@ packages: resolution: {integrity: sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q==} requiresBuild: true dependencies: - '@types/node': 18.19.31 + '@types/node': 20.10.8 dev: false optional: true @@ -5465,7 +5468,7 @@ packages: dependencies: '@types/cookie': 0.4.1 '@types/cors': 2.8.17 - '@types/node': 18.19.31 + '@types/node': 20.10.8 accepts: 1.3.8 base64id: 2.0.0 cookie: 0.4.2 @@ -14416,6 +14419,35 @@ packages: - supports-color dev: false + file:projects/arm-guestconfiguration.tgz: + resolution: {integrity: sha512-GTpbrpDPK7vVJRuni6sEBAm2ItIPX9M3wLAJZV76z6gHvXrIEO7iGXbSzsO2tT5RCGWLb40nEKZWSNS81UktxQ==, tarball: file:projects/arm-guestconfiguration.tgz} + name: '@rush-temp/arm-guestconfiguration' + version: 0.0.0 + dependencies: + '@azure-tools/test-credential': 1.0.4 + '@azure-tools/test-recorder': 3.1.2 + '@azure/identity': 4.1.0 + '@microsoft/api-extractor': 7.43.1(@types/node@18.19.31) + '@types/chai': 4.3.14 + '@types/mocha': 10.0.6 + '@types/node': 18.19.31 + chai: 4.3.10 + cross-env: 7.0.3 + dotenv: 16.4.5 + esm: 3.2.25 + mkdirp: 3.0.1 + mocha: 10.4.0 + rimraf: 5.0.5 + ts-node: 10.9.2(@types/node@18.19.31)(typescript@5.4.5) + tslib: 2.6.2 + typescript: 5.4.5 + uglify-js: 3.17.4 + transitivePeerDependencies: + - '@swc/core' + - '@swc/wasm' + - supports-color + dev: false + file:projects/arm-hanaonazure.tgz: resolution: {integrity: sha512-9zK9QdmF4kyJn7ieuLlX6vDE4ZjALN9+djnWyxZeh1P9aCFCvvbTOMb+vLJ7qCKXmEeND8EESAAN8g7X8IYCLQ==, tarball: file:projects/arm-hanaonazure.tgz} name: '@rush-temp/arm-hanaonazure' @@ -21647,7 +21679,7 @@ packages: dev: false file:projects/monitor-opentelemetry.tgz: - resolution: {integrity: sha512-86DR3dHrvlTLs8B1XCmfHkdXTPrEgd8j3C5WDw452AH5FNmKuN0qaN0h9oDkdPn+p+oO3mmeyYYL+utaKf8VyQ==, tarball: file:projects/monitor-opentelemetry.tgz} + resolution: {integrity: sha512-K1658C1RtJ1M0bBoIiikcDK862eKgfQR7ffWfNxnKo6TDVyDLFBhXkIWBPqhVzfQSm0dnpcW5VT4TdH50kKJyw==, tarball: file:projects/monitor-opentelemetry.tgz} name: '@rush-temp/monitor-opentelemetry' version: 0.0.0 dependencies: diff --git a/eng/ignore-links.txt b/eng/ignore-links.txt index b863ad79e69a..6aa05d837146 100644 --- a/eng/ignore-links.txt +++ b/eng/ignore-links.txt @@ -20,8 +20,6 @@ https://docs.microsoft.com/javascript/api/@azure-rest/purview-datamap?view=azure https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/purview/purview-datamap-rest/samples https://docs.microsoft.com/javascript/api/@azure/arm-migrationdiscoverysap?view=azure-node-preview https://docs.microsoft.com/javascript/api/@azure/arm-storageactions?view=azure-node-preview -<<<<<<< HEAD +https://docs.microsoft.com/javascript/api/@azure/arm-guestconfiguration?view=azure-node-preview https://docs.microsoft.com/javascript/api/@azure/arm-deviceregistry?view=azure-node-preview -======= https://docs.microsoft.com/javascript/api/@azure/arm-standbypool?view=azure-node-preview ->>>>>>> main diff --git a/rush.json b/rush.json index 79a51ecc0d60..2eeacc4addb2 100644 --- a/rush.json +++ b/rush.json @@ -2183,6 +2183,11 @@ "projectFolder": "sdk/storageactions/arm-storageactions", "versionPolicyName": "management" }, + { + "packageName": "@azure/arm-guestconfiguration", + "projectFolder": "sdk/guestconfiguration/arm-guestconfiguration", + "versionPolicyName": "management" + }, { "packageName": "@azure/arm-deviceregistry", "projectFolder": "sdk/deviceregistry/arm-deviceregistry", diff --git a/sdk/guestconfiguration/arm-guestconfiguration/CHANGELOG.md b/sdk/guestconfiguration/arm-guestconfiguration/CHANGELOG.md new file mode 100644 index 000000000000..ed33b52c0586 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2024-04-28) + +The package of @azure/arm-guestconfiguration is using our next generation design principles. To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/js/mgmt/quickstart ). diff --git a/sdk/guestconfiguration/arm-guestconfiguration/LICENSE b/sdk/guestconfiguration/arm-guestconfiguration/LICENSE new file mode 100644 index 000000000000..7d5934740965 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2024 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/guestconfiguration/arm-guestconfiguration/README.md b/sdk/guestconfiguration/arm-guestconfiguration/README.md new file mode 100644 index 000000000000..327919aa705b --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/README.md @@ -0,0 +1,109 @@ +# Azure GuestConfiguration client library for JavaScript + +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure GuestConfiguration client. + +Guest Configuration Client + +[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/guestconfiguration/arm-guestconfiguration) | +[Package (NPM)](https://www.npmjs.com/package/@azure/arm-guestconfiguration) | +[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-guestconfiguration?view=azure-node-preview) | +[Samples](https://github.com/Azure-Samples/azure-samples-js-management) + +## Getting started + +### Currently supported environments + +- [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule) +- Latest versions of Safari, Chrome, Edge and Firefox. + +See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details. + +### Prerequisites + +- An [Azure subscription][azure_sub]. + +### Install the `@azure/arm-guestconfiguration` package + +Install the Azure GuestConfiguration client library for JavaScript with `npm`: + +```bash +npm install @azure/arm-guestconfiguration +``` + +### Create and authenticate a `GuestConfigurationClient` + +To create a client object to access the Azure GuestConfiguration API, you will need the `endpoint` of your Azure GuestConfiguration resource and a `credential`. The Azure GuestConfiguration client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your Azure GuestConfiguration 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 GuestConfiguration** 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 { GuestConfigurationClient } = require("@azure/arm-guestconfiguration"); +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 GuestConfigurationClient(new DefaultAzureCredential(), subscriptionId); + +// For client-side applications running in the browser, use this code instead: +// const credential = new InteractiveBrowserCredential({ +// tenantId: "", +// clientId: "" +// }); +// const client = new GuestConfigurationClient(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 + +### GuestConfigurationClient + +`GuestConfigurationClient` is the primary interface for developers using the Azure GuestConfiguration client library. Explore the methods on this client object to understand the different features of the Azure GuestConfiguration service that you can access. + +## Troubleshooting + +### Logging + +Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`: + +```javascript +const { setLogLevel } = require("@azure/logger"); +setLogLevel("info"); +``` + +For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger). + +## Next steps + +Please take a look at the [samples](https://github.com/Azure-Samples/azure-samples-js-management) directory for detailed examples on how to use this library. + +## Contributing + +If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code. + +## Related projects + +- [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js) + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fguestconfiguration%2Farm-guestconfiguration%2FREADME.png) + +[azure_cli]: https://docs.microsoft.com/cli/azure +[azure_sub]: https://azure.microsoft.com/free/ +[azure_sub]: https://azure.microsoft.com/free/ +[azure_portal]: https://portal.azure.com +[azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity +[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential diff --git a/sdk/guestconfiguration/arm-guestconfiguration/_meta.json b/sdk/guestconfiguration/arm-guestconfiguration/_meta.json new file mode 100644 index 000000000000..b282352e3da6 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/_meta.json @@ -0,0 +1,8 @@ +{ + "commit": "e6a20fec72ed3bcb4b43c559ee20b56ca2786ec0", + "readme": "specification/guestconfiguration/resource-manager/readme.md", + "autorest_command": "autorest --version=3.9.7 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\Git\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\guestconfiguration\\resource-manager\\readme.md --use=@autorest/typescript@6.0.20 --generate-sample=true", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "release_tool": "@azure-tools/js-sdk-release-tools@2.7.5", + "use": "@autorest/typescript@6.0.20" +} \ No newline at end of file diff --git a/sdk/guestconfiguration/arm-guestconfiguration/api-extractor.json b/sdk/guestconfiguration/arm-guestconfiguration/api-extractor.json new file mode 100644 index 000000000000..f7b9add7dacc --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/api-extractor.json @@ -0,0 +1,31 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "mainEntryPointFilePath": "./dist-esm/src/index.d.ts", + "docModel": { + "enabled": true + }, + "apiReport": { + "enabled": true, + "reportFolder": "./review" + }, + "dtsRollup": { + "enabled": true, + "untrimmedFilePath": "", + "publicTrimmedFilePath": "./types/arm-guestconfiguration.d.ts" + }, + "messages": { + "tsdocMessageReporting": { + "default": { + "logLevel": "none" + } + }, + "extractorMessageReporting": { + "ae-missing-release-tag": { + "logLevel": "none" + }, + "ae-unresolved-link": { + "logLevel": "none" + } + } + } +} \ No newline at end of file diff --git a/sdk/guestconfiguration/arm-guestconfiguration/assets.json b/sdk/guestconfiguration/arm-guestconfiguration/assets.json new file mode 100644 index 000000000000..8a27e0eedf49 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/assets.json @@ -0,0 +1,6 @@ +{ + "AssetsRepo": "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath": "js", + "TagPrefix": "js/guestconfiguration/arm-guestconfiguration", + "Tag": "js/guestconfiguration/arm-guestconfiguration_84d8556eb5" +} diff --git a/sdk/guestconfiguration/arm-guestconfiguration/package.json b/sdk/guestconfiguration/arm-guestconfiguration/package.json new file mode 100644 index 000000000000..4ace4f1ff0e4 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/package.json @@ -0,0 +1,116 @@ +{ + "name": "@azure/arm-guestconfiguration", + "sdk-type": "mgmt", + "author": "Microsoft Corporation", + "description": "A generated SDK for GuestConfigurationClient.", + "version": "1.0.0-beta.1", + "engines": { + "node": ">=18.0.0" + }, + "dependencies": { + "@azure/core-paging": "^1.2.0", + "@azure/core-client": "^1.7.0", + "@azure/core-auth": "^1.6.0", + "@azure/core-rest-pipeline": "^1.14.0", + "tslib": "^2.2.0" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "license": "MIT", + "main": "./dist/index.js", + "module": "./dist-esm/src/index.js", + "types": "./types/arm-guestconfiguration.d.ts", + "devDependencies": { + "@microsoft/api-extractor": "^7.31.1", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", + "uglify-js": "^3.4.9", + "rimraf": "^5.0.0", + "dotenv": "^16.0.0", + "@azure/dev-tool": "^1.0.0", + "@azure/identity": "^4.0.1", + "@azure-tools/test-recorder": "^3.0.0", + "@azure-tools/test-credential": "^1.0.0", + "mocha": "^10.0.0", + "@types/mocha": "^10.0.0", + "esm": "^3.2.18", + "@types/chai": "^4.2.8", + "chai": "^4.2.0", + "cross-env": "^7.0.2", + "@types/node": "^18.0.0", + "ts-node": "^10.0.0" + }, + "repository": { + "type": "git", + "url": "https://github.com/Azure/azure-sdk-for-js.git" + }, + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "files": [ + "dist/**/*.js", + "dist/**/*.js.map", + "dist/**/*.d.ts", + "dist/**/*.d.ts.map", + "dist-esm/**/*.js", + "dist-esm/**/*.js.map", + "dist-esm/**/*.d.ts", + "dist-esm/**/*.d.ts.map", + "src/**/*.ts", + "README.md", + "LICENSE", + "tsconfig.json", + "review/*", + "CHANGELOG.md", + "types/*" + ], + "scripts": { + "build": "npm run clean && tsc && dev-tool run bundle && npm run minify && mkdirp ./review && npm run extract-api", + "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", + "prepack": "npm run build", + "pack": "npm pack 2>&1", + "extract-api": "api-extractor run --local", + "lint": "echo skipped", + "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", + "build:node": "echo skipped", + "build:browser": "echo skipped", + "build:test": "echo skipped", + "build:samples": "echo skipped.", + "check-format": "echo skipped", + "execute:samples": "echo skipped", + "format": "echo skipped", + "test": "npm run integration-test", + "test:node": "echo skipped", + "test:browser": "echo skipped", + "unit-test": "npm run unit-test:node && npm run unit-test:browser", + "unit-test:node": "cross-env TEST_MODE=playback npm run integration-test:node", + "unit-test:browser": "echo skipped", + "integration-test": "npm run integration-test:node && npm run integration-test:browser", + "integration-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 'test/*.ts'", + "integration-test:browser": "echo skipped" + }, + "sideEffects": false, + "//metadata": { + "constantPaths": [ + { + "path": "src/guestConfigurationClient.ts", + "prefix": "packageDetails" + } + ] + }, + "autoPublish": true, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/guestconfiguration/arm-guestconfiguration", + "//sampleConfiguration": { + "productName": "", + "productSlugs": [ + "azure" + ], + "disableDocsMs": true, + "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-guestconfiguration?view=azure-node-preview" + } +} diff --git a/sdk/guestconfiguration/arm-guestconfiguration/review/arm-guestconfiguration.api.md b/sdk/guestconfiguration/arm-guestconfiguration/review/arm-guestconfiguration.api.md new file mode 100644 index 000000000000..96c0cda8a3c7 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/review/arm-guestconfiguration.api.md @@ -0,0 +1,579 @@ +## API Report File for "@azure/arm-guestconfiguration" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import * as coreAuth from '@azure/core-auth'; +import * as coreClient from '@azure/core-client'; +import { PagedAsyncIterableIterator } from '@azure/core-paging'; + +// @public +export type ActionAfterReboot = string; + +// @public +export interface AssignmentInfo { + configuration?: ConfigurationInfo; + readonly name?: string; +} + +// @public (undocumented) +export interface AssignmentReport { + assignment?: AssignmentInfo; + readonly complianceStatus?: ComplianceStatus; + readonly endTime?: Date; + readonly id?: string; + readonly operationType?: Type; + readonly reportId?: string; + resources?: AssignmentReportResource[]; + readonly startTime?: Date; + vm?: VMInfo; +} + +// @public +export interface AssignmentReportDetails { + readonly complianceStatus?: ComplianceStatus; + readonly endTime?: Date; + readonly jobId?: string; + readonly operationType?: Type; + resources?: AssignmentReportResource[]; + readonly startTime?: Date; +} + +// @public +export interface AssignmentReportResource { + readonly complianceStatus?: ComplianceStatus; + readonly properties?: Record; + reasons?: AssignmentReportResourceComplianceReason[]; + readonly resourceId?: string; +} + +// @public +export interface AssignmentReportResourceComplianceReason { + readonly code?: string; + readonly phrase?: string; +} + +// @public +export type AssignmentType = string; + +// @public +export type ComplianceStatus = string; + +// @public +export interface ConfigurationInfo { + readonly name?: string; + readonly version?: string; +} + +// @public +export type ConfigurationMode = string; + +// @public +export interface ConfigurationParameter { + name?: string; + value?: string; +} + +// @public +export interface ConfigurationSetting { + readonly actionAfterReboot?: ActionAfterReboot; + readonly allowModuleOverwrite?: boolean; + readonly configurationMode?: ConfigurationMode; + readonly configurationModeFrequencyMins?: number; + readonly rebootIfNeeded?: boolean; + readonly refreshFrequencyMins?: number; +} + +// @public +export type CreatedByType = string; + +// @public +export interface ErrorResponse { + // (undocumented) + error?: ErrorResponseError; +} + +// @public (undocumented) +export interface ErrorResponseError { + code?: string; + message?: string; +} + +// @public +export function getContinuationToken(page: unknown): string | undefined; + +// @public +export interface GuestConfigurationAssignment extends ProxyResource { + properties?: GuestConfigurationAssignmentProperties; + readonly systemData?: SystemData; +} + +// @public +export interface GuestConfigurationAssignmentList { + value?: GuestConfigurationAssignment[]; +} + +// @public +export interface GuestConfigurationAssignmentProperties { + readonly assignmentHash?: string; + readonly complianceStatus?: ComplianceStatus; + context?: string; + guestConfiguration?: GuestConfigurationNavigation; + readonly lastComplianceStatusChecked?: Date; + latestAssignmentReport?: AssignmentReport; + readonly latestReportId?: string; + readonly parameterHash?: string; + readonly provisioningState?: ProvisioningState; + readonly resourceType?: string; + readonly targetResourceId?: string; + vmssVMList?: VmssvmInfo[]; +} + +// @public +export interface GuestConfigurationAssignmentReport { + readonly id?: string; + readonly name?: string; + properties?: GuestConfigurationAssignmentReportProperties; +} + +// @public +export interface GuestConfigurationAssignmentReportList { + value?: GuestConfigurationAssignmentReport[]; +} + +// @public +export interface GuestConfigurationAssignmentReportProperties { + assignment?: AssignmentInfo; + readonly complianceStatus?: ComplianceStatus; + details?: AssignmentReportDetails; + readonly endTime?: Date; + readonly reportId?: string; + readonly startTime?: Date; + vm?: VMInfo; + readonly vmssResourceId?: string; +} + +// @public +export interface GuestConfigurationAssignmentReports { + get(resourceGroupName: string, guestConfigurationAssignmentName: string, reportId: string, vmName: string, options?: GuestConfigurationAssignmentReportsGetOptionalParams): Promise; + list(resourceGroupName: string, guestConfigurationAssignmentName: string, vmName: string, options?: GuestConfigurationAssignmentReportsListOptionalParams): Promise; +} + +// @public +export interface GuestConfigurationAssignmentReportsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type GuestConfigurationAssignmentReportsGetResponse = GuestConfigurationAssignmentReport; + +// @public +export interface GuestConfigurationAssignmentReportsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type GuestConfigurationAssignmentReportsListResponse = GuestConfigurationAssignmentReportList; + +// @public +export interface GuestConfigurationAssignmentReportsVmss { + get(resourceGroupName: string, vmssName: string, name: string, id: string, options?: GuestConfigurationAssignmentReportsVmssGetOptionalParams): Promise; + list(resourceGroupName: string, vmssName: string, name: string, options?: GuestConfigurationAssignmentReportsVmssListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface GuestConfigurationAssignmentReportsVmssGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type GuestConfigurationAssignmentReportsVmssGetResponse = GuestConfigurationAssignmentReport; + +// @public +export interface GuestConfigurationAssignmentReportsVmssListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type GuestConfigurationAssignmentReportsVmssListResponse = GuestConfigurationAssignmentReportList; + +// @public +export interface GuestConfigurationAssignments { + createOrUpdate(guestConfigurationAssignmentName: string, resourceGroupName: string, vmName: string, parameters: GuestConfigurationAssignment, options?: GuestConfigurationAssignmentsCreateOrUpdateOptionalParams): Promise; + delete(resourceGroupName: string, guestConfigurationAssignmentName: string, vmName: string, options?: GuestConfigurationAssignmentsDeleteOptionalParams): Promise; + get(resourceGroupName: string, guestConfigurationAssignmentName: string, vmName: string, options?: GuestConfigurationAssignmentsGetOptionalParams): Promise; + list(resourceGroupName: string, vmName: string, options?: GuestConfigurationAssignmentsListOptionalParams): PagedAsyncIterableIterator; + listRGList(resourceGroupName: string, options?: GuestConfigurationAssignmentsRGListOptionalParams): PagedAsyncIterableIterator; + listSubscriptionList(options?: GuestConfigurationAssignmentsSubscriptionListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface GuestConfigurationAssignmentsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type GuestConfigurationAssignmentsCreateOrUpdateResponse = GuestConfigurationAssignment; + +// @public +export interface GuestConfigurationAssignmentsDeleteOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface GuestConfigurationAssignmentsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type GuestConfigurationAssignmentsGetResponse = GuestConfigurationAssignment; + +// @public +export interface GuestConfigurationAssignmentsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type GuestConfigurationAssignmentsListResponse = GuestConfigurationAssignmentList; + +// @public +export interface GuestConfigurationAssignmentsRGListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type GuestConfigurationAssignmentsRGListResponse = GuestConfigurationAssignmentList; + +// @public +export interface GuestConfigurationAssignmentsSubscriptionListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type GuestConfigurationAssignmentsSubscriptionListResponse = GuestConfigurationAssignmentList; + +// @public +export interface GuestConfigurationAssignmentsVmss { + createOrUpdate(resourceGroupName: string, vmssName: string, name: string, parameters: GuestConfigurationAssignment, options?: GuestConfigurationAssignmentsVmssCreateOrUpdateOptionalParams): Promise; + delete(resourceGroupName: string, vmssName: string, name: string, options?: GuestConfigurationAssignmentsVmssDeleteOptionalParams): Promise; + get(resourceGroupName: string, vmssName: string, name: string, options?: GuestConfigurationAssignmentsVmssGetOptionalParams): Promise; + list(resourceGroupName: string, vmssName: string, options?: GuestConfigurationAssignmentsVmssListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface GuestConfigurationAssignmentsVmssCreateOrUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type GuestConfigurationAssignmentsVmssCreateOrUpdateResponse = GuestConfigurationAssignment; + +// @public +export interface GuestConfigurationAssignmentsVmssDeleteOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type GuestConfigurationAssignmentsVmssDeleteResponse = GuestConfigurationAssignment; + +// @public +export interface GuestConfigurationAssignmentsVmssGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type GuestConfigurationAssignmentsVmssGetResponse = GuestConfigurationAssignment; + +// @public +export interface GuestConfigurationAssignmentsVmssListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type GuestConfigurationAssignmentsVmssListResponse = GuestConfigurationAssignmentList; + +// @public (undocumented) +export class GuestConfigurationClient extends coreClient.ServiceClient { + // (undocumented) + $host: string; + constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: GuestConfigurationClientOptionalParams); + // (undocumented) + apiVersion: string; + // (undocumented) + guestConfigurationAssignmentReports: GuestConfigurationAssignmentReports; + // (undocumented) + guestConfigurationAssignmentReportsVmss: GuestConfigurationAssignmentReportsVmss; + // (undocumented) + guestConfigurationAssignments: GuestConfigurationAssignments; + // (undocumented) + guestConfigurationAssignmentsVmss: GuestConfigurationAssignmentsVmss; + // (undocumented) + guestConfigurationConnectedVMwarevSphereAssignments: GuestConfigurationConnectedVMwarevSphereAssignments; + // (undocumented) + guestConfigurationConnectedVMwarevSphereAssignmentsReports: GuestConfigurationConnectedVMwarevSphereAssignmentsReports; + // (undocumented) + guestConfigurationHcrpAssignmentReports: GuestConfigurationHcrpAssignmentReports; + // (undocumented) + guestConfigurationHcrpAssignments: GuestConfigurationHcrpAssignments; + // (undocumented) + operations: Operations; + // (undocumented) + subscriptionId: string; +} + +// @public +export interface GuestConfigurationClientOptionalParams extends coreClient.ServiceClientOptions { + $host?: string; + apiVersion?: string; + endpoint?: string; +} + +// @public +export interface GuestConfigurationConnectedVMwarevSphereAssignments { + createOrUpdate(resourceGroupName: string, vmName: string, guestConfigurationAssignmentName: string, parameters: GuestConfigurationAssignment, options?: GuestConfigurationConnectedVMwarevSphereAssignmentsCreateOrUpdateOptionalParams): Promise; + delete(resourceGroupName: string, vmName: string, guestConfigurationAssignmentName: string, options?: GuestConfigurationConnectedVMwarevSphereAssignmentsDeleteOptionalParams): Promise; + get(resourceGroupName: string, vmName: string, guestConfigurationAssignmentName: string, options?: GuestConfigurationConnectedVMwarevSphereAssignmentsGetOptionalParams): Promise; + list(resourceGroupName: string, vmName: string, options?: GuestConfigurationConnectedVMwarevSphereAssignmentsListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface GuestConfigurationConnectedVMwarevSphereAssignmentsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type GuestConfigurationConnectedVMwarevSphereAssignmentsCreateOrUpdateResponse = GuestConfigurationAssignment; + +// @public +export interface GuestConfigurationConnectedVMwarevSphereAssignmentsDeleteOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface GuestConfigurationConnectedVMwarevSphereAssignmentsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type GuestConfigurationConnectedVMwarevSphereAssignmentsGetResponse = GuestConfigurationAssignment; + +// @public +export interface GuestConfigurationConnectedVMwarevSphereAssignmentsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type GuestConfigurationConnectedVMwarevSphereAssignmentsListResponse = GuestConfigurationAssignmentList; + +// @public +export interface GuestConfigurationConnectedVMwarevSphereAssignmentsReports { + get(resourceGroupName: string, vmName: string, guestConfigurationAssignmentName: string, reportId: string, options?: GuestConfigurationConnectedVMwarevSphereAssignmentsReportsGetOptionalParams): Promise; + list(resourceGroupName: string, vmName: string, guestConfigurationAssignmentName: string, options?: GuestConfigurationConnectedVMwarevSphereAssignmentsReportsListOptionalParams): Promise; +} + +// @public +export interface GuestConfigurationConnectedVMwarevSphereAssignmentsReportsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type GuestConfigurationConnectedVMwarevSphereAssignmentsReportsGetResponse = GuestConfigurationAssignmentReport; + +// @public +export interface GuestConfigurationConnectedVMwarevSphereAssignmentsReportsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type GuestConfigurationConnectedVMwarevSphereAssignmentsReportsListResponse = GuestConfigurationAssignmentReportList; + +// @public +export interface GuestConfigurationHcrpAssignmentReports { + get(resourceGroupName: string, guestConfigurationAssignmentName: string, reportId: string, machineName: string, options?: GuestConfigurationHcrpAssignmentReportsGetOptionalParams): Promise; + list(resourceGroupName: string, guestConfigurationAssignmentName: string, machineName: string, options?: GuestConfigurationHcrpAssignmentReportsListOptionalParams): Promise; +} + +// @public +export interface GuestConfigurationHcrpAssignmentReportsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type GuestConfigurationHcrpAssignmentReportsGetResponse = GuestConfigurationAssignmentReport; + +// @public +export interface GuestConfigurationHcrpAssignmentReportsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type GuestConfigurationHcrpAssignmentReportsListResponse = GuestConfigurationAssignmentReportList; + +// @public +export interface GuestConfigurationHcrpAssignments { + createOrUpdate(guestConfigurationAssignmentName: string, resourceGroupName: string, machineName: string, parameters: GuestConfigurationAssignment, options?: GuestConfigurationHcrpAssignmentsCreateOrUpdateOptionalParams): Promise; + delete(resourceGroupName: string, guestConfigurationAssignmentName: string, machineName: string, options?: GuestConfigurationHcrpAssignmentsDeleteOptionalParams): Promise; + get(resourceGroupName: string, guestConfigurationAssignmentName: string, machineName: string, options?: GuestConfigurationHcrpAssignmentsGetOptionalParams): Promise; + list(resourceGroupName: string, machineName: string, options?: GuestConfigurationHcrpAssignmentsListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface GuestConfigurationHcrpAssignmentsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type GuestConfigurationHcrpAssignmentsCreateOrUpdateResponse = GuestConfigurationAssignment; + +// @public +export interface GuestConfigurationHcrpAssignmentsDeleteOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface GuestConfigurationHcrpAssignmentsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type GuestConfigurationHcrpAssignmentsGetResponse = GuestConfigurationAssignment; + +// @public +export interface GuestConfigurationHcrpAssignmentsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type GuestConfigurationHcrpAssignmentsListResponse = GuestConfigurationAssignmentList; + +// @public +export interface GuestConfigurationNavigation { + readonly assignmentSource?: string; + assignmentType?: AssignmentType; + configurationParameter?: ConfigurationParameter[]; + configurationProtectedParameter?: ConfigurationParameter[]; + readonly configurationSetting?: ConfigurationSetting; + contentHash?: string; + readonly contentType?: string; + contentUri?: string; + kind?: Kind; + name?: string; + version?: string; +} + +// @public +export type Kind = string; + +// @public +export enum KnownActionAfterReboot { + ContinueConfiguration = "ContinueConfiguration", + StopConfiguration = "StopConfiguration" +} + +// @public +export enum KnownAssignmentType { + ApplyAndAutoCorrect = "ApplyAndAutoCorrect", + ApplyAndMonitor = "ApplyAndMonitor", + Audit = "Audit", + DeployAndAutoCorrect = "DeployAndAutoCorrect" +} + +// @public +export enum KnownComplianceStatus { + Compliant = "Compliant", + NonCompliant = "NonCompliant", + Pending = "Pending" +} + +// @public +export enum KnownConfigurationMode { + ApplyAndAutoCorrect = "ApplyAndAutoCorrect", + ApplyAndMonitor = "ApplyAndMonitor", + ApplyOnly = "ApplyOnly" +} + +// @public +export enum KnownCreatedByType { + Application = "Application", + Key = "Key", + ManagedIdentity = "ManagedIdentity", + User = "User" +} + +// @public +export enum KnownKind { + DSC = "DSC" +} + +// @public +export enum KnownProvisioningState { + Canceled = "Canceled", + Created = "Created", + Failed = "Failed", + Succeeded = "Succeeded" +} + +// @public +export enum KnownType { + Consistency = "Consistency", + Initial = "Initial" +} + +// @public +export interface Operation { + display?: OperationDisplay; + name?: string; + properties?: OperationProperties; +} + +// @public +export interface OperationDisplay { + description?: string; + operation?: string; + provider?: string; + resource?: string; +} + +// @public +export interface OperationList { + value?: Operation[]; +} + +// @public +export interface OperationProperties { + statusCode?: string; +} + +// @public +export interface Operations { + list(options?: OperationsListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface OperationsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type OperationsListResponse = OperationList; + +// @public +export type ProvisioningState = string; + +// @public +export interface ProxyResource extends Resource { +} + +// @public +export interface Resource { + readonly id?: string; + location?: string; + name?: string; + readonly type?: string; +} + +// @public +export interface SystemData { + createdAt?: Date; + createdBy?: string; + createdByType?: CreatedByType; + lastModifiedAt?: Date; + lastModifiedBy?: string; + lastModifiedByType?: CreatedByType; +} + +// @public +export type Type = string; + +// @public +export interface VMInfo { + readonly id?: string; + readonly uuid?: string; +} + +// @public +export interface VmssvmInfo { + readonly complianceStatus?: ComplianceStatus; + readonly lastComplianceChecked?: Date; + readonly latestReportId?: string; + readonly vmId?: string; + readonly vmResourceId?: string; +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/guestconfiguration/arm-guestconfiguration/sample.env b/sdk/guestconfiguration/arm-guestconfiguration/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/sample.env @@ -0,0 +1,4 @@ +# App registration secret for AAD authentication +AZURE_CLIENT_SECRET= +AZURE_CLIENT_ID= +AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationAssignmentReportsGetSample.ts b/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationAssignmentReportsGetSample.ts new file mode 100644 index 000000000000..e8787a276298 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationAssignmentReportsGetSample.ts @@ -0,0 +1,46 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { GuestConfigurationClient } from "@azure/arm-guestconfiguration"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get a report for the guest configuration assignment, by reportId. + * + * @summary Get a report for the guest configuration assignment, by reportId. + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getGuestConfigurationAssignmentReportById.json + */ +async function getAGuestConfigurationAssignmentReportByIdForAVirtualMachine() { + const subscriptionId = + process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionid"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const guestConfigurationAssignmentName = "AuditSecureProtocol"; + const reportId = "7367cbb8-ae99-47d0-a33b-a283564d2cb1"; + const vmName = "myvm"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const result = await client.guestConfigurationAssignmentReports.get( + resourceGroupName, + guestConfigurationAssignmentName, + reportId, + vmName, + ); + console.log(result); +} + +async function main() { + getAGuestConfigurationAssignmentReportByIdForAVirtualMachine(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationAssignmentReportsListSample.ts b/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationAssignmentReportsListSample.ts new file mode 100644 index 000000000000..0a8c31a57bfc --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationAssignmentReportsListSample.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { GuestConfigurationClient } from "@azure/arm-guestconfiguration"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to List all reports for the guest configuration assignment, latest report first. + * + * @summary List all reports for the guest configuration assignment, latest report first. + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listAllGuestConfigurationAssignmentReports.json + */ +async function listAllGuestConfigurationAssignmentsForAVirtualMachine() { + const subscriptionId = + process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionid"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const guestConfigurationAssignmentName = "AuditSecureProtocol"; + const vmName = "myVMName"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const result = await client.guestConfigurationAssignmentReports.list( + resourceGroupName, + guestConfigurationAssignmentName, + vmName, + ); + console.log(result); +} + +async function main() { + listAllGuestConfigurationAssignmentsForAVirtualMachine(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationAssignmentReportsVmssGetSample.ts b/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationAssignmentReportsVmssGetSample.ts new file mode 100644 index 000000000000..d4d7ef647401 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationAssignmentReportsVmssGetSample.ts @@ -0,0 +1,46 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { GuestConfigurationClient } from "@azure/arm-guestconfiguration"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get a report for the VMSS guest configuration assignment, by reportId. + * + * @summary Get a report for the VMSS guest configuration assignment, by reportId. + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getVMSSGuestConfigurationAssignmentReportById.json + */ +async function getAGuestConfigurationAssignmentReportByIdForAVirtualMachineScaleSet() { + const subscriptionId = + process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionid"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const vmssName = "myvmss"; + const name = "AuditSecureProtocol"; + const id = "7367cbb8-ae99-47d0-a33b-a283564d2cb1"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const result = await client.guestConfigurationAssignmentReportsVmss.get( + resourceGroupName, + vmssName, + name, + id, + ); + console.log(result); +} + +async function main() { + getAGuestConfigurationAssignmentReportByIdForAVirtualMachineScaleSet(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationAssignmentReportsVmssListSample.ts b/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationAssignmentReportsVmssListSample.ts new file mode 100644 index 000000000000..eac2f6c8fd23 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationAssignmentReportsVmssListSample.ts @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { GuestConfigurationClient } from "@azure/arm-guestconfiguration"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to List all reports for the VMSS guest configuration assignment, latest report first. + * + * @summary List all reports for the VMSS guest configuration assignment, latest report first. + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listAllVMSSGuestConfigurationAssignmentReports.json + */ +async function listAllReportsForTheVmssGuestConfigurationAssignmentWithLatestReportFirst() { + const subscriptionId = + process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionid"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const vmssName = "myVMSSName"; + const name = "AuditSecureProtocol"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.guestConfigurationAssignmentReportsVmss.list( + resourceGroupName, + vmssName, + name, + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAllReportsForTheVmssGuestConfigurationAssignmentWithLatestReportFirst(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationAssignmentsCreateOrUpdateSample.ts b/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationAssignmentsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..f1ae2b3e3dab --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationAssignmentsCreateOrUpdateSample.ts @@ -0,0 +1,68 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + GuestConfigurationAssignment, + GuestConfigurationClient, +} from "@azure/arm-guestconfiguration"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates an association between a VM and guest configuration + * + * @summary Creates an association between a VM and guest configuration + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/createOrUpdateGuestConfigurationAssignment.json + */ +async function createOrUpdateGuestConfigurationAssignment() { + const subscriptionId = + process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionId"; + const guestConfigurationAssignmentName = "NotInstalledApplicationForWindows"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const vmName = "myVMName"; + const parameters: GuestConfigurationAssignment = { + name: "NotInstalledApplicationForWindows", + location: "westcentralus", + properties: { + context: "Azure policy", + guestConfiguration: { + name: "NotInstalledApplicationForWindows", + assignmentType: "ApplyAndAutoCorrect", + configurationParameter: [ + { + name: "[InstalledApplication]NotInstalledApplicationResource1;Name", + value: "NotePad,sql", + }, + ], + contentHash: "123contenthash", + contentUri: "https://thisisfake/pacakge", + version: "1.0.0.3", + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const result = await client.guestConfigurationAssignments.createOrUpdate( + guestConfigurationAssignmentName, + resourceGroupName, + vmName, + parameters, + ); + console.log(result); +} + +async function main() { + createOrUpdateGuestConfigurationAssignment(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationAssignmentsDeleteSample.ts b/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationAssignmentsDeleteSample.ts new file mode 100644 index 000000000000..3d3c509ce915 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationAssignmentsDeleteSample.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { GuestConfigurationClient } from "@azure/arm-guestconfiguration"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Delete a guest configuration assignment + * + * @summary Delete a guest configuration assignment + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/deleteGuestConfigurationAssignment.json + */ +async function deleteAnGuestConfigurationAssignment() { + const subscriptionId = + process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionId"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const guestConfigurationAssignmentName = "SecureProtocol"; + const vmName = "myVMName"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const result = await client.guestConfigurationAssignments.delete( + resourceGroupName, + guestConfigurationAssignmentName, + vmName, + ); + console.log(result); +} + +async function main() { + deleteAnGuestConfigurationAssignment(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationAssignmentsGetSample.ts b/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationAssignmentsGetSample.ts new file mode 100644 index 000000000000..5d43e43e6407 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationAssignmentsGetSample.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { GuestConfigurationClient } from "@azure/arm-guestconfiguration"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get information about a guest configuration assignment + * + * @summary Get information about a guest configuration assignment + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getGuestConfigurationAssignment.json + */ +async function getAGuestConfigurationAssignment() { + const subscriptionId = + process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionId"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const guestConfigurationAssignmentName = "SecureProtocol"; + const vmName = "myVMName"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const result = await client.guestConfigurationAssignments.get( + resourceGroupName, + guestConfigurationAssignmentName, + vmName, + ); + console.log(result); +} + +async function main() { + getAGuestConfigurationAssignment(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationAssignmentsListSample.ts b/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationAssignmentsListSample.ts new file mode 100644 index 000000000000..8e9582329f7e --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationAssignmentsListSample.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { GuestConfigurationClient } from "@azure/arm-guestconfiguration"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to List all guest configuration assignments for a virtual machine. + * + * @summary List all guest configuration assignments for a virtual machine. + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listGuestConfigurationAssignments.json + */ +async function listAllGuestConfigurationAssignmentsForAVirtualMachine() { + const subscriptionId = + process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionId"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const vmName = "myVMName"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.guestConfigurationAssignments.list( + resourceGroupName, + vmName, + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAllGuestConfigurationAssignmentsForAVirtualMachine(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationAssignmentsRgListSample.ts b/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationAssignmentsRgListSample.ts new file mode 100644 index 000000000000..251b35a9a2ae --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationAssignmentsRgListSample.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { GuestConfigurationClient } from "@azure/arm-guestconfiguration"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to List all guest configuration assignments for a resource group. + * + * @summary List all guest configuration assignments for a resource group. + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listRGGuestConfigurationAssignments.json + */ +async function listAllGuestConfigurationAssignmentsForAResourceGroup() { + const subscriptionId = + process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionId"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.guestConfigurationAssignments.listRGList( + resourceGroupName, + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAllGuestConfigurationAssignmentsForAResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationAssignmentsSubscriptionListSample.ts b/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationAssignmentsSubscriptionListSample.ts new file mode 100644 index 000000000000..79a84720651d --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationAssignmentsSubscriptionListSample.ts @@ -0,0 +1,39 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { GuestConfigurationClient } from "@azure/arm-guestconfiguration"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to List all guest configuration assignments for a subscription. + * + * @summary List all guest configuration assignments for a subscription. + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listSubGuestConfigurationAssignments.json + */ +async function listAllGuestConfigurationAssignmentsForASubscription() { + const subscriptionId = + process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionId"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.guestConfigurationAssignments.listSubscriptionList()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAllGuestConfigurationAssignmentsForASubscription(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationAssignmentsVmssCreateOrUpdateSample.ts b/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationAssignmentsVmssCreateOrUpdateSample.ts new file mode 100644 index 000000000000..21b62b893959 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationAssignmentsVmssCreateOrUpdateSample.ts @@ -0,0 +1,68 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + GuestConfigurationAssignment, + GuestConfigurationClient, +} from "@azure/arm-guestconfiguration"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates an association between a VMSS and guest configuration + * + * @summary Creates an association between a VMSS and guest configuration + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/createOrUpdateGuestConfigurationVMSSAssignment.json + */ +async function createOrUpdateGuestConfigurationAssignment() { + const subscriptionId = + process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionId"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const vmssName = "myVMSSName"; + const name = "NotInstalledApplicationForWindows"; + const parameters: GuestConfigurationAssignment = { + name: "NotInstalledApplicationForWindows", + location: "westcentralus", + properties: { + context: "Azure policy", + guestConfiguration: { + name: "NotInstalledApplicationForWindows", + assignmentType: "ApplyAndAutoCorrect", + configurationParameter: [ + { + name: "[InstalledApplication]NotInstalledApplicationResource1;Name", + value: "NotePad,sql", + }, + ], + contentHash: "123contenthash", + contentUri: "https://thisisfake/pacakge", + version: "1.0.0.3", + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const result = await client.guestConfigurationAssignmentsVmss.createOrUpdate( + resourceGroupName, + vmssName, + name, + parameters, + ); + console.log(result); +} + +async function main() { + createOrUpdateGuestConfigurationAssignment(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationAssignmentsVmssDeleteSample.ts b/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationAssignmentsVmssDeleteSample.ts new file mode 100644 index 000000000000..d32f52f49a2b --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationAssignmentsVmssDeleteSample.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { GuestConfigurationClient } from "@azure/arm-guestconfiguration"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Delete a guest configuration assignment for VMSS + * + * @summary Delete a guest configuration assignment for VMSS + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/deleteGuestConfigurationVMSSAssignment.json + */ +async function deleteAnGuestConfigurationAssignmentForVmss() { + const subscriptionId = + process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionId"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const vmssName = "myVMSSName"; + const name = "SecureProtocol"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const result = await client.guestConfigurationAssignmentsVmss.delete( + resourceGroupName, + vmssName, + name, + ); + console.log(result); +} + +async function main() { + deleteAnGuestConfigurationAssignmentForVmss(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationAssignmentsVmssGetSample.ts b/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationAssignmentsVmssGetSample.ts new file mode 100644 index 000000000000..a6a46413d195 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationAssignmentsVmssGetSample.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { GuestConfigurationClient } from "@azure/arm-guestconfiguration"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get information about a guest configuration assignment for VMSS + * + * @summary Get information about a guest configuration assignment for VMSS + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getVMSSGuestConfigurationAssignment.json + */ +async function getAVmssGuestConfigurationAssignment() { + const subscriptionId = + process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionId"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const vmssName = "myVMSSName"; + const name = "SecureProtocol"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const result = await client.guestConfigurationAssignmentsVmss.get( + resourceGroupName, + vmssName, + name, + ); + console.log(result); +} + +async function main() { + getAVmssGuestConfigurationAssignment(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationAssignmentsVmssListSample.ts b/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationAssignmentsVmssListSample.ts new file mode 100644 index 000000000000..758d6354b64a --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationAssignmentsVmssListSample.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { GuestConfigurationClient } from "@azure/arm-guestconfiguration"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to List all guest configuration assignments for VMSS. + * + * @summary List all guest configuration assignments for VMSS. + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listVMSSGuestConfigurationAssignments.json + */ +async function listAllGuestConfigurationAssignmentsForVmss() { + const subscriptionId = + process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionId"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const vmssName = "myVMSSName"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.guestConfigurationAssignmentsVmss.list( + resourceGroupName, + vmssName, + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAllGuestConfigurationAssignmentsForVmss(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationConnectedVMwarevSphereAssignmentsCreateOrUpdateSample.ts b/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationConnectedVMwarevSphereAssignmentsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..cb2c08c167cb --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationConnectedVMwarevSphereAssignmentsCreateOrUpdateSample.ts @@ -0,0 +1,69 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + GuestConfigurationAssignment, + GuestConfigurationClient, +} from "@azure/arm-guestconfiguration"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates an association between a Connected VM Sphere machine and guest configuration + * + * @summary Creates an association between a Connected VM Sphere machine and guest configuration + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/createOrUpdateGuestConfigurationConnectedVMwarevSphereAssignment.json + */ +async function createOrUpdateGuestConfigurationAssignment() { + const subscriptionId = + process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionId"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const vmName = "myVMName"; + const guestConfigurationAssignmentName = "NotInstalledApplicationForWindows"; + const parameters: GuestConfigurationAssignment = { + name: "NotInstalledApplicationForWindows", + location: "westcentralus", + properties: { + context: "Azure policy", + guestConfiguration: { + name: "NotInstalledApplicationForWindows", + assignmentType: "ApplyAndAutoCorrect", + configurationParameter: [ + { + name: "[InstalledApplication]NotInstalledApplicationResource1;Name", + value: "NotePad,sql", + }, + ], + contentHash: "123contenthash", + contentUri: "https://thisisfake/pacakge", + version: "1.0.0.0", + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const result = + await client.guestConfigurationConnectedVMwarevSphereAssignments.createOrUpdate( + resourceGroupName, + vmName, + guestConfigurationAssignmentName, + parameters, + ); + console.log(result); +} + +async function main() { + createOrUpdateGuestConfigurationAssignment(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationConnectedVMwarevSphereAssignmentsDeleteSample.ts b/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationConnectedVMwarevSphereAssignmentsDeleteSample.ts new file mode 100644 index 000000000000..73d6066465c2 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationConnectedVMwarevSphereAssignmentsDeleteSample.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { GuestConfigurationClient } from "@azure/arm-guestconfiguration"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Delete a guest configuration assignment + * + * @summary Delete a guest configuration assignment + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/deleteGuestConfigurationConnectedVMwarevSphereAssignment.json + */ +async function deleteAnGuestConfigurationAssignment() { + const subscriptionId = + process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionId"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const vmName = "myVMName"; + const guestConfigurationAssignmentName = "SecureProtocol"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const result = + await client.guestConfigurationConnectedVMwarevSphereAssignments.delete( + resourceGroupName, + vmName, + guestConfigurationAssignmentName, + ); + console.log(result); +} + +async function main() { + deleteAnGuestConfigurationAssignment(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationConnectedVMwarevSphereAssignmentsGetSample.ts b/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationConnectedVMwarevSphereAssignmentsGetSample.ts new file mode 100644 index 000000000000..bf8cb76a42f6 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationConnectedVMwarevSphereAssignmentsGetSample.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { GuestConfigurationClient } from "@azure/arm-guestconfiguration"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get information about a guest configuration assignment + * + * @summary Get information about a guest configuration assignment + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getGuestConfigurationConnectedVMwarevSphereAssignment.json + */ +async function getAGuestConfigurationAssignment() { + const subscriptionId = + process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionId"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const vmName = "myVMName"; + const guestConfigurationAssignmentName = "SecureProtocol"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const result = + await client.guestConfigurationConnectedVMwarevSphereAssignments.get( + resourceGroupName, + vmName, + guestConfigurationAssignmentName, + ); + console.log(result); +} + +async function main() { + getAGuestConfigurationAssignment(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationConnectedVMwarevSphereAssignmentsListSample.ts b/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationConnectedVMwarevSphereAssignmentsListSample.ts new file mode 100644 index 000000000000..be1a7258f033 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationConnectedVMwarevSphereAssignmentsListSample.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { GuestConfigurationClient } from "@azure/arm-guestconfiguration"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to List all guest configuration assignments for an ARC machine. + * + * @summary List all guest configuration assignments for an ARC machine. + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listGuestConfigurationConnectedVMwarevSphereAssignments.json + */ +async function listAllGuestConfigurationAssignmentsForAVirtualMachine() { + const subscriptionId = + process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionId"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const vmName = "myVMName"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.guestConfigurationConnectedVMwarevSphereAssignments.list( + resourceGroupName, + vmName, + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAllGuestConfigurationAssignmentsForAVirtualMachine(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationConnectedVMwarevSphereAssignmentsReportsGetSample.ts b/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationConnectedVMwarevSphereAssignmentsReportsGetSample.ts new file mode 100644 index 000000000000..a25fb4720209 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationConnectedVMwarevSphereAssignmentsReportsGetSample.ts @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { GuestConfigurationClient } from "@azure/arm-guestconfiguration"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get a report for the guest configuration assignment, by reportId. + * + * @summary Get a report for the guest configuration assignment, by reportId. + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getGuestConfigurationConnectedVMwarevSphereAssignmentReportById.json + */ +async function getAGuestConfigurationAssignmentReportByIdForAVirtualMachine() { + const subscriptionId = + process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionid"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const vmName = "myvm"; + const guestConfigurationAssignmentName = "AuditSecureProtocol"; + const reportId = "7367cbb8-ae99-47d0-a33b-a283564d2cb1"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const result = + await client.guestConfigurationConnectedVMwarevSphereAssignmentsReports.get( + resourceGroupName, + vmName, + guestConfigurationAssignmentName, + reportId, + ); + console.log(result); +} + +async function main() { + getAGuestConfigurationAssignmentReportByIdForAVirtualMachine(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationConnectedVMwarevSphereAssignmentsReportsListSample.ts b/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationConnectedVMwarevSphereAssignmentsReportsListSample.ts new file mode 100644 index 000000000000..16b0e4e082b7 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationConnectedVMwarevSphereAssignmentsReportsListSample.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { GuestConfigurationClient } from "@azure/arm-guestconfiguration"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to List all reports for the guest configuration assignment, latest report first. + * + * @summary List all reports for the guest configuration assignment, latest report first. + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listAllGuestConfigurationConnectedVMwarevSphereAssignmentsReports.json + */ +async function listAllGuestConfigurationAssignmentsForAVirtualMachine() { + const subscriptionId = + process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionid"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const vmName = "myVMName"; + const guestConfigurationAssignmentName = "AuditSecureProtocol"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const result = + await client.guestConfigurationConnectedVMwarevSphereAssignmentsReports.list( + resourceGroupName, + vmName, + guestConfigurationAssignmentName, + ); + console.log(result); +} + +async function main() { + listAllGuestConfigurationAssignmentsForAVirtualMachine(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationHcrpAssignmentReportsGetSample.ts b/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationHcrpAssignmentReportsGetSample.ts new file mode 100644 index 000000000000..508aaf983396 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationHcrpAssignmentReportsGetSample.ts @@ -0,0 +1,46 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { GuestConfigurationClient } from "@azure/arm-guestconfiguration"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get a report for the guest configuration assignment, by reportId. + * + * @summary Get a report for the guest configuration assignment, by reportId. + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getGuestConfigurationHCRPAssignmentReportById.json + */ +async function getAGuestConfigurationAssignmentReportByIdForAVirtualMachine() { + const subscriptionId = + process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionid"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const guestConfigurationAssignmentName = "AuditSecureProtocol"; + const reportId = "7367cbb8-ae99-47d0-a33b-a283564d2cb1"; + const machineName = "myMachineName"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const result = await client.guestConfigurationHcrpAssignmentReports.get( + resourceGroupName, + guestConfigurationAssignmentName, + reportId, + machineName, + ); + console.log(result); +} + +async function main() { + getAGuestConfigurationAssignmentReportByIdForAVirtualMachine(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationHcrpAssignmentReportsListSample.ts b/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationHcrpAssignmentReportsListSample.ts new file mode 100644 index 000000000000..7c5b7f1b7e01 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationHcrpAssignmentReportsListSample.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { GuestConfigurationClient } from "@azure/arm-guestconfiguration"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to List all reports for the guest configuration assignment, latest report first. + * + * @summary List all reports for the guest configuration assignment, latest report first. + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listAllGuestConfigurationHCRPAssignmentReports.json + */ +async function listAllGuestConfigurationAssignmentsForAVirtualMachine() { + const subscriptionId = + process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionid"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const guestConfigurationAssignmentName = "AuditSecureProtocol"; + const machineName = "myMachineName"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const result = await client.guestConfigurationHcrpAssignmentReports.list( + resourceGroupName, + guestConfigurationAssignmentName, + machineName, + ); + console.log(result); +} + +async function main() { + listAllGuestConfigurationAssignmentsForAVirtualMachine(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationHcrpAssignmentsCreateOrUpdateSample.ts b/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationHcrpAssignmentsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..24502d922c2e --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationHcrpAssignmentsCreateOrUpdateSample.ts @@ -0,0 +1,68 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + GuestConfigurationAssignment, + GuestConfigurationClient, +} from "@azure/arm-guestconfiguration"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates an association between a ARC machine and guest configuration + * + * @summary Creates an association between a ARC machine and guest configuration + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/createOrUpdateGuestConfigurationHCRPAssignment.json + */ +async function createOrUpdateGuestConfigurationAssignment() { + const subscriptionId = + process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionId"; + const guestConfigurationAssignmentName = "NotInstalledApplicationForWindows"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const machineName = "myMachineName"; + const parameters: GuestConfigurationAssignment = { + name: "NotInstalledApplicationForWindows", + location: "westcentralus", + properties: { + context: "Azure policy", + guestConfiguration: { + name: "NotInstalledApplicationForWindows", + assignmentType: "ApplyAndAutoCorrect", + configurationParameter: [ + { + name: "[InstalledApplication]NotInstalledApplicationResource1;Name", + value: "NotePad,sql", + }, + ], + contentHash: "123contenthash", + contentUri: "https://thisisfake/pacakge", + version: "1.0.0.3", + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const result = await client.guestConfigurationHcrpAssignments.createOrUpdate( + guestConfigurationAssignmentName, + resourceGroupName, + machineName, + parameters, + ); + console.log(result); +} + +async function main() { + createOrUpdateGuestConfigurationAssignment(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationHcrpAssignmentsDeleteSample.ts b/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationHcrpAssignmentsDeleteSample.ts new file mode 100644 index 000000000000..ff28a663a6c4 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationHcrpAssignmentsDeleteSample.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { GuestConfigurationClient } from "@azure/arm-guestconfiguration"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Delete a guest configuration assignment + * + * @summary Delete a guest configuration assignment + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/deleteGuestConfigurationHCRPAssignment.json + */ +async function deleteAnGuestConfigurationAssignment() { + const subscriptionId = + process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionId"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const guestConfigurationAssignmentName = "SecureProtocol"; + const machineName = "myMachineName"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const result = await client.guestConfigurationHcrpAssignments.delete( + resourceGroupName, + guestConfigurationAssignmentName, + machineName, + ); + console.log(result); +} + +async function main() { + deleteAnGuestConfigurationAssignment(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationHcrpAssignmentsGetSample.ts b/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationHcrpAssignmentsGetSample.ts new file mode 100644 index 000000000000..8fc4f0a461a1 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationHcrpAssignmentsGetSample.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { GuestConfigurationClient } from "@azure/arm-guestconfiguration"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get information about a guest configuration assignment + * + * @summary Get information about a guest configuration assignment + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getGuestConfigurationHCRPAssignment.json + */ +async function getAGuestConfigurationAssignment() { + const subscriptionId = + process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionId"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const guestConfigurationAssignmentName = "SecureProtocol"; + const machineName = "myMachineName"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const result = await client.guestConfigurationHcrpAssignments.get( + resourceGroupName, + guestConfigurationAssignmentName, + machineName, + ); + console.log(result); +} + +async function main() { + getAGuestConfigurationAssignment(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationHcrpAssignmentsListSample.ts b/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationHcrpAssignmentsListSample.ts new file mode 100644 index 000000000000..cdeacd1baab5 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/guestConfigurationHcrpAssignmentsListSample.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { GuestConfigurationClient } from "@azure/arm-guestconfiguration"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to List all guest configuration assignments for an ARC machine. + * + * @summary List all guest configuration assignments for an ARC machine. + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listGuestConfigurationHCRPAssignments.json + */ +async function listAllGuestConfigurationAssignmentsForAVirtualMachine() { + const subscriptionId = + process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionId"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const machineName = "myMachineName"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.guestConfigurationHcrpAssignments.list( + resourceGroupName, + machineName, + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAllGuestConfigurationAssignmentsForAVirtualMachine(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/operationsListSample.ts b/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/operationsListSample.ts new file mode 100644 index 000000000000..c7fd9e0dbd2f --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples-dev/operationsListSample.ts @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { GuestConfigurationClient } from "@azure/arm-guestconfiguration"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists all of the available GuestConfiguration REST API operations. + * + * @summary Lists all of the available GuestConfiguration REST API operations. + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listOperations.json + */ +async function listsAllOfTheAvailableGuestConfigurationRestApiOperations() { + const subscriptionId = + process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listsAllOfTheAvailableGuestConfigurationRestApiOperations(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/README.md b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/README.md new file mode 100644 index 000000000000..30b40a2c20dd --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/README.md @@ -0,0 +1,102 @@ +# client library samples for JavaScript (Beta) + +These sample programs show how to use the JavaScript client libraries for in some common scenarios. + +| **File Name** | **Description** | +| ----------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [guestConfigurationAssignmentReportsGetSample.js][guestconfigurationassignmentreportsgetsample] | Get a report for the guest configuration assignment, by reportId. x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getGuestConfigurationAssignmentReportById.json | +| [guestConfigurationAssignmentReportsListSample.js][guestconfigurationassignmentreportslistsample] | List all reports for the guest configuration assignment, latest report first. x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listAllGuestConfigurationAssignmentReports.json | +| [guestConfigurationAssignmentReportsVmssGetSample.js][guestconfigurationassignmentreportsvmssgetsample] | Get a report for the VMSS guest configuration assignment, by reportId. x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getVMSSGuestConfigurationAssignmentReportById.json | +| [guestConfigurationAssignmentReportsVmssListSample.js][guestconfigurationassignmentreportsvmsslistsample] | List all reports for the VMSS guest configuration assignment, latest report first. x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listAllVMSSGuestConfigurationAssignmentReports.json | +| [guestConfigurationAssignmentsCreateOrUpdateSample.js][guestconfigurationassignmentscreateorupdatesample] | Creates an association between a VM and guest configuration x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/createOrUpdateGuestConfigurationAssignment.json | +| [guestConfigurationAssignmentsDeleteSample.js][guestconfigurationassignmentsdeletesample] | Delete a guest configuration assignment x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/deleteGuestConfigurationAssignment.json | +| [guestConfigurationAssignmentsGetSample.js][guestconfigurationassignmentsgetsample] | Get information about a guest configuration assignment x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getGuestConfigurationAssignment.json | +| [guestConfigurationAssignmentsListSample.js][guestconfigurationassignmentslistsample] | List all guest configuration assignments for a virtual machine. x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listGuestConfigurationAssignments.json | +| [guestConfigurationAssignmentsRgListSample.js][guestconfigurationassignmentsrglistsample] | List all guest configuration assignments for a resource group. x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listRGGuestConfigurationAssignments.json | +| [guestConfigurationAssignmentsSubscriptionListSample.js][guestconfigurationassignmentssubscriptionlistsample] | List all guest configuration assignments for a subscription. x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listSubGuestConfigurationAssignments.json | +| [guestConfigurationAssignmentsVmssCreateOrUpdateSample.js][guestconfigurationassignmentsvmsscreateorupdatesample] | Creates an association between a VMSS and guest configuration x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/createOrUpdateGuestConfigurationVMSSAssignment.json | +| [guestConfigurationAssignmentsVmssDeleteSample.js][guestconfigurationassignmentsvmssdeletesample] | Delete a guest configuration assignment for VMSS x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/deleteGuestConfigurationVMSSAssignment.json | +| [guestConfigurationAssignmentsVmssGetSample.js][guestconfigurationassignmentsvmssgetsample] | Get information about a guest configuration assignment for VMSS x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getVMSSGuestConfigurationAssignment.json | +| [guestConfigurationAssignmentsVmssListSample.js][guestconfigurationassignmentsvmsslistsample] | List all guest configuration assignments for VMSS. x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listVMSSGuestConfigurationAssignments.json | +| [guestConfigurationConnectedVMwarevSphereAssignmentsCreateOrUpdateSample.js][guestconfigurationconnectedvmwarevsphereassignmentscreateorupdatesample] | Creates an association between a Connected VM Sphere machine and guest configuration x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/createOrUpdateGuestConfigurationConnectedVMwarevSphereAssignment.json | +| [guestConfigurationConnectedVMwarevSphereAssignmentsDeleteSample.js][guestconfigurationconnectedvmwarevsphereassignmentsdeletesample] | Delete a guest configuration assignment x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/deleteGuestConfigurationConnectedVMwarevSphereAssignment.json | +| [guestConfigurationConnectedVMwarevSphereAssignmentsGetSample.js][guestconfigurationconnectedvmwarevsphereassignmentsgetsample] | Get information about a guest configuration assignment x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getGuestConfigurationConnectedVMwarevSphereAssignment.json | +| [guestConfigurationConnectedVMwarevSphereAssignmentsListSample.js][guestconfigurationconnectedvmwarevsphereassignmentslistsample] | List all guest configuration assignments for an ARC machine. x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listGuestConfigurationConnectedVMwarevSphereAssignments.json | +| [guestConfigurationConnectedVMwarevSphereAssignmentsReportsGetSample.js][guestconfigurationconnectedvmwarevsphereassignmentsreportsgetsample] | Get a report for the guest configuration assignment, by reportId. x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getGuestConfigurationConnectedVMwarevSphereAssignmentReportById.json | +| [guestConfigurationConnectedVMwarevSphereAssignmentsReportsListSample.js][guestconfigurationconnectedvmwarevsphereassignmentsreportslistsample] | List all reports for the guest configuration assignment, latest report first. x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listAllGuestConfigurationConnectedVMwarevSphereAssignmentsReports.json | +| [guestConfigurationHcrpAssignmentReportsGetSample.js][guestconfigurationhcrpassignmentreportsgetsample] | Get a report for the guest configuration assignment, by reportId. x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getGuestConfigurationHCRPAssignmentReportById.json | +| [guestConfigurationHcrpAssignmentReportsListSample.js][guestconfigurationhcrpassignmentreportslistsample] | List all reports for the guest configuration assignment, latest report first. x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listAllGuestConfigurationHCRPAssignmentReports.json | +| [guestConfigurationHcrpAssignmentsCreateOrUpdateSample.js][guestconfigurationhcrpassignmentscreateorupdatesample] | Creates an association between a ARC machine and guest configuration x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/createOrUpdateGuestConfigurationHCRPAssignment.json | +| [guestConfigurationHcrpAssignmentsDeleteSample.js][guestconfigurationhcrpassignmentsdeletesample] | Delete a guest configuration assignment x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/deleteGuestConfigurationHCRPAssignment.json | +| [guestConfigurationHcrpAssignmentsGetSample.js][guestconfigurationhcrpassignmentsgetsample] | Get information about a guest configuration assignment x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getGuestConfigurationHCRPAssignment.json | +| [guestConfigurationHcrpAssignmentsListSample.js][guestconfigurationhcrpassignmentslistsample] | List all guest configuration assignments for an ARC machine. x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listGuestConfigurationHCRPAssignments.json | +| [operationsListSample.js][operationslistsample] | Lists all of the available GuestConfiguration REST API operations. x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listOperations.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 guestConfigurationAssignmentReportsGetSample.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 GUESTCONFIGURATION_SUBSCRIPTION_ID="" GUESTCONFIGURATION_RESOURCE_GROUP="" node guestConfigurationAssignmentReportsGetSample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[guestconfigurationassignmentreportsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationAssignmentReportsGetSample.js +[guestconfigurationassignmentreportslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationAssignmentReportsListSample.js +[guestconfigurationassignmentreportsvmssgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationAssignmentReportsVmssGetSample.js +[guestconfigurationassignmentreportsvmsslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationAssignmentReportsVmssListSample.js +[guestconfigurationassignmentscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationAssignmentsCreateOrUpdateSample.js +[guestconfigurationassignmentsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationAssignmentsDeleteSample.js +[guestconfigurationassignmentsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationAssignmentsGetSample.js +[guestconfigurationassignmentslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationAssignmentsListSample.js +[guestconfigurationassignmentsrglistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationAssignmentsRgListSample.js +[guestconfigurationassignmentssubscriptionlistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationAssignmentsSubscriptionListSample.js +[guestconfigurationassignmentsvmsscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationAssignmentsVmssCreateOrUpdateSample.js +[guestconfigurationassignmentsvmssdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationAssignmentsVmssDeleteSample.js +[guestconfigurationassignmentsvmssgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationAssignmentsVmssGetSample.js +[guestconfigurationassignmentsvmsslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationAssignmentsVmssListSample.js +[guestconfigurationconnectedvmwarevsphereassignmentscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationConnectedVMwarevSphereAssignmentsCreateOrUpdateSample.js +[guestconfigurationconnectedvmwarevsphereassignmentsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationConnectedVMwarevSphereAssignmentsDeleteSample.js +[guestconfigurationconnectedvmwarevsphereassignmentsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationConnectedVMwarevSphereAssignmentsGetSample.js +[guestconfigurationconnectedvmwarevsphereassignmentslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationConnectedVMwarevSphereAssignmentsListSample.js +[guestconfigurationconnectedvmwarevsphereassignmentsreportsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationConnectedVMwarevSphereAssignmentsReportsGetSample.js +[guestconfigurationconnectedvmwarevsphereassignmentsreportslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationConnectedVMwarevSphereAssignmentsReportsListSample.js +[guestconfigurationhcrpassignmentreportsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationHcrpAssignmentReportsGetSample.js +[guestconfigurationhcrpassignmentreportslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationHcrpAssignmentReportsListSample.js +[guestconfigurationhcrpassignmentscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationHcrpAssignmentsCreateOrUpdateSample.js +[guestconfigurationhcrpassignmentsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationHcrpAssignmentsDeleteSample.js +[guestconfigurationhcrpassignmentsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationHcrpAssignmentsGetSample.js +[guestconfigurationhcrpassignmentslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationHcrpAssignmentsListSample.js +[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/operationsListSample.js +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-guestconfiguration?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/guestconfiguration/arm-guestconfiguration/README.md diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationAssignmentReportsGetSample.js b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationAssignmentReportsGetSample.js new file mode 100644 index 000000000000..8974f3f78bb1 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationAssignmentReportsGetSample.js @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { GuestConfigurationClient } = require("@azure/arm-guestconfiguration"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get a report for the guest configuration assignment, by reportId. + * + * @summary Get a report for the guest configuration assignment, by reportId. + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getGuestConfigurationAssignmentReportById.json + */ +async function getAGuestConfigurationAssignmentReportByIdForAVirtualMachine() { + const subscriptionId = process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionid"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const guestConfigurationAssignmentName = "AuditSecureProtocol"; + const reportId = "7367cbb8-ae99-47d0-a33b-a283564d2cb1"; + const vmName = "myvm"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const result = await client.guestConfigurationAssignmentReports.get( + resourceGroupName, + guestConfigurationAssignmentName, + reportId, + vmName, + ); + console.log(result); +} + +async function main() { + getAGuestConfigurationAssignmentReportByIdForAVirtualMachine(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationAssignmentReportsListSample.js b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationAssignmentReportsListSample.js new file mode 100644 index 000000000000..482d3aa55c03 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationAssignmentReportsListSample.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { GuestConfigurationClient } = require("@azure/arm-guestconfiguration"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to List all reports for the guest configuration assignment, latest report first. + * + * @summary List all reports for the guest configuration assignment, latest report first. + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listAllGuestConfigurationAssignmentReports.json + */ +async function listAllGuestConfigurationAssignmentsForAVirtualMachine() { + const subscriptionId = process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionid"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const guestConfigurationAssignmentName = "AuditSecureProtocol"; + const vmName = "myVMName"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const result = await client.guestConfigurationAssignmentReports.list( + resourceGroupName, + guestConfigurationAssignmentName, + vmName, + ); + console.log(result); +} + +async function main() { + listAllGuestConfigurationAssignmentsForAVirtualMachine(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationAssignmentReportsVmssGetSample.js b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationAssignmentReportsVmssGetSample.js new file mode 100644 index 000000000000..aecae4f48fea --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationAssignmentReportsVmssGetSample.js @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { GuestConfigurationClient } = require("@azure/arm-guestconfiguration"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get a report for the VMSS guest configuration assignment, by reportId. + * + * @summary Get a report for the VMSS guest configuration assignment, by reportId. + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getVMSSGuestConfigurationAssignmentReportById.json + */ +async function getAGuestConfigurationAssignmentReportByIdForAVirtualMachineScaleSet() { + const subscriptionId = process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionid"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const vmssName = "myvmss"; + const name = "AuditSecureProtocol"; + const id = "7367cbb8-ae99-47d0-a33b-a283564d2cb1"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const result = await client.guestConfigurationAssignmentReportsVmss.get( + resourceGroupName, + vmssName, + name, + id, + ); + console.log(result); +} + +async function main() { + getAGuestConfigurationAssignmentReportByIdForAVirtualMachineScaleSet(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationAssignmentReportsVmssListSample.js b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationAssignmentReportsVmssListSample.js new file mode 100644 index 000000000000..e2239d5ea52e --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationAssignmentReportsVmssListSample.js @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { GuestConfigurationClient } = require("@azure/arm-guestconfiguration"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to List all reports for the VMSS guest configuration assignment, latest report first. + * + * @summary List all reports for the VMSS guest configuration assignment, latest report first. + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listAllVMSSGuestConfigurationAssignmentReports.json + */ +async function listAllReportsForTheVmssGuestConfigurationAssignmentWithLatestReportFirst() { + const subscriptionId = process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionid"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const vmssName = "myVMSSName"; + const name = "AuditSecureProtocol"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.guestConfigurationAssignmentReportsVmss.list( + resourceGroupName, + vmssName, + name, + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAllReportsForTheVmssGuestConfigurationAssignmentWithLatestReportFirst(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationAssignmentsCreateOrUpdateSample.js b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationAssignmentsCreateOrUpdateSample.js new file mode 100644 index 000000000000..b0d9698f6081 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationAssignmentsCreateOrUpdateSample.js @@ -0,0 +1,62 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { GuestConfigurationClient } = require("@azure/arm-guestconfiguration"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Creates an association between a VM and guest configuration + * + * @summary Creates an association between a VM and guest configuration + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/createOrUpdateGuestConfigurationAssignment.json + */ +async function createOrUpdateGuestConfigurationAssignment() { + const subscriptionId = process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionId"; + const guestConfigurationAssignmentName = "NotInstalledApplicationForWindows"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const vmName = "myVMName"; + const parameters = { + name: "NotInstalledApplicationForWindows", + location: "westcentralus", + properties: { + context: "Azure policy", + guestConfiguration: { + name: "NotInstalledApplicationForWindows", + assignmentType: "ApplyAndAutoCorrect", + configurationParameter: [ + { + name: "[InstalledApplication]NotInstalledApplicationResource1;Name", + value: "NotePad,sql", + }, + ], + contentHash: "123contenthash", + contentUri: "https://thisisfake/pacakge", + version: "1.0.0.3", + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const result = await client.guestConfigurationAssignments.createOrUpdate( + guestConfigurationAssignmentName, + resourceGroupName, + vmName, + parameters, + ); + console.log(result); +} + +async function main() { + createOrUpdateGuestConfigurationAssignment(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationAssignmentsDeleteSample.js b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationAssignmentsDeleteSample.js new file mode 100644 index 000000000000..cced14fd0f86 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationAssignmentsDeleteSample.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { GuestConfigurationClient } = require("@azure/arm-guestconfiguration"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Delete a guest configuration assignment + * + * @summary Delete a guest configuration assignment + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/deleteGuestConfigurationAssignment.json + */ +async function deleteAnGuestConfigurationAssignment() { + const subscriptionId = process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionId"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const guestConfigurationAssignmentName = "SecureProtocol"; + const vmName = "myVMName"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const result = await client.guestConfigurationAssignments.delete( + resourceGroupName, + guestConfigurationAssignmentName, + vmName, + ); + console.log(result); +} + +async function main() { + deleteAnGuestConfigurationAssignment(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationAssignmentsGetSample.js b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationAssignmentsGetSample.js new file mode 100644 index 000000000000..c9b083eee65e --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationAssignmentsGetSample.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { GuestConfigurationClient } = require("@azure/arm-guestconfiguration"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get information about a guest configuration assignment + * + * @summary Get information about a guest configuration assignment + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getGuestConfigurationAssignment.json + */ +async function getAGuestConfigurationAssignment() { + const subscriptionId = process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionId"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const guestConfigurationAssignmentName = "SecureProtocol"; + const vmName = "myVMName"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const result = await client.guestConfigurationAssignments.get( + resourceGroupName, + guestConfigurationAssignmentName, + vmName, + ); + console.log(result); +} + +async function main() { + getAGuestConfigurationAssignment(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationAssignmentsListSample.js b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationAssignmentsListSample.js new file mode 100644 index 000000000000..88f404e26e79 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationAssignmentsListSample.js @@ -0,0 +1,39 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { GuestConfigurationClient } = require("@azure/arm-guestconfiguration"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to List all guest configuration assignments for a virtual machine. + * + * @summary List all guest configuration assignments for a virtual machine. + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listGuestConfigurationAssignments.json + */ +async function listAllGuestConfigurationAssignmentsForAVirtualMachine() { + const subscriptionId = process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionId"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const vmName = "myVMName"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.guestConfigurationAssignments.list(resourceGroupName, vmName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAllGuestConfigurationAssignmentsForAVirtualMachine(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationAssignmentsRgListSample.js b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationAssignmentsRgListSample.js new file mode 100644 index 000000000000..169094434049 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationAssignmentsRgListSample.js @@ -0,0 +1,38 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { GuestConfigurationClient } = require("@azure/arm-guestconfiguration"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to List all guest configuration assignments for a resource group. + * + * @summary List all guest configuration assignments for a resource group. + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listRGGuestConfigurationAssignments.json + */ +async function listAllGuestConfigurationAssignmentsForAResourceGroup() { + const subscriptionId = process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionId"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.guestConfigurationAssignments.listRGList(resourceGroupName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAllGuestConfigurationAssignmentsForAResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationAssignmentsSubscriptionListSample.js b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationAssignmentsSubscriptionListSample.js new file mode 100644 index 000000000000..73b756dc9b50 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationAssignmentsSubscriptionListSample.js @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { GuestConfigurationClient } = require("@azure/arm-guestconfiguration"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to List all guest configuration assignments for a subscription. + * + * @summary List all guest configuration assignments for a subscription. + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listSubGuestConfigurationAssignments.json + */ +async function listAllGuestConfigurationAssignmentsForASubscription() { + const subscriptionId = process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionId"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.guestConfigurationAssignments.listSubscriptionList()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAllGuestConfigurationAssignmentsForASubscription(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationAssignmentsVmssCreateOrUpdateSample.js b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationAssignmentsVmssCreateOrUpdateSample.js new file mode 100644 index 000000000000..b667cbf2b682 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationAssignmentsVmssCreateOrUpdateSample.js @@ -0,0 +1,62 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { GuestConfigurationClient } = require("@azure/arm-guestconfiguration"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Creates an association between a VMSS and guest configuration + * + * @summary Creates an association between a VMSS and guest configuration + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/createOrUpdateGuestConfigurationVMSSAssignment.json + */ +async function createOrUpdateGuestConfigurationAssignment() { + const subscriptionId = process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionId"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const vmssName = "myVMSSName"; + const name = "NotInstalledApplicationForWindows"; + const parameters = { + name: "NotInstalledApplicationForWindows", + location: "westcentralus", + properties: { + context: "Azure policy", + guestConfiguration: { + name: "NotInstalledApplicationForWindows", + assignmentType: "ApplyAndAutoCorrect", + configurationParameter: [ + { + name: "[InstalledApplication]NotInstalledApplicationResource1;Name", + value: "NotePad,sql", + }, + ], + contentHash: "123contenthash", + contentUri: "https://thisisfake/pacakge", + version: "1.0.0.3", + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const result = await client.guestConfigurationAssignmentsVmss.createOrUpdate( + resourceGroupName, + vmssName, + name, + parameters, + ); + console.log(result); +} + +async function main() { + createOrUpdateGuestConfigurationAssignment(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationAssignmentsVmssDeleteSample.js b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationAssignmentsVmssDeleteSample.js new file mode 100644 index 000000000000..053969abdf3b --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationAssignmentsVmssDeleteSample.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { GuestConfigurationClient } = require("@azure/arm-guestconfiguration"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Delete a guest configuration assignment for VMSS + * + * @summary Delete a guest configuration assignment for VMSS + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/deleteGuestConfigurationVMSSAssignment.json + */ +async function deleteAnGuestConfigurationAssignmentForVmss() { + const subscriptionId = process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionId"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const vmssName = "myVMSSName"; + const name = "SecureProtocol"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const result = await client.guestConfigurationAssignmentsVmss.delete( + resourceGroupName, + vmssName, + name, + ); + console.log(result); +} + +async function main() { + deleteAnGuestConfigurationAssignmentForVmss(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationAssignmentsVmssGetSample.js b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationAssignmentsVmssGetSample.js new file mode 100644 index 000000000000..22591da4bc13 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationAssignmentsVmssGetSample.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { GuestConfigurationClient } = require("@azure/arm-guestconfiguration"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get information about a guest configuration assignment for VMSS + * + * @summary Get information about a guest configuration assignment for VMSS + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getVMSSGuestConfigurationAssignment.json + */ +async function getAVmssGuestConfigurationAssignment() { + const subscriptionId = process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionId"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const vmssName = "myVMSSName"; + const name = "SecureProtocol"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const result = await client.guestConfigurationAssignmentsVmss.get( + resourceGroupName, + vmssName, + name, + ); + console.log(result); +} + +async function main() { + getAVmssGuestConfigurationAssignment(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationAssignmentsVmssListSample.js b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationAssignmentsVmssListSample.js new file mode 100644 index 000000000000..c0566f38c69c --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationAssignmentsVmssListSample.js @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { GuestConfigurationClient } = require("@azure/arm-guestconfiguration"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to List all guest configuration assignments for VMSS. + * + * @summary List all guest configuration assignments for VMSS. + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listVMSSGuestConfigurationAssignments.json + */ +async function listAllGuestConfigurationAssignmentsForVmss() { + const subscriptionId = process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionId"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const vmssName = "myVMSSName"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.guestConfigurationAssignmentsVmss.list( + resourceGroupName, + vmssName, + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAllGuestConfigurationAssignmentsForVmss(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationConnectedVMwarevSphereAssignmentsCreateOrUpdateSample.js b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationConnectedVMwarevSphereAssignmentsCreateOrUpdateSample.js new file mode 100644 index 000000000000..624e9564409d --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationConnectedVMwarevSphereAssignmentsCreateOrUpdateSample.js @@ -0,0 +1,62 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { GuestConfigurationClient } = require("@azure/arm-guestconfiguration"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Creates an association between a Connected VM Sphere machine and guest configuration + * + * @summary Creates an association between a Connected VM Sphere machine and guest configuration + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/createOrUpdateGuestConfigurationConnectedVMwarevSphereAssignment.json + */ +async function createOrUpdateGuestConfigurationAssignment() { + const subscriptionId = process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionId"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const vmName = "myVMName"; + const guestConfigurationAssignmentName = "NotInstalledApplicationForWindows"; + const parameters = { + name: "NotInstalledApplicationForWindows", + location: "westcentralus", + properties: { + context: "Azure policy", + guestConfiguration: { + name: "NotInstalledApplicationForWindows", + assignmentType: "ApplyAndAutoCorrect", + configurationParameter: [ + { + name: "[InstalledApplication]NotInstalledApplicationResource1;Name", + value: "NotePad,sql", + }, + ], + contentHash: "123contenthash", + contentUri: "https://thisisfake/pacakge", + version: "1.0.0.0", + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const result = await client.guestConfigurationConnectedVMwarevSphereAssignments.createOrUpdate( + resourceGroupName, + vmName, + guestConfigurationAssignmentName, + parameters, + ); + console.log(result); +} + +async function main() { + createOrUpdateGuestConfigurationAssignment(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationConnectedVMwarevSphereAssignmentsDeleteSample.js b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationConnectedVMwarevSphereAssignmentsDeleteSample.js new file mode 100644 index 000000000000..718950a595ce --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationConnectedVMwarevSphereAssignmentsDeleteSample.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { GuestConfigurationClient } = require("@azure/arm-guestconfiguration"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Delete a guest configuration assignment + * + * @summary Delete a guest configuration assignment + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/deleteGuestConfigurationConnectedVMwarevSphereAssignment.json + */ +async function deleteAnGuestConfigurationAssignment() { + const subscriptionId = process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionId"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const vmName = "myVMName"; + const guestConfigurationAssignmentName = "SecureProtocol"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const result = await client.guestConfigurationConnectedVMwarevSphereAssignments.delete( + resourceGroupName, + vmName, + guestConfigurationAssignmentName, + ); + console.log(result); +} + +async function main() { + deleteAnGuestConfigurationAssignment(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationConnectedVMwarevSphereAssignmentsGetSample.js b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationConnectedVMwarevSphereAssignmentsGetSample.js new file mode 100644 index 000000000000..a181f688345a --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationConnectedVMwarevSphereAssignmentsGetSample.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { GuestConfigurationClient } = require("@azure/arm-guestconfiguration"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get information about a guest configuration assignment + * + * @summary Get information about a guest configuration assignment + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getGuestConfigurationConnectedVMwarevSphereAssignment.json + */ +async function getAGuestConfigurationAssignment() { + const subscriptionId = process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionId"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const vmName = "myVMName"; + const guestConfigurationAssignmentName = "SecureProtocol"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const result = await client.guestConfigurationConnectedVMwarevSphereAssignments.get( + resourceGroupName, + vmName, + guestConfigurationAssignmentName, + ); + console.log(result); +} + +async function main() { + getAGuestConfigurationAssignment(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationConnectedVMwarevSphereAssignmentsListSample.js b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationConnectedVMwarevSphereAssignmentsListSample.js new file mode 100644 index 000000000000..334f053d86bc --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationConnectedVMwarevSphereAssignmentsListSample.js @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { GuestConfigurationClient } = require("@azure/arm-guestconfiguration"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to List all guest configuration assignments for an ARC machine. + * + * @summary List all guest configuration assignments for an ARC machine. + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listGuestConfigurationConnectedVMwarevSphereAssignments.json + */ +async function listAllGuestConfigurationAssignmentsForAVirtualMachine() { + const subscriptionId = process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionId"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const vmName = "myVMName"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.guestConfigurationConnectedVMwarevSphereAssignments.list( + resourceGroupName, + vmName, + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAllGuestConfigurationAssignmentsForAVirtualMachine(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationConnectedVMwarevSphereAssignmentsReportsGetSample.js b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationConnectedVMwarevSphereAssignmentsReportsGetSample.js new file mode 100644 index 000000000000..45e4593b0f2b --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationConnectedVMwarevSphereAssignmentsReportsGetSample.js @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { GuestConfigurationClient } = require("@azure/arm-guestconfiguration"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get a report for the guest configuration assignment, by reportId. + * + * @summary Get a report for the guest configuration assignment, by reportId. + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getGuestConfigurationConnectedVMwarevSphereAssignmentReportById.json + */ +async function getAGuestConfigurationAssignmentReportByIdForAVirtualMachine() { + const subscriptionId = process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionid"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const vmName = "myvm"; + const guestConfigurationAssignmentName = "AuditSecureProtocol"; + const reportId = "7367cbb8-ae99-47d0-a33b-a283564d2cb1"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const result = await client.guestConfigurationConnectedVMwarevSphereAssignmentsReports.get( + resourceGroupName, + vmName, + guestConfigurationAssignmentName, + reportId, + ); + console.log(result); +} + +async function main() { + getAGuestConfigurationAssignmentReportByIdForAVirtualMachine(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationConnectedVMwarevSphereAssignmentsReportsListSample.js b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationConnectedVMwarevSphereAssignmentsReportsListSample.js new file mode 100644 index 000000000000..0fca681fd981 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationConnectedVMwarevSphereAssignmentsReportsListSample.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { GuestConfigurationClient } = require("@azure/arm-guestconfiguration"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to List all reports for the guest configuration assignment, latest report first. + * + * @summary List all reports for the guest configuration assignment, latest report first. + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listAllGuestConfigurationConnectedVMwarevSphereAssignmentsReports.json + */ +async function listAllGuestConfigurationAssignmentsForAVirtualMachine() { + const subscriptionId = process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionid"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const vmName = "myVMName"; + const guestConfigurationAssignmentName = "AuditSecureProtocol"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const result = await client.guestConfigurationConnectedVMwarevSphereAssignmentsReports.list( + resourceGroupName, + vmName, + guestConfigurationAssignmentName, + ); + console.log(result); +} + +async function main() { + listAllGuestConfigurationAssignmentsForAVirtualMachine(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationHcrpAssignmentReportsGetSample.js b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationHcrpAssignmentReportsGetSample.js new file mode 100644 index 000000000000..06f0909737cf --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationHcrpAssignmentReportsGetSample.js @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { GuestConfigurationClient } = require("@azure/arm-guestconfiguration"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get a report for the guest configuration assignment, by reportId. + * + * @summary Get a report for the guest configuration assignment, by reportId. + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getGuestConfigurationHCRPAssignmentReportById.json + */ +async function getAGuestConfigurationAssignmentReportByIdForAVirtualMachine() { + const subscriptionId = process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionid"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const guestConfigurationAssignmentName = "AuditSecureProtocol"; + const reportId = "7367cbb8-ae99-47d0-a33b-a283564d2cb1"; + const machineName = "myMachineName"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const result = await client.guestConfigurationHcrpAssignmentReports.get( + resourceGroupName, + guestConfigurationAssignmentName, + reportId, + machineName, + ); + console.log(result); +} + +async function main() { + getAGuestConfigurationAssignmentReportByIdForAVirtualMachine(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationHcrpAssignmentReportsListSample.js b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationHcrpAssignmentReportsListSample.js new file mode 100644 index 000000000000..15e28c73cacd --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationHcrpAssignmentReportsListSample.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { GuestConfigurationClient } = require("@azure/arm-guestconfiguration"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to List all reports for the guest configuration assignment, latest report first. + * + * @summary List all reports for the guest configuration assignment, latest report first. + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listAllGuestConfigurationHCRPAssignmentReports.json + */ +async function listAllGuestConfigurationAssignmentsForAVirtualMachine() { + const subscriptionId = process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionid"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const guestConfigurationAssignmentName = "AuditSecureProtocol"; + const machineName = "myMachineName"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const result = await client.guestConfigurationHcrpAssignmentReports.list( + resourceGroupName, + guestConfigurationAssignmentName, + machineName, + ); + console.log(result); +} + +async function main() { + listAllGuestConfigurationAssignmentsForAVirtualMachine(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationHcrpAssignmentsCreateOrUpdateSample.js b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationHcrpAssignmentsCreateOrUpdateSample.js new file mode 100644 index 000000000000..2118d8d556fb --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationHcrpAssignmentsCreateOrUpdateSample.js @@ -0,0 +1,62 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { GuestConfigurationClient } = require("@azure/arm-guestconfiguration"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Creates an association between a ARC machine and guest configuration + * + * @summary Creates an association between a ARC machine and guest configuration + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/createOrUpdateGuestConfigurationHCRPAssignment.json + */ +async function createOrUpdateGuestConfigurationAssignment() { + const subscriptionId = process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionId"; + const guestConfigurationAssignmentName = "NotInstalledApplicationForWindows"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const machineName = "myMachineName"; + const parameters = { + name: "NotInstalledApplicationForWindows", + location: "westcentralus", + properties: { + context: "Azure policy", + guestConfiguration: { + name: "NotInstalledApplicationForWindows", + assignmentType: "ApplyAndAutoCorrect", + configurationParameter: [ + { + name: "[InstalledApplication]NotInstalledApplicationResource1;Name", + value: "NotePad,sql", + }, + ], + contentHash: "123contenthash", + contentUri: "https://thisisfake/pacakge", + version: "1.0.0.3", + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const result = await client.guestConfigurationHcrpAssignments.createOrUpdate( + guestConfigurationAssignmentName, + resourceGroupName, + machineName, + parameters, + ); + console.log(result); +} + +async function main() { + createOrUpdateGuestConfigurationAssignment(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationHcrpAssignmentsDeleteSample.js b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationHcrpAssignmentsDeleteSample.js new file mode 100644 index 000000000000..632d3d51f659 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationHcrpAssignmentsDeleteSample.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { GuestConfigurationClient } = require("@azure/arm-guestconfiguration"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Delete a guest configuration assignment + * + * @summary Delete a guest configuration assignment + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/deleteGuestConfigurationHCRPAssignment.json + */ +async function deleteAnGuestConfigurationAssignment() { + const subscriptionId = process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionId"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const guestConfigurationAssignmentName = "SecureProtocol"; + const machineName = "myMachineName"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const result = await client.guestConfigurationHcrpAssignments.delete( + resourceGroupName, + guestConfigurationAssignmentName, + machineName, + ); + console.log(result); +} + +async function main() { + deleteAnGuestConfigurationAssignment(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationHcrpAssignmentsGetSample.js b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationHcrpAssignmentsGetSample.js new file mode 100644 index 000000000000..865b8b977505 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationHcrpAssignmentsGetSample.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { GuestConfigurationClient } = require("@azure/arm-guestconfiguration"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get information about a guest configuration assignment + * + * @summary Get information about a guest configuration assignment + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getGuestConfigurationHCRPAssignment.json + */ +async function getAGuestConfigurationAssignment() { + const subscriptionId = process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionId"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const guestConfigurationAssignmentName = "SecureProtocol"; + const machineName = "myMachineName"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const result = await client.guestConfigurationHcrpAssignments.get( + resourceGroupName, + guestConfigurationAssignmentName, + machineName, + ); + console.log(result); +} + +async function main() { + getAGuestConfigurationAssignment(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationHcrpAssignmentsListSample.js b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationHcrpAssignmentsListSample.js new file mode 100644 index 000000000000..a9cbfdf5d0ee --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/guestConfigurationHcrpAssignmentsListSample.js @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { GuestConfigurationClient } = require("@azure/arm-guestconfiguration"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to List all guest configuration assignments for an ARC machine. + * + * @summary List all guest configuration assignments for an ARC machine. + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listGuestConfigurationHCRPAssignments.json + */ +async function listAllGuestConfigurationAssignmentsForAVirtualMachine() { + const subscriptionId = process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionId"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const machineName = "myMachineName"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.guestConfigurationHcrpAssignments.list( + resourceGroupName, + machineName, + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAllGuestConfigurationAssignmentsForAVirtualMachine(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/operationsListSample.js b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/operationsListSample.js new file mode 100644 index 000000000000..fb958520ce44 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/operationsListSample.js @@ -0,0 +1,37 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { GuestConfigurationClient } = require("@azure/arm-guestconfiguration"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Lists all of the available GuestConfiguration REST API operations. + * + * @summary Lists all of the available GuestConfiguration REST API operations. + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listOperations.json + */ +async function listsAllOfTheAvailableGuestConfigurationRestApiOperations() { + const subscriptionId = + process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listsAllOfTheAvailableGuestConfigurationRestApiOperations(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/package.json b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/package.json new file mode 100644 index 000000000000..8de1964ad105 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/package.json @@ -0,0 +1,32 @@ +{ + "name": "@azure-samples/arm-guestconfiguration-js-beta", + "private": true, + "version": "1.0.0", + "description": " 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/guestconfiguration/arm-guestconfiguration" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "author": "Microsoft Corporation", + "license": "MIT", + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/guestconfiguration/arm-guestconfiguration", + "dependencies": { + "@azure/arm-guestconfiguration": "next", + "dotenv": "latest", + "@azure/identity": "^4.0.1" + } +} diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/sample.env b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/javascript/sample.env @@ -0,0 +1,4 @@ +# App registration secret for AAD authentication +AZURE_CLIENT_SECRET= +AZURE_CLIENT_ID= +AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/README.md b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/README.md new file mode 100644 index 000000000000..50a033023323 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/README.md @@ -0,0 +1,115 @@ +# client library samples for TypeScript (Beta) + +These sample programs show how to use the TypeScript client libraries for in some common scenarios. + +| **File Name** | **Description** | +| ----------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [guestConfigurationAssignmentReportsGetSample.ts][guestconfigurationassignmentreportsgetsample] | Get a report for the guest configuration assignment, by reportId. x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getGuestConfigurationAssignmentReportById.json | +| [guestConfigurationAssignmentReportsListSample.ts][guestconfigurationassignmentreportslistsample] | List all reports for the guest configuration assignment, latest report first. x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listAllGuestConfigurationAssignmentReports.json | +| [guestConfigurationAssignmentReportsVmssGetSample.ts][guestconfigurationassignmentreportsvmssgetsample] | Get a report for the VMSS guest configuration assignment, by reportId. x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getVMSSGuestConfigurationAssignmentReportById.json | +| [guestConfigurationAssignmentReportsVmssListSample.ts][guestconfigurationassignmentreportsvmsslistsample] | List all reports for the VMSS guest configuration assignment, latest report first. x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listAllVMSSGuestConfigurationAssignmentReports.json | +| [guestConfigurationAssignmentsCreateOrUpdateSample.ts][guestconfigurationassignmentscreateorupdatesample] | Creates an association between a VM and guest configuration x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/createOrUpdateGuestConfigurationAssignment.json | +| [guestConfigurationAssignmentsDeleteSample.ts][guestconfigurationassignmentsdeletesample] | Delete a guest configuration assignment x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/deleteGuestConfigurationAssignment.json | +| [guestConfigurationAssignmentsGetSample.ts][guestconfigurationassignmentsgetsample] | Get information about a guest configuration assignment x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getGuestConfigurationAssignment.json | +| [guestConfigurationAssignmentsListSample.ts][guestconfigurationassignmentslistsample] | List all guest configuration assignments for a virtual machine. x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listGuestConfigurationAssignments.json | +| [guestConfigurationAssignmentsRgListSample.ts][guestconfigurationassignmentsrglistsample] | List all guest configuration assignments for a resource group. x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listRGGuestConfigurationAssignments.json | +| [guestConfigurationAssignmentsSubscriptionListSample.ts][guestconfigurationassignmentssubscriptionlistsample] | List all guest configuration assignments for a subscription. x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listSubGuestConfigurationAssignments.json | +| [guestConfigurationAssignmentsVmssCreateOrUpdateSample.ts][guestconfigurationassignmentsvmsscreateorupdatesample] | Creates an association between a VMSS and guest configuration x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/createOrUpdateGuestConfigurationVMSSAssignment.json | +| [guestConfigurationAssignmentsVmssDeleteSample.ts][guestconfigurationassignmentsvmssdeletesample] | Delete a guest configuration assignment for VMSS x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/deleteGuestConfigurationVMSSAssignment.json | +| [guestConfigurationAssignmentsVmssGetSample.ts][guestconfigurationassignmentsvmssgetsample] | Get information about a guest configuration assignment for VMSS x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getVMSSGuestConfigurationAssignment.json | +| [guestConfigurationAssignmentsVmssListSample.ts][guestconfigurationassignmentsvmsslistsample] | List all guest configuration assignments for VMSS. x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listVMSSGuestConfigurationAssignments.json | +| [guestConfigurationConnectedVMwarevSphereAssignmentsCreateOrUpdateSample.ts][guestconfigurationconnectedvmwarevsphereassignmentscreateorupdatesample] | Creates an association between a Connected VM Sphere machine and guest configuration x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/createOrUpdateGuestConfigurationConnectedVMwarevSphereAssignment.json | +| [guestConfigurationConnectedVMwarevSphereAssignmentsDeleteSample.ts][guestconfigurationconnectedvmwarevsphereassignmentsdeletesample] | Delete a guest configuration assignment x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/deleteGuestConfigurationConnectedVMwarevSphereAssignment.json | +| [guestConfigurationConnectedVMwarevSphereAssignmentsGetSample.ts][guestconfigurationconnectedvmwarevsphereassignmentsgetsample] | Get information about a guest configuration assignment x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getGuestConfigurationConnectedVMwarevSphereAssignment.json | +| [guestConfigurationConnectedVMwarevSphereAssignmentsListSample.ts][guestconfigurationconnectedvmwarevsphereassignmentslistsample] | List all guest configuration assignments for an ARC machine. x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listGuestConfigurationConnectedVMwarevSphereAssignments.json | +| [guestConfigurationConnectedVMwarevSphereAssignmentsReportsGetSample.ts][guestconfigurationconnectedvmwarevsphereassignmentsreportsgetsample] | Get a report for the guest configuration assignment, by reportId. x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getGuestConfigurationConnectedVMwarevSphereAssignmentReportById.json | +| [guestConfigurationConnectedVMwarevSphereAssignmentsReportsListSample.ts][guestconfigurationconnectedvmwarevsphereassignmentsreportslistsample] | List all reports for the guest configuration assignment, latest report first. x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listAllGuestConfigurationConnectedVMwarevSphereAssignmentsReports.json | +| [guestConfigurationHcrpAssignmentReportsGetSample.ts][guestconfigurationhcrpassignmentreportsgetsample] | Get a report for the guest configuration assignment, by reportId. x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getGuestConfigurationHCRPAssignmentReportById.json | +| [guestConfigurationHcrpAssignmentReportsListSample.ts][guestconfigurationhcrpassignmentreportslistsample] | List all reports for the guest configuration assignment, latest report first. x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listAllGuestConfigurationHCRPAssignmentReports.json | +| [guestConfigurationHcrpAssignmentsCreateOrUpdateSample.ts][guestconfigurationhcrpassignmentscreateorupdatesample] | Creates an association between a ARC machine and guest configuration x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/createOrUpdateGuestConfigurationHCRPAssignment.json | +| [guestConfigurationHcrpAssignmentsDeleteSample.ts][guestconfigurationhcrpassignmentsdeletesample] | Delete a guest configuration assignment x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/deleteGuestConfigurationHCRPAssignment.json | +| [guestConfigurationHcrpAssignmentsGetSample.ts][guestconfigurationhcrpassignmentsgetsample] | Get information about a guest configuration assignment x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getGuestConfigurationHCRPAssignment.json | +| [guestConfigurationHcrpAssignmentsListSample.ts][guestconfigurationhcrpassignmentslistsample] | List all guest configuration assignments for an ARC machine. x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listGuestConfigurationHCRPAssignments.json | +| [operationsListSample.ts][operationslistsample] | Lists all of the available GuestConfiguration REST API operations. x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listOperations.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/guestConfigurationAssignmentReportsGetSample.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 GUESTCONFIGURATION_SUBSCRIPTION_ID="" GUESTCONFIGURATION_RESOURCE_GROUP="" node dist/guestConfigurationAssignmentReportsGetSample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[guestconfigurationassignmentreportsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationAssignmentReportsGetSample.ts +[guestconfigurationassignmentreportslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationAssignmentReportsListSample.ts +[guestconfigurationassignmentreportsvmssgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationAssignmentReportsVmssGetSample.ts +[guestconfigurationassignmentreportsvmsslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationAssignmentReportsVmssListSample.ts +[guestconfigurationassignmentscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationAssignmentsCreateOrUpdateSample.ts +[guestconfigurationassignmentsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationAssignmentsDeleteSample.ts +[guestconfigurationassignmentsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationAssignmentsGetSample.ts +[guestconfigurationassignmentslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationAssignmentsListSample.ts +[guestconfigurationassignmentsrglistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationAssignmentsRgListSample.ts +[guestconfigurationassignmentssubscriptionlistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationAssignmentsSubscriptionListSample.ts +[guestconfigurationassignmentsvmsscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationAssignmentsVmssCreateOrUpdateSample.ts +[guestconfigurationassignmentsvmssdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationAssignmentsVmssDeleteSample.ts +[guestconfigurationassignmentsvmssgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationAssignmentsVmssGetSample.ts +[guestconfigurationassignmentsvmsslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationAssignmentsVmssListSample.ts +[guestconfigurationconnectedvmwarevsphereassignmentscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationConnectedVMwarevSphereAssignmentsCreateOrUpdateSample.ts +[guestconfigurationconnectedvmwarevsphereassignmentsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationConnectedVMwarevSphereAssignmentsDeleteSample.ts +[guestconfigurationconnectedvmwarevsphereassignmentsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationConnectedVMwarevSphereAssignmentsGetSample.ts +[guestconfigurationconnectedvmwarevsphereassignmentslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationConnectedVMwarevSphereAssignmentsListSample.ts +[guestconfigurationconnectedvmwarevsphereassignmentsreportsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationConnectedVMwarevSphereAssignmentsReportsGetSample.ts +[guestconfigurationconnectedvmwarevsphereassignmentsreportslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationConnectedVMwarevSphereAssignmentsReportsListSample.ts +[guestconfigurationhcrpassignmentreportsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationHcrpAssignmentReportsGetSample.ts +[guestconfigurationhcrpassignmentreportslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationHcrpAssignmentReportsListSample.ts +[guestconfigurationhcrpassignmentscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationHcrpAssignmentsCreateOrUpdateSample.ts +[guestconfigurationhcrpassignmentsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationHcrpAssignmentsDeleteSample.ts +[guestconfigurationhcrpassignmentsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationHcrpAssignmentsGetSample.ts +[guestconfigurationhcrpassignmentslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationHcrpAssignmentsListSample.ts +[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/operationsListSample.ts +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-guestconfiguration?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/guestconfiguration/arm-guestconfiguration/README.md +[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/package.json b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/package.json new file mode 100644 index 000000000000..76a075a33ad1 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/package.json @@ -0,0 +1,41 @@ +{ + "name": "@azure-samples/arm-guestconfiguration-ts-beta", + "private": true, + "version": "1.0.0", + "description": " 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/guestconfiguration/arm-guestconfiguration" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "author": "Microsoft Corporation", + "license": "MIT", + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/guestconfiguration/arm-guestconfiguration", + "dependencies": { + "@azure/arm-guestconfiguration": "next", + "dotenv": "latest", + "@azure/identity": "^4.0.1" + }, + "devDependencies": { + "@types/node": "^18.0.0", + "typescript": "~5.4.5", + "rimraf": "latest" + } +} diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/sample.env b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/sample.env @@ -0,0 +1,4 @@ +# App registration secret for AAD authentication +AZURE_CLIENT_SECRET= +AZURE_CLIENT_ID= +AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationAssignmentReportsGetSample.ts b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationAssignmentReportsGetSample.ts new file mode 100644 index 000000000000..e8787a276298 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationAssignmentReportsGetSample.ts @@ -0,0 +1,46 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { GuestConfigurationClient } from "@azure/arm-guestconfiguration"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get a report for the guest configuration assignment, by reportId. + * + * @summary Get a report for the guest configuration assignment, by reportId. + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getGuestConfigurationAssignmentReportById.json + */ +async function getAGuestConfigurationAssignmentReportByIdForAVirtualMachine() { + const subscriptionId = + process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionid"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const guestConfigurationAssignmentName = "AuditSecureProtocol"; + const reportId = "7367cbb8-ae99-47d0-a33b-a283564d2cb1"; + const vmName = "myvm"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const result = await client.guestConfigurationAssignmentReports.get( + resourceGroupName, + guestConfigurationAssignmentName, + reportId, + vmName, + ); + console.log(result); +} + +async function main() { + getAGuestConfigurationAssignmentReportByIdForAVirtualMachine(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationAssignmentReportsListSample.ts b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationAssignmentReportsListSample.ts new file mode 100644 index 000000000000..0a8c31a57bfc --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationAssignmentReportsListSample.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { GuestConfigurationClient } from "@azure/arm-guestconfiguration"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to List all reports for the guest configuration assignment, latest report first. + * + * @summary List all reports for the guest configuration assignment, latest report first. + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listAllGuestConfigurationAssignmentReports.json + */ +async function listAllGuestConfigurationAssignmentsForAVirtualMachine() { + const subscriptionId = + process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionid"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const guestConfigurationAssignmentName = "AuditSecureProtocol"; + const vmName = "myVMName"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const result = await client.guestConfigurationAssignmentReports.list( + resourceGroupName, + guestConfigurationAssignmentName, + vmName, + ); + console.log(result); +} + +async function main() { + listAllGuestConfigurationAssignmentsForAVirtualMachine(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationAssignmentReportsVmssGetSample.ts b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationAssignmentReportsVmssGetSample.ts new file mode 100644 index 000000000000..d4d7ef647401 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationAssignmentReportsVmssGetSample.ts @@ -0,0 +1,46 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { GuestConfigurationClient } from "@azure/arm-guestconfiguration"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get a report for the VMSS guest configuration assignment, by reportId. + * + * @summary Get a report for the VMSS guest configuration assignment, by reportId. + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getVMSSGuestConfigurationAssignmentReportById.json + */ +async function getAGuestConfigurationAssignmentReportByIdForAVirtualMachineScaleSet() { + const subscriptionId = + process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionid"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const vmssName = "myvmss"; + const name = "AuditSecureProtocol"; + const id = "7367cbb8-ae99-47d0-a33b-a283564d2cb1"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const result = await client.guestConfigurationAssignmentReportsVmss.get( + resourceGroupName, + vmssName, + name, + id, + ); + console.log(result); +} + +async function main() { + getAGuestConfigurationAssignmentReportByIdForAVirtualMachineScaleSet(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationAssignmentReportsVmssListSample.ts b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationAssignmentReportsVmssListSample.ts new file mode 100644 index 000000000000..eac2f6c8fd23 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationAssignmentReportsVmssListSample.ts @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { GuestConfigurationClient } from "@azure/arm-guestconfiguration"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to List all reports for the VMSS guest configuration assignment, latest report first. + * + * @summary List all reports for the VMSS guest configuration assignment, latest report first. + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listAllVMSSGuestConfigurationAssignmentReports.json + */ +async function listAllReportsForTheVmssGuestConfigurationAssignmentWithLatestReportFirst() { + const subscriptionId = + process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionid"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const vmssName = "myVMSSName"; + const name = "AuditSecureProtocol"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.guestConfigurationAssignmentReportsVmss.list( + resourceGroupName, + vmssName, + name, + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAllReportsForTheVmssGuestConfigurationAssignmentWithLatestReportFirst(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationAssignmentsCreateOrUpdateSample.ts b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationAssignmentsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..f1ae2b3e3dab --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationAssignmentsCreateOrUpdateSample.ts @@ -0,0 +1,68 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + GuestConfigurationAssignment, + GuestConfigurationClient, +} from "@azure/arm-guestconfiguration"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates an association between a VM and guest configuration + * + * @summary Creates an association between a VM and guest configuration + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/createOrUpdateGuestConfigurationAssignment.json + */ +async function createOrUpdateGuestConfigurationAssignment() { + const subscriptionId = + process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionId"; + const guestConfigurationAssignmentName = "NotInstalledApplicationForWindows"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const vmName = "myVMName"; + const parameters: GuestConfigurationAssignment = { + name: "NotInstalledApplicationForWindows", + location: "westcentralus", + properties: { + context: "Azure policy", + guestConfiguration: { + name: "NotInstalledApplicationForWindows", + assignmentType: "ApplyAndAutoCorrect", + configurationParameter: [ + { + name: "[InstalledApplication]NotInstalledApplicationResource1;Name", + value: "NotePad,sql", + }, + ], + contentHash: "123contenthash", + contentUri: "https://thisisfake/pacakge", + version: "1.0.0.3", + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const result = await client.guestConfigurationAssignments.createOrUpdate( + guestConfigurationAssignmentName, + resourceGroupName, + vmName, + parameters, + ); + console.log(result); +} + +async function main() { + createOrUpdateGuestConfigurationAssignment(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationAssignmentsDeleteSample.ts b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationAssignmentsDeleteSample.ts new file mode 100644 index 000000000000..3d3c509ce915 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationAssignmentsDeleteSample.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { GuestConfigurationClient } from "@azure/arm-guestconfiguration"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Delete a guest configuration assignment + * + * @summary Delete a guest configuration assignment + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/deleteGuestConfigurationAssignment.json + */ +async function deleteAnGuestConfigurationAssignment() { + const subscriptionId = + process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionId"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const guestConfigurationAssignmentName = "SecureProtocol"; + const vmName = "myVMName"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const result = await client.guestConfigurationAssignments.delete( + resourceGroupName, + guestConfigurationAssignmentName, + vmName, + ); + console.log(result); +} + +async function main() { + deleteAnGuestConfigurationAssignment(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationAssignmentsGetSample.ts b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationAssignmentsGetSample.ts new file mode 100644 index 000000000000..5d43e43e6407 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationAssignmentsGetSample.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { GuestConfigurationClient } from "@azure/arm-guestconfiguration"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get information about a guest configuration assignment + * + * @summary Get information about a guest configuration assignment + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getGuestConfigurationAssignment.json + */ +async function getAGuestConfigurationAssignment() { + const subscriptionId = + process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionId"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const guestConfigurationAssignmentName = "SecureProtocol"; + const vmName = "myVMName"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const result = await client.guestConfigurationAssignments.get( + resourceGroupName, + guestConfigurationAssignmentName, + vmName, + ); + console.log(result); +} + +async function main() { + getAGuestConfigurationAssignment(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationAssignmentsListSample.ts b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationAssignmentsListSample.ts new file mode 100644 index 000000000000..8e9582329f7e --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationAssignmentsListSample.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { GuestConfigurationClient } from "@azure/arm-guestconfiguration"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to List all guest configuration assignments for a virtual machine. + * + * @summary List all guest configuration assignments for a virtual machine. + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listGuestConfigurationAssignments.json + */ +async function listAllGuestConfigurationAssignmentsForAVirtualMachine() { + const subscriptionId = + process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionId"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const vmName = "myVMName"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.guestConfigurationAssignments.list( + resourceGroupName, + vmName, + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAllGuestConfigurationAssignmentsForAVirtualMachine(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationAssignmentsRgListSample.ts b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationAssignmentsRgListSample.ts new file mode 100644 index 000000000000..251b35a9a2ae --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationAssignmentsRgListSample.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { GuestConfigurationClient } from "@azure/arm-guestconfiguration"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to List all guest configuration assignments for a resource group. + * + * @summary List all guest configuration assignments for a resource group. + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listRGGuestConfigurationAssignments.json + */ +async function listAllGuestConfigurationAssignmentsForAResourceGroup() { + const subscriptionId = + process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionId"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.guestConfigurationAssignments.listRGList( + resourceGroupName, + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAllGuestConfigurationAssignmentsForAResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationAssignmentsSubscriptionListSample.ts b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationAssignmentsSubscriptionListSample.ts new file mode 100644 index 000000000000..79a84720651d --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationAssignmentsSubscriptionListSample.ts @@ -0,0 +1,39 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { GuestConfigurationClient } from "@azure/arm-guestconfiguration"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to List all guest configuration assignments for a subscription. + * + * @summary List all guest configuration assignments for a subscription. + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listSubGuestConfigurationAssignments.json + */ +async function listAllGuestConfigurationAssignmentsForASubscription() { + const subscriptionId = + process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionId"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.guestConfigurationAssignments.listSubscriptionList()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAllGuestConfigurationAssignmentsForASubscription(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationAssignmentsVmssCreateOrUpdateSample.ts b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationAssignmentsVmssCreateOrUpdateSample.ts new file mode 100644 index 000000000000..21b62b893959 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationAssignmentsVmssCreateOrUpdateSample.ts @@ -0,0 +1,68 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + GuestConfigurationAssignment, + GuestConfigurationClient, +} from "@azure/arm-guestconfiguration"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates an association between a VMSS and guest configuration + * + * @summary Creates an association between a VMSS and guest configuration + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/createOrUpdateGuestConfigurationVMSSAssignment.json + */ +async function createOrUpdateGuestConfigurationAssignment() { + const subscriptionId = + process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionId"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const vmssName = "myVMSSName"; + const name = "NotInstalledApplicationForWindows"; + const parameters: GuestConfigurationAssignment = { + name: "NotInstalledApplicationForWindows", + location: "westcentralus", + properties: { + context: "Azure policy", + guestConfiguration: { + name: "NotInstalledApplicationForWindows", + assignmentType: "ApplyAndAutoCorrect", + configurationParameter: [ + { + name: "[InstalledApplication]NotInstalledApplicationResource1;Name", + value: "NotePad,sql", + }, + ], + contentHash: "123contenthash", + contentUri: "https://thisisfake/pacakge", + version: "1.0.0.3", + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const result = await client.guestConfigurationAssignmentsVmss.createOrUpdate( + resourceGroupName, + vmssName, + name, + parameters, + ); + console.log(result); +} + +async function main() { + createOrUpdateGuestConfigurationAssignment(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationAssignmentsVmssDeleteSample.ts b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationAssignmentsVmssDeleteSample.ts new file mode 100644 index 000000000000..d32f52f49a2b --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationAssignmentsVmssDeleteSample.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { GuestConfigurationClient } from "@azure/arm-guestconfiguration"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Delete a guest configuration assignment for VMSS + * + * @summary Delete a guest configuration assignment for VMSS + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/deleteGuestConfigurationVMSSAssignment.json + */ +async function deleteAnGuestConfigurationAssignmentForVmss() { + const subscriptionId = + process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionId"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const vmssName = "myVMSSName"; + const name = "SecureProtocol"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const result = await client.guestConfigurationAssignmentsVmss.delete( + resourceGroupName, + vmssName, + name, + ); + console.log(result); +} + +async function main() { + deleteAnGuestConfigurationAssignmentForVmss(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationAssignmentsVmssGetSample.ts b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationAssignmentsVmssGetSample.ts new file mode 100644 index 000000000000..a6a46413d195 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationAssignmentsVmssGetSample.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { GuestConfigurationClient } from "@azure/arm-guestconfiguration"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get information about a guest configuration assignment for VMSS + * + * @summary Get information about a guest configuration assignment for VMSS + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getVMSSGuestConfigurationAssignment.json + */ +async function getAVmssGuestConfigurationAssignment() { + const subscriptionId = + process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionId"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const vmssName = "myVMSSName"; + const name = "SecureProtocol"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const result = await client.guestConfigurationAssignmentsVmss.get( + resourceGroupName, + vmssName, + name, + ); + console.log(result); +} + +async function main() { + getAVmssGuestConfigurationAssignment(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationAssignmentsVmssListSample.ts b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationAssignmentsVmssListSample.ts new file mode 100644 index 000000000000..758d6354b64a --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationAssignmentsVmssListSample.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { GuestConfigurationClient } from "@azure/arm-guestconfiguration"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to List all guest configuration assignments for VMSS. + * + * @summary List all guest configuration assignments for VMSS. + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listVMSSGuestConfigurationAssignments.json + */ +async function listAllGuestConfigurationAssignmentsForVmss() { + const subscriptionId = + process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionId"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const vmssName = "myVMSSName"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.guestConfigurationAssignmentsVmss.list( + resourceGroupName, + vmssName, + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAllGuestConfigurationAssignmentsForVmss(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationConnectedVMwarevSphereAssignmentsCreateOrUpdateSample.ts b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationConnectedVMwarevSphereAssignmentsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..cb2c08c167cb --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationConnectedVMwarevSphereAssignmentsCreateOrUpdateSample.ts @@ -0,0 +1,69 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + GuestConfigurationAssignment, + GuestConfigurationClient, +} from "@azure/arm-guestconfiguration"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates an association between a Connected VM Sphere machine and guest configuration + * + * @summary Creates an association between a Connected VM Sphere machine and guest configuration + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/createOrUpdateGuestConfigurationConnectedVMwarevSphereAssignment.json + */ +async function createOrUpdateGuestConfigurationAssignment() { + const subscriptionId = + process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionId"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const vmName = "myVMName"; + const guestConfigurationAssignmentName = "NotInstalledApplicationForWindows"; + const parameters: GuestConfigurationAssignment = { + name: "NotInstalledApplicationForWindows", + location: "westcentralus", + properties: { + context: "Azure policy", + guestConfiguration: { + name: "NotInstalledApplicationForWindows", + assignmentType: "ApplyAndAutoCorrect", + configurationParameter: [ + { + name: "[InstalledApplication]NotInstalledApplicationResource1;Name", + value: "NotePad,sql", + }, + ], + contentHash: "123contenthash", + contentUri: "https://thisisfake/pacakge", + version: "1.0.0.0", + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const result = + await client.guestConfigurationConnectedVMwarevSphereAssignments.createOrUpdate( + resourceGroupName, + vmName, + guestConfigurationAssignmentName, + parameters, + ); + console.log(result); +} + +async function main() { + createOrUpdateGuestConfigurationAssignment(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationConnectedVMwarevSphereAssignmentsDeleteSample.ts b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationConnectedVMwarevSphereAssignmentsDeleteSample.ts new file mode 100644 index 000000000000..73d6066465c2 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationConnectedVMwarevSphereAssignmentsDeleteSample.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { GuestConfigurationClient } from "@azure/arm-guestconfiguration"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Delete a guest configuration assignment + * + * @summary Delete a guest configuration assignment + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/deleteGuestConfigurationConnectedVMwarevSphereAssignment.json + */ +async function deleteAnGuestConfigurationAssignment() { + const subscriptionId = + process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionId"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const vmName = "myVMName"; + const guestConfigurationAssignmentName = "SecureProtocol"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const result = + await client.guestConfigurationConnectedVMwarevSphereAssignments.delete( + resourceGroupName, + vmName, + guestConfigurationAssignmentName, + ); + console.log(result); +} + +async function main() { + deleteAnGuestConfigurationAssignment(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationConnectedVMwarevSphereAssignmentsGetSample.ts b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationConnectedVMwarevSphereAssignmentsGetSample.ts new file mode 100644 index 000000000000..bf8cb76a42f6 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationConnectedVMwarevSphereAssignmentsGetSample.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { GuestConfigurationClient } from "@azure/arm-guestconfiguration"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get information about a guest configuration assignment + * + * @summary Get information about a guest configuration assignment + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getGuestConfigurationConnectedVMwarevSphereAssignment.json + */ +async function getAGuestConfigurationAssignment() { + const subscriptionId = + process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionId"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const vmName = "myVMName"; + const guestConfigurationAssignmentName = "SecureProtocol"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const result = + await client.guestConfigurationConnectedVMwarevSphereAssignments.get( + resourceGroupName, + vmName, + guestConfigurationAssignmentName, + ); + console.log(result); +} + +async function main() { + getAGuestConfigurationAssignment(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationConnectedVMwarevSphereAssignmentsListSample.ts b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationConnectedVMwarevSphereAssignmentsListSample.ts new file mode 100644 index 000000000000..be1a7258f033 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationConnectedVMwarevSphereAssignmentsListSample.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { GuestConfigurationClient } from "@azure/arm-guestconfiguration"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to List all guest configuration assignments for an ARC machine. + * + * @summary List all guest configuration assignments for an ARC machine. + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listGuestConfigurationConnectedVMwarevSphereAssignments.json + */ +async function listAllGuestConfigurationAssignmentsForAVirtualMachine() { + const subscriptionId = + process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionId"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const vmName = "myVMName"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.guestConfigurationConnectedVMwarevSphereAssignments.list( + resourceGroupName, + vmName, + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAllGuestConfigurationAssignmentsForAVirtualMachine(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationConnectedVMwarevSphereAssignmentsReportsGetSample.ts b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationConnectedVMwarevSphereAssignmentsReportsGetSample.ts new file mode 100644 index 000000000000..a25fb4720209 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationConnectedVMwarevSphereAssignmentsReportsGetSample.ts @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { GuestConfigurationClient } from "@azure/arm-guestconfiguration"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get a report for the guest configuration assignment, by reportId. + * + * @summary Get a report for the guest configuration assignment, by reportId. + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getGuestConfigurationConnectedVMwarevSphereAssignmentReportById.json + */ +async function getAGuestConfigurationAssignmentReportByIdForAVirtualMachine() { + const subscriptionId = + process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionid"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const vmName = "myvm"; + const guestConfigurationAssignmentName = "AuditSecureProtocol"; + const reportId = "7367cbb8-ae99-47d0-a33b-a283564d2cb1"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const result = + await client.guestConfigurationConnectedVMwarevSphereAssignmentsReports.get( + resourceGroupName, + vmName, + guestConfigurationAssignmentName, + reportId, + ); + console.log(result); +} + +async function main() { + getAGuestConfigurationAssignmentReportByIdForAVirtualMachine(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationConnectedVMwarevSphereAssignmentsReportsListSample.ts b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationConnectedVMwarevSphereAssignmentsReportsListSample.ts new file mode 100644 index 000000000000..16b0e4e082b7 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationConnectedVMwarevSphereAssignmentsReportsListSample.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { GuestConfigurationClient } from "@azure/arm-guestconfiguration"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to List all reports for the guest configuration assignment, latest report first. + * + * @summary List all reports for the guest configuration assignment, latest report first. + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listAllGuestConfigurationConnectedVMwarevSphereAssignmentsReports.json + */ +async function listAllGuestConfigurationAssignmentsForAVirtualMachine() { + const subscriptionId = + process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionid"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const vmName = "myVMName"; + const guestConfigurationAssignmentName = "AuditSecureProtocol"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const result = + await client.guestConfigurationConnectedVMwarevSphereAssignmentsReports.list( + resourceGroupName, + vmName, + guestConfigurationAssignmentName, + ); + console.log(result); +} + +async function main() { + listAllGuestConfigurationAssignmentsForAVirtualMachine(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationHcrpAssignmentReportsGetSample.ts b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationHcrpAssignmentReportsGetSample.ts new file mode 100644 index 000000000000..508aaf983396 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationHcrpAssignmentReportsGetSample.ts @@ -0,0 +1,46 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { GuestConfigurationClient } from "@azure/arm-guestconfiguration"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get a report for the guest configuration assignment, by reportId. + * + * @summary Get a report for the guest configuration assignment, by reportId. + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getGuestConfigurationHCRPAssignmentReportById.json + */ +async function getAGuestConfigurationAssignmentReportByIdForAVirtualMachine() { + const subscriptionId = + process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionid"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const guestConfigurationAssignmentName = "AuditSecureProtocol"; + const reportId = "7367cbb8-ae99-47d0-a33b-a283564d2cb1"; + const machineName = "myMachineName"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const result = await client.guestConfigurationHcrpAssignmentReports.get( + resourceGroupName, + guestConfigurationAssignmentName, + reportId, + machineName, + ); + console.log(result); +} + +async function main() { + getAGuestConfigurationAssignmentReportByIdForAVirtualMachine(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationHcrpAssignmentReportsListSample.ts b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationHcrpAssignmentReportsListSample.ts new file mode 100644 index 000000000000..7c5b7f1b7e01 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationHcrpAssignmentReportsListSample.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { GuestConfigurationClient } from "@azure/arm-guestconfiguration"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to List all reports for the guest configuration assignment, latest report first. + * + * @summary List all reports for the guest configuration assignment, latest report first. + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listAllGuestConfigurationHCRPAssignmentReports.json + */ +async function listAllGuestConfigurationAssignmentsForAVirtualMachine() { + const subscriptionId = + process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionid"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const guestConfigurationAssignmentName = "AuditSecureProtocol"; + const machineName = "myMachineName"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const result = await client.guestConfigurationHcrpAssignmentReports.list( + resourceGroupName, + guestConfigurationAssignmentName, + machineName, + ); + console.log(result); +} + +async function main() { + listAllGuestConfigurationAssignmentsForAVirtualMachine(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationHcrpAssignmentsCreateOrUpdateSample.ts b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationHcrpAssignmentsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..24502d922c2e --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationHcrpAssignmentsCreateOrUpdateSample.ts @@ -0,0 +1,68 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + GuestConfigurationAssignment, + GuestConfigurationClient, +} from "@azure/arm-guestconfiguration"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates an association between a ARC machine and guest configuration + * + * @summary Creates an association between a ARC machine and guest configuration + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/createOrUpdateGuestConfigurationHCRPAssignment.json + */ +async function createOrUpdateGuestConfigurationAssignment() { + const subscriptionId = + process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionId"; + const guestConfigurationAssignmentName = "NotInstalledApplicationForWindows"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const machineName = "myMachineName"; + const parameters: GuestConfigurationAssignment = { + name: "NotInstalledApplicationForWindows", + location: "westcentralus", + properties: { + context: "Azure policy", + guestConfiguration: { + name: "NotInstalledApplicationForWindows", + assignmentType: "ApplyAndAutoCorrect", + configurationParameter: [ + { + name: "[InstalledApplication]NotInstalledApplicationResource1;Name", + value: "NotePad,sql", + }, + ], + contentHash: "123contenthash", + contentUri: "https://thisisfake/pacakge", + version: "1.0.0.3", + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const result = await client.guestConfigurationHcrpAssignments.createOrUpdate( + guestConfigurationAssignmentName, + resourceGroupName, + machineName, + parameters, + ); + console.log(result); +} + +async function main() { + createOrUpdateGuestConfigurationAssignment(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationHcrpAssignmentsDeleteSample.ts b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationHcrpAssignmentsDeleteSample.ts new file mode 100644 index 000000000000..ff28a663a6c4 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationHcrpAssignmentsDeleteSample.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { GuestConfigurationClient } from "@azure/arm-guestconfiguration"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Delete a guest configuration assignment + * + * @summary Delete a guest configuration assignment + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/deleteGuestConfigurationHCRPAssignment.json + */ +async function deleteAnGuestConfigurationAssignment() { + const subscriptionId = + process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionId"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const guestConfigurationAssignmentName = "SecureProtocol"; + const machineName = "myMachineName"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const result = await client.guestConfigurationHcrpAssignments.delete( + resourceGroupName, + guestConfigurationAssignmentName, + machineName, + ); + console.log(result); +} + +async function main() { + deleteAnGuestConfigurationAssignment(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationHcrpAssignmentsGetSample.ts b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationHcrpAssignmentsGetSample.ts new file mode 100644 index 000000000000..8fc4f0a461a1 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationHcrpAssignmentsGetSample.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { GuestConfigurationClient } from "@azure/arm-guestconfiguration"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get information about a guest configuration assignment + * + * @summary Get information about a guest configuration assignment + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getGuestConfigurationHCRPAssignment.json + */ +async function getAGuestConfigurationAssignment() { + const subscriptionId = + process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionId"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const guestConfigurationAssignmentName = "SecureProtocol"; + const machineName = "myMachineName"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const result = await client.guestConfigurationHcrpAssignments.get( + resourceGroupName, + guestConfigurationAssignmentName, + machineName, + ); + console.log(result); +} + +async function main() { + getAGuestConfigurationAssignment(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationHcrpAssignmentsListSample.ts b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationHcrpAssignmentsListSample.ts new file mode 100644 index 000000000000..cdeacd1baab5 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/guestConfigurationHcrpAssignmentsListSample.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { GuestConfigurationClient } from "@azure/arm-guestconfiguration"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to List all guest configuration assignments for an ARC machine. + * + * @summary List all guest configuration assignments for an ARC machine. + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listGuestConfigurationHCRPAssignments.json + */ +async function listAllGuestConfigurationAssignmentsForAVirtualMachine() { + const subscriptionId = + process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || "mySubscriptionId"; + const resourceGroupName = + process.env["GUESTCONFIGURATION_RESOURCE_GROUP"] || "myResourceGroupName"; + const machineName = "myMachineName"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.guestConfigurationHcrpAssignments.list( + resourceGroupName, + machineName, + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAllGuestConfigurationAssignmentsForAVirtualMachine(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/operationsListSample.ts b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/operationsListSample.ts new file mode 100644 index 000000000000..c7fd9e0dbd2f --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/src/operationsListSample.ts @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { GuestConfigurationClient } from "@azure/arm-guestconfiguration"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists all of the available GuestConfiguration REST API operations. + * + * @summary Lists all of the available GuestConfiguration REST API operations. + * x-ms-original-file: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listOperations.json + */ +async function listsAllOfTheAvailableGuestConfigurationRestApiOperations() { + const subscriptionId = + process.env["GUESTCONFIGURATION_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new GuestConfigurationClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listsAllOfTheAvailableGuestConfigurationRestApiOperations(); +} + +main().catch(console.error); diff --git a/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/tsconfig.json b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/tsconfig.json new file mode 100644 index 000000000000..e26ce2a6d8f7 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/samples/v1-beta/typescript/tsconfig.json @@ -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" + ] +} diff --git a/sdk/guestconfiguration/arm-guestconfiguration/src/guestConfigurationClient.ts b/sdk/guestconfiguration/arm-guestconfiguration/src/guestConfigurationClient.ts new file mode 100644 index 000000000000..4e900b406f99 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/src/guestConfigurationClient.ts @@ -0,0 +1,187 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import * as coreClient from "@azure/core-client"; +import * as coreRestPipeline from "@azure/core-rest-pipeline"; +import { + PipelineRequest, + PipelineResponse, + SendRequest, +} from "@azure/core-rest-pipeline"; +import * as coreAuth from "@azure/core-auth"; +import { + GuestConfigurationAssignmentsImpl, + GuestConfigurationAssignmentReportsImpl, + GuestConfigurationHcrpAssignmentsImpl, + GuestConfigurationHcrpAssignmentReportsImpl, + GuestConfigurationAssignmentsVmssImpl, + GuestConfigurationAssignmentReportsVmssImpl, + GuestConfigurationConnectedVMwarevSphereAssignmentsImpl, + GuestConfigurationConnectedVMwarevSphereAssignmentsReportsImpl, + OperationsImpl, +} from "./operations"; +import { + GuestConfigurationAssignments, + GuestConfigurationAssignmentReports, + GuestConfigurationHcrpAssignments, + GuestConfigurationHcrpAssignmentReports, + GuestConfigurationAssignmentsVmss, + GuestConfigurationAssignmentReportsVmss, + GuestConfigurationConnectedVMwarevSphereAssignments, + GuestConfigurationConnectedVMwarevSphereAssignmentsReports, + Operations, +} from "./operationsInterfaces"; +import { GuestConfigurationClientOptionalParams } from "./models"; + +export class GuestConfigurationClient extends coreClient.ServiceClient { + $host: string; + subscriptionId: string; + apiVersion: string; + + /** + * Initializes a new instance of the GuestConfigurationClient class. + * @param credentials Subscription credentials which uniquely identify client subscription. + * @param subscriptionId Subscription ID which uniquely identify Microsoft Azure subscription. The + * subscription ID forms part of the URI for every service call. + * @param options The parameter options + */ + constructor( + credentials: coreAuth.TokenCredential, + subscriptionId: string, + options?: GuestConfigurationClientOptionalParams, + ) { + if (credentials === undefined) { + throw new Error("'credentials' cannot be null"); + } + if (subscriptionId === undefined) { + throw new Error("'subscriptionId' cannot be null"); + } + + // Initializing default values for options + if (!options) { + options = {}; + } + const defaults: GuestConfigurationClientOptionalParams = { + requestContentType: "application/json; charset=utf-8", + credential: credentials, + }; + + const packageDetails = `azsdk-js-arm-guestconfiguration/1.0.0-beta.1`; + const userAgentPrefix = + options.userAgentOptions && options.userAgentOptions.userAgentPrefix + ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` + : `${packageDetails}`; + + const optionsWithDefaults = { + ...defaults, + ...options, + userAgentOptions: { + userAgentPrefix, + }, + endpoint: + options.endpoint ?? options.baseUri ?? "https://management.azure.com", + }; + super(optionsWithDefaults); + + let bearerTokenAuthenticationPolicyFound: boolean = false; + if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) { + const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = + options.pipeline.getOrderedPolicies(); + bearerTokenAuthenticationPolicyFound = pipelinePolicies.some( + (pipelinePolicy) => + pipelinePolicy.name === + coreRestPipeline.bearerTokenAuthenticationPolicyName, + ); + } + if ( + !options || + !options.pipeline || + options.pipeline.getOrderedPolicies().length == 0 || + !bearerTokenAuthenticationPolicyFound + ) { + this.pipeline.removePolicy({ + name: coreRestPipeline.bearerTokenAuthenticationPolicyName, + }); + this.pipeline.addPolicy( + coreRestPipeline.bearerTokenAuthenticationPolicy({ + credential: credentials, + scopes: + optionsWithDefaults.credentialScopes ?? + `${optionsWithDefaults.endpoint}/.default`, + challengeCallbacks: { + authorizeRequestOnChallenge: + coreClient.authorizeRequestOnClaimChallenge, + }, + }), + ); + } + // Parameter assignments + this.subscriptionId = subscriptionId; + + // Assigning values to Constant parameters + this.$host = options.$host || "https://management.azure.com"; + this.apiVersion = options.apiVersion || "2022-01-25"; + this.guestConfigurationAssignments = new GuestConfigurationAssignmentsImpl( + this, + ); + this.guestConfigurationAssignmentReports = + new GuestConfigurationAssignmentReportsImpl(this); + this.guestConfigurationHcrpAssignments = + new GuestConfigurationHcrpAssignmentsImpl(this); + this.guestConfigurationHcrpAssignmentReports = + new GuestConfigurationHcrpAssignmentReportsImpl(this); + this.guestConfigurationAssignmentsVmss = + new GuestConfigurationAssignmentsVmssImpl(this); + this.guestConfigurationAssignmentReportsVmss = + new GuestConfigurationAssignmentReportsVmssImpl(this); + this.guestConfigurationConnectedVMwarevSphereAssignments = + new GuestConfigurationConnectedVMwarevSphereAssignmentsImpl(this); + this.guestConfigurationConnectedVMwarevSphereAssignmentsReports = + new GuestConfigurationConnectedVMwarevSphereAssignmentsReportsImpl(this); + this.operations = new OperationsImpl(this); + this.addCustomApiVersionPolicy(options.apiVersion); + } + + /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */ + private addCustomApiVersionPolicy(apiVersion?: string) { + if (!apiVersion) { + return; + } + const apiVersionPolicy = { + name: "CustomApiVersionPolicy", + async sendRequest( + request: PipelineRequest, + next: SendRequest, + ): Promise { + const param = request.url.split("?"); + if (param.length > 1) { + const newParams = param[1].split("&").map((item) => { + if (item.indexOf("api-version") > -1) { + return "api-version=" + apiVersion; + } else { + return item; + } + }); + request.url = param[0] + "?" + newParams.join("&"); + } + return next(request); + }, + }; + this.pipeline.addPolicy(apiVersionPolicy); + } + + guestConfigurationAssignments: GuestConfigurationAssignments; + guestConfigurationAssignmentReports: GuestConfigurationAssignmentReports; + guestConfigurationHcrpAssignments: GuestConfigurationHcrpAssignments; + guestConfigurationHcrpAssignmentReports: GuestConfigurationHcrpAssignmentReports; + guestConfigurationAssignmentsVmss: GuestConfigurationAssignmentsVmss; + guestConfigurationAssignmentReportsVmss: GuestConfigurationAssignmentReportsVmss; + guestConfigurationConnectedVMwarevSphereAssignments: GuestConfigurationConnectedVMwarevSphereAssignments; + guestConfigurationConnectedVMwarevSphereAssignmentsReports: GuestConfigurationConnectedVMwarevSphereAssignmentsReports; + operations: Operations; +} diff --git a/sdk/guestconfiguration/arm-guestconfiguration/src/index.ts b/sdk/guestconfiguration/arm-guestconfiguration/src/index.ts new file mode 100644 index 000000000000..b74f4582a02a --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/src/index.ts @@ -0,0 +1,13 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +/// +export { getContinuationToken } from "./pagingHelper"; +export * from "./models"; +export { GuestConfigurationClient } from "./guestConfigurationClient"; +export * from "./operationsInterfaces"; diff --git a/sdk/guestconfiguration/arm-guestconfiguration/src/models/index.ts b/sdk/guestconfiguration/arm-guestconfiguration/src/models/index.ts new file mode 100644 index 000000000000..b3e62505b843 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/src/models/index.ts @@ -0,0 +1,847 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import * as coreClient from "@azure/core-client"; + +/** Guest configuration assignment properties. */ +export interface GuestConfigurationAssignmentProperties { + /** + * VM resource Id. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly targetResourceId?: string; + /** The guest configuration to assign. */ + guestConfiguration?: GuestConfigurationNavigation; + /** + * A value indicating compliance status of the machine for the assigned guest configuration. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly complianceStatus?: ComplianceStatus; + /** + * Date and time when last compliance status was checked. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly lastComplianceStatusChecked?: Date; + /** + * Id of the latest report for the guest configuration assignment. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly latestReportId?: string; + /** + * parameter hash for the guest configuration assignment. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly parameterHash?: string; + /** Last reported guest configuration assignment report. */ + latestAssignmentReport?: AssignmentReport; + /** The source which initiated the guest configuration assignment. Ex: Azure Policy */ + context?: string; + /** + * Combined hash of the configuration package and parameters. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly assignmentHash?: string; + /** + * The provisioning state, which only appears in the response. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: ProvisioningState; + /** + * Type of the resource - VMSS / VM + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly resourceType?: string; + /** The list of VM Compliance data for VMSS */ + vmssVMList?: VmssvmInfo[]; +} + +/** Guest configuration is an artifact that encapsulates DSC configuration and its dependencies. The artifact is a zip file containing DSC configuration (as MOF) and dependent resources and other dependencies like modules. */ +export interface GuestConfigurationNavigation { + /** Kind of the guest configuration. For example:DSC */ + kind?: Kind; + /** Name of the guest configuration. */ + name?: string; + /** Version of the guest configuration. */ + version?: string; + /** Uri of the storage where guest configuration package is uploaded. */ + contentUri?: string; + /** Combined hash of the guest configuration package and configuration parameters. */ + contentHash?: string; + /** Specifies the assignment type and execution of the configuration. Possible values are Audit, DeployAndAutoCorrect, ApplyAndAutoCorrect and ApplyAndMonitor. */ + assignmentType?: AssignmentType; + /** + * Specifies the origin of the configuration. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly assignmentSource?: string; + /** + * Specifies the content type of the configuration. Possible values could be Builtin or Custom. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly contentType?: string; + /** The configuration parameters for the guest configuration. */ + configurationParameter?: ConfigurationParameter[]; + /** The protected configuration parameters for the guest configuration. */ + configurationProtectedParameter?: ConfigurationParameter[]; + /** + * The configuration setting for the guest configuration. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly configurationSetting?: ConfigurationSetting; +} + +/** Represents a configuration parameter. */ +export interface ConfigurationParameter { + /** Name of the configuration parameter. */ + name?: string; + /** Value of the configuration parameter. */ + value?: string; +} + +/** Configuration setting of LCM (Local Configuration Manager). */ +export interface ConfigurationSetting { + /** + * Specifies how the LCM(Local Configuration Manager) actually applies the configuration to the target nodes. Possible values are ApplyOnly, ApplyAndMonitor, and ApplyAndAutoCorrect. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly configurationMode?: ConfigurationMode; + /** + * If true - new configurations downloaded from the pull service are allowed to overwrite the old ones on the target node. Otherwise, false + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly allowModuleOverwrite?: boolean; + /** + * Specifies what happens after a reboot during the application of a configuration. The possible values are ContinueConfiguration and StopConfiguration + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly actionAfterReboot?: ActionAfterReboot; + /** + * The time interval, in minutes, at which the LCM checks a pull service to get updated configurations. This value is ignored if the LCM is not configured in pull mode. The default value is 30. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly refreshFrequencyMins?: number; + /** + * Set this to true to automatically reboot the node after a configuration that requires reboot is applied. Otherwise, you will have to manually reboot the node for any configuration that requires it. The default value is false. To use this setting when a reboot condition is enacted by something other than DSC (such as Windows Installer), combine this setting with the xPendingReboot module. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly rebootIfNeeded?: boolean; + /** + * How often, in minutes, the current configuration is checked and applied. This property is ignored if the ConfigurationMode property is set to ApplyOnly. The default value is 15. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly configurationModeFrequencyMins?: number; +} + +export interface AssignmentReport { + /** + * ARM resource id of the report for the guest configuration assignment. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly id?: string; + /** + * GUID that identifies the guest configuration assignment report under a subscription, resource group. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly reportId?: string; + /** Configuration details of the guest configuration assignment. */ + assignment?: AssignmentInfo; + /** Information about the VM. */ + vm?: VMInfo; + /** + * Start date and time of the guest configuration assignment compliance status check. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly startTime?: Date; + /** + * End date and time of the guest configuration assignment compliance status check. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly endTime?: Date; + /** + * A value indicating compliance status of the machine for the assigned guest configuration. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly complianceStatus?: ComplianceStatus; + /** + * Type of report, Consistency or Initial + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly operationType?: Type; + /** The list of resources for which guest configuration assignment compliance is checked. */ + resources?: AssignmentReportResource[]; +} + +/** Information about the guest configuration assignment. */ +export interface AssignmentInfo { + /** + * Name of the guest configuration assignment. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; + /** Information about the configuration. */ + configuration?: ConfigurationInfo; +} + +/** Information about the configuration. */ +export interface ConfigurationInfo { + /** + * Name of the configuration. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; + /** + * Version of the configuration. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly version?: string; +} + +/** Information about the VM. */ +export interface VMInfo { + /** + * Azure resource Id of the VM. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly id?: string; + /** + * UUID(Universally Unique Identifier) of the VM. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly uuid?: string; +} + +/** The guest configuration assignment resource. */ +export interface AssignmentReportResource { + /** + * A value indicating compliance status of the machine for the assigned guest configuration. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly complianceStatus?: ComplianceStatus; + /** + * Name of the guest configuration assignment resource setting. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly resourceId?: string; + /** Compliance reason and reason code for a resource. */ + reasons?: AssignmentReportResourceComplianceReason[]; + /** + * Properties of a guest configuration assignment resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly properties?: Record; +} + +/** Reason and code for the compliance of the guest configuration assignment resource. */ +export interface AssignmentReportResourceComplianceReason { + /** + * Reason for the compliance of the guest configuration assignment resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly phrase?: string; + /** + * Code for the compliance of the guest configuration assignment resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly code?: string; +} + +/** Information about VMSS VM */ +export interface VmssvmInfo { + /** + * UUID of the VM. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly vmId?: string; + /** + * Azure resource Id of the VM. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly vmResourceId?: string; + /** + * A value indicating compliance status of the machine for the assigned guest configuration. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly complianceStatus?: ComplianceStatus; + /** + * Id of the latest report for the guest configuration assignment. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly latestReportId?: string; + /** + * Date and time when last compliance status was checked. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly lastComplianceChecked?: Date; +} + +/** Metadata pertaining to creation and last modification of the resource. */ +export interface SystemData { + /** The identity that created the resource. */ + createdBy?: string; + /** The type of identity that created the resource. */ + createdByType?: CreatedByType; + /** The timestamp of resource creation (UTC). */ + createdAt?: Date; + /** The identity that last modified the resource. */ + lastModifiedBy?: string; + /** The type of identity that last modified the resource. */ + lastModifiedByType?: CreatedByType; + /** The timestamp of resource last modification (UTC) */ + lastModifiedAt?: Date; +} + +/** The core properties of ARM resources */ +export interface Resource { + /** + * ARM resource id of the guest configuration assignment. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly id?: string; + /** Name of the guest configuration assignment. */ + name?: string; + /** Region where the VM is located. */ + location?: string; + /** + * The type of the resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; +} + +/** Error response of an operation failure */ +export interface ErrorResponse { + error?: ErrorResponseError; +} + +export interface ErrorResponseError { + /** Error code. */ + code?: string; + /** Detail error message indicating why the operation failed. */ + message?: string; +} + +/** The response of the list guest configuration assignment operation. */ +export interface GuestConfigurationAssignmentList { + /** Result of the list guest configuration assignment operation. */ + value?: GuestConfigurationAssignment[]; +} + +/** List of guest configuration assignment reports. */ +export interface GuestConfigurationAssignmentReportList { + /** List of reports for the guest configuration. Report contains information such as compliance status, reason and more. */ + value?: GuestConfigurationAssignmentReport[]; +} + +/** Report for the guest configuration assignment. Report contains information such as compliance status, reason, and more. */ +export interface GuestConfigurationAssignmentReport { + /** + * ARM resource id of the report for the guest configuration assignment. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly id?: string; + /** + * GUID that identifies the guest configuration assignment report under a subscription, resource group. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; + /** Properties of the guest configuration report. */ + properties?: GuestConfigurationAssignmentReportProperties; +} + +/** Report for the guest configuration assignment. Report contains information such as compliance status, reason, and more. */ +export interface GuestConfigurationAssignmentReportProperties { + /** + * A value indicating compliance status of the machine for the assigned guest configuration. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly complianceStatus?: ComplianceStatus; + /** + * GUID that identifies the guest configuration assignment report under a subscription, resource group. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly reportId?: string; + /** Configuration details of the guest configuration assignment. */ + assignment?: AssignmentInfo; + /** Information about the VM. */ + vm?: VMInfo; + /** + * Start date and time of the guest configuration assignment compliance status check. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly startTime?: Date; + /** + * End date and time of the guest configuration assignment compliance status check. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly endTime?: Date; + /** Details of the assignment report. */ + details?: AssignmentReportDetails; + /** + * Azure resource Id of the VMSS. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly vmssResourceId?: string; +} + +/** Details of the guest configuration assignment report. */ +export interface AssignmentReportDetails { + /** + * A value indicating compliance status of the machine for the assigned guest configuration. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly complianceStatus?: ComplianceStatus; + /** + * Start date and time of the guest configuration assignment compliance status check. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly startTime?: Date; + /** + * End date and time of the guest configuration assignment compliance status check. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly endTime?: Date; + /** + * GUID of the report. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly jobId?: string; + /** + * Type of report, Consistency or Initial + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly operationType?: Type; + /** The list of resources for which guest configuration assignment compliance is checked. */ + resources?: AssignmentReportResource[]; +} + +/** The response model for the list of Automation operations */ +export interface OperationList { + /** List of Automation operations supported by the Automation resource provider. */ + value?: Operation[]; +} + +/** GuestConfiguration REST API operation */ +export interface Operation { + /** Operation name: For ex. providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/write or read */ + name?: string; + /** Provider, Resource, Operation and description values. */ + display?: OperationDisplay; + /** Provider, Resource, Operation and description values. */ + properties?: OperationProperties; +} + +/** Provider, Resource, Operation and description values. */ +export interface OperationDisplay { + /** Service provider: Microsoft.GuestConfiguration */ + provider?: string; + /** Resource on which the operation is performed: For ex. */ + resource?: string; + /** Operation type: Read, write, delete, etc. */ + operation?: string; + /** Description about operation. */ + description?: string; +} + +/** Provider, Resource, Operation and description values. */ +export interface OperationProperties { + /** Service provider: Microsoft.GuestConfiguration */ + statusCode?: string; +} + +/** ARM proxy resource. */ +export interface ProxyResource extends Resource {} + +/** Guest configuration assignment is an association between a machine and guest configuration. */ +export interface GuestConfigurationAssignment extends ProxyResource { + /** Properties of the Guest configuration assignment. */ + properties?: GuestConfigurationAssignmentProperties; + /** + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly systemData?: SystemData; +} + +/** Known values of {@link Kind} that the service accepts. */ +export enum KnownKind { + /** DSC */ + DSC = "DSC", +} + +/** + * Defines values for Kind. \ + * {@link KnownKind} can be used interchangeably with Kind, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **DSC** + */ +export type Kind = string; + +/** Known values of {@link AssignmentType} that the service accepts. */ +export enum KnownAssignmentType { + /** Audit */ + Audit = "Audit", + /** DeployAndAutoCorrect */ + DeployAndAutoCorrect = "DeployAndAutoCorrect", + /** ApplyAndAutoCorrect */ + ApplyAndAutoCorrect = "ApplyAndAutoCorrect", + /** ApplyAndMonitor */ + ApplyAndMonitor = "ApplyAndMonitor", +} + +/** + * Defines values for AssignmentType. \ + * {@link KnownAssignmentType} can be used interchangeably with AssignmentType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Audit** \ + * **DeployAndAutoCorrect** \ + * **ApplyAndAutoCorrect** \ + * **ApplyAndMonitor** + */ +export type AssignmentType = string; + +/** Known values of {@link ConfigurationMode} that the service accepts. */ +export enum KnownConfigurationMode { + /** ApplyOnly */ + ApplyOnly = "ApplyOnly", + /** ApplyAndMonitor */ + ApplyAndMonitor = "ApplyAndMonitor", + /** ApplyAndAutoCorrect */ + ApplyAndAutoCorrect = "ApplyAndAutoCorrect", +} + +/** + * Defines values for ConfigurationMode. \ + * {@link KnownConfigurationMode} can be used interchangeably with ConfigurationMode, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **ApplyOnly** \ + * **ApplyAndMonitor** \ + * **ApplyAndAutoCorrect** + */ +export type ConfigurationMode = string; + +/** Known values of {@link ActionAfterReboot} that the service accepts. */ +export enum KnownActionAfterReboot { + /** ContinueConfiguration */ + ContinueConfiguration = "ContinueConfiguration", + /** StopConfiguration */ + StopConfiguration = "StopConfiguration", +} + +/** + * Defines values for ActionAfterReboot. \ + * {@link KnownActionAfterReboot} can be used interchangeably with ActionAfterReboot, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **ContinueConfiguration** \ + * **StopConfiguration** + */ +export type ActionAfterReboot = string; + +/** Known values of {@link ComplianceStatus} that the service accepts. */ +export enum KnownComplianceStatus { + /** Compliant */ + Compliant = "Compliant", + /** NonCompliant */ + NonCompliant = "NonCompliant", + /** Pending */ + Pending = "Pending", +} + +/** + * Defines values for ComplianceStatus. \ + * {@link KnownComplianceStatus} can be used interchangeably with ComplianceStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Compliant** \ + * **NonCompliant** \ + * **Pending** + */ +export type ComplianceStatus = string; + +/** Known values of {@link Type} that the service accepts. */ +export enum KnownType { + /** Consistency */ + Consistency = "Consistency", + /** Initial */ + Initial = "Initial", +} + +/** + * Defines values for Type. \ + * {@link KnownType} can be used interchangeably with Type, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Consistency** \ + * **Initial** + */ +export type Type = string; + +/** Known values of {@link ProvisioningState} that the service accepts. */ +export enum KnownProvisioningState { + /** Succeeded */ + Succeeded = "Succeeded", + /** Failed */ + Failed = "Failed", + /** Canceled */ + Canceled = "Canceled", + /** Created */ + Created = "Created", +} + +/** + * Defines values for ProvisioningState. \ + * {@link KnownProvisioningState} can be used interchangeably with ProvisioningState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Succeeded** \ + * **Failed** \ + * **Canceled** \ + * **Created** + */ +export type ProvisioningState = string; + +/** Known values of {@link CreatedByType} that the service accepts. */ +export enum KnownCreatedByType { + /** User */ + User = "User", + /** Application */ + Application = "Application", + /** ManagedIdentity */ + ManagedIdentity = "ManagedIdentity", + /** Key */ + Key = "Key", +} + +/** + * Defines values for CreatedByType. \ + * {@link KnownCreatedByType} can be used interchangeably with CreatedByType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **User** \ + * **Application** \ + * **ManagedIdentity** \ + * **Key** + */ +export type CreatedByType = string; + +/** Optional parameters. */ +export interface GuestConfigurationAssignmentsCreateOrUpdateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the createOrUpdate operation. */ +export type GuestConfigurationAssignmentsCreateOrUpdateResponse = + GuestConfigurationAssignment; + +/** Optional parameters. */ +export interface GuestConfigurationAssignmentsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type GuestConfigurationAssignmentsGetResponse = + GuestConfigurationAssignment; + +/** Optional parameters. */ +export interface GuestConfigurationAssignmentsDeleteOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface GuestConfigurationAssignmentsSubscriptionListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the subscriptionList operation. */ +export type GuestConfigurationAssignmentsSubscriptionListResponse = + GuestConfigurationAssignmentList; + +/** Optional parameters. */ +export interface GuestConfigurationAssignmentsRGListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the rGList operation. */ +export type GuestConfigurationAssignmentsRGListResponse = + GuestConfigurationAssignmentList; + +/** Optional parameters. */ +export interface GuestConfigurationAssignmentsListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type GuestConfigurationAssignmentsListResponse = + GuestConfigurationAssignmentList; + +/** Optional parameters. */ +export interface GuestConfigurationAssignmentReportsListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type GuestConfigurationAssignmentReportsListResponse = + GuestConfigurationAssignmentReportList; + +/** Optional parameters. */ +export interface GuestConfigurationAssignmentReportsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type GuestConfigurationAssignmentReportsGetResponse = + GuestConfigurationAssignmentReport; + +/** Optional parameters. */ +export interface GuestConfigurationHcrpAssignmentsCreateOrUpdateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the createOrUpdate operation. */ +export type GuestConfigurationHcrpAssignmentsCreateOrUpdateResponse = + GuestConfigurationAssignment; + +/** Optional parameters. */ +export interface GuestConfigurationHcrpAssignmentsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type GuestConfigurationHcrpAssignmentsGetResponse = + GuestConfigurationAssignment; + +/** Optional parameters. */ +export interface GuestConfigurationHcrpAssignmentsDeleteOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface GuestConfigurationHcrpAssignmentsListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type GuestConfigurationHcrpAssignmentsListResponse = + GuestConfigurationAssignmentList; + +/** Optional parameters. */ +export interface GuestConfigurationHcrpAssignmentReportsListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type GuestConfigurationHcrpAssignmentReportsListResponse = + GuestConfigurationAssignmentReportList; + +/** Optional parameters. */ +export interface GuestConfigurationHcrpAssignmentReportsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type GuestConfigurationHcrpAssignmentReportsGetResponse = + GuestConfigurationAssignmentReport; + +/** Optional parameters. */ +export interface GuestConfigurationAssignmentsVmssCreateOrUpdateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the createOrUpdate operation. */ +export type GuestConfigurationAssignmentsVmssCreateOrUpdateResponse = + GuestConfigurationAssignment; + +/** Optional parameters. */ +export interface GuestConfigurationAssignmentsVmssGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type GuestConfigurationAssignmentsVmssGetResponse = + GuestConfigurationAssignment; + +/** Optional parameters. */ +export interface GuestConfigurationAssignmentsVmssDeleteOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the delete operation. */ +export type GuestConfigurationAssignmentsVmssDeleteResponse = + GuestConfigurationAssignment; + +/** Optional parameters. */ +export interface GuestConfigurationAssignmentsVmssListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type GuestConfigurationAssignmentsVmssListResponse = + GuestConfigurationAssignmentList; + +/** Optional parameters. */ +export interface GuestConfigurationAssignmentReportsVmssListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type GuestConfigurationAssignmentReportsVmssListResponse = + GuestConfigurationAssignmentReportList; + +/** Optional parameters. */ +export interface GuestConfigurationAssignmentReportsVmssGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type GuestConfigurationAssignmentReportsVmssGetResponse = + GuestConfigurationAssignmentReport; + +/** Optional parameters. */ +export interface GuestConfigurationConnectedVMwarevSphereAssignmentsCreateOrUpdateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the createOrUpdate operation. */ +export type GuestConfigurationConnectedVMwarevSphereAssignmentsCreateOrUpdateResponse = + GuestConfigurationAssignment; + +/** Optional parameters. */ +export interface GuestConfigurationConnectedVMwarevSphereAssignmentsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type GuestConfigurationConnectedVMwarevSphereAssignmentsGetResponse = + GuestConfigurationAssignment; + +/** Optional parameters. */ +export interface GuestConfigurationConnectedVMwarevSphereAssignmentsDeleteOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface GuestConfigurationConnectedVMwarevSphereAssignmentsListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type GuestConfigurationConnectedVMwarevSphereAssignmentsListResponse = + GuestConfigurationAssignmentList; + +/** Optional parameters. */ +export interface GuestConfigurationConnectedVMwarevSphereAssignmentsReportsListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type GuestConfigurationConnectedVMwarevSphereAssignmentsReportsListResponse = + GuestConfigurationAssignmentReportList; + +/** Optional parameters. */ +export interface GuestConfigurationConnectedVMwarevSphereAssignmentsReportsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type GuestConfigurationConnectedVMwarevSphereAssignmentsReportsGetResponse = + GuestConfigurationAssignmentReport; + +/** Optional parameters. */ +export interface OperationsListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type OperationsListResponse = OperationList; + +/** Optional parameters. */ +export interface GuestConfigurationClientOptionalParams + extends coreClient.ServiceClientOptions { + /** server parameter */ + $host?: string; + /** Api Version */ + apiVersion?: string; + /** Overrides client endpoint. */ + endpoint?: string; +} diff --git a/sdk/guestconfiguration/arm-guestconfiguration/src/models/mappers.ts b/sdk/guestconfiguration/arm-guestconfiguration/src/models/mappers.ts new file mode 100644 index 000000000000..b716d082a984 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/src/models/mappers.ts @@ -0,0 +1,983 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import * as coreClient from "@azure/core-client"; + +export const GuestConfigurationAssignmentProperties: coreClient.CompositeMapper = + { + type: { + name: "Composite", + className: "GuestConfigurationAssignmentProperties", + modelProperties: { + targetResourceId: { + serializedName: "targetResourceId", + readOnly: true, + nullable: true, + type: { + name: "String", + }, + }, + guestConfiguration: { + serializedName: "guestConfiguration", + type: { + name: "Composite", + className: "GuestConfigurationNavigation", + }, + }, + complianceStatus: { + serializedName: "complianceStatus", + readOnly: true, + type: { + name: "String", + }, + }, + lastComplianceStatusChecked: { + serializedName: "lastComplianceStatusChecked", + readOnly: true, + nullable: true, + type: { + name: "DateTime", + }, + }, + latestReportId: { + serializedName: "latestReportId", + readOnly: true, + nullable: true, + type: { + name: "String", + }, + }, + parameterHash: { + serializedName: "parameterHash", + readOnly: true, + nullable: true, + type: { + name: "String", + }, + }, + latestAssignmentReport: { + serializedName: "latestAssignmentReport", + type: { + name: "Composite", + className: "AssignmentReport", + }, + }, + context: { + serializedName: "context", + type: { + name: "String", + }, + }, + assignmentHash: { + serializedName: "assignmentHash", + readOnly: true, + nullable: true, + type: { + name: "String", + }, + }, + provisioningState: { + serializedName: "provisioningState", + readOnly: true, + nullable: true, + type: { + name: "String", + }, + }, + resourceType: { + serializedName: "resourceType", + readOnly: true, + nullable: true, + type: { + name: "String", + }, + }, + vmssVMList: { + serializedName: "vmssVMList", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "VmssvmInfo", + }, + }, + }, + }, + }, + }, + }; + +export const GuestConfigurationNavigation: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "GuestConfigurationNavigation", + modelProperties: { + kind: { + serializedName: "kind", + type: { + name: "String", + }, + }, + name: { + serializedName: "name", + type: { + name: "String", + }, + }, + version: { + serializedName: "version", + type: { + name: "String", + }, + }, + contentUri: { + serializedName: "contentUri", + type: { + name: "String", + }, + }, + contentHash: { + serializedName: "contentHash", + type: { + name: "String", + }, + }, + assignmentType: { + serializedName: "assignmentType", + type: { + name: "String", + }, + }, + assignmentSource: { + serializedName: "assignmentSource", + readOnly: true, + nullable: true, + type: { + name: "String", + }, + }, + contentType: { + serializedName: "contentType", + readOnly: true, + nullable: true, + type: { + name: "String", + }, + }, + configurationParameter: { + serializedName: "configurationParameter", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ConfigurationParameter", + }, + }, + }, + }, + configurationProtectedParameter: { + serializedName: "configurationProtectedParameter", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ConfigurationParameter", + }, + }, + }, + }, + configurationSetting: { + serializedName: "configurationSetting", + type: { + name: "Composite", + className: "ConfigurationSetting", + }, + }, + }, + }, +}; + +export const ConfigurationParameter: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ConfigurationParameter", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String", + }, + }, + value: { + serializedName: "value", + type: { + name: "String", + }, + }, + }, + }, +}; + +export const ConfigurationSetting: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ConfigurationSetting", + modelProperties: { + configurationMode: { + serializedName: "configurationMode", + readOnly: true, + type: { + name: "String", + }, + }, + allowModuleOverwrite: { + serializedName: "allowModuleOverwrite", + readOnly: true, + type: { + name: "Boolean", + }, + }, + actionAfterReboot: { + serializedName: "actionAfterReboot", + readOnly: true, + type: { + name: "String", + }, + }, + refreshFrequencyMins: { + defaultValue: 30, + serializedName: "refreshFrequencyMins", + readOnly: true, + type: { + name: "Number", + }, + }, + rebootIfNeeded: { + serializedName: "rebootIfNeeded", + readOnly: true, + type: { + name: "Boolean", + }, + }, + configurationModeFrequencyMins: { + defaultValue: 15, + serializedName: "configurationModeFrequencyMins", + readOnly: true, + type: { + name: "Number", + }, + }, + }, + }, +}; + +export const AssignmentReport: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AssignmentReport", + modelProperties: { + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String", + }, + }, + reportId: { + serializedName: "reportId", + readOnly: true, + type: { + name: "String", + }, + }, + assignment: { + serializedName: "assignment", + type: { + name: "Composite", + className: "AssignmentInfo", + }, + }, + vm: { + serializedName: "vm", + type: { + name: "Composite", + className: "VMInfo", + }, + }, + startTime: { + serializedName: "startTime", + readOnly: true, + type: { + name: "DateTime", + }, + }, + endTime: { + serializedName: "endTime", + readOnly: true, + type: { + name: "DateTime", + }, + }, + complianceStatus: { + serializedName: "complianceStatus", + readOnly: true, + type: { + name: "String", + }, + }, + operationType: { + serializedName: "operationType", + readOnly: true, + type: { + name: "String", + }, + }, + resources: { + serializedName: "resources", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "AssignmentReportResource", + }, + }, + }, + }, + }, + }, +}; + +export const AssignmentInfo: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AssignmentInfo", + modelProperties: { + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String", + }, + }, + configuration: { + serializedName: "configuration", + type: { + name: "Composite", + className: "ConfigurationInfo", + }, + }, + }, + }, +}; + +export const ConfigurationInfo: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ConfigurationInfo", + modelProperties: { + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String", + }, + }, + version: { + serializedName: "version", + readOnly: true, + type: { + name: "String", + }, + }, + }, + }, +}; + +export const VMInfo: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "VMInfo", + modelProperties: { + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String", + }, + }, + uuid: { + serializedName: "uuid", + readOnly: true, + type: { + name: "String", + }, + }, + }, + }, +}; + +export const AssignmentReportResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AssignmentReportResource", + modelProperties: { + complianceStatus: { + serializedName: "complianceStatus", + readOnly: true, + type: { + name: "String", + }, + }, + resourceId: { + serializedName: "resourceId", + readOnly: true, + type: { + name: "String", + }, + }, + reasons: { + serializedName: "reasons", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "AssignmentReportResourceComplianceReason", + }, + }, + }, + }, + properties: { + serializedName: "properties", + readOnly: true, + type: { + name: "Dictionary", + value: { type: { name: "any" } }, + }, + }, + }, + }, +}; + +export const AssignmentReportResourceComplianceReason: coreClient.CompositeMapper = + { + type: { + name: "Composite", + className: "AssignmentReportResourceComplianceReason", + modelProperties: { + phrase: { + serializedName: "phrase", + readOnly: true, + type: { + name: "String", + }, + }, + code: { + serializedName: "code", + readOnly: true, + type: { + name: "String", + }, + }, + }, + }, + }; + +export const VmssvmInfo: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "VmssvmInfo", + modelProperties: { + vmId: { + serializedName: "vmId", + readOnly: true, + type: { + name: "String", + }, + }, + vmResourceId: { + serializedName: "vmResourceId", + readOnly: true, + type: { + name: "String", + }, + }, + complianceStatus: { + serializedName: "complianceStatus", + readOnly: true, + type: { + name: "String", + }, + }, + latestReportId: { + serializedName: "latestReportId", + readOnly: true, + nullable: true, + type: { + name: "String", + }, + }, + lastComplianceChecked: { + serializedName: "lastComplianceChecked", + readOnly: true, + nullable: true, + type: { + name: "DateTime", + }, + }, + }, + }, +}; + +export const SystemData: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SystemData", + modelProperties: { + createdBy: { + serializedName: "createdBy", + type: { + name: "String", + }, + }, + createdByType: { + serializedName: "createdByType", + type: { + name: "String", + }, + }, + createdAt: { + serializedName: "createdAt", + type: { + name: "DateTime", + }, + }, + lastModifiedBy: { + serializedName: "lastModifiedBy", + type: { + name: "String", + }, + }, + lastModifiedByType: { + serializedName: "lastModifiedByType", + type: { + name: "String", + }, + }, + lastModifiedAt: { + serializedName: "lastModifiedAt", + type: { + name: "DateTime", + }, + }, + }, + }, +}; + +export const Resource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Resource", + modelProperties: { + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String", + }, + }, + name: { + serializedName: "name", + type: { + name: "String", + }, + }, + location: { + serializedName: "location", + type: { + name: "String", + }, + }, + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String", + }, + }, + }, + }, +}; + +export const ErrorResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorResponse", + modelProperties: { + error: { + serializedName: "error", + type: { + name: "Composite", + className: "ErrorResponseError", + }, + }, + }, + }, +}; + +export const ErrorResponseError: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorResponseError", + modelProperties: { + code: { + serializedName: "code", + type: { + name: "String", + }, + }, + message: { + serializedName: "message", + type: { + name: "String", + }, + }, + }, + }, +}; + +export const GuestConfigurationAssignmentList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "GuestConfigurationAssignmentList", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "GuestConfigurationAssignment", + }, + }, + }, + }, + }, + }, +}; + +export const GuestConfigurationAssignmentReportList: coreClient.CompositeMapper = + { + type: { + name: "Composite", + className: "GuestConfigurationAssignmentReportList", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "GuestConfigurationAssignmentReport", + }, + }, + }, + }, + }, + }, + }; + +export const GuestConfigurationAssignmentReport: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "GuestConfigurationAssignmentReport", + modelProperties: { + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String", + }, + }, + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String", + }, + }, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "GuestConfigurationAssignmentReportProperties", + }, + }, + }, + }, +}; + +export const GuestConfigurationAssignmentReportProperties: coreClient.CompositeMapper = + { + type: { + name: "Composite", + className: "GuestConfigurationAssignmentReportProperties", + modelProperties: { + complianceStatus: { + serializedName: "complianceStatus", + readOnly: true, + type: { + name: "String", + }, + }, + reportId: { + serializedName: "reportId", + readOnly: true, + type: { + name: "String", + }, + }, + assignment: { + serializedName: "assignment", + type: { + name: "Composite", + className: "AssignmentInfo", + }, + }, + vm: { + serializedName: "vm", + type: { + name: "Composite", + className: "VMInfo", + }, + }, + startTime: { + serializedName: "startTime", + readOnly: true, + type: { + name: "DateTime", + }, + }, + endTime: { + serializedName: "endTime", + readOnly: true, + type: { + name: "DateTime", + }, + }, + details: { + serializedName: "details", + type: { + name: "Composite", + className: "AssignmentReportDetails", + }, + }, + vmssResourceId: { + serializedName: "vmssResourceId", + readOnly: true, + type: { + name: "String", + }, + }, + }, + }, + }; + +export const AssignmentReportDetails: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AssignmentReportDetails", + modelProperties: { + complianceStatus: { + serializedName: "complianceStatus", + readOnly: true, + type: { + name: "String", + }, + }, + startTime: { + serializedName: "startTime", + readOnly: true, + type: { + name: "DateTime", + }, + }, + endTime: { + serializedName: "endTime", + readOnly: true, + type: { + name: "DateTime", + }, + }, + jobId: { + serializedName: "jobId", + readOnly: true, + type: { + name: "String", + }, + }, + operationType: { + serializedName: "operationType", + readOnly: true, + type: { + name: "String", + }, + }, + resources: { + serializedName: "resources", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "AssignmentReportResource", + }, + }, + }, + }, + }, + }, +}; + +export const OperationList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationList", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Operation", + }, + }, + }, + }, + }, + }, +}; + +export const Operation: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Operation", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String", + }, + }, + display: { + serializedName: "display", + type: { + name: "Composite", + className: "OperationDisplay", + }, + }, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "OperationProperties", + }, + }, + }, + }, +}; + +export const OperationDisplay: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationDisplay", + modelProperties: { + provider: { + serializedName: "provider", + type: { + name: "String", + }, + }, + resource: { + serializedName: "resource", + type: { + name: "String", + }, + }, + operation: { + serializedName: "operation", + type: { + name: "String", + }, + }, + description: { + serializedName: "description", + type: { + name: "String", + }, + }, + }, + }, +}; + +export const OperationProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationProperties", + modelProperties: { + statusCode: { + serializedName: "statusCode", + type: { + name: "String", + }, + }, + }, + }, +}; + +export const ProxyResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ProxyResource", + modelProperties: { + ...Resource.type.modelProperties, + }, + }, +}; + +export const GuestConfigurationAssignment: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "GuestConfigurationAssignment", + modelProperties: { + ...ProxyResource.type.modelProperties, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "GuestConfigurationAssignmentProperties", + }, + }, + systemData: { + serializedName: "systemData", + type: { + name: "Composite", + className: "SystemData", + }, + }, + }, + }, +}; diff --git a/sdk/guestconfiguration/arm-guestconfiguration/src/models/parameters.ts b/sdk/guestconfiguration/arm-guestconfiguration/src/models/parameters.ts new file mode 100644 index 000000000000..edbbdbb361e5 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/src/models/parameters.ts @@ -0,0 +1,186 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + OperationParameter, + OperationURLParameter, + OperationQueryParameter, +} from "@azure/core-client"; +import { GuestConfigurationAssignment as GuestConfigurationAssignmentMapper } from "../models/mappers"; + +export const contentType: OperationParameter = { + parameterPath: ["options", "contentType"], + mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Content-Type", + type: { + name: "String", + }, + }, +}; + +export const parameters: OperationParameter = { + parameterPath: "parameters", + mapper: GuestConfigurationAssignmentMapper, +}; + +export const accept: OperationParameter = { + parameterPath: "accept", + mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Accept", + type: { + name: "String", + }, + }, +}; + +export const $host: OperationURLParameter = { + parameterPath: "$host", + mapper: { + serializedName: "$host", + required: true, + type: { + name: "String", + }, + }, + skipEncoding: true, +}; + +export const guestConfigurationAssignmentName: OperationURLParameter = { + parameterPath: "guestConfigurationAssignmentName", + mapper: { + serializedName: "guestConfigurationAssignmentName", + required: true, + type: { + name: "String", + }, + }, +}; + +export const subscriptionId: OperationURLParameter = { + parameterPath: "subscriptionId", + mapper: { + serializedName: "subscriptionId", + required: true, + type: { + name: "String", + }, + }, +}; + +export const resourceGroupName: OperationURLParameter = { + parameterPath: "resourceGroupName", + mapper: { + constraints: { + Pattern: new RegExp("^[-\\w\\._]+$"), + }, + serializedName: "resourceGroupName", + required: true, + type: { + name: "String", + }, + }, +}; + +export const vmName: OperationURLParameter = { + parameterPath: "vmName", + mapper: { + constraints: { + Pattern: new RegExp("^[a-zA-Z0-9][-a-zA-Z0-9_.]*[a-zA-Z0-9]$"), + }, + serializedName: "vmName", + required: true, + type: { + name: "String", + }, + }, +}; + +export const apiVersion: OperationQueryParameter = { + parameterPath: "apiVersion", + mapper: { + defaultValue: "2022-01-25", + isConstant: true, + serializedName: "api-version", + type: { + name: "String", + }, + }, +}; + +export const reportId: OperationURLParameter = { + parameterPath: "reportId", + mapper: { + serializedName: "reportId", + required: true, + type: { + name: "String", + }, + }, +}; + +export const machineName: OperationURLParameter = { + parameterPath: "machineName", + mapper: { + serializedName: "machineName", + required: true, + type: { + name: "String", + }, + }, +}; + +export const vmssName: OperationURLParameter = { + parameterPath: "vmssName", + mapper: { + serializedName: "vmssName", + required: true, + type: { + name: "String", + }, + }, +}; + +export const name: OperationURLParameter = { + parameterPath: "name", + mapper: { + serializedName: "name", + required: true, + type: { + name: "String", + }, + }, +}; + +export const id: OperationURLParameter = { + parameterPath: "id", + mapper: { + serializedName: "id", + required: true, + type: { + name: "String", + }, + }, +}; + +export const guestConfigurationAssignmentName1: OperationURLParameter = { + parameterPath: "guestConfigurationAssignmentName", + mapper: { + constraints: { + Pattern: new RegExp("^[^<>%&:\\\\?/#]*$"), + }, + serializedName: "guestConfigurationAssignmentName", + required: true, + type: { + name: "String", + }, + }, +}; diff --git a/sdk/guestconfiguration/arm-guestconfiguration/src/operations/guestConfigurationAssignmentReports.ts b/sdk/guestconfiguration/arm-guestconfiguration/src/operations/guestConfigurationAssignmentReports.ts new file mode 100644 index 000000000000..79f79ad60056 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/src/operations/guestConfigurationAssignmentReports.ts @@ -0,0 +1,128 @@ +/* + * 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 { GuestConfigurationAssignmentReports } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { GuestConfigurationClient } from "../guestConfigurationClient"; +import { + GuestConfigurationAssignmentReportsListOptionalParams, + GuestConfigurationAssignmentReportsListResponse, + GuestConfigurationAssignmentReportsGetOptionalParams, + GuestConfigurationAssignmentReportsGetResponse, +} from "../models"; + +/** Class containing GuestConfigurationAssignmentReports operations. */ +export class GuestConfigurationAssignmentReportsImpl + implements GuestConfigurationAssignmentReports +{ + private readonly client: GuestConfigurationClient; + + /** + * Initialize a new instance of the class GuestConfigurationAssignmentReports class. + * @param client Reference to the service client + */ + constructor(client: GuestConfigurationClient) { + this.client = client; + } + + /** + * List all reports for the guest configuration assignment, latest report first. + * @param resourceGroupName The resource group name. + * @param guestConfigurationAssignmentName The guest configuration assignment name. + * @param vmName The name of the virtual machine. + * @param options The options parameters. + */ + list( + resourceGroupName: string, + guestConfigurationAssignmentName: string, + vmName: string, + options?: GuestConfigurationAssignmentReportsListOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, guestConfigurationAssignmentName, vmName, options }, + listOperationSpec, + ); + } + + /** + * Get a report for the guest configuration assignment, by reportId. + * @param resourceGroupName The resource group name. + * @param guestConfigurationAssignmentName The guest configuration assignment name. + * @param reportId The GUID for the guest configuration assignment report. + * @param vmName The name of the virtual machine. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + guestConfigurationAssignmentName: string, + reportId: string, + vmName: string, + options?: GuestConfigurationAssignmentReportsGetOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + guestConfigurationAssignmentName, + reportId, + vmName, + options, + }, + getOperationSpec, + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}/reports", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.GuestConfigurationAssignmentReportList, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.guestConfigurationAssignmentName, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vmName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const getOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}/reports/{reportId}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.GuestConfigurationAssignmentReport, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.guestConfigurationAssignmentName, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vmName, + Parameters.reportId, + ], + headerParameters: [Parameters.accept], + serializer, +}; diff --git a/sdk/guestconfiguration/arm-guestconfiguration/src/operations/guestConfigurationAssignmentReportsVmss.ts b/sdk/guestconfiguration/arm-guestconfiguration/src/operations/guestConfigurationAssignmentReportsVmss.ts new file mode 100644 index 000000000000..04656edeb061 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/src/operations/guestConfigurationAssignmentReportsVmss.ts @@ -0,0 +1,189 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { GuestConfigurationAssignmentReportsVmss } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { GuestConfigurationClient } from "../guestConfigurationClient"; +import { + GuestConfigurationAssignmentReport, + GuestConfigurationAssignmentReportsVmssListOptionalParams, + GuestConfigurationAssignmentReportsVmssListResponse, + GuestConfigurationAssignmentReportsVmssGetOptionalParams, + GuestConfigurationAssignmentReportsVmssGetResponse, +} from "../models"; + +/// +/** Class containing GuestConfigurationAssignmentReportsVmss operations. */ +export class GuestConfigurationAssignmentReportsVmssImpl + implements GuestConfigurationAssignmentReportsVmss +{ + private readonly client: GuestConfigurationClient; + + /** + * Initialize a new instance of the class GuestConfigurationAssignmentReportsVmss class. + * @param client Reference to the service client + */ + constructor(client: GuestConfigurationClient) { + this.client = client; + } + + /** + * List all reports for the VMSS guest configuration assignment, latest report first. + * @param resourceGroupName The resource group name. + * @param vmssName The name of the virtual machine scale set. + * @param name The guest configuration assignment name. + * @param options The options parameters. + */ + public list( + resourceGroupName: string, + vmssName: string, + name: string, + options?: GuestConfigurationAssignmentReportsVmssListOptionalParams, + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(resourceGroupName, vmssName, name, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage( + resourceGroupName, + vmssName, + name, + options, + settings, + ); + }, + }; + } + + private async *listPagingPage( + resourceGroupName: string, + vmssName: string, + name: string, + options?: GuestConfigurationAssignmentReportsVmssListOptionalParams, + _settings?: PageSettings, + ): AsyncIterableIterator { + let result: GuestConfigurationAssignmentReportsVmssListResponse; + result = await this._list(resourceGroupName, vmssName, name, options); + yield result.value || []; + } + + private async *listPagingAll( + resourceGroupName: string, + vmssName: string, + name: string, + options?: GuestConfigurationAssignmentReportsVmssListOptionalParams, + ): AsyncIterableIterator { + for await (const page of this.listPagingPage( + resourceGroupName, + vmssName, + name, + options, + )) { + yield* page; + } + } + + /** + * List all reports for the VMSS guest configuration assignment, latest report first. + * @param resourceGroupName The resource group name. + * @param vmssName The name of the virtual machine scale set. + * @param name The guest configuration assignment name. + * @param options The options parameters. + */ + private _list( + resourceGroupName: string, + vmssName: string, + name: string, + options?: GuestConfigurationAssignmentReportsVmssListOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, vmssName, name, options }, + listOperationSpec, + ); + } + + /** + * Get a report for the VMSS guest configuration assignment, by reportId. + * @param resourceGroupName The resource group name. + * @param vmssName The name of the virtual machine scale set. + * @param name The guest configuration assignment name. + * @param id The GUID for the guest configuration assignment report. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + vmssName: string, + name: string, + id: string, + options?: GuestConfigurationAssignmentReportsVmssGetOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, vmssName, name, id, options }, + getOperationSpec, + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{name}/reports", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.GuestConfigurationAssignmentReportList, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vmssName, + Parameters.name, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const getOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{name}/reports/{id}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.GuestConfigurationAssignmentReport, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vmssName, + Parameters.name, + Parameters.id, + ], + headerParameters: [Parameters.accept], + serializer, +}; diff --git a/sdk/guestconfiguration/arm-guestconfiguration/src/operations/guestConfigurationAssignments.ts b/sdk/guestconfiguration/arm-guestconfiguration/src/operations/guestConfigurationAssignments.ts new file mode 100644 index 000000000000..48d1cbb61fa2 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/src/operations/guestConfigurationAssignments.ts @@ -0,0 +1,432 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { GuestConfigurationAssignments } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { GuestConfigurationClient } from "../guestConfigurationClient"; +import { + GuestConfigurationAssignment, + GuestConfigurationAssignmentsSubscriptionListOptionalParams, + GuestConfigurationAssignmentsSubscriptionListResponse, + GuestConfigurationAssignmentsRGListOptionalParams, + GuestConfigurationAssignmentsRGListResponse, + GuestConfigurationAssignmentsListOptionalParams, + GuestConfigurationAssignmentsListResponse, + GuestConfigurationAssignmentsCreateOrUpdateOptionalParams, + GuestConfigurationAssignmentsCreateOrUpdateResponse, + GuestConfigurationAssignmentsGetOptionalParams, + GuestConfigurationAssignmentsGetResponse, + GuestConfigurationAssignmentsDeleteOptionalParams, +} from "../models"; + +/// +/** Class containing GuestConfigurationAssignments operations. */ +export class GuestConfigurationAssignmentsImpl + implements GuestConfigurationAssignments +{ + private readonly client: GuestConfigurationClient; + + /** + * Initialize a new instance of the class GuestConfigurationAssignments class. + * @param client Reference to the service client + */ + constructor(client: GuestConfigurationClient) { + this.client = client; + } + + /** + * List all guest configuration assignments for a subscription. + * @param options The options parameters. + */ + public listSubscriptionList( + options?: GuestConfigurationAssignmentsSubscriptionListOptionalParams, + ): PagedAsyncIterableIterator { + const iter = this.subscriptionListPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.subscriptionListPagingPage(options, settings); + }, + }; + } + + private async *subscriptionListPagingPage( + options?: GuestConfigurationAssignmentsSubscriptionListOptionalParams, + _settings?: PageSettings, + ): AsyncIterableIterator { + let result: GuestConfigurationAssignmentsSubscriptionListResponse; + result = await this._subscriptionList(options); + yield result.value || []; + } + + private async *subscriptionListPagingAll( + options?: GuestConfigurationAssignmentsSubscriptionListOptionalParams, + ): AsyncIterableIterator { + for await (const page of this.subscriptionListPagingPage(options)) { + yield* page; + } + } + + /** + * List all guest configuration assignments for a resource group. + * @param resourceGroupName The resource group name. + * @param options The options parameters. + */ + public listRGList( + resourceGroupName: string, + options?: GuestConfigurationAssignmentsRGListOptionalParams, + ): PagedAsyncIterableIterator { + const iter = this.rGListPagingAll(resourceGroupName, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.rGListPagingPage(resourceGroupName, options, settings); + }, + }; + } + + private async *rGListPagingPage( + resourceGroupName: string, + options?: GuestConfigurationAssignmentsRGListOptionalParams, + _settings?: PageSettings, + ): AsyncIterableIterator { + let result: GuestConfigurationAssignmentsRGListResponse; + result = await this._rGList(resourceGroupName, options); + yield result.value || []; + } + + private async *rGListPagingAll( + resourceGroupName: string, + options?: GuestConfigurationAssignmentsRGListOptionalParams, + ): AsyncIterableIterator { + for await (const page of this.rGListPagingPage( + resourceGroupName, + options, + )) { + yield* page; + } + } + + /** + * List all guest configuration assignments for a virtual machine. + * @param resourceGroupName The resource group name. + * @param vmName The name of the virtual machine. + * @param options The options parameters. + */ + public list( + resourceGroupName: string, + vmName: string, + options?: GuestConfigurationAssignmentsListOptionalParams, + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(resourceGroupName, vmName, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage( + resourceGroupName, + vmName, + options, + settings, + ); + }, + }; + } + + private async *listPagingPage( + resourceGroupName: string, + vmName: string, + options?: GuestConfigurationAssignmentsListOptionalParams, + _settings?: PageSettings, + ): AsyncIterableIterator { + let result: GuestConfigurationAssignmentsListResponse; + result = await this._list(resourceGroupName, vmName, options); + yield result.value || []; + } + + private async *listPagingAll( + resourceGroupName: string, + vmName: string, + options?: GuestConfigurationAssignmentsListOptionalParams, + ): AsyncIterableIterator { + for await (const page of this.listPagingPage( + resourceGroupName, + vmName, + options, + )) { + yield* page; + } + } + + /** + * Creates an association between a VM and guest configuration + * @param guestConfigurationAssignmentName Name of the guest configuration assignment. + * @param resourceGroupName The resource group name. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the create or update guest configuration assignment. + * @param options The options parameters. + */ + createOrUpdate( + guestConfigurationAssignmentName: string, + resourceGroupName: string, + vmName: string, + parameters: GuestConfigurationAssignment, + options?: GuestConfigurationAssignmentsCreateOrUpdateOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { + guestConfigurationAssignmentName, + resourceGroupName, + vmName, + parameters, + options, + }, + createOrUpdateOperationSpec, + ); + } + + /** + * Get information about a guest configuration assignment + * @param resourceGroupName The resource group name. + * @param guestConfigurationAssignmentName The guest configuration assignment name. + * @param vmName The name of the virtual machine. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + guestConfigurationAssignmentName: string, + vmName: string, + options?: GuestConfigurationAssignmentsGetOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, guestConfigurationAssignmentName, vmName, options }, + getOperationSpec, + ); + } + + /** + * Delete a guest configuration assignment + * @param resourceGroupName The resource group name. + * @param guestConfigurationAssignmentName Name of the guest configuration assignment + * @param vmName The name of the virtual machine. + * @param options The options parameters. + */ + delete( + resourceGroupName: string, + guestConfigurationAssignmentName: string, + vmName: string, + options?: GuestConfigurationAssignmentsDeleteOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, guestConfigurationAssignmentName, vmName, options }, + deleteOperationSpec, + ); + } + + /** + * List all guest configuration assignments for a subscription. + * @param options The options parameters. + */ + private _subscriptionList( + options?: GuestConfigurationAssignmentsSubscriptionListOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { options }, + subscriptionListOperationSpec, + ); + } + + /** + * List all guest configuration assignments for a resource group. + * @param resourceGroupName The resource group name. + * @param options The options parameters. + */ + private _rGList( + resourceGroupName: string, + options?: GuestConfigurationAssignmentsRGListOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, options }, + rGListOperationSpec, + ); + } + + /** + * List all guest configuration assignments for a virtual machine. + * @param resourceGroupName The resource group name. + * @param vmName The name of the virtual machine. + * @param options The options parameters. + */ + private _list( + resourceGroupName: string, + vmName: string, + options?: GuestConfigurationAssignmentsListOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, vmName, options }, + listOperationSpec, + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.GuestConfigurationAssignment, + }, + 201: { + bodyMapper: Mappers.GuestConfigurationAssignment, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + requestBody: Parameters.parameters, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.guestConfigurationAssignmentName, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vmName, + ], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", + serializer, +}; +const getOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.GuestConfigurationAssignment, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.guestConfigurationAssignmentName, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vmName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}", + httpMethod: "DELETE", + responses: { + 200: {}, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.guestConfigurationAssignmentName, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vmName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const subscriptionListOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.GuestConfigurationAssignmentList, + }, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept], + serializer, +}; +const rGListOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.GuestConfigurationAssignmentList, + }, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const listOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.GuestConfigurationAssignmentList, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vmName, + ], + headerParameters: [Parameters.accept], + serializer, +}; diff --git a/sdk/guestconfiguration/arm-guestconfiguration/src/operations/guestConfigurationAssignmentsVmss.ts b/sdk/guestconfiguration/arm-guestconfiguration/src/operations/guestConfigurationAssignmentsVmss.ts new file mode 100644 index 000000000000..fda241d647ef --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/src/operations/guestConfigurationAssignmentsVmss.ts @@ -0,0 +1,271 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { GuestConfigurationAssignmentsVmss } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { GuestConfigurationClient } from "../guestConfigurationClient"; +import { + GuestConfigurationAssignment, + GuestConfigurationAssignmentsVmssListOptionalParams, + GuestConfigurationAssignmentsVmssListResponse, + GuestConfigurationAssignmentsVmssCreateOrUpdateOptionalParams, + GuestConfigurationAssignmentsVmssCreateOrUpdateResponse, + GuestConfigurationAssignmentsVmssGetOptionalParams, + GuestConfigurationAssignmentsVmssGetResponse, + GuestConfigurationAssignmentsVmssDeleteOptionalParams, + GuestConfigurationAssignmentsVmssDeleteResponse, +} from "../models"; + +/// +/** Class containing GuestConfigurationAssignmentsVmss operations. */ +export class GuestConfigurationAssignmentsVmssImpl + implements GuestConfigurationAssignmentsVmss +{ + private readonly client: GuestConfigurationClient; + + /** + * Initialize a new instance of the class GuestConfigurationAssignmentsVmss class. + * @param client Reference to the service client + */ + constructor(client: GuestConfigurationClient) { + this.client = client; + } + + /** + * List all guest configuration assignments for VMSS. + * @param resourceGroupName The resource group name. + * @param vmssName The name of the virtual machine scale set. + * @param options The options parameters. + */ + public list( + resourceGroupName: string, + vmssName: string, + options?: GuestConfigurationAssignmentsVmssListOptionalParams, + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(resourceGroupName, vmssName, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage( + resourceGroupName, + vmssName, + options, + settings, + ); + }, + }; + } + + private async *listPagingPage( + resourceGroupName: string, + vmssName: string, + options?: GuestConfigurationAssignmentsVmssListOptionalParams, + _settings?: PageSettings, + ): AsyncIterableIterator { + let result: GuestConfigurationAssignmentsVmssListResponse; + result = await this._list(resourceGroupName, vmssName, options); + yield result.value || []; + } + + private async *listPagingAll( + resourceGroupName: string, + vmssName: string, + options?: GuestConfigurationAssignmentsVmssListOptionalParams, + ): AsyncIterableIterator { + for await (const page of this.listPagingPage( + resourceGroupName, + vmssName, + options, + )) { + yield* page; + } + } + + /** + * Creates an association between a VMSS and guest configuration + * @param resourceGroupName The resource group name. + * @param vmssName The name of the virtual machine scale set. + * @param name Name of the guest configuration assignment. + * @param parameters Parameters supplied to the create or update guest configuration assignment. + * @param options The options parameters. + */ + createOrUpdate( + resourceGroupName: string, + vmssName: string, + name: string, + parameters: GuestConfigurationAssignment, + options?: GuestConfigurationAssignmentsVmssCreateOrUpdateOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, vmssName, name, parameters, options }, + createOrUpdateOperationSpec, + ); + } + + /** + * Get information about a guest configuration assignment for VMSS + * @param resourceGroupName The resource group name. + * @param vmssName The name of the virtual machine scale set. + * @param name The guest configuration assignment name. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + vmssName: string, + name: string, + options?: GuestConfigurationAssignmentsVmssGetOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, vmssName, name, options }, + getOperationSpec, + ); + } + + /** + * Delete a guest configuration assignment for VMSS + * @param resourceGroupName The resource group name. + * @param vmssName The name of the virtual machine scale set. + * @param name The guest configuration assignment name. + * @param options The options parameters. + */ + delete( + resourceGroupName: string, + vmssName: string, + name: string, + options?: GuestConfigurationAssignmentsVmssDeleteOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, vmssName, name, options }, + deleteOperationSpec, + ); + } + + /** + * List all guest configuration assignments for VMSS. + * @param resourceGroupName The resource group name. + * @param vmssName The name of the virtual machine scale set. + * @param options The options parameters. + */ + private _list( + resourceGroupName: string, + vmssName: string, + options?: GuestConfigurationAssignmentsVmssListOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, vmssName, options }, + listOperationSpec, + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{name}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.GuestConfigurationAssignment, + }, + 201: { + bodyMapper: Mappers.GuestConfigurationAssignment, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + requestBody: Parameters.parameters, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vmssName, + Parameters.name, + ], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", + serializer, +}; +const getOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{name}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.GuestConfigurationAssignment, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vmssName, + Parameters.name, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{name}", + httpMethod: "DELETE", + responses: { + 200: { + bodyMapper: Mappers.GuestConfigurationAssignment, + }, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vmssName, + Parameters.name, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const listOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.GuestConfigurationAssignmentList, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vmssName, + ], + headerParameters: [Parameters.accept], + serializer, +}; diff --git a/sdk/guestconfiguration/arm-guestconfiguration/src/operations/guestConfigurationConnectedVMwarevSphereAssignments.ts b/sdk/guestconfiguration/arm-guestconfiguration/src/operations/guestConfigurationConnectedVMwarevSphereAssignments.ts new file mode 100644 index 000000000000..7f76050724d1 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/src/operations/guestConfigurationConnectedVMwarevSphereAssignments.ts @@ -0,0 +1,274 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { GuestConfigurationConnectedVMwarevSphereAssignments } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { GuestConfigurationClient } from "../guestConfigurationClient"; +import { + GuestConfigurationAssignment, + GuestConfigurationConnectedVMwarevSphereAssignmentsListOptionalParams, + GuestConfigurationConnectedVMwarevSphereAssignmentsListResponse, + GuestConfigurationConnectedVMwarevSphereAssignmentsCreateOrUpdateOptionalParams, + GuestConfigurationConnectedVMwarevSphereAssignmentsCreateOrUpdateResponse, + GuestConfigurationConnectedVMwarevSphereAssignmentsGetOptionalParams, + GuestConfigurationConnectedVMwarevSphereAssignmentsGetResponse, + GuestConfigurationConnectedVMwarevSphereAssignmentsDeleteOptionalParams, +} from "../models"; + +/// +/** Class containing GuestConfigurationConnectedVMwarevSphereAssignments operations. */ +export class GuestConfigurationConnectedVMwarevSphereAssignmentsImpl + implements GuestConfigurationConnectedVMwarevSphereAssignments +{ + private readonly client: GuestConfigurationClient; + + /** + * Initialize a new instance of the class GuestConfigurationConnectedVMwarevSphereAssignments class. + * @param client Reference to the service client + */ + constructor(client: GuestConfigurationClient) { + this.client = client; + } + + /** + * List all guest configuration assignments for an ARC machine. + * @param resourceGroupName The resource group name. + * @param vmName The name of the virtual machine. + * @param options The options parameters. + */ + public list( + resourceGroupName: string, + vmName: string, + options?: GuestConfigurationConnectedVMwarevSphereAssignmentsListOptionalParams, + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(resourceGroupName, vmName, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage( + resourceGroupName, + vmName, + options, + settings, + ); + }, + }; + } + + private async *listPagingPage( + resourceGroupName: string, + vmName: string, + options?: GuestConfigurationConnectedVMwarevSphereAssignmentsListOptionalParams, + _settings?: PageSettings, + ): AsyncIterableIterator { + let result: GuestConfigurationConnectedVMwarevSphereAssignmentsListResponse; + result = await this._list(resourceGroupName, vmName, options); + yield result.value || []; + } + + private async *listPagingAll( + resourceGroupName: string, + vmName: string, + options?: GuestConfigurationConnectedVMwarevSphereAssignmentsListOptionalParams, + ): AsyncIterableIterator { + for await (const page of this.listPagingPage( + resourceGroupName, + vmName, + options, + )) { + yield* page; + } + } + + /** + * Creates an association between a Connected VM Sphere machine and guest configuration + * @param resourceGroupName The resource group name. + * @param vmName The name of the virtual machine. + * @param guestConfigurationAssignmentName Name of the guest configuration assignment. + * @param parameters Parameters supplied to the create or update guest configuration assignment. + * @param options The options parameters. + */ + createOrUpdate( + resourceGroupName: string, + vmName: string, + guestConfigurationAssignmentName: string, + parameters: GuestConfigurationAssignment, + options?: GuestConfigurationConnectedVMwarevSphereAssignmentsCreateOrUpdateOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + vmName, + guestConfigurationAssignmentName, + parameters, + options, + }, + createOrUpdateOperationSpec, + ); + } + + /** + * Get information about a guest configuration assignment + * @param resourceGroupName The resource group name. + * @param vmName The name of the virtual machine. + * @param guestConfigurationAssignmentName The guest configuration assignment name. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + vmName: string, + guestConfigurationAssignmentName: string, + options?: GuestConfigurationConnectedVMwarevSphereAssignmentsGetOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, vmName, guestConfigurationAssignmentName, options }, + getOperationSpec, + ); + } + + /** + * Delete a guest configuration assignment + * @param resourceGroupName The resource group name. + * @param vmName The name of the virtual machine. + * @param guestConfigurationAssignmentName Name of the guest configuration assignment + * @param options The options parameters. + */ + delete( + resourceGroupName: string, + vmName: string, + guestConfigurationAssignmentName: string, + options?: GuestConfigurationConnectedVMwarevSphereAssignmentsDeleteOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, vmName, guestConfigurationAssignmentName, options }, + deleteOperationSpec, + ); + } + + /** + * List all guest configuration assignments for an ARC machine. + * @param resourceGroupName The resource group name. + * @param vmName The name of the virtual machine. + * @param options The options parameters. + */ + private _list( + resourceGroupName: string, + vmName: string, + options?: GuestConfigurationConnectedVMwarevSphereAssignmentsListOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, vmName, options }, + listOperationSpec, + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualmachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.GuestConfigurationAssignment, + }, + 201: { + bodyMapper: Mappers.GuestConfigurationAssignment, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + requestBody: Parameters.parameters, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vmName, + Parameters.guestConfigurationAssignmentName1, + ], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", + serializer, +}; +const getOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualmachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.GuestConfigurationAssignment, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vmName, + Parameters.guestConfigurationAssignmentName1, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualmachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}", + httpMethod: "DELETE", + responses: { + 200: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vmName, + Parameters.guestConfigurationAssignmentName1, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const listOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualmachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.GuestConfigurationAssignmentList, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vmName, + ], + headerParameters: [Parameters.accept], + serializer, +}; diff --git a/sdk/guestconfiguration/arm-guestconfiguration/src/operations/guestConfigurationConnectedVMwarevSphereAssignmentsReports.ts b/sdk/guestconfiguration/arm-guestconfiguration/src/operations/guestConfigurationConnectedVMwarevSphereAssignmentsReports.ts new file mode 100644 index 000000000000..74cecc94f77b --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/src/operations/guestConfigurationConnectedVMwarevSphereAssignmentsReports.ts @@ -0,0 +1,128 @@ +/* + * 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 { GuestConfigurationConnectedVMwarevSphereAssignmentsReports } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { GuestConfigurationClient } from "../guestConfigurationClient"; +import { + GuestConfigurationConnectedVMwarevSphereAssignmentsReportsListOptionalParams, + GuestConfigurationConnectedVMwarevSphereAssignmentsReportsListResponse, + GuestConfigurationConnectedVMwarevSphereAssignmentsReportsGetOptionalParams, + GuestConfigurationConnectedVMwarevSphereAssignmentsReportsGetResponse, +} from "../models"; + +/** Class containing GuestConfigurationConnectedVMwarevSphereAssignmentsReports operations. */ +export class GuestConfigurationConnectedVMwarevSphereAssignmentsReportsImpl + implements GuestConfigurationConnectedVMwarevSphereAssignmentsReports +{ + private readonly client: GuestConfigurationClient; + + /** + * Initialize a new instance of the class GuestConfigurationConnectedVMwarevSphereAssignmentsReports class. + * @param client Reference to the service client + */ + constructor(client: GuestConfigurationClient) { + this.client = client; + } + + /** + * List all reports for the guest configuration assignment, latest report first. + * @param resourceGroupName The resource group name. + * @param vmName The name of the virtual machine. + * @param guestConfigurationAssignmentName The guest configuration assignment name. + * @param options The options parameters. + */ + list( + resourceGroupName: string, + vmName: string, + guestConfigurationAssignmentName: string, + options?: GuestConfigurationConnectedVMwarevSphereAssignmentsReportsListOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, vmName, guestConfigurationAssignmentName, options }, + listOperationSpec, + ); + } + + /** + * Get a report for the guest configuration assignment, by reportId. + * @param resourceGroupName The resource group name. + * @param vmName The name of the virtual machine. + * @param guestConfigurationAssignmentName The guest configuration assignment name. + * @param reportId The GUID for the guest configuration assignment report. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + vmName: string, + guestConfigurationAssignmentName: string, + reportId: string, + options?: GuestConfigurationConnectedVMwarevSphereAssignmentsReportsGetOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + vmName, + guestConfigurationAssignmentName, + reportId, + options, + }, + getOperationSpec, + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualmachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}/reports", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.GuestConfigurationAssignmentReportList, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vmName, + Parameters.guestConfigurationAssignmentName1, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const getOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualmachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}/reports/{reportId}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.GuestConfigurationAssignmentReport, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vmName, + Parameters.reportId, + Parameters.guestConfigurationAssignmentName1, + ], + headerParameters: [Parameters.accept], + serializer, +}; diff --git a/sdk/guestconfiguration/arm-guestconfiguration/src/operations/guestConfigurationHcrpAssignmentReports.ts b/sdk/guestconfiguration/arm-guestconfiguration/src/operations/guestConfigurationHcrpAssignmentReports.ts new file mode 100644 index 000000000000..4ed59b7435b9 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/src/operations/guestConfigurationHcrpAssignmentReports.ts @@ -0,0 +1,133 @@ +/* + * 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 { GuestConfigurationHcrpAssignmentReports } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { GuestConfigurationClient } from "../guestConfigurationClient"; +import { + GuestConfigurationHcrpAssignmentReportsListOptionalParams, + GuestConfigurationHcrpAssignmentReportsListResponse, + GuestConfigurationHcrpAssignmentReportsGetOptionalParams, + GuestConfigurationHcrpAssignmentReportsGetResponse, +} from "../models"; + +/** Class containing GuestConfigurationHcrpAssignmentReports operations. */ +export class GuestConfigurationHcrpAssignmentReportsImpl + implements GuestConfigurationHcrpAssignmentReports +{ + private readonly client: GuestConfigurationClient; + + /** + * Initialize a new instance of the class GuestConfigurationHcrpAssignmentReports class. + * @param client Reference to the service client + */ + constructor(client: GuestConfigurationClient) { + this.client = client; + } + + /** + * List all reports for the guest configuration assignment, latest report first. + * @param resourceGroupName The resource group name. + * @param guestConfigurationAssignmentName The guest configuration assignment name. + * @param machineName The name of the ARC machine. + * @param options The options parameters. + */ + list( + resourceGroupName: string, + guestConfigurationAssignmentName: string, + machineName: string, + options?: GuestConfigurationHcrpAssignmentReportsListOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + guestConfigurationAssignmentName, + machineName, + options, + }, + listOperationSpec, + ); + } + + /** + * Get a report for the guest configuration assignment, by reportId. + * @param resourceGroupName The resource group name. + * @param guestConfigurationAssignmentName The guest configuration assignment name. + * @param reportId The GUID for the guest configuration assignment report. + * @param machineName The name of the ARC machine. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + guestConfigurationAssignmentName: string, + reportId: string, + machineName: string, + options?: GuestConfigurationHcrpAssignmentReportsGetOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + guestConfigurationAssignmentName, + reportId, + machineName, + options, + }, + getOperationSpec, + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}/reports", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.GuestConfigurationAssignmentReportList, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.guestConfigurationAssignmentName, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.machineName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const getOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}/reports/{reportId}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.GuestConfigurationAssignmentReport, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.guestConfigurationAssignmentName, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.reportId, + Parameters.machineName, + ], + headerParameters: [Parameters.accept], + serializer, +}; diff --git a/sdk/guestconfiguration/arm-guestconfiguration/src/operations/guestConfigurationHcrpAssignments.ts b/sdk/guestconfiguration/arm-guestconfiguration/src/operations/guestConfigurationHcrpAssignments.ts new file mode 100644 index 000000000000..52630872489c --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/src/operations/guestConfigurationHcrpAssignments.ts @@ -0,0 +1,283 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { GuestConfigurationHcrpAssignments } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { GuestConfigurationClient } from "../guestConfigurationClient"; +import { + GuestConfigurationAssignment, + GuestConfigurationHcrpAssignmentsListOptionalParams, + GuestConfigurationHcrpAssignmentsListResponse, + GuestConfigurationHcrpAssignmentsCreateOrUpdateOptionalParams, + GuestConfigurationHcrpAssignmentsCreateOrUpdateResponse, + GuestConfigurationHcrpAssignmentsGetOptionalParams, + GuestConfigurationHcrpAssignmentsGetResponse, + GuestConfigurationHcrpAssignmentsDeleteOptionalParams, +} from "../models"; + +/// +/** Class containing GuestConfigurationHcrpAssignments operations. */ +export class GuestConfigurationHcrpAssignmentsImpl + implements GuestConfigurationHcrpAssignments +{ + private readonly client: GuestConfigurationClient; + + /** + * Initialize a new instance of the class GuestConfigurationHcrpAssignments class. + * @param client Reference to the service client + */ + constructor(client: GuestConfigurationClient) { + this.client = client; + } + + /** + * List all guest configuration assignments for an ARC machine. + * @param resourceGroupName The resource group name. + * @param machineName The name of the ARC machine. + * @param options The options parameters. + */ + public list( + resourceGroupName: string, + machineName: string, + options?: GuestConfigurationHcrpAssignmentsListOptionalParams, + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(resourceGroupName, machineName, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage( + resourceGroupName, + machineName, + options, + settings, + ); + }, + }; + } + + private async *listPagingPage( + resourceGroupName: string, + machineName: string, + options?: GuestConfigurationHcrpAssignmentsListOptionalParams, + _settings?: PageSettings, + ): AsyncIterableIterator { + let result: GuestConfigurationHcrpAssignmentsListResponse; + result = await this._list(resourceGroupName, machineName, options); + yield result.value || []; + } + + private async *listPagingAll( + resourceGroupName: string, + machineName: string, + options?: GuestConfigurationHcrpAssignmentsListOptionalParams, + ): AsyncIterableIterator { + for await (const page of this.listPagingPage( + resourceGroupName, + machineName, + options, + )) { + yield* page; + } + } + + /** + * Creates an association between a ARC machine and guest configuration + * @param guestConfigurationAssignmentName Name of the guest configuration assignment. + * @param resourceGroupName The resource group name. + * @param machineName The name of the ARC machine. + * @param parameters Parameters supplied to the create or update guest configuration assignment. + * @param options The options parameters. + */ + createOrUpdate( + guestConfigurationAssignmentName: string, + resourceGroupName: string, + machineName: string, + parameters: GuestConfigurationAssignment, + options?: GuestConfigurationHcrpAssignmentsCreateOrUpdateOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { + guestConfigurationAssignmentName, + resourceGroupName, + machineName, + parameters, + options, + }, + createOrUpdateOperationSpec, + ); + } + + /** + * Get information about a guest configuration assignment + * @param resourceGroupName The resource group name. + * @param guestConfigurationAssignmentName The guest configuration assignment name. + * @param machineName The name of the ARC machine. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + guestConfigurationAssignmentName: string, + machineName: string, + options?: GuestConfigurationHcrpAssignmentsGetOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + guestConfigurationAssignmentName, + machineName, + options, + }, + getOperationSpec, + ); + } + + /** + * Delete a guest configuration assignment + * @param resourceGroupName The resource group name. + * @param guestConfigurationAssignmentName Name of the guest configuration assignment + * @param machineName The name of the ARC machine. + * @param options The options parameters. + */ + delete( + resourceGroupName: string, + guestConfigurationAssignmentName: string, + machineName: string, + options?: GuestConfigurationHcrpAssignmentsDeleteOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + guestConfigurationAssignmentName, + machineName, + options, + }, + deleteOperationSpec, + ); + } + + /** + * List all guest configuration assignments for an ARC machine. + * @param resourceGroupName The resource group name. + * @param machineName The name of the ARC machine. + * @param options The options parameters. + */ + private _list( + resourceGroupName: string, + machineName: string, + options?: GuestConfigurationHcrpAssignmentsListOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, machineName, options }, + listOperationSpec, + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.GuestConfigurationAssignment, + }, + 201: { + bodyMapper: Mappers.GuestConfigurationAssignment, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + requestBody: Parameters.parameters, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.guestConfigurationAssignmentName, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.machineName, + ], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", + serializer, +}; +const getOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.GuestConfigurationAssignment, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.guestConfigurationAssignmentName, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.machineName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}", + httpMethod: "DELETE", + responses: { + 200: {}, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.guestConfigurationAssignmentName, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.machineName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const listOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.GuestConfigurationAssignmentList, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.machineName, + ], + headerParameters: [Parameters.accept], + serializer, +}; diff --git a/sdk/guestconfiguration/arm-guestconfiguration/src/operations/index.ts b/sdk/guestconfiguration/arm-guestconfiguration/src/operations/index.ts new file mode 100644 index 000000000000..37af41210fb2 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/src/operations/index.ts @@ -0,0 +1,17 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export * from "./guestConfigurationAssignments"; +export * from "./guestConfigurationAssignmentReports"; +export * from "./guestConfigurationHcrpAssignments"; +export * from "./guestConfigurationHcrpAssignmentReports"; +export * from "./guestConfigurationAssignmentsVmss"; +export * from "./guestConfigurationAssignmentReportsVmss"; +export * from "./guestConfigurationConnectedVMwarevSphereAssignments"; +export * from "./guestConfigurationConnectedVMwarevSphereAssignmentsReports"; +export * from "./operations"; diff --git a/sdk/guestconfiguration/arm-guestconfiguration/src/operations/operations.ts b/sdk/guestconfiguration/arm-guestconfiguration/src/operations/operations.ts new file mode 100644 index 000000000000..5fd860e04026 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/src/operations/operations.ts @@ -0,0 +1,103 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { Operations } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { GuestConfigurationClient } from "../guestConfigurationClient"; +import { + Operation, + OperationsListOptionalParams, + OperationsListResponse, +} from "../models"; + +/// +/** Class containing Operations operations. */ +export class OperationsImpl implements Operations { + private readonly client: GuestConfigurationClient; + + /** + * Initialize a new instance of the class Operations class. + * @param client Reference to the service client + */ + constructor(client: GuestConfigurationClient) { + this.client = client; + } + + /** + * Lists all of the available GuestConfiguration REST API operations. + * @param options The options parameters. + */ + public list( + options?: OperationsListOptionalParams, + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(options, settings); + }, + }; + } + + private async *listPagingPage( + options?: OperationsListOptionalParams, + _settings?: PageSettings, + ): AsyncIterableIterator { + let result: OperationsListResponse; + result = await this._list(options); + yield result.value || []; + } + + private async *listPagingAll( + options?: OperationsListOptionalParams, + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(options)) { + yield* page; + } + } + + /** + * Lists all of the available GuestConfiguration REST API operations. + * @param options The options parameters. + */ + private _list( + options?: OperationsListOptionalParams, + ): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.GuestConfiguration/operations", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.OperationList, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host], + headerParameters: [Parameters.accept], + serializer, +}; diff --git a/sdk/guestconfiguration/arm-guestconfiguration/src/operationsInterfaces/guestConfigurationAssignmentReports.ts b/sdk/guestconfiguration/arm-guestconfiguration/src/operationsInterfaces/guestConfigurationAssignmentReports.ts new file mode 100644 index 000000000000..cfffc5fbe443 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/src/operationsInterfaces/guestConfigurationAssignmentReports.ts @@ -0,0 +1,46 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + GuestConfigurationAssignmentReportsListOptionalParams, + GuestConfigurationAssignmentReportsListResponse, + GuestConfigurationAssignmentReportsGetOptionalParams, + GuestConfigurationAssignmentReportsGetResponse, +} from "../models"; + +/** Interface representing a GuestConfigurationAssignmentReports. */ +export interface GuestConfigurationAssignmentReports { + /** + * List all reports for the guest configuration assignment, latest report first. + * @param resourceGroupName The resource group name. + * @param guestConfigurationAssignmentName The guest configuration assignment name. + * @param vmName The name of the virtual machine. + * @param options The options parameters. + */ + list( + resourceGroupName: string, + guestConfigurationAssignmentName: string, + vmName: string, + options?: GuestConfigurationAssignmentReportsListOptionalParams, + ): Promise; + /** + * Get a report for the guest configuration assignment, by reportId. + * @param resourceGroupName The resource group name. + * @param guestConfigurationAssignmentName The guest configuration assignment name. + * @param reportId The GUID for the guest configuration assignment report. + * @param vmName The name of the virtual machine. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + guestConfigurationAssignmentName: string, + reportId: string, + vmName: string, + options?: GuestConfigurationAssignmentReportsGetOptionalParams, + ): Promise; +} diff --git a/sdk/guestconfiguration/arm-guestconfiguration/src/operationsInterfaces/guestConfigurationAssignmentReportsVmss.ts b/sdk/guestconfiguration/arm-guestconfiguration/src/operationsInterfaces/guestConfigurationAssignmentReportsVmss.ts new file mode 100644 index 000000000000..f3a75115d683 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/src/operationsInterfaces/guestConfigurationAssignmentReportsVmss.ts @@ -0,0 +1,48 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { + GuestConfigurationAssignmentReport, + GuestConfigurationAssignmentReportsVmssListOptionalParams, + GuestConfigurationAssignmentReportsVmssGetOptionalParams, + GuestConfigurationAssignmentReportsVmssGetResponse, +} from "../models"; + +/// +/** Interface representing a GuestConfigurationAssignmentReportsVmss. */ +export interface GuestConfigurationAssignmentReportsVmss { + /** + * List all reports for the VMSS guest configuration assignment, latest report first. + * @param resourceGroupName The resource group name. + * @param vmssName The name of the virtual machine scale set. + * @param name The guest configuration assignment name. + * @param options The options parameters. + */ + list( + resourceGroupName: string, + vmssName: string, + name: string, + options?: GuestConfigurationAssignmentReportsVmssListOptionalParams, + ): PagedAsyncIterableIterator; + /** + * Get a report for the VMSS guest configuration assignment, by reportId. + * @param resourceGroupName The resource group name. + * @param vmssName The name of the virtual machine scale set. + * @param name The guest configuration assignment name. + * @param id The GUID for the guest configuration assignment report. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + vmssName: string, + name: string, + id: string, + options?: GuestConfigurationAssignmentReportsVmssGetOptionalParams, + ): Promise; +} diff --git a/sdk/guestconfiguration/arm-guestconfiguration/src/operationsInterfaces/guestConfigurationAssignments.ts b/sdk/guestconfiguration/arm-guestconfiguration/src/operationsInterfaces/guestConfigurationAssignments.ts new file mode 100644 index 000000000000..c9dd97801ed7 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/src/operationsInterfaces/guestConfigurationAssignments.ts @@ -0,0 +1,93 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { + GuestConfigurationAssignment, + GuestConfigurationAssignmentsSubscriptionListOptionalParams, + GuestConfigurationAssignmentsRGListOptionalParams, + GuestConfigurationAssignmentsListOptionalParams, + GuestConfigurationAssignmentsCreateOrUpdateOptionalParams, + GuestConfigurationAssignmentsCreateOrUpdateResponse, + GuestConfigurationAssignmentsGetOptionalParams, + GuestConfigurationAssignmentsGetResponse, + GuestConfigurationAssignmentsDeleteOptionalParams, +} from "../models"; + +/// +/** Interface representing a GuestConfigurationAssignments. */ +export interface GuestConfigurationAssignments { + /** + * List all guest configuration assignments for a subscription. + * @param options The options parameters. + */ + listSubscriptionList( + options?: GuestConfigurationAssignmentsSubscriptionListOptionalParams, + ): PagedAsyncIterableIterator; + /** + * List all guest configuration assignments for a resource group. + * @param resourceGroupName The resource group name. + * @param options The options parameters. + */ + listRGList( + resourceGroupName: string, + options?: GuestConfigurationAssignmentsRGListOptionalParams, + ): PagedAsyncIterableIterator; + /** + * List all guest configuration assignments for a virtual machine. + * @param resourceGroupName The resource group name. + * @param vmName The name of the virtual machine. + * @param options The options parameters. + */ + list( + resourceGroupName: string, + vmName: string, + options?: GuestConfigurationAssignmentsListOptionalParams, + ): PagedAsyncIterableIterator; + /** + * Creates an association between a VM and guest configuration + * @param guestConfigurationAssignmentName Name of the guest configuration assignment. + * @param resourceGroupName The resource group name. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the create or update guest configuration assignment. + * @param options The options parameters. + */ + createOrUpdate( + guestConfigurationAssignmentName: string, + resourceGroupName: string, + vmName: string, + parameters: GuestConfigurationAssignment, + options?: GuestConfigurationAssignmentsCreateOrUpdateOptionalParams, + ): Promise; + /** + * Get information about a guest configuration assignment + * @param resourceGroupName The resource group name. + * @param guestConfigurationAssignmentName The guest configuration assignment name. + * @param vmName The name of the virtual machine. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + guestConfigurationAssignmentName: string, + vmName: string, + options?: GuestConfigurationAssignmentsGetOptionalParams, + ): Promise; + /** + * Delete a guest configuration assignment + * @param resourceGroupName The resource group name. + * @param guestConfigurationAssignmentName Name of the guest configuration assignment + * @param vmName The name of the virtual machine. + * @param options The options parameters. + */ + delete( + resourceGroupName: string, + guestConfigurationAssignmentName: string, + vmName: string, + options?: GuestConfigurationAssignmentsDeleteOptionalParams, + ): Promise; +} diff --git a/sdk/guestconfiguration/arm-guestconfiguration/src/operationsInterfaces/guestConfigurationAssignmentsVmss.ts b/sdk/guestconfiguration/arm-guestconfiguration/src/operationsInterfaces/guestConfigurationAssignmentsVmss.ts new file mode 100644 index 000000000000..edbdadd9b7db --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/src/operationsInterfaces/guestConfigurationAssignmentsVmss.ts @@ -0,0 +1,76 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { + GuestConfigurationAssignment, + GuestConfigurationAssignmentsVmssListOptionalParams, + GuestConfigurationAssignmentsVmssCreateOrUpdateOptionalParams, + GuestConfigurationAssignmentsVmssCreateOrUpdateResponse, + GuestConfigurationAssignmentsVmssGetOptionalParams, + GuestConfigurationAssignmentsVmssGetResponse, + GuestConfigurationAssignmentsVmssDeleteOptionalParams, + GuestConfigurationAssignmentsVmssDeleteResponse, +} from "../models"; + +/// +/** Interface representing a GuestConfigurationAssignmentsVmss. */ +export interface GuestConfigurationAssignmentsVmss { + /** + * List all guest configuration assignments for VMSS. + * @param resourceGroupName The resource group name. + * @param vmssName The name of the virtual machine scale set. + * @param options The options parameters. + */ + list( + resourceGroupName: string, + vmssName: string, + options?: GuestConfigurationAssignmentsVmssListOptionalParams, + ): PagedAsyncIterableIterator; + /** + * Creates an association between a VMSS and guest configuration + * @param resourceGroupName The resource group name. + * @param vmssName The name of the virtual machine scale set. + * @param name Name of the guest configuration assignment. + * @param parameters Parameters supplied to the create or update guest configuration assignment. + * @param options The options parameters. + */ + createOrUpdate( + resourceGroupName: string, + vmssName: string, + name: string, + parameters: GuestConfigurationAssignment, + options?: GuestConfigurationAssignmentsVmssCreateOrUpdateOptionalParams, + ): Promise; + /** + * Get information about a guest configuration assignment for VMSS + * @param resourceGroupName The resource group name. + * @param vmssName The name of the virtual machine scale set. + * @param name The guest configuration assignment name. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + vmssName: string, + name: string, + options?: GuestConfigurationAssignmentsVmssGetOptionalParams, + ): Promise; + /** + * Delete a guest configuration assignment for VMSS + * @param resourceGroupName The resource group name. + * @param vmssName The name of the virtual machine scale set. + * @param name The guest configuration assignment name. + * @param options The options parameters. + */ + delete( + resourceGroupName: string, + vmssName: string, + name: string, + options?: GuestConfigurationAssignmentsVmssDeleteOptionalParams, + ): Promise; +} diff --git a/sdk/guestconfiguration/arm-guestconfiguration/src/operationsInterfaces/guestConfigurationConnectedVMwarevSphereAssignments.ts b/sdk/guestconfiguration/arm-guestconfiguration/src/operationsInterfaces/guestConfigurationConnectedVMwarevSphereAssignments.ts new file mode 100644 index 000000000000..6ca12c89b6ad --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/src/operationsInterfaces/guestConfigurationConnectedVMwarevSphereAssignments.ts @@ -0,0 +1,75 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { + GuestConfigurationAssignment, + GuestConfigurationConnectedVMwarevSphereAssignmentsListOptionalParams, + GuestConfigurationConnectedVMwarevSphereAssignmentsCreateOrUpdateOptionalParams, + GuestConfigurationConnectedVMwarevSphereAssignmentsCreateOrUpdateResponse, + GuestConfigurationConnectedVMwarevSphereAssignmentsGetOptionalParams, + GuestConfigurationConnectedVMwarevSphereAssignmentsGetResponse, + GuestConfigurationConnectedVMwarevSphereAssignmentsDeleteOptionalParams, +} from "../models"; + +/// +/** Interface representing a GuestConfigurationConnectedVMwarevSphereAssignments. */ +export interface GuestConfigurationConnectedVMwarevSphereAssignments { + /** + * List all guest configuration assignments for an ARC machine. + * @param resourceGroupName The resource group name. + * @param vmName The name of the virtual machine. + * @param options The options parameters. + */ + list( + resourceGroupName: string, + vmName: string, + options?: GuestConfigurationConnectedVMwarevSphereAssignmentsListOptionalParams, + ): PagedAsyncIterableIterator; + /** + * Creates an association between a Connected VM Sphere machine and guest configuration + * @param resourceGroupName The resource group name. + * @param vmName The name of the virtual machine. + * @param guestConfigurationAssignmentName Name of the guest configuration assignment. + * @param parameters Parameters supplied to the create or update guest configuration assignment. + * @param options The options parameters. + */ + createOrUpdate( + resourceGroupName: string, + vmName: string, + guestConfigurationAssignmentName: string, + parameters: GuestConfigurationAssignment, + options?: GuestConfigurationConnectedVMwarevSphereAssignmentsCreateOrUpdateOptionalParams, + ): Promise; + /** + * Get information about a guest configuration assignment + * @param resourceGroupName The resource group name. + * @param vmName The name of the virtual machine. + * @param guestConfigurationAssignmentName The guest configuration assignment name. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + vmName: string, + guestConfigurationAssignmentName: string, + options?: GuestConfigurationConnectedVMwarevSphereAssignmentsGetOptionalParams, + ): Promise; + /** + * Delete a guest configuration assignment + * @param resourceGroupName The resource group name. + * @param vmName The name of the virtual machine. + * @param guestConfigurationAssignmentName Name of the guest configuration assignment + * @param options The options parameters. + */ + delete( + resourceGroupName: string, + vmName: string, + guestConfigurationAssignmentName: string, + options?: GuestConfigurationConnectedVMwarevSphereAssignmentsDeleteOptionalParams, + ): Promise; +} diff --git a/sdk/guestconfiguration/arm-guestconfiguration/src/operationsInterfaces/guestConfigurationConnectedVMwarevSphereAssignmentsReports.ts b/sdk/guestconfiguration/arm-guestconfiguration/src/operationsInterfaces/guestConfigurationConnectedVMwarevSphereAssignmentsReports.ts new file mode 100644 index 000000000000..b36c14e792e1 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/src/operationsInterfaces/guestConfigurationConnectedVMwarevSphereAssignmentsReports.ts @@ -0,0 +1,46 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + GuestConfigurationConnectedVMwarevSphereAssignmentsReportsListOptionalParams, + GuestConfigurationConnectedVMwarevSphereAssignmentsReportsListResponse, + GuestConfigurationConnectedVMwarevSphereAssignmentsReportsGetOptionalParams, + GuestConfigurationConnectedVMwarevSphereAssignmentsReportsGetResponse, +} from "../models"; + +/** Interface representing a GuestConfigurationConnectedVMwarevSphereAssignmentsReports. */ +export interface GuestConfigurationConnectedVMwarevSphereAssignmentsReports { + /** + * List all reports for the guest configuration assignment, latest report first. + * @param resourceGroupName The resource group name. + * @param vmName The name of the virtual machine. + * @param guestConfigurationAssignmentName The guest configuration assignment name. + * @param options The options parameters. + */ + list( + resourceGroupName: string, + vmName: string, + guestConfigurationAssignmentName: string, + options?: GuestConfigurationConnectedVMwarevSphereAssignmentsReportsListOptionalParams, + ): Promise; + /** + * Get a report for the guest configuration assignment, by reportId. + * @param resourceGroupName The resource group name. + * @param vmName The name of the virtual machine. + * @param guestConfigurationAssignmentName The guest configuration assignment name. + * @param reportId The GUID for the guest configuration assignment report. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + vmName: string, + guestConfigurationAssignmentName: string, + reportId: string, + options?: GuestConfigurationConnectedVMwarevSphereAssignmentsReportsGetOptionalParams, + ): Promise; +} diff --git a/sdk/guestconfiguration/arm-guestconfiguration/src/operationsInterfaces/guestConfigurationHcrpAssignmentReports.ts b/sdk/guestconfiguration/arm-guestconfiguration/src/operationsInterfaces/guestConfigurationHcrpAssignmentReports.ts new file mode 100644 index 000000000000..4d7516488ba5 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/src/operationsInterfaces/guestConfigurationHcrpAssignmentReports.ts @@ -0,0 +1,46 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + GuestConfigurationHcrpAssignmentReportsListOptionalParams, + GuestConfigurationHcrpAssignmentReportsListResponse, + GuestConfigurationHcrpAssignmentReportsGetOptionalParams, + GuestConfigurationHcrpAssignmentReportsGetResponse, +} from "../models"; + +/** Interface representing a GuestConfigurationHcrpAssignmentReports. */ +export interface GuestConfigurationHcrpAssignmentReports { + /** + * List all reports for the guest configuration assignment, latest report first. + * @param resourceGroupName The resource group name. + * @param guestConfigurationAssignmentName The guest configuration assignment name. + * @param machineName The name of the ARC machine. + * @param options The options parameters. + */ + list( + resourceGroupName: string, + guestConfigurationAssignmentName: string, + machineName: string, + options?: GuestConfigurationHcrpAssignmentReportsListOptionalParams, + ): Promise; + /** + * Get a report for the guest configuration assignment, by reportId. + * @param resourceGroupName The resource group name. + * @param guestConfigurationAssignmentName The guest configuration assignment name. + * @param reportId The GUID for the guest configuration assignment report. + * @param machineName The name of the ARC machine. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + guestConfigurationAssignmentName: string, + reportId: string, + machineName: string, + options?: GuestConfigurationHcrpAssignmentReportsGetOptionalParams, + ): Promise; +} diff --git a/sdk/guestconfiguration/arm-guestconfiguration/src/operationsInterfaces/guestConfigurationHcrpAssignments.ts b/sdk/guestconfiguration/arm-guestconfiguration/src/operationsInterfaces/guestConfigurationHcrpAssignments.ts new file mode 100644 index 000000000000..32a5744ee33b --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/src/operationsInterfaces/guestConfigurationHcrpAssignments.ts @@ -0,0 +1,75 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { + GuestConfigurationAssignment, + GuestConfigurationHcrpAssignmentsListOptionalParams, + GuestConfigurationHcrpAssignmentsCreateOrUpdateOptionalParams, + GuestConfigurationHcrpAssignmentsCreateOrUpdateResponse, + GuestConfigurationHcrpAssignmentsGetOptionalParams, + GuestConfigurationHcrpAssignmentsGetResponse, + GuestConfigurationHcrpAssignmentsDeleteOptionalParams, +} from "../models"; + +/// +/** Interface representing a GuestConfigurationHcrpAssignments. */ +export interface GuestConfigurationHcrpAssignments { + /** + * List all guest configuration assignments for an ARC machine. + * @param resourceGroupName The resource group name. + * @param machineName The name of the ARC machine. + * @param options The options parameters. + */ + list( + resourceGroupName: string, + machineName: string, + options?: GuestConfigurationHcrpAssignmentsListOptionalParams, + ): PagedAsyncIterableIterator; + /** + * Creates an association between a ARC machine and guest configuration + * @param guestConfigurationAssignmentName Name of the guest configuration assignment. + * @param resourceGroupName The resource group name. + * @param machineName The name of the ARC machine. + * @param parameters Parameters supplied to the create or update guest configuration assignment. + * @param options The options parameters. + */ + createOrUpdate( + guestConfigurationAssignmentName: string, + resourceGroupName: string, + machineName: string, + parameters: GuestConfigurationAssignment, + options?: GuestConfigurationHcrpAssignmentsCreateOrUpdateOptionalParams, + ): Promise; + /** + * Get information about a guest configuration assignment + * @param resourceGroupName The resource group name. + * @param guestConfigurationAssignmentName The guest configuration assignment name. + * @param machineName The name of the ARC machine. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + guestConfigurationAssignmentName: string, + machineName: string, + options?: GuestConfigurationHcrpAssignmentsGetOptionalParams, + ): Promise; + /** + * Delete a guest configuration assignment + * @param resourceGroupName The resource group name. + * @param guestConfigurationAssignmentName Name of the guest configuration assignment + * @param machineName The name of the ARC machine. + * @param options The options parameters. + */ + delete( + resourceGroupName: string, + guestConfigurationAssignmentName: string, + machineName: string, + options?: GuestConfigurationHcrpAssignmentsDeleteOptionalParams, + ): Promise; +} diff --git a/sdk/guestconfiguration/arm-guestconfiguration/src/operationsInterfaces/index.ts b/sdk/guestconfiguration/arm-guestconfiguration/src/operationsInterfaces/index.ts new file mode 100644 index 000000000000..37af41210fb2 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/src/operationsInterfaces/index.ts @@ -0,0 +1,17 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export * from "./guestConfigurationAssignments"; +export * from "./guestConfigurationAssignmentReports"; +export * from "./guestConfigurationHcrpAssignments"; +export * from "./guestConfigurationHcrpAssignmentReports"; +export * from "./guestConfigurationAssignmentsVmss"; +export * from "./guestConfigurationAssignmentReportsVmss"; +export * from "./guestConfigurationConnectedVMwarevSphereAssignments"; +export * from "./guestConfigurationConnectedVMwarevSphereAssignmentsReports"; +export * from "./operations"; diff --git a/sdk/guestconfiguration/arm-guestconfiguration/src/operationsInterfaces/operations.ts b/sdk/guestconfiguration/arm-guestconfiguration/src/operationsInterfaces/operations.ts new file mode 100644 index 000000000000..2dddcb4dda6a --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/src/operationsInterfaces/operations.ts @@ -0,0 +1,22 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { Operation, OperationsListOptionalParams } from "../models"; + +/// +/** Interface representing a Operations. */ +export interface Operations { + /** + * Lists all of the available GuestConfiguration REST API operations. + * @param options The options parameters. + */ + list( + options?: OperationsListOptionalParams, + ): PagedAsyncIterableIterator; +} diff --git a/sdk/guestconfiguration/arm-guestconfiguration/src/pagingHelper.ts b/sdk/guestconfiguration/arm-guestconfiguration/src/pagingHelper.ts new file mode 100644 index 000000000000..205cccc26592 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/src/pagingHelper.ts @@ -0,0 +1,39 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export interface PageInfo { + continuationToken?: string; +} + +const pageMap = new WeakMap(); + +/** + * Given the last `.value` produced by the `byPage` iterator, + * returns a continuation token that can be used to begin paging from + * that point later. + * @param page An object from accessing `value` on the IteratorResult from a `byPage` iterator. + * @returns The continuation token that can be passed into byPage() during future calls. + */ +export function getContinuationToken(page: unknown): string | undefined { + if (typeof page !== "object" || page === null) { + return undefined; + } + return pageMap.get(page)?.continuationToken; +} + +export function setContinuationToken( + page: unknown, + continuationToken: string | undefined, +): void { + if (typeof page !== "object" || page === null || !continuationToken) { + return; + } + const pageInfo = pageMap.get(page) ?? {}; + pageInfo.continuationToken = continuationToken; + pageMap.set(page, pageInfo); +} diff --git a/sdk/guestconfiguration/arm-guestconfiguration/test/guestconfiguration_operations_test.spec.ts b/sdk/guestconfiguration/arm-guestconfiguration/test/guestconfiguration_operations_test.spec.ts new file mode 100644 index 000000000000..b2971b58df20 --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/test/guestconfiguration_operations_test.spec.ts @@ -0,0 +1,75 @@ +/* + * 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, + RecorderStartOptions, + delay, + isPlaybackMode, +} from "@azure-tools/test-recorder"; +import { NoOpCredential } from "@azure-tools/test-credential"; +import { assert } from "chai"; +import { Context } from "mocha"; +import { GuestConfigurationClient } from "../src/guestConfigurationClient"; +import { DefaultAzureCredential } from "@azure/identity"; + +const replaceableVariables: Record = { + SUBSCRIPTION_ID: "azure_subscription_id" +}; + +const recorderOptions: RecorderStartOptions = { + envSetupForPlayback: replaceableVariables +}; + +export const testPollingOptions = { + updateIntervalInMs: isPlaybackMode() ? 0 : undefined, +}; + +export function createTestCredential() { + return isPlaybackMode() + ? new NoOpCredential() + : new + DefaultAzureCredential() + ; +} + +describe("GuestConfiguration test", () => { + let recorder: Recorder; + let subscriptionId: string; + let client: GuestConfigurationClient; + let location: string; + let resourceGroup: string; + let resourcename: string; + + beforeEach(async function (this: Context) { + recorder = new Recorder(this.currentTest); + await recorder.start(recorderOptions); + subscriptionId = env.SUBSCRIPTION_ID || ''; + // This is an example of how the environment variables are used + const credential = createTestCredential(); + client = new GuestConfigurationClient(credential, subscriptionId, recorder.configureClientOptions({})); + location = "eastus"; + resourceGroup = "myjstest"; + resourcename = "resourcetest"; + + }); + + afterEach(async function () { + await recorder.stop(); + }); + + it("operation list test", async function () { + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + assert.notEqual(resArray.length, 0); + }); + +}) diff --git a/sdk/guestconfiguration/arm-guestconfiguration/tsconfig.json b/sdk/guestconfiguration/arm-guestconfiguration/tsconfig.json new file mode 100644 index 000000000000..bb1d03f38e1b --- /dev/null +++ b/sdk/guestconfiguration/arm-guestconfiguration/tsconfig.json @@ -0,0 +1,33 @@ +{ + "compilerOptions": { + "module": "es6", + "moduleResolution": "node", + "strict": true, + "target": "es6", + "sourceMap": true, + "declarationMap": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "forceConsistentCasingInFileNames": true, + "lib": [ + "es6", + "dom" + ], + "declaration": true, + "outDir": "./dist-esm", + "importHelpers": true, + "paths": { + "@azure/arm-guestconfiguration": [ + "./src/index" + ] + } + }, + "include": [ + "./src/**/*.ts", + "./test/**/*.ts", + "samples-dev/**/*.ts" + ], + "exclude": [ + "node_modules" + ] +} \ No newline at end of file diff --git a/sdk/guestconfiguration/ci.mgmt.yml b/sdk/guestconfiguration/ci.mgmt.yml new file mode 100644 index 000000000000..de783e0eb97b --- /dev/null +++ b/sdk/guestconfiguration/ci.mgmt.yml @@ -0,0 +1,38 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - feature/* + - release/* + - hotfix/* + exclude: + - feature/v4 + paths: + include: + - sdk/guestconfiguration/arm-guestconfiguration + - sdk/guestconfiguration/ci.mgmt.yml + +pr: + branches: + include: + - main + - feature/* + - release/* + - hotfix/* + exclude: + - feature/v4 + paths: + include: + - sdk/guestconfiguration/arm-guestconfiguration + - sdk/guestconfiguration/ci.mgmt.yml + +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: guestconfiguration + Artifacts: + - name: azure-arm-guestconfiguration + safeName: azurearmguestconfiguration + \ No newline at end of file