diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 76511c6f2794..167e07d1e000 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -9623,7 +9623,7 @@ packages: dev: false file:projects/arm-batch.tgz: - resolution: {integrity: sha512-U12+hJthmarEst+7U9wWLyW7wIgGgrkQHJlKK6+wsN+/bUv5wdbvh2K02YKa3Z1uGNWfHzb0heHM44HlzMio7g==, tarball: file:projects/arm-batch.tgz} + resolution: {integrity: sha512-WJVhWy6KfhKhjuzZRBnC9TNCA6XeVzV3Q412nXk5b348H0bUw2ycHmdheogmKIiWC2KN7KRJeDCdvraba/3hjA==, tarball: file:projects/arm-batch.tgz} name: '@rush-temp/arm-batch' version: 0.0.0 dependencies: @@ -9633,18 +9633,19 @@ packages: '@microsoft/api-extractor': 7.19.4 '@rollup/plugin-commonjs': 21.0.1_rollup@2.67.1 '@rollup/plugin-json': 4.1.0_rollup@2.67.1 - '@rollup/plugin-multi-entry': 3.0.1_rollup@2.67.1 - '@rollup/plugin-node-resolve': 8.4.0_rollup@2.67.1 + '@rollup/plugin-multi-entry': 4.1.0_rollup@2.67.1 + '@rollup/plugin-node-resolve': 13.1.3_rollup@2.67.1 cross-env: 7.0.3 mkdirp: 1.0.4 mocha: 7.2.0 rimraf: 3.0.2 rollup: 2.67.1 - rollup-plugin-sourcemaps: 0.4.2_rollup@2.67.1 + rollup-plugin-sourcemaps: 0.6.3_rollup@2.67.1 tslib: 2.3.1 typescript: 4.2.4 uglify-js: 3.15.1 transitivePeerDependencies: + - '@types/node' - debug - encoding - supports-color @@ -13909,7 +13910,7 @@ packages: dev: false file:projects/communication-short-codes.tgz: - resolution: {integrity: sha512-WwFds5Jll5VrVjGgeeodQu8a5k6lqUQw4pRKCGHJ+cU6ZjjfMuHGIk6r5g0YfXuq+Dioi05TcLphC21D1Cpl2g==, tarball: file:projects/communication-short-codes.tgz} + resolution: {integrity: sha512-SsNyYtLexrtLt4/pDhHBfg1dnwGlNMIUHhc8GDvnHHUyufkKdCxU1q8mEGQCdY1D4Dbd/Q01vhpHaxFNYeehIg==, tarball: file:projects/communication-short-codes.tgz} name: '@rush-temp/communication-short-codes' version: 0.0.0 dependencies: @@ -14347,7 +14348,7 @@ packages: dev: false file:projects/core-http.tgz: - resolution: {integrity: sha512-0FVqqxMmaS5b9gJAQBmon4VGSa8vMDyR2wqukGCB27gvIw8ciyzEg8GTyqWDlXs/9qs02FDrl2qJOvyirN8TIw==, tarball: file:projects/core-http.tgz} + resolution: {integrity: sha512-jiD6yigzItg43NzPs/AN8oxAa8fXDsZPx920Sq7DGPlslluxiFzwdrLV1AGEVLZJAtxr+hIQIozsQBm5MHBOhg==, tarball: file:projects/core-http.tgz} name: '@rush-temp/core-http' version: 0.0.0 dependencies: diff --git a/eng/ignore-links.txt b/eng/ignore-links.txt index f1a36dd55508..d5de1e96d1c7 100644 --- a/eng/ignore-links.txt +++ b/eng/ignore-links.txt @@ -27,3 +27,4 @@ https://docs.microsoft.com/javascript/api/@azure/arm-iothub-profile-2020-09-01-h https://docs.microsoft.com/javascript/api/@azure/arm-monitor-profile-2020-09-01-hybrid?view=azure-node-preview https://docs.microsoft.com/javascript/api/@azure/arm-databoxedge-profile-2020-09-01-hybrid https://docs.microsoft.com/javascript/api/@azure/arm-appservice-profile-2020-09-01-hybrid +https://docs.microsoft.com/en-us/azure/batch/batch-virtual-network diff --git a/sdk/batch/arm-batch/CHANGELOG.md b/sdk/batch/arm-batch/CHANGELOG.md index fb144dc54424..e3817c3b8e6f 100644 --- a/sdk/batch/arm-batch/CHANGELOG.md +++ b/sdk/batch/arm-batch/CHANGELOG.md @@ -1,15 +1,23 @@ # Release History - -## 7.0.1 (Unreleased) - -### Features Added - -### Breaking Changes - -### Bugs Fixed - -### Other Changes - + +## 7.1.0 (2022-03-02) + +**Features** + + - Added operation BatchAccountOperations.getDetector + - Added operation BatchAccountOperations.listDetectors + - Added Interface BatchAccountGetDetectorOptionalParams + - Added Interface BatchAccountListDetectorsNextOptionalParams + - Added Interface BatchAccountListDetectorsOptionalParams + - Added Interface DetectorListResult + - Added Type Alias BatchAccountGetDetectorResponse + - Added Type Alias BatchAccountListDetectorsNextResponse + - Added Type Alias BatchAccountListDetectorsResponse + - Added Type Alias DetectorResponse + - Added Type Alias DynamicVNetAssignmentScope + - Interface NetworkConfiguration has a new optional parameter dynamicVNetAssignmentScope + + ## 7.0.0 (2021-12-24) The package of @azure/arm-batch is using our next generation design principles since version 7.0.0, which contains breaking changes. diff --git a/sdk/batch/arm-batch/LICENSE b/sdk/batch/arm-batch/LICENSE index ccb63b166732..5d1d36e0af80 100644 --- a/sdk/batch/arm-batch/LICENSE +++ b/sdk/batch/arm-batch/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2021 Microsoft +Copyright (c) 2022 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 diff --git a/sdk/batch/arm-batch/README.md b/sdk/batch/arm-batch/README.md index 66b50ab7c8d7..4f641f2eec3e 100644 --- a/sdk/batch/arm-batch/README.md +++ b/sdk/batch/arm-batch/README.md @@ -16,6 +16,8 @@ Batch Client - [LTS versions of Node.js](https://nodejs.org/about/releases/) - 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]. @@ -49,8 +51,17 @@ For more information about how to create an Azure AD Application check out [this ```javascript const { BatchManagementClient } = require("@azure/arm-batch"); 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 BatchManagementClient(new DefaultAzureCredential(), subscriptionId); + +// For client-side applications running in the browser, use this code instead: +// const credential = new InteractiveBrowserCredential({ +// tenantId: "", +// clientId: "" +// }); +// const client = new BatchManagementClient(credential, subscriptionId); ``` diff --git a/sdk/batch/arm-batch/_meta.json b/sdk/batch/arm-batch/_meta.json index 5fd6b75fc80c..8edc47352bc9 100644 --- a/sdk/batch/arm-batch/_meta.json +++ b/sdk/batch/arm-batch/_meta.json @@ -1,7 +1,7 @@ { - "commit": "698ebc782f3cc4650f6df1d765f6a38a6695ad50", + "commit": "4042a47cff72c950d35dd72149895b044ed79713", "readme": "specification/batch/resource-manager/readme.md", - "autorest_command": "autorest --version=3.1.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\mydev\\azure-sdk-for-js ../azure-rest-api-specs/specification/batch/resource-manager/readme.md --use=@autorest/typescript@6.0.0-alpha.16.20211217.1", + "autorest_command": "autorest --version=3.7.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\mydev\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\batch\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-beta.16 --generate-sample=true", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "use": "@autorest/typescript@6.0.0-alpha.16.20211217.1" + "use": "@autorest/typescript@6.0.0-beta.16" } \ No newline at end of file diff --git a/sdk/batch/arm-batch/api-extractor.json b/sdk/batch/arm-batch/api-extractor.json index 74a32fc5ad6e..d6617ba118c0 100644 --- a/sdk/batch/arm-batch/api-extractor.json +++ b/sdk/batch/arm-batch/api-extractor.json @@ -1,18 +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" }, + "docModel": { + "enabled": true + }, + "apiReport": { + "enabled": true, + "reportFolder": "./review" + }, "dtsRollup": { "enabled": true, "untrimmedFilePath": "", "publicTrimmedFilePath": "./types/arm-batch.d.ts" }, "messages": { - "tsdocMessageReporting": { "default": { "logLevel": "none" } }, + "tsdocMessageReporting": { + "default": { + "logLevel": "none" + } + }, "extractorMessageReporting": { - "ae-missing-release-tag": { "logLevel": "none" }, - "ae-unresolved-link": { "logLevel": "none" } + "ae-missing-release-tag": { + "logLevel": "none" + }, + "ae-unresolved-link": { + "logLevel": "none" + } } } -} +} \ No newline at end of file diff --git a/sdk/batch/arm-batch/package.json b/sdk/batch/arm-batch/package.json index a5eb59def7cf..a933b9728dc8 100644 --- a/sdk/batch/arm-batch/package.json +++ b/sdk/batch/arm-batch/package.json @@ -3,7 +3,7 @@ "sdk-type": "mgmt", "author": "Microsoft Corporation", "description": "A generated SDK for BatchManagementClient.", - "version": "7.0.1", + "version": "7.1.0", "engines": { "node": ">=12.0.0" }, @@ -30,12 +30,12 @@ "devDependencies": { "@microsoft/api-extractor": "^7.18.11", "@rollup/plugin-commonjs": "^21.0.1", - "@rollup/plugin-json": "^4.0.0", - "@rollup/plugin-multi-entry": "^3.0.0", - "@rollup/plugin-node-resolve": "^8.0.0", + "@rollup/plugin-json": "^4.1.0", + "@rollup/plugin-multi-entry": "^4.1.0", + "@rollup/plugin-node-resolve": "^13.1.3", "mkdirp": "^1.0.4", - "rollup": "^2.0.0", - "rollup-plugin-sourcemaps": "^0.4.2", + "rollup": "^2.66.1", + "rollup-plugin-sourcemaps": "^0.6.3", "typescript": "~4.2.0", "uglify-js": "^3.4.9", "rimraf": "^3.0.0", @@ -43,7 +43,7 @@ "@azure-tools/test-recorder": "^1.0.0", "mocha": "^7.1.1", "cross-env": "^7.0.2", - "@azure/arm-storage": "^17.0.0" + "@azure/arm-storage": "^17.1.0" }, "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/batch/arm-batch", "repository": { @@ -99,5 +99,21 @@ "docs": "echo skipped" }, "sideEffects": false, - "autoPublish": true + "//metadata": { + "constantPaths": [ + { + "path": "src/batchManagementClient.ts", + "prefix": "packageDetails" + } + ] + }, + "autoPublish": true, + "//sampleConfiguration": { + "productName": "", + "productSlugs": [ + "azure" + ], + "disableDocsMs": true, + "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-batch?view=azure-node-preview" + } } diff --git a/sdk/batch/arm-batch/review/arm-batch.api.md b/sdk/batch/arm-batch/review/arm-batch.api.md index dd151ccc0e5c..bf8a2382e4d0 100644 --- a/sdk/batch/arm-batch/review/arm-batch.api.md +++ b/sdk/batch/arm-batch/review/arm-batch.api.md @@ -274,6 +274,13 @@ export interface BatchAccountDeleteOptionalParams extends coreClient.OperationOp updateIntervalInMs?: number; } +// @public +export interface BatchAccountGetDetectorOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type BatchAccountGetDetectorResponse = DetectorResponse; + // @public export interface BatchAccountGetKeysOptionalParams extends coreClient.OperationOptions { } @@ -319,6 +326,20 @@ export interface BatchAccountListByResourceGroupOptionalParams extends coreClien // @public export type BatchAccountListByResourceGroupResponse = BatchAccountListResult; +// @public +export interface BatchAccountListDetectorsNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type BatchAccountListDetectorsNextResponse = DetectorListResult; + +// @public +export interface BatchAccountListDetectorsOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type BatchAccountListDetectorsResponse = DetectorListResult; + // @public export interface BatchAccountListNextOptionalParams extends coreClient.OperationOptions { } @@ -360,9 +381,11 @@ export interface BatchAccountOperations { beginDelete(resourceGroupName: string, accountName: string, options?: BatchAccountDeleteOptionalParams): Promise, void>>; beginDeleteAndWait(resourceGroupName: string, accountName: string, options?: BatchAccountDeleteOptionalParams): Promise; get(resourceGroupName: string, accountName: string, options?: BatchAccountGetOptionalParams): Promise; + getDetector(resourceGroupName: string, accountName: string, detectorId: string, options?: BatchAccountGetDetectorOptionalParams): Promise; getKeys(resourceGroupName: string, accountName: string, options?: BatchAccountGetKeysOptionalParams): Promise; list(options?: BatchAccountListOptionalParams): PagedAsyncIterableIterator; listByResourceGroup(resourceGroupName: string, options?: BatchAccountListByResourceGroupOptionalParams): PagedAsyncIterableIterator; + listDetectors(resourceGroupName: string, accountName: string, options?: BatchAccountListDetectorsOptionalParams): PagedAsyncIterableIterator; listOutboundNetworkDependenciesEndpoints(resourceGroupName: string, accountName: string, options?: BatchAccountListOutboundNetworkDependenciesEndpointsOptionalParams): PagedAsyncIterableIterator; regenerateKey(resourceGroupName: string, accountName: string, parameters: BatchAccountRegenerateKeyParameters, options?: BatchAccountRegenerateKeyOptionalParams): Promise; synchronizeAutoStorageKeys(resourceGroupName: string, accountName: string, options?: BatchAccountSynchronizeAutoStorageKeysOptionalParams): Promise; @@ -706,6 +729,17 @@ export interface DeploymentConfiguration { virtualMachineConfiguration?: VirtualMachineConfiguration; } +// @public +export interface DetectorListResult { + nextLink?: string; + value?: DetectorResponse[]; +} + +// @public +export type DetectorResponse = ProxyResource & { + value?: string; +}; + // @public export interface DiffDiskSettings { placement?: "CacheDisk"; @@ -719,6 +753,9 @@ export interface DiskEncryptionConfiguration { // @public export type DiskEncryptionTarget = "OsDisk" | "TemporaryDisk"; +// @public +export type DynamicVNetAssignmentScope = "none" | "job"; + // @public export type ElevationLevel = "NonAdmin" | "Admin"; @@ -920,6 +957,7 @@ export type NameAvailabilityReason = "Invalid" | "AlreadyExists"; // @public export interface NetworkConfiguration { + dynamicVNetAssignmentScope?: DynamicVNetAssignmentScope; endpointConfiguration?: PoolEndpointConfiguration; publicIPAddressConfiguration?: PublicIPAddressConfiguration; subnetId?: string; diff --git a/sdk/batch/arm-batch/rollup.config.js b/sdk/batch/arm-batch/rollup.config.js index 9be1955eb7f1..3f89d7309da5 100644 --- a/sdk/batch/arm-batch/rollup.config.js +++ b/sdk/batch/arm-batch/rollup.config.js @@ -14,62 +14,14 @@ import json from "@rollup/plugin-json"; import nodeBuiltins from "builtin-modules"; -/** - * Gets the proper configuration needed for rollup's commonJS plugin for @opentelemetry/api. - * - * NOTE: this manual configuration is only needed because OpenTelemetry uses an - * __exportStar downleveled helper function to declare its exports which confuses - * rollup's automatic discovery mechanism. - * - * @returns an object reference that can be `...`'d into your cjs() configuration. - */ -export function openTelemetryCommonJs() { - const namedExports = {}; - - for (const key of [ - "@opentelemetry/api", - "@azure/core-tracing/node_modules/@opentelemetry/api" - ]) { - namedExports[key] = [ - "SpanKind", - "TraceFlags", - "getSpan", - "setSpan", - "SpanStatusCode", - "getSpanContext", - "setSpanContext" - ]; - } - - const releasedOpenTelemetryVersions = ["0.10.2", "1.0.0-rc.0"]; - - for (const version of releasedOpenTelemetryVersions) { - namedExports[ - // working around a limitation in the rollup common.js plugin - it's not able to resolve these modules so the named exports listed above will not get applied. We have to drill down to the actual path. - `../../../common/temp/node_modules/.pnpm/@opentelemetry/api@${version}/node_modules/@opentelemetry/api/build/src/index.js` - ] = [ - "SpanKind", - "TraceFlags", - "getSpan", - "setSpan", - "StatusCode", - "CanonicalCode", - "getSpanContext", - "setSpanContext" - ]; - } - - return namedExports; -} - // #region Warning Handler /** - * A function that can determine whether a rollupwarning should be ignored. If + * A function that can determine whether a rollup warning should be ignored. If * the function returns `true`, then the warning will not be displayed. */ -function ignoreNiseSinonEvalWarnings(warning) { +function ignoreNiseSinonEval(warning) { return ( warning.code === "EVAL" && warning.id && @@ -78,17 +30,14 @@ function ignoreNiseSinonEvalWarnings(warning) { ); } -function ignoreChaiCircularDependencyWarnings(warning) { +function ignoreChaiCircularDependency(warning) { return ( warning.code === "CIRCULAR_DEPENDENCY" && warning.importer && warning.importer.includes("node_modules/chai") === true ); } -const warningInhibitors = [ - ignoreChaiCircularDependencyWarnings, - ignoreNiseSinonEvalWarnings -]; +const warningInhibitors = [ignoreChaiCircularDependency, ignoreNiseSinonEval]; /** * Construct a warning handler for the shared rollup configuration @@ -122,22 +71,7 @@ function makeBrowserTestConfig() { nodeResolve({ mainFields: ["module", "browser"] }), - cjs({ - namedExports: { - // Chai's strange internal architecture makes it impossible to statically - // analyze its exports. - chai: [ - "version", - "use", - "util", - "config", - "expect", - "should", - "assert" - ], - ...openTelemetryCommonJs() - } - }), + cjs(), json(), sourcemaps() //viz({ filename: "dist-test/browser-stats.html", sourcemap: true }) @@ -173,7 +107,7 @@ export function makeConfig(pkg, options) { ], output: { file: "dist/index.js", format: "cjs", sourcemap: true }, preserveSymlinks: false, - plugins: [sourcemaps(), nodeResolve(), cjs()] + plugins: [sourcemaps(), nodeResolve()] }; const config = [baseConfig]; diff --git a/sdk/batch/arm-batch/sample.env b/sdk/batch/arm-batch/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/batch/arm-batch/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/batch/arm-batch/samples-dev/applicationCreateSample.ts b/sdk/batch/arm-batch/samples-dev/applicationCreateSample.ts new file mode 100644 index 000000000000..679a379232ba --- /dev/null +++ b/sdk/batch/arm-batch/samples-dev/applicationCreateSample.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 { + Application, + ApplicationCreateOptionalParams, + BatchManagementClient +} from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Adds an application to the specified Batch account. + * + * @summary Adds an application to the specified Batch account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationCreate.json + */ +async function applicationCreate() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const applicationName = "app1"; + const parameters: Application = { + allowUpdates: false, + displayName: "myAppName" + }; + const options: ApplicationCreateOptionalParams = { parameters }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.applicationOperations.create( + resourceGroupName, + accountName, + applicationName, + options + ); + console.log(result); +} + +applicationCreate().catch(console.error); diff --git a/sdk/batch/arm-batch/samples-dev/applicationDeleteSample.ts b/sdk/batch/arm-batch/samples-dev/applicationDeleteSample.ts new file mode 100644 index 000000000000..669116ae294e --- /dev/null +++ b/sdk/batch/arm-batch/samples-dev/applicationDeleteSample.ts @@ -0,0 +1,35 @@ +/* + * 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 { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Deletes an application. + * + * @summary Deletes an application. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationDelete.json + */ +async function applicationDelete() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const applicationName = "app1"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.applicationOperations.delete( + resourceGroupName, + accountName, + applicationName + ); + console.log(result); +} + +applicationDelete().catch(console.error); diff --git a/sdk/batch/arm-batch/samples-dev/applicationGetSample.ts b/sdk/batch/arm-batch/samples-dev/applicationGetSample.ts new file mode 100644 index 000000000000..71d0ad31352f --- /dev/null +++ b/sdk/batch/arm-batch/samples-dev/applicationGetSample.ts @@ -0,0 +1,35 @@ +/* + * 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 { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets information about the specified application. + * + * @summary Gets information about the specified application. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationGet.json + */ +async function applicationGet() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const applicationName = "app1"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.applicationOperations.get( + resourceGroupName, + accountName, + applicationName + ); + console.log(result); +} + +applicationGet().catch(console.error); diff --git a/sdk/batch/arm-batch/samples-dev/applicationListSample.ts b/sdk/batch/arm-batch/samples-dev/applicationListSample.ts new file mode 100644 index 000000000000..3bb6a73216a5 --- /dev/null +++ b/sdk/batch/arm-batch/samples-dev/applicationListSample.ts @@ -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. +import { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Lists all of the applications in the specified account. + * + * @summary Lists all of the applications in the specified account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationList.json + */ +async function applicationList() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.applicationOperations.list( + resourceGroupName, + accountName + )) { + resArray.push(item); + } + console.log(resArray); +} + +applicationList().catch(console.error); diff --git a/sdk/batch/arm-batch/samples-dev/applicationPackageActivateSample.ts b/sdk/batch/arm-batch/samples-dev/applicationPackageActivateSample.ts new file mode 100644 index 000000000000..85cb7868a533 --- /dev/null +++ b/sdk/batch/arm-batch/samples-dev/applicationPackageActivateSample.ts @@ -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. +import { + ActivateApplicationPackageParameters, + BatchManagementClient +} from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Activates the specified application package. This should be done after the `ApplicationPackage` was created and uploaded. This needs to be done before an `ApplicationPackage` can be used on Pools or Tasks. + * + * @summary Activates the specified application package. This should be done after the `ApplicationPackage` was created and uploaded. This needs to be done before an `ApplicationPackage` can be used on Pools or Tasks. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationPackageActivate.json + */ +async function applicationPackageActivate() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const applicationName = "app1"; + const versionName = "1"; + const parameters: ActivateApplicationPackageParameters = { format: "zip" }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.applicationPackageOperations.activate( + resourceGroupName, + accountName, + applicationName, + versionName, + parameters + ); + console.log(result); +} + +applicationPackageActivate().catch(console.error); diff --git a/sdk/batch/arm-batch/samples-dev/applicationPackageCreateSample.ts b/sdk/batch/arm-batch/samples-dev/applicationPackageCreateSample.ts new file mode 100644 index 000000000000..6d29ac601293 --- /dev/null +++ b/sdk/batch/arm-batch/samples-dev/applicationPackageCreateSample.ts @@ -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. +import { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Creates an application package record. The record contains a storageUrl where the package should be uploaded to. Once it is uploaded the `ApplicationPackage` needs to be activated using `ApplicationPackageActive` before it can be used. If the auto storage account was configured to use storage keys, the URL returned will contain a SAS. + * + * @summary Creates an application package record. The record contains a storageUrl where the package should be uploaded to. Once it is uploaded the `ApplicationPackage` needs to be activated using `ApplicationPackageActive` before it can be used. If the auto storage account was configured to use storage keys, the URL returned will contain a SAS. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationPackageCreate.json + */ +async function applicationPackageCreate() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const applicationName = "app1"; + const versionName = "1"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.applicationPackageOperations.create( + resourceGroupName, + accountName, + applicationName, + versionName + ); + console.log(result); +} + +applicationPackageCreate().catch(console.error); diff --git a/sdk/batch/arm-batch/samples-dev/applicationPackageDeleteSample.ts b/sdk/batch/arm-batch/samples-dev/applicationPackageDeleteSample.ts new file mode 100644 index 000000000000..ccd5b0a210a8 --- /dev/null +++ b/sdk/batch/arm-batch/samples-dev/applicationPackageDeleteSample.ts @@ -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. +import { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Deletes an application package record and its associated binary file. + * + * @summary Deletes an application package record and its associated binary file. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationPackageDelete.json + */ +async function applicationPackageDelete() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const applicationName = "app1"; + const versionName = "1"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.applicationPackageOperations.delete( + resourceGroupName, + accountName, + applicationName, + versionName + ); + console.log(result); +} + +applicationPackageDelete().catch(console.error); diff --git a/sdk/batch/arm-batch/samples-dev/applicationPackageGetSample.ts b/sdk/batch/arm-batch/samples-dev/applicationPackageGetSample.ts new file mode 100644 index 000000000000..c5eeb9794eba --- /dev/null +++ b/sdk/batch/arm-batch/samples-dev/applicationPackageGetSample.ts @@ -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. +import { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets information about the specified application package. + * + * @summary Gets information about the specified application package. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationPackageGet.json + */ +async function applicationPackageGet() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const applicationName = "app1"; + const versionName = "1"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.applicationPackageOperations.get( + resourceGroupName, + accountName, + applicationName, + versionName + ); + console.log(result); +} + +applicationPackageGet().catch(console.error); diff --git a/sdk/batch/arm-batch/samples-dev/applicationPackageListSample.ts b/sdk/batch/arm-batch/samples-dev/applicationPackageListSample.ts new file mode 100644 index 000000000000..6721a6fc067a --- /dev/null +++ b/sdk/batch/arm-batch/samples-dev/applicationPackageListSample.ts @@ -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. +import { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Lists all of the application packages in the specified application. + * + * @summary Lists all of the application packages in the specified application. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationPackageList.json + */ +async function applicationPackageList() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const applicationName = "app1"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.applicationPackageOperations.list( + resourceGroupName, + accountName, + applicationName + )) { + resArray.push(item); + } + console.log(resArray); +} + +applicationPackageList().catch(console.error); diff --git a/sdk/batch/arm-batch/samples-dev/applicationUpdateSample.ts b/sdk/batch/arm-batch/samples-dev/applicationUpdateSample.ts new file mode 100644 index 000000000000..e4c58c14907f --- /dev/null +++ b/sdk/batch/arm-batch/samples-dev/applicationUpdateSample.ts @@ -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. +import { Application, BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Updates settings for the specified application. + * + * @summary Updates settings for the specified application. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationUpdate.json + */ +async function applicationUpdate() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const applicationName = "app1"; + const parameters: Application = { + allowUpdates: true, + defaultVersion: "2", + displayName: "myAppName" + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.applicationOperations.update( + resourceGroupName, + accountName, + applicationName, + parameters + ); + console.log(result); +} + +applicationUpdate().catch(console.error); diff --git a/sdk/batch/arm-batch/samples-dev/batchAccountCreateSample.ts b/sdk/batch/arm-batch/samples-dev/batchAccountCreateSample.ts new file mode 100644 index 000000000000..6b24738d5f02 --- /dev/null +++ b/sdk/batch/arm-batch/samples-dev/batchAccountCreateSample.ts @@ -0,0 +1,179 @@ +/* + * 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 { + BatchAccountCreateParameters, + BatchManagementClient +} from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and should instead be updated with the Update Batch Account API. + * + * @summary Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and should instead be updated with the Update Batch Account API. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountCreate_BYOS.json + */ +async function batchAccountCreateByos() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const parameters: BatchAccountCreateParameters = { + autoStorage: { + storageAccountId: + "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage" + }, + keyVaultReference: { + id: + "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.KeyVault/vaults/sample", + url: "http://sample.vault.azure.net/" + }, + location: "japaneast", + poolAllocationMode: "UserSubscription" + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.batchAccountOperations.beginCreateAndWait( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +batchAccountCreateByos().catch(console.error); + +/** + * This sample demonstrates how to Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and should instead be updated with the Update Batch Account API. + * + * @summary Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and should instead be updated with the Update Batch Account API. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountCreate_Default.json + */ +async function batchAccountCreateDefault() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const parameters: BatchAccountCreateParameters = { + autoStorage: { + storageAccountId: + "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage" + }, + location: "japaneast" + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.batchAccountOperations.beginCreateAndWait( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +batchAccountCreateDefault().catch(console.error); + +/** + * This sample demonstrates how to Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and should instead be updated with the Update Batch Account API. + * + * @summary Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and should instead be updated with the Update Batch Account API. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountCreate_SystemAssignedIdentity.json + */ +async function batchAccountCreateSystemAssignedIdentity() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const parameters: BatchAccountCreateParameters = { + autoStorage: { + storageAccountId: + "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage" + }, + identity: { type: "SystemAssigned" }, + location: "japaneast" + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.batchAccountOperations.beginCreateAndWait( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +batchAccountCreateSystemAssignedIdentity().catch(console.error); + +/** + * This sample demonstrates how to Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and should instead be updated with the Update Batch Account API. + * + * @summary Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and should instead be updated with the Update Batch Account API. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountCreate_UserAssignedIdentity.json + */ +async function batchAccountCreateUserAssignedIdentity() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const parameters: BatchAccountCreateParameters = { + autoStorage: { + storageAccountId: + "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage" + }, + identity: { + type: "UserAssigned", + userAssignedIdentities: { + "/subscriptions/subid/resourceGroups/defaultAzurebatchJapaneast/providers/MicrosoftManagedIdentity/userAssignedIdentities/id1": {} + } + }, + location: "japaneast" + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.batchAccountOperations.beginCreateAndWait( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +batchAccountCreateUserAssignedIdentity().catch(console.error); + +/** + * This sample demonstrates how to Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and should instead be updated with the Update Batch Account API. + * + * @summary Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and should instead be updated with the Update Batch Account API. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PrivateBatchAccountCreate.json + */ +async function privateBatchAccountCreate() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const parameters: BatchAccountCreateParameters = { + autoStorage: { + storageAccountId: + "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage" + }, + keyVaultReference: { + id: + "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.KeyVault/vaults/sample", + url: "http://sample.vault.azure.net/" + }, + location: "japaneast", + publicNetworkAccess: "Disabled" + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.batchAccountOperations.beginCreateAndWait( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +privateBatchAccountCreate().catch(console.error); diff --git a/sdk/batch/arm-batch/samples-dev/batchAccountDeleteSample.ts b/sdk/batch/arm-batch/samples-dev/batchAccountDeleteSample.ts new file mode 100644 index 000000000000..8196f63d2564 --- /dev/null +++ b/sdk/batch/arm-batch/samples-dev/batchAccountDeleteSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Deletes the specified Batch account. + * + * @summary Deletes the specified Batch account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountDelete.json + */ +async function batchAccountDelete() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.batchAccountOperations.beginDeleteAndWait( + resourceGroupName, + accountName + ); + console.log(result); +} + +batchAccountDelete().catch(console.error); diff --git a/sdk/batch/arm-batch/samples-dev/batchAccountGetDetectorSample.ts b/sdk/batch/arm-batch/samples-dev/batchAccountGetDetectorSample.ts new file mode 100644 index 000000000000..5ddeab460cc3 --- /dev/null +++ b/sdk/batch/arm-batch/samples-dev/batchAccountGetDetectorSample.ts @@ -0,0 +1,35 @@ +/* + * 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 { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets information about the given detector for a given Batch account. + * + * @summary Gets information about the given detector for a given Batch account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/DetectorGet.json + */ +async function getDetector() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const detectorId = "poolsAndNodes"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.batchAccountOperations.getDetector( + resourceGroupName, + accountName, + detectorId + ); + console.log(result); +} + +getDetector().catch(console.error); diff --git a/sdk/batch/arm-batch/samples-dev/batchAccountGetKeysSample.ts b/sdk/batch/arm-batch/samples-dev/batchAccountGetKeysSample.ts new file mode 100644 index 000000000000..0d0642d79ebd --- /dev/null +++ b/sdk/batch/arm-batch/samples-dev/batchAccountGetKeysSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to This operation applies only to Batch accounts with allowedAuthenticationModes containing 'SharedKey'. If the Batch account doesn't contain 'SharedKey' in its allowedAuthenticationMode, clients cannot use shared keys to authenticate, and must use another allowedAuthenticationModes instead. In this case, getting the keys will fail. + * + * @summary This operation applies only to Batch accounts with allowedAuthenticationModes containing 'SharedKey'. If the Batch account doesn't contain 'SharedKey' in its allowedAuthenticationMode, clients cannot use shared keys to authenticate, and must use another allowedAuthenticationModes instead. In this case, getting the keys will fail. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountGetKeys.json + */ +async function batchAccountGetKeys() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.batchAccountOperations.getKeys( + resourceGroupName, + accountName + ); + console.log(result); +} + +batchAccountGetKeys().catch(console.error); diff --git a/sdk/batch/arm-batch/samples-dev/batchAccountGetSample.ts b/sdk/batch/arm-batch/samples-dev/batchAccountGetSample.ts new file mode 100644 index 000000000000..d7a140a16a2c --- /dev/null +++ b/sdk/batch/arm-batch/samples-dev/batchAccountGetSample.ts @@ -0,0 +1,54 @@ +/* + * 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 { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets information about the specified Batch account. + * + * @summary Gets information about the specified Batch account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountGet.json + */ +async function batchAccountGet() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.batchAccountOperations.get( + resourceGroupName, + accountName + ); + console.log(result); +} + +batchAccountGet().catch(console.error); + +/** + * This sample demonstrates how to Gets information about the specified Batch account. + * + * @summary Gets information about the specified Batch account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PrivateBatchAccountGet.json + */ +async function privateBatchAccountGet() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.batchAccountOperations.get( + resourceGroupName, + accountName + ); + console.log(result); +} + +privateBatchAccountGet().catch(console.error); diff --git a/sdk/batch/arm-batch/samples-dev/batchAccountListByResourceGroupSample.ts b/sdk/batch/arm-batch/samples-dev/batchAccountListByResourceGroupSample.ts new file mode 100644 index 000000000000..0c397bff08e9 --- /dev/null +++ b/sdk/batch/arm-batch/samples-dev/batchAccountListByResourceGroupSample.ts @@ -0,0 +1,34 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets information about the Batch accounts associated with the specified resource group. + * + * @summary Gets information about the Batch accounts associated with the specified resource group. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountListByResourceGroup.json + */ +async function batchAccountListByResourceGroup() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.batchAccountOperations.listByResourceGroup( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +batchAccountListByResourceGroup().catch(console.error); diff --git a/sdk/batch/arm-batch/samples-dev/batchAccountListDetectorsSample.ts b/sdk/batch/arm-batch/samples-dev/batchAccountListDetectorsSample.ts new file mode 100644 index 000000000000..5b04846a2f14 --- /dev/null +++ b/sdk/batch/arm-batch/samples-dev/batchAccountListDetectorsSample.ts @@ -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. +import { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets information about the detectors available for a given Batch account. + * + * @summary Gets information about the detectors available for a given Batch account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/DetectorList.json + */ +async function listDetectors() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.batchAccountOperations.listDetectors( + resourceGroupName, + accountName + )) { + resArray.push(item); + } + console.log(resArray); +} + +listDetectors().catch(console.error); diff --git a/sdk/batch/arm-batch/samples-dev/batchAccountListOutboundNetworkDependenciesEndpointsSample.ts b/sdk/batch/arm-batch/samples-dev/batchAccountListOutboundNetworkDependenciesEndpointsSample.ts new file mode 100644 index 000000000000..7b76f19d96c5 --- /dev/null +++ b/sdk/batch/arm-batch/samples-dev/batchAccountListOutboundNetworkDependenciesEndpointsSample.ts @@ -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. +import { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Lists the endpoints that a Batch Compute Node under this Batch Account may call as part of Batch service administration. If you are deploying a Pool inside of a virtual network that you specify, you must make sure your network allows outbound access to these endpoints. Failure to allow access to these endpoints may cause Batch to mark the affected nodes as unusable. For more information about creating a pool inside of a virtual network, see https://docs.microsoft.com/en-us/azure/batch/batch-virtual-network. + * + * @summary Lists the endpoints that a Batch Compute Node under this Batch Account may call as part of Batch service administration. If you are deploying a Pool inside of a virtual network that you specify, you must make sure your network allows outbound access to these endpoints. Failure to allow access to these endpoints may cause Batch to mark the affected nodes as unusable. For more information about creating a pool inside of a virtual network, see https://docs.microsoft.com/en-us/azure/batch/batch-virtual-network. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountListOutboundNetworkDependenciesEndpoints.json + */ +async function listOutboundNetworkDependencies() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.batchAccountOperations.listOutboundNetworkDependenciesEndpoints( + resourceGroupName, + accountName + )) { + resArray.push(item); + } + console.log(resArray); +} + +listOutboundNetworkDependencies().catch(console.error); diff --git a/sdk/batch/arm-batch/samples-dev/batchAccountListSample.ts b/sdk/batch/arm-batch/samples-dev/batchAccountListSample.ts new file mode 100644 index 000000000000..bb2de024199e --- /dev/null +++ b/sdk/batch/arm-batch/samples-dev/batchAccountListSample.ts @@ -0,0 +1,31 @@ +/* + * 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 { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets information about the Batch accounts associated with the subscription. + * + * @summary Gets information about the Batch accounts associated with the subscription. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountList.json + */ +async function batchAccountList() { + const subscriptionId = "subid"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.batchAccountOperations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +batchAccountList().catch(console.error); diff --git a/sdk/batch/arm-batch/samples-dev/batchAccountRegenerateKeySample.ts b/sdk/batch/arm-batch/samples-dev/batchAccountRegenerateKeySample.ts new file mode 100644 index 000000000000..e390bc2f0793 --- /dev/null +++ b/sdk/batch/arm-batch/samples-dev/batchAccountRegenerateKeySample.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 { + BatchAccountRegenerateKeyParameters, + BatchManagementClient +} from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to This operation applies only to Batch accounts with allowedAuthenticationModes containing 'SharedKey'. If the Batch account doesn't contain 'SharedKey' in its allowedAuthenticationMode, clients cannot use shared keys to authenticate, and must use another allowedAuthenticationModes instead. In this case, regenerating the keys will fail. + * + * @summary This operation applies only to Batch accounts with allowedAuthenticationModes containing 'SharedKey'. If the Batch account doesn't contain 'SharedKey' in its allowedAuthenticationMode, clients cannot use shared keys to authenticate, and must use another allowedAuthenticationModes instead. In this case, regenerating the keys will fail. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountRegenerateKey.json + */ +async function batchAccountRegenerateKey() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const parameters: BatchAccountRegenerateKeyParameters = { + keyName: "Primary" + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.batchAccountOperations.regenerateKey( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +batchAccountRegenerateKey().catch(console.error); diff --git a/sdk/batch/arm-batch/samples-dev/batchAccountSynchronizeAutoStorageKeysSample.ts b/sdk/batch/arm-batch/samples-dev/batchAccountSynchronizeAutoStorageKeysSample.ts new file mode 100644 index 000000000000..4fc3820e2174 --- /dev/null +++ b/sdk/batch/arm-batch/samples-dev/batchAccountSynchronizeAutoStorageKeysSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Synchronizes access keys for the auto-storage account configured for the specified Batch account, only if storage key authentication is being used. + * + * @summary Synchronizes access keys for the auto-storage account configured for the specified Batch account, only if storage key authentication is being used. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountSynchronizeAutoStorageKeys.json + */ +async function batchAccountSynchronizeAutoStorageKeys() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.batchAccountOperations.synchronizeAutoStorageKeys( + resourceGroupName, + accountName + ); + console.log(result); +} + +batchAccountSynchronizeAutoStorageKeys().catch(console.error); diff --git a/sdk/batch/arm-batch/samples-dev/batchAccountUpdateSample.ts b/sdk/batch/arm-batch/samples-dev/batchAccountUpdateSample.ts new file mode 100644 index 000000000000..0a558f108957 --- /dev/null +++ b/sdk/batch/arm-batch/samples-dev/batchAccountUpdateSample.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 { + BatchAccountUpdateParameters, + BatchManagementClient +} from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Updates the properties of an existing Batch account. + * + * @summary Updates the properties of an existing Batch account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountUpdate.json + */ +async function batchAccountUpdate() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const parameters: BatchAccountUpdateParameters = { + autoStorage: { + storageAccountId: + "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage" + } + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.batchAccountOperations.update( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +batchAccountUpdate().catch(console.error); diff --git a/sdk/batch/arm-batch/samples-dev/certificateCancelDeletionSample.ts b/sdk/batch/arm-batch/samples-dev/certificateCancelDeletionSample.ts new file mode 100644 index 000000000000..b436f708c6aa --- /dev/null +++ b/sdk/batch/arm-batch/samples-dev/certificateCancelDeletionSample.ts @@ -0,0 +1,35 @@ +/* + * 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 { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to If you try to delete a certificate that is being used by a pool or compute node, the status of the certificate changes to deleteFailed. If you decide that you want to continue using the certificate, you can use this operation to set the status of the certificate back to active. If you intend to delete the certificate, you do not need to run this operation after the deletion failed. You must make sure that the certificate is not being used by any resources, and then you can try again to delete the certificate. + * + * @summary If you try to delete a certificate that is being used by a pool or compute node, the status of the certificate changes to deleteFailed. If you decide that you want to continue using the certificate, you can use this operation to set the status of the certificate back to active. If you intend to delete the certificate, you do not need to run this operation after the deletion failed. You must make sure that the certificate is not being used by any resources, and then you can try again to delete the certificate. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/CertificateCancelDeletion.json + */ +async function certificateCancelDeletion() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const certificateName = "sha1-0a0e4f50d51beadeac1d35afc5116098e7902e6e"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.certificateOperations.cancelDeletion( + resourceGroupName, + accountName, + certificateName + ); + console.log(result); +} + +certificateCancelDeletion().catch(console.error); diff --git a/sdk/batch/arm-batch/samples-dev/certificateCreateSample.ts b/sdk/batch/arm-batch/samples-dev/certificateCreateSample.ts new file mode 100644 index 000000000000..a35ee5c3864c --- /dev/null +++ b/sdk/batch/arm-batch/samples-dev/certificateCreateSample.ts @@ -0,0 +1,102 @@ +/* + * 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 { + CertificateCreateOrUpdateParameters, + BatchManagementClient +} from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Creates a new certificate inside the specified account. + * + * @summary Creates a new certificate inside the specified account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/CertificateCreate_Full.json + */ +async function createCertificateFull() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const certificateName = "sha1-0a0e4f50d51beadeac1d35afc5116098e7902e6e"; + const parameters: CertificateCreateOrUpdateParameters = { + format: "Pfx", + data: "MIIJsgIBAzCCCW4GCSqGSIb3DQE...", + password: "", + thumbprint: "0a0e4f50d51beadeac1d35afc5116098e7902e6e", + thumbprintAlgorithm: "sha1" + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.certificateOperations.create( + resourceGroupName, + accountName, + certificateName, + parameters + ); + console.log(result); +} + +createCertificateFull().catch(console.error); + +/** + * This sample demonstrates how to Creates a new certificate inside the specified account. + * + * @summary Creates a new certificate inside the specified account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/CertificateCreate_MinimalCer.json + */ +async function createCertificateMinimalCer() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const certificateName = "sha1-0a0e4f50d51beadeac1d35afc5116098e7902e6e"; + const parameters: CertificateCreateOrUpdateParameters = { + format: "Cer", + data: "MIICrjCCAZagAwI..." + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.certificateOperations.create( + resourceGroupName, + accountName, + certificateName, + parameters + ); + console.log(result); +} + +createCertificateMinimalCer().catch(console.error); + +/** + * This sample demonstrates how to Creates a new certificate inside the specified account. + * + * @summary Creates a new certificate inside the specified account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/CertificateCreate_Minimal.json + */ +async function createCertificateMinimalPfx() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const certificateName = "sha1-0a0e4f50d51beadeac1d35afc5116098e7902e6e"; + const parameters: CertificateCreateOrUpdateParameters = { + data: "MIIJsgIBAzCCCW4GCSqGSIb3DQE...", + password: "" + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.certificateOperations.create( + resourceGroupName, + accountName, + certificateName, + parameters + ); + console.log(result); +} + +createCertificateMinimalPfx().catch(console.error); diff --git a/sdk/batch/arm-batch/samples-dev/certificateDeleteSample.ts b/sdk/batch/arm-batch/samples-dev/certificateDeleteSample.ts new file mode 100644 index 000000000000..1b16bacd2ed8 --- /dev/null +++ b/sdk/batch/arm-batch/samples-dev/certificateDeleteSample.ts @@ -0,0 +1,35 @@ +/* + * 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 { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Deletes the specified certificate. + * + * @summary Deletes the specified certificate. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/CertificateDelete.json + */ +async function certificateDelete() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const certificateName = "sha1-0a0e4f50d51beadeac1d35afc5116098e7902e6e"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.certificateOperations.beginDeleteAndWait( + resourceGroupName, + accountName, + certificateName + ); + console.log(result); +} + +certificateDelete().catch(console.error); diff --git a/sdk/batch/arm-batch/samples-dev/certificateGetSample.ts b/sdk/batch/arm-batch/samples-dev/certificateGetSample.ts new file mode 100644 index 000000000000..6cd0239f3682 --- /dev/null +++ b/sdk/batch/arm-batch/samples-dev/certificateGetSample.ts @@ -0,0 +1,58 @@ +/* + * 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 { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets information about the specified certificate. + * + * @summary Gets information about the specified certificate. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/CertificateGet.json + */ +async function getCertificate() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const certificateName = "sha1-0a0e4f50d51beadeac1d35afc5116098e7902e6e"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.certificateOperations.get( + resourceGroupName, + accountName, + certificateName + ); + console.log(result); +} + +getCertificate().catch(console.error); + +/** + * This sample demonstrates how to Gets information about the specified certificate. + * + * @summary Gets information about the specified certificate. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/CertificateGetWithDeletionError.json + */ +async function getCertificateWithDeletionError() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const certificateName = "sha1-0a0e4f50d51beadeac1d35afc5116098e7902e6e"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.certificateOperations.get( + resourceGroupName, + accountName, + certificateName + ); + console.log(result); +} + +getCertificateWithDeletionError().catch(console.error); diff --git a/sdk/batch/arm-batch/samples-dev/certificateListByBatchAccountSample.ts b/sdk/batch/arm-batch/samples-dev/certificateListByBatchAccountSample.ts new file mode 100644 index 000000000000..62996221d136 --- /dev/null +++ b/sdk/batch/arm-batch/samples-dev/certificateListByBatchAccountSample.ts @@ -0,0 +1,71 @@ +/* + * 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 { + CertificateListByBatchAccountOptionalParams, + BatchManagementClient +} from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Lists all of the certificates in the specified account. + * + * @summary Lists all of the certificates in the specified account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/CertificateList.json + */ +async function listCertificates() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.certificateOperations.listByBatchAccount( + resourceGroupName, + accountName + )) { + resArray.push(item); + } + console.log(resArray); +} + +listCertificates().catch(console.error); + +/** + * This sample demonstrates how to Lists all of the certificates in the specified account. + * + * @summary Lists all of the certificates in the specified account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/CertificateListWithFilter.json + */ +async function listCertificatesFilterAndSelect() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const select = "properties/format,properties/provisioningState"; + const filter = + "properties/provisioningStateTransitionTime gt '2017-05-01' or properties/provisioningState eq 'Failed'"; + const options: CertificateListByBatchAccountOptionalParams = { + select, + filter + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.certificateOperations.listByBatchAccount( + resourceGroupName, + accountName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +listCertificatesFilterAndSelect().catch(console.error); diff --git a/sdk/batch/arm-batch/samples-dev/certificateUpdateSample.ts b/sdk/batch/arm-batch/samples-dev/certificateUpdateSample.ts new file mode 100644 index 000000000000..ea1bdc4fb99e --- /dev/null +++ b/sdk/batch/arm-batch/samples-dev/certificateUpdateSample.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 { + CertificateCreateOrUpdateParameters, + BatchManagementClient +} from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Updates the properties of an existing certificate. + * + * @summary Updates the properties of an existing certificate. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/CertificateUpdate.json + */ +async function updateCertificate() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const certificateName = "sha1-0a0e4f50d51beadeac1d35afc5116098e7902e6e"; + const parameters: CertificateCreateOrUpdateParameters = { + data: "MIIJsgIBAzCCCW4GCSqGSIb3DQE...", + password: "" + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.certificateOperations.update( + resourceGroupName, + accountName, + certificateName, + parameters + ); + console.log(result); +} + +updateCertificate().catch(console.error); diff --git a/sdk/batch/arm-batch/samples-dev/locationCheckNameAvailabilitySample.ts b/sdk/batch/arm-batch/samples-dev/locationCheckNameAvailabilitySample.ts new file mode 100644 index 000000000000..56a8f4d7549c --- /dev/null +++ b/sdk/batch/arm-batch/samples-dev/locationCheckNameAvailabilitySample.ts @@ -0,0 +1,63 @@ +/* + * 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 { + CheckNameAvailabilityParameters, + BatchManagementClient +} from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Checks whether the Batch account name is available in the specified region. + * + * @summary Checks whether the Batch account name is available in the specified region. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/LocationCheckNameAvailability_AlreadyExists.json + */ +async function locationCheckNameAvailabilityAlreadyExists() { + const subscriptionId = "subid"; + const locationName = "japaneast"; + const parameters: CheckNameAvailabilityParameters = { + name: "existingaccountname", + type: "Microsoft.Batch/batchAccounts" + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.location.checkNameAvailability( + locationName, + parameters + ); + console.log(result); +} + +locationCheckNameAvailabilityAlreadyExists().catch(console.error); + +/** + * This sample demonstrates how to Checks whether the Batch account name is available in the specified region. + * + * @summary Checks whether the Batch account name is available in the specified region. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/LocationCheckNameAvailability_Available.json + */ +async function locationCheckNameAvailabilityAvailable() { + const subscriptionId = "subid"; + const locationName = "japaneast"; + const parameters: CheckNameAvailabilityParameters = { + name: "newaccountname", + type: "Microsoft.Batch/batchAccounts" + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.location.checkNameAvailability( + locationName, + parameters + ); + console.log(result); +} + +locationCheckNameAvailabilityAvailable().catch(console.error); diff --git a/sdk/batch/arm-batch/samples-dev/locationGetQuotasSample.ts b/sdk/batch/arm-batch/samples-dev/locationGetQuotasSample.ts new file mode 100644 index 000000000000..e259385aeec5 --- /dev/null +++ b/sdk/batch/arm-batch/samples-dev/locationGetQuotasSample.ts @@ -0,0 +1,29 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets the Batch service quotas for the specified subscription at the given location. + * + * @summary Gets the Batch service quotas for the specified subscription at the given location. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/LocationGetQuotas.json + */ +async function locationGetQuotas() { + const subscriptionId = "subid"; + const locationName = "japaneast"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.location.getQuotas(locationName); + console.log(result); +} + +locationGetQuotas().catch(console.error); diff --git a/sdk/batch/arm-batch/samples-dev/locationListSupportedCloudServiceSkusSample.ts b/sdk/batch/arm-batch/samples-dev/locationListSupportedCloudServiceSkusSample.ts new file mode 100644 index 000000000000..dbf9979688c0 --- /dev/null +++ b/sdk/batch/arm-batch/samples-dev/locationListSupportedCloudServiceSkusSample.ts @@ -0,0 +1,34 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets the list of Batch supported Cloud Service VM sizes available at the given location. + * + * @summary Gets the list of Batch supported Cloud Service VM sizes available at the given location. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/LocationListCloudServiceSkus.json + */ +async function locationListCloudServiceSkus() { + const subscriptionId = "subid"; + const locationName = "japaneast"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.location.listSupportedCloudServiceSkus( + locationName + )) { + resArray.push(item); + } + console.log(resArray); +} + +locationListCloudServiceSkus().catch(console.error); diff --git a/sdk/batch/arm-batch/samples-dev/locationListSupportedVirtualMachineSkusSample.ts b/sdk/batch/arm-batch/samples-dev/locationListSupportedVirtualMachineSkusSample.ts new file mode 100644 index 000000000000..82e940c7fb15 --- /dev/null +++ b/sdk/batch/arm-batch/samples-dev/locationListSupportedVirtualMachineSkusSample.ts @@ -0,0 +1,34 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets the list of Batch supported Virtual Machine VM sizes available at the given location. + * + * @summary Gets the list of Batch supported Virtual Machine VM sizes available at the given location. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/LocationListVirtualMachineSkus.json + */ +async function locationListVirtualMachineSkus() { + const subscriptionId = "subid"; + const locationName = "japaneast"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.location.listSupportedVirtualMachineSkus( + locationName + )) { + resArray.push(item); + } + console.log(resArray); +} + +locationListVirtualMachineSkus().catch(console.error); diff --git a/sdk/batch/arm-batch/samples-dev/operationsListSample.ts b/sdk/batch/arm-batch/samples-dev/operationsListSample.ts new file mode 100644 index 000000000000..e1d87b331ac9 --- /dev/null +++ b/sdk/batch/arm-batch/samples-dev/operationsListSample.ts @@ -0,0 +1,31 @@ +/* + * 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 { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Lists available operations for the Microsoft.Batch provider + * + * @summary Lists available operations for the Microsoft.Batch provider + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/OperationsList.json + */ +async function operationsList() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +operationsList().catch(console.error); diff --git a/sdk/batch/arm-batch/samples-dev/poolCreateSample.ts b/sdk/batch/arm-batch/samples-dev/poolCreateSample.ts new file mode 100644 index 000000000000..179e188ccc30 --- /dev/null +++ b/sdk/batch/arm-batch/samples-dev/poolCreateSample.ts @@ -0,0 +1,508 @@ +/* + * 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 { Pool, BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Creates a new pool inside the specified account. + * + * @summary Creates a new pool inside the specified account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolCreate_SharedImageGallery.json + */ +async function createPoolCustomImage() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const poolName = "testpool"; + const parameters: Pool = { + deploymentConfiguration: { + virtualMachineConfiguration: { + imageReference: { + id: + "/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1" + }, + nodeAgentSkuId: "batch.node.ubuntu 18.04" + } + }, + vmSize: "STANDARD_D4" + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.poolOperations.create( + resourceGroupName, + accountName, + poolName, + parameters + ); + console.log(result); +} + +createPoolCustomImage().catch(console.error); + +/** + * This sample demonstrates how to Creates a new pool inside the specified account. + * + * @summary Creates a new pool inside the specified account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolCreate_CloudServiceConfiguration.json + */ +async function createPoolFullCloudServiceConfiguration() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const poolName = "testpool"; + const parameters: Pool = { + applicationLicenses: ["app-license0", "app-license1"], + applicationPackages: [ + { + id: + "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool/applications/app_1234", + version: "asdf" + } + ], + certificates: [ + { + id: + "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool/certificates/sha1-1234567", + storeLocation: "LocalMachine", + storeName: "MY", + visibility: ["RemoteUser"] + } + ], + deploymentConfiguration: { + cloudServiceConfiguration: { + osFamily: "4", + osVersion: "WA-GUEST-OS-4.45_201708-01" + } + }, + displayName: "my-pool-name", + interNodeCommunication: "Enabled", + metadata: [ + { name: "metadata-1", value: "value-1" }, + { name: "metadata-2", value: "value-2" } + ], + networkConfiguration: { + publicIPAddressConfiguration: { + ipAddressIds: [ + "/subscriptions/subid1/resourceGroups/rg13/providers/Microsoft.Network/publicIPAddresses/ip135", + "/subscriptions/subid2/resourceGroups/rg24/providers/Microsoft.Network/publicIPAddresses/ip268" + ], + provision: "UserManaged" + }, + subnetId: + "/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123" + }, + scaleSettings: { + fixedScale: { + nodeDeallocationOption: "TaskCompletion", + resizeTimeout: "PT8M", + targetDedicatedNodes: 6, + targetLowPriorityNodes: 28 + } + }, + startTask: { + commandLine: "cmd /c SET", + environmentSettings: [{ name: "MYSET", value: "1234" }], + maxTaskRetryCount: 6, + resourceFiles: [ + { + fileMode: "777", + filePath: "c:\tempgohere", + httpUrl: "https://testaccount.blob.core.windows.net/example-blob-file" + } + ], + userIdentity: { autoUser: { elevationLevel: "Admin", scope: "Pool" } }, + waitForSuccess: true + }, + taskSchedulingPolicy: { nodeFillType: "Pack" }, + taskSlotsPerNode: 13, + userAccounts: [ + { + name: "username1", + elevationLevel: "Admin", + linuxUserConfiguration: { + gid: 4567, + sshPrivateKey: "sshprivatekeyvalue", + uid: 1234 + }, + password: "" + } + ], + vmSize: "STANDARD_D4" + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.poolOperations.create( + resourceGroupName, + accountName, + poolName, + parameters + ); + console.log(result); +} + +createPoolFullCloudServiceConfiguration().catch(console.error); + +/** + * This sample demonstrates how to Creates a new pool inside the specified account. + * + * @summary Creates a new pool inside the specified account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolCreate_VirtualMachineConfiguration.json + */ +async function createPoolFullVirtualMachineConfiguration() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const poolName = "testpool"; + const parameters: Pool = { + deploymentConfiguration: { + virtualMachineConfiguration: { + dataDisks: [ + { + caching: "ReadWrite", + diskSizeGB: 30, + lun: 0, + storageAccountType: "Premium_LRS" + }, + { + caching: "None", + diskSizeGB: 200, + lun: 1, + storageAccountType: "Standard_LRS" + } + ], + diskEncryptionConfiguration: { targets: ["OsDisk", "TemporaryDisk"] }, + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter-SmallDisk", + version: "latest" + }, + licenseType: "Windows_Server", + nodeAgentSkuId: "batch.node.windows amd64", + nodePlacementConfiguration: { policy: "Zonal" }, + osDisk: { ephemeralOSDiskSettings: { placement: "CacheDisk" } }, + windowsConfiguration: { enableAutomaticUpdates: false } + } + }, + networkConfiguration: { + endpointConfiguration: { + inboundNatPools: [ + { + name: "testnat", + backendPort: 12001, + frontendPortRangeEnd: 15100, + frontendPortRangeStart: 15000, + networkSecurityGroupRules: [ + { + access: "Allow", + priority: 150, + sourceAddressPrefix: "192.100.12.45", + sourcePortRanges: ["1", "2"] + }, + { + access: "Deny", + priority: 3500, + sourceAddressPrefix: "*", + sourcePortRanges: ["*"] + } + ], + protocol: "TCP" + } + ] + } + }, + scaleSettings: { + autoScale: { + evaluationInterval: "PT5M", + formula: "$TargetDedicatedNodes=1" + } + }, + vmSize: "STANDARD_D4" + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.poolOperations.create( + resourceGroupName, + accountName, + poolName, + parameters + ); + console.log(result); +} + +createPoolFullVirtualMachineConfiguration().catch(console.error); + +/** + * This sample demonstrates how to Creates a new pool inside the specified account. + * + * @summary Creates a new pool inside the specified account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolCreate_MinimalCloudServiceConfiguration.json + */ +async function createPoolMinimalCloudServiceConfiguration() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const poolName = "testpool"; + const parameters: Pool = { + deploymentConfiguration: { cloudServiceConfiguration: { osFamily: "5" } }, + scaleSettings: { fixedScale: { targetDedicatedNodes: 3 } }, + vmSize: "STANDARD_D4" + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.poolOperations.create( + resourceGroupName, + accountName, + poolName, + parameters + ); + console.log(result); +} + +createPoolMinimalCloudServiceConfiguration().catch(console.error); + +/** + * This sample demonstrates how to Creates a new pool inside the specified account. + * + * @summary Creates a new pool inside the specified account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolCreate_MinimalVirtualMachineConfiguration.json + */ +async function createPoolMinimalVirtualMachineConfiguration() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const poolName = "testpool"; + const parameters: Pool = { + deploymentConfiguration: { + virtualMachineConfiguration: { + imageReference: { + offer: "UbuntuServer", + publisher: "Canonical", + sku: "18.04-LTS", + version: "latest" + }, + nodeAgentSkuId: "batch.node.ubuntu 18.04" + } + }, + scaleSettings: { + autoScale: { + evaluationInterval: "PT5M", + formula: "$TargetDedicatedNodes=1" + } + }, + vmSize: "STANDARD_D4" + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.poolOperations.create( + resourceGroupName, + accountName, + poolName, + parameters + ); + console.log(result); +} + +createPoolMinimalVirtualMachineConfiguration().catch(console.error); + +/** + * This sample demonstrates how to Creates a new pool inside the specified account. + * + * @summary Creates a new pool inside the specified account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolCreate_NoPublicIPAddresses.json + */ +async function createPoolNoPublicIP() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const poolName = "testpool"; + const parameters: Pool = { + deploymentConfiguration: { + virtualMachineConfiguration: { + imageReference: { + id: + "/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1" + }, + nodeAgentSkuId: "batch.node.ubuntu 18.04" + } + }, + networkConfiguration: { + publicIPAddressConfiguration: { provision: "NoPublicIPAddresses" }, + subnetId: + "/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123" + }, + vmSize: "STANDARD_D4" + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.poolOperations.create( + resourceGroupName, + accountName, + poolName, + parameters + ); + console.log(result); +} + +createPoolNoPublicIP().catch(console.error); + +/** + * This sample demonstrates how to Creates a new pool inside the specified account. + * + * @summary Creates a new pool inside the specified account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolCreate_PublicIPs.json + */ +async function createPoolPublicIPs() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const poolName = "testpool"; + const parameters: Pool = { + deploymentConfiguration: { + virtualMachineConfiguration: { + imageReference: { + id: + "/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1" + }, + nodeAgentSkuId: "batch.node.ubuntu 18.04" + } + }, + networkConfiguration: { + publicIPAddressConfiguration: { + ipAddressIds: [ + "/subscriptions/subid1/resourceGroups/rg13/providers/Microsoft.Network/publicIPAddresses/ip135" + ], + provision: "UserManaged" + }, + subnetId: + "/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123" + }, + vmSize: "STANDARD_D4" + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.poolOperations.create( + resourceGroupName, + accountName, + poolName, + parameters + ); + console.log(result); +} + +createPoolPublicIPs().catch(console.error); + +/** + * This sample demonstrates how to Creates a new pool inside the specified account. + * + * @summary Creates a new pool inside the specified account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolCreate_UserAssignedIdentities.json + */ +async function createPoolUserAssignedIdentities() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const poolName = "testpool"; + const parameters: Pool = { + deploymentConfiguration: { + virtualMachineConfiguration: { + imageReference: { + offer: "UbuntuServer", + publisher: "Canonical", + sku: "18.04-LTS", + version: "latest" + }, + nodeAgentSkuId: "batch.node.ubuntu 18.04" + } + }, + identity: { + type: "UserAssigned", + userAssignedIdentities: { + "/subscriptions/subid/resourceGroups/defaultAzurebatchJapaneast/providers/MicrosoftManagedIdentity/userAssignedIdentities/id1": {}, + "/subscriptions/subid/resourceGroups/defaultAzurebatchJapaneast/providers/MicrosoftManagedIdentity/userAssignedIdentities/id2": {} + } + }, + scaleSettings: { + autoScale: { + evaluationInterval: "PT5M", + formula: "$TargetDedicatedNodes=1" + } + }, + vmSize: "STANDARD_D4" + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.poolOperations.create( + resourceGroupName, + accountName, + poolName, + parameters + ); + console.log(result); +} + +createPoolUserAssignedIdentities().catch(console.error); + +/** + * This sample demonstrates how to Creates a new pool inside the specified account. + * + * @summary Creates a new pool inside the specified account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolCreate_VirtualMachineConfiguration_Extensions.json + */ +async function createPoolVirtualMachineConfigurationExtensions() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const poolName = "testpool"; + const parameters: Pool = { + deploymentConfiguration: { + virtualMachineConfiguration: { + imageReference: { + offer: "0001-com-ubuntu-server-focal", + publisher: "Canonical", + sku: "20_04-lts" + }, + nodeAgentSkuId: "batch.node.ubuntu 20.04", + extensions: [ + { + name: "batchextension1", + type: "SecurityMonitoringForLinux", + autoUpgradeMinorVersion: true, + protectedSettings: { + protectedSettingsKey: "protectedSettingsValue" + }, + publisher: "Microsoft.Azure.Security.Monitoring", + settings: { settingsKey: "settingsValue" }, + typeHandlerVersion: "1.0" + } + ] + } + }, + scaleSettings: { + autoScale: { + evaluationInterval: "PT5M", + formula: "$TargetDedicatedNodes=1" + } + }, + vmSize: "STANDARD_D4" + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.poolOperations.create( + resourceGroupName, + accountName, + poolName, + parameters + ); + console.log(result); +} + +createPoolVirtualMachineConfigurationExtensions().catch(console.error); diff --git a/sdk/batch/arm-batch/samples-dev/poolDeleteSample.ts b/sdk/batch/arm-batch/samples-dev/poolDeleteSample.ts new file mode 100644 index 000000000000..64017e520897 --- /dev/null +++ b/sdk/batch/arm-batch/samples-dev/poolDeleteSample.ts @@ -0,0 +1,35 @@ +/* + * 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 { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Deletes the specified pool. + * + * @summary Deletes the specified pool. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolDelete.json + */ +async function deletePool() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const poolName = "testpool"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.poolOperations.beginDeleteAndWait( + resourceGroupName, + accountName, + poolName + ); + console.log(result); +} + +deletePool().catch(console.error); diff --git a/sdk/batch/arm-batch/samples-dev/poolDisableAutoScaleSample.ts b/sdk/batch/arm-batch/samples-dev/poolDisableAutoScaleSample.ts new file mode 100644 index 000000000000..a889dcd6a1c2 --- /dev/null +++ b/sdk/batch/arm-batch/samples-dev/poolDisableAutoScaleSample.ts @@ -0,0 +1,35 @@ +/* + * 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 { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Disables automatic scaling for a pool. + * + * @summary Disables automatic scaling for a pool. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolDisableAutoScale.json + */ +async function disableAutoScale() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const poolName = "testpool"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.poolOperations.disableAutoScale( + resourceGroupName, + accountName, + poolName + ); + console.log(result); +} + +disableAutoScale().catch(console.error); diff --git a/sdk/batch/arm-batch/samples-dev/poolGetSample.ts b/sdk/batch/arm-batch/samples-dev/poolGetSample.ts new file mode 100644 index 000000000000..88376ecccc53 --- /dev/null +++ b/sdk/batch/arm-batch/samples-dev/poolGetSample.ts @@ -0,0 +1,58 @@ +/* + * 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 { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets information about the specified pool. + * + * @summary Gets information about the specified pool. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolGet.json + */ +async function getPool() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const poolName = "testpool"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.poolOperations.get( + resourceGroupName, + accountName, + poolName + ); + console.log(result); +} + +getPool().catch(console.error); + +/** + * This sample demonstrates how to Gets information about the specified pool. + * + * @summary Gets information about the specified pool. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolGet_VirtualMachineConfiguration_Extensions.json + */ +async function getPoolVirtualMachineConfigurationExtensions() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const poolName = "testpool"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.poolOperations.get( + resourceGroupName, + accountName, + poolName + ); + console.log(result); +} + +getPoolVirtualMachineConfigurationExtensions().catch(console.error); diff --git a/sdk/batch/arm-batch/samples-dev/poolListByBatchAccountSample.ts b/sdk/batch/arm-batch/samples-dev/poolListByBatchAccountSample.ts new file mode 100644 index 000000000000..b73817a0dbc6 --- /dev/null +++ b/sdk/batch/arm-batch/samples-dev/poolListByBatchAccountSample.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 { + PoolListByBatchAccountOptionalParams, + BatchManagementClient +} from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Lists all of the pools in the specified account. + * + * @summary Lists all of the pools in the specified account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolList.json + */ +async function listPool() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.poolOperations.listByBatchAccount( + resourceGroupName, + accountName + )) { + resArray.push(item); + } + console.log(resArray); +} + +listPool().catch(console.error); + +/** + * This sample demonstrates how to Lists all of the pools in the specified account. + * + * @summary Lists all of the pools in the specified account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolListWithFilter.json + */ +async function listPoolWithFilter() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const select = + "properties/allocationState,properties/provisioningStateTransitionTime,properties/currentDedicatedNodes,properties/currentLowPriorityNodes"; + const filter = + "startswith(name, 'po') or (properties/allocationState eq 'Steady' and properties/provisioningStateTransitionTime lt datetime'2017-02-02')"; + const options: PoolListByBatchAccountOptionalParams = { select, filter }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.poolOperations.listByBatchAccount( + resourceGroupName, + accountName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +listPoolWithFilter().catch(console.error); diff --git a/sdk/batch/arm-batch/samples-dev/poolStopResizeSample.ts b/sdk/batch/arm-batch/samples-dev/poolStopResizeSample.ts new file mode 100644 index 000000000000..e28c7178f433 --- /dev/null +++ b/sdk/batch/arm-batch/samples-dev/poolStopResizeSample.ts @@ -0,0 +1,35 @@ +/* + * 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 { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to This does not restore the pool to its previous state before the resize operation: it only stops any further changes being made, and the pool maintains its current state. After stopping, the pool stabilizes at the number of nodes it was at when the stop operation was done. During the stop operation, the pool allocation state changes first to stopping and then to steady. A resize operation need not be an explicit resize pool request; this API can also be used to halt the initial sizing of the pool when it is created. + * + * @summary This does not restore the pool to its previous state before the resize operation: it only stops any further changes being made, and the pool maintains its current state. After stopping, the pool stabilizes at the number of nodes it was at when the stop operation was done. During the stop operation, the pool allocation state changes first to stopping and then to steady. A resize operation need not be an explicit resize pool request; this API can also be used to halt the initial sizing of the pool when it is created. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolStopResize.json + */ +async function stopPoolResize() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const poolName = "testpool"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.poolOperations.stopResize( + resourceGroupName, + accountName, + poolName + ); + console.log(result); +} + +stopPoolResize().catch(console.error); diff --git a/sdk/batch/arm-batch/samples-dev/poolUpdateSample.ts b/sdk/batch/arm-batch/samples-dev/poolUpdateSample.ts new file mode 100644 index 000000000000..f21c34b6b332 --- /dev/null +++ b/sdk/batch/arm-batch/samples-dev/poolUpdateSample.ts @@ -0,0 +1,144 @@ +/* + * 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 { Pool, BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Updates the properties of an existing pool. + * + * @summary Updates the properties of an existing pool. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolUpdate_EnableAutoScale.json + */ +async function updatePoolEnableAutoscale() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const poolName = "testpool"; + const parameters: Pool = { + scaleSettings: { autoScale: { formula: "$TargetDedicatedNodes=34" } } + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.poolOperations.update( + resourceGroupName, + accountName, + poolName, + parameters + ); + console.log(result); +} + +updatePoolEnableAutoscale().catch(console.error); + +/** + * This sample demonstrates how to Updates the properties of an existing pool. + * + * @summary Updates the properties of an existing pool. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolUpdate_OtherProperties.json + */ +async function updatePoolOtherProperties() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const poolName = "testpool"; + const parameters: Pool = { + applicationPackages: [ + { + id: + "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool/applications/app_1234" + }, + { + id: + "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool/applications/app_5678", + version: "1.0" + } + ], + certificates: [ + { + id: + "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool/certificates/sha1-1234567", + storeLocation: "LocalMachine", + storeName: "MY" + } + ], + metadata: [{ name: "key1", value: "value1" }] + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.poolOperations.update( + resourceGroupName, + accountName, + poolName, + parameters + ); + console.log(result); +} + +updatePoolOtherProperties().catch(console.error); + +/** + * This sample demonstrates how to Updates the properties of an existing pool. + * + * @summary Updates the properties of an existing pool. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolUpdate_RemoveStartTask.json + */ +async function updatePoolRemoveStartTask() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const poolName = "testpool"; + const parameters: Pool = { startTask: {} }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.poolOperations.update( + resourceGroupName, + accountName, + poolName, + parameters + ); + console.log(result); +} + +updatePoolRemoveStartTask().catch(console.error); + +/** + * This sample demonstrates how to Updates the properties of an existing pool. + * + * @summary Updates the properties of an existing pool. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolUpdate_ResizePool.json + */ +async function updatePoolResizePool() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const poolName = "testpool"; + const parameters: Pool = { + scaleSettings: { + fixedScale: { + nodeDeallocationOption: "TaskCompletion", + resizeTimeout: "PT8M", + targetDedicatedNodes: 5, + targetLowPriorityNodes: 0 + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.poolOperations.update( + resourceGroupName, + accountName, + poolName, + parameters + ); + console.log(result); +} + +updatePoolResizePool().catch(console.error); diff --git a/sdk/batch/arm-batch/samples-dev/privateEndpointConnectionGetSample.ts b/sdk/batch/arm-batch/samples-dev/privateEndpointConnectionGetSample.ts new file mode 100644 index 000000000000..760713d49f60 --- /dev/null +++ b/sdk/batch/arm-batch/samples-dev/privateEndpointConnectionGetSample.ts @@ -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. +import { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets information about the specified private endpoint connection. + * + * @summary Gets information about the specified private endpoint connection. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PrivateEndpointConnectionGet.json + */ +async function getPrivateEndpointConnection() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const privateEndpointConnectionName = + "testprivateEndpointConnection5testprivateEndpointConnection5.24d6b4b5-e65c-4330-bbe9-3a290d62f8e0"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.privateEndpointConnectionOperations.get( + resourceGroupName, + accountName, + privateEndpointConnectionName + ); + console.log(result); +} + +getPrivateEndpointConnection().catch(console.error); diff --git a/sdk/batch/arm-batch/samples-dev/privateEndpointConnectionListByBatchAccountSample.ts b/sdk/batch/arm-batch/samples-dev/privateEndpointConnectionListByBatchAccountSample.ts new file mode 100644 index 000000000000..235cc5ddf8a7 --- /dev/null +++ b/sdk/batch/arm-batch/samples-dev/privateEndpointConnectionListByBatchAccountSample.ts @@ -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. +import { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Lists all of the private endpoint connections in the specified account. + * + * @summary Lists all of the private endpoint connections in the specified account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PrivateEndpointConnectionsList.json + */ +async function listPrivateEndpointConnections() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.privateEndpointConnectionOperations.listByBatchAccount( + resourceGroupName, + accountName + )) { + resArray.push(item); + } + console.log(resArray); +} + +listPrivateEndpointConnections().catch(console.error); diff --git a/sdk/batch/arm-batch/samples-dev/privateEndpointConnectionUpdateSample.ts b/sdk/batch/arm-batch/samples-dev/privateEndpointConnectionUpdateSample.ts new file mode 100644 index 000000000000..94fe980b2f78 --- /dev/null +++ b/sdk/batch/arm-batch/samples-dev/privateEndpointConnectionUpdateSample.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 { + PrivateEndpointConnection, + BatchManagementClient +} from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Updates the properties of an existing private endpoint connection. + * + * @summary Updates the properties of an existing private endpoint connection. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PrivateEndpointConnectionUpdate.json + */ +async function updatePrivateEndpointConnection() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const privateEndpointConnectionName = + "testprivateEndpointConnection5.24d6b4b5-e65c-4330-bbe9-3a290d62f8e0"; + const parameters: PrivateEndpointConnection = { + privateLinkServiceConnectionState: { + description: "Approved by xyz.abc@company.com", + status: "Approved" + } + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.privateEndpointConnectionOperations.beginUpdateAndWait( + resourceGroupName, + accountName, + privateEndpointConnectionName, + parameters + ); + console.log(result); +} + +updatePrivateEndpointConnection().catch(console.error); diff --git a/sdk/batch/arm-batch/samples-dev/privateLinkResourceGetSample.ts b/sdk/batch/arm-batch/samples-dev/privateLinkResourceGetSample.ts new file mode 100644 index 000000000000..52d6b30fb81e --- /dev/null +++ b/sdk/batch/arm-batch/samples-dev/privateLinkResourceGetSample.ts @@ -0,0 +1,35 @@ +/* + * 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 { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets information about the specified private link resource. + * + * @summary Gets information about the specified private link resource. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PrivateLinkResourceGet.json + */ +async function getPrivateLinkResource() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const privateLinkResourceName = "sampleacct"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.privateLinkResourceOperations.get( + resourceGroupName, + accountName, + privateLinkResourceName + ); + console.log(result); +} + +getPrivateLinkResource().catch(console.error); diff --git a/sdk/batch/arm-batch/samples-dev/privateLinkResourceListByBatchAccountSample.ts b/sdk/batch/arm-batch/samples-dev/privateLinkResourceListByBatchAccountSample.ts new file mode 100644 index 000000000000..05a019a98064 --- /dev/null +++ b/sdk/batch/arm-batch/samples-dev/privateLinkResourceListByBatchAccountSample.ts @@ -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. +import { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Lists all of the private link resources in the specified account. + * + * @summary Lists all of the private link resources in the specified account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PrivateLinkResourcesList.json + */ +async function listPrivateLinkResource() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.privateLinkResourceOperations.listByBatchAccount( + resourceGroupName, + accountName + )) { + resArray.push(item); + } + console.log(resArray); +} + +listPrivateLinkResource().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/javascript/README.md b/sdk/batch/arm-batch/samples/v7/javascript/README.md new file mode 100644 index 000000000000..0d855ad54aa7 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/javascript/README.md @@ -0,0 +1,138 @@ +# client library samples for JavaScript + +These sample programs show how to use the JavaScript client libraries for in some common scenarios. + +| **File Name** | **Description** | +| --------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [applicationCreateSample.js][applicationcreatesample] | Adds an application to the specified Batch account. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationCreate.json | +| [applicationDeleteSample.js][applicationdeletesample] | Deletes an application. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationDelete.json | +| [applicationGetSample.js][applicationgetsample] | Gets information about the specified application. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationGet.json | +| [applicationListSample.js][applicationlistsample] | Lists all of the applications in the specified account. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationList.json | +| [applicationPackageActivateSample.js][applicationpackageactivatesample] | Activates the specified application package. This should be done after the `ApplicationPackage` was created and uploaded. This needs to be done before an `ApplicationPackage` can be used on Pools or Tasks. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationPackageActivate.json | +| [applicationPackageCreateSample.js][applicationpackagecreatesample] | Creates an application package record. The record contains a storageUrl where the package should be uploaded to. Once it is uploaded the `ApplicationPackage` needs to be activated using `ApplicationPackageActive` before it can be used. If the auto storage account was configured to use storage keys, the URL returned will contain a SAS. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationPackageCreate.json | +| [applicationPackageDeleteSample.js][applicationpackagedeletesample] | Deletes an application package record and its associated binary file. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationPackageDelete.json | +| [applicationPackageGetSample.js][applicationpackagegetsample] | Gets information about the specified application package. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationPackageGet.json | +| [applicationPackageListSample.js][applicationpackagelistsample] | Lists all of the application packages in the specified application. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationPackageList.json | +| [applicationUpdateSample.js][applicationupdatesample] | Updates settings for the specified application. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationUpdate.json | +| [batchAccountCreateSample.js][batchaccountcreatesample] | Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and should instead be updated with the Update Batch Account API. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountCreate_BYOS.json | +| [batchAccountDeleteSample.js][batchaccountdeletesample] | Deletes the specified Batch account. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountDelete.json | +| [batchAccountGetDetectorSample.js][batchaccountgetdetectorsample] | Gets information about the given detector for a given Batch account. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/DetectorGet.json | +| [batchAccountGetKeysSample.js][batchaccountgetkeyssample] | This operation applies only to Batch accounts with allowedAuthenticationModes containing 'SharedKey'. If the Batch account doesn't contain 'SharedKey' in its allowedAuthenticationMode, clients cannot use shared keys to authenticate, and must use another allowedAuthenticationModes instead. In this case, getting the keys will fail. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountGetKeys.json | +| [batchAccountGetSample.js][batchaccountgetsample] | Gets information about the specified Batch account. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountGet.json | +| [batchAccountListByResourceGroupSample.js][batchaccountlistbyresourcegroupsample] | Gets information about the Batch accounts associated with the specified resource group. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountListByResourceGroup.json | +| [batchAccountListDetectorsSample.js][batchaccountlistdetectorssample] | Gets information about the detectors available for a given Batch account. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/DetectorList.json | +| [batchAccountListOutboundNetworkDependenciesEndpointsSample.js][batchaccountlistoutboundnetworkdependenciesendpointssample] | Lists the endpoints that a Batch Compute Node under this Batch Account may call as part of Batch service administration. If you are deploying a Pool inside of a virtual network that you specify, you must make sure your network allows outbound access to these endpoints. Failure to allow access to these endpoints may cause Batch to mark the affected nodes as unusable. For more information about creating a pool inside of a virtual network, see https://docs.microsoft.com/en-us/azure/batch/batch-virtual-network. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountListOutboundNetworkDependenciesEndpoints.json | +| [batchAccountListSample.js][batchaccountlistsample] | Gets information about the Batch accounts associated with the subscription. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountList.json | +| [batchAccountRegenerateKeySample.js][batchaccountregeneratekeysample] | This operation applies only to Batch accounts with allowedAuthenticationModes containing 'SharedKey'. If the Batch account doesn't contain 'SharedKey' in its allowedAuthenticationMode, clients cannot use shared keys to authenticate, and must use another allowedAuthenticationModes instead. In this case, regenerating the keys will fail. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountRegenerateKey.json | +| [batchAccountSynchronizeAutoStorageKeysSample.js][batchaccountsynchronizeautostoragekeyssample] | Synchronizes access keys for the auto-storage account configured for the specified Batch account, only if storage key authentication is being used. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountSynchronizeAutoStorageKeys.json | +| [batchAccountUpdateSample.js][batchaccountupdatesample] | Updates the properties of an existing Batch account. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountUpdate.json | +| [certificateCancelDeletionSample.js][certificatecanceldeletionsample] | If you try to delete a certificate that is being used by a pool or compute node, the status of the certificate changes to deleteFailed. If you decide that you want to continue using the certificate, you can use this operation to set the status of the certificate back to active. If you intend to delete the certificate, you do not need to run this operation after the deletion failed. You must make sure that the certificate is not being used by any resources, and then you can try again to delete the certificate. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/CertificateCancelDeletion.json | +| [certificateCreateSample.js][certificatecreatesample] | Creates a new certificate inside the specified account. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/CertificateCreate_Full.json | +| [certificateDeleteSample.js][certificatedeletesample] | Deletes the specified certificate. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/CertificateDelete.json | +| [certificateGetSample.js][certificategetsample] | Gets information about the specified certificate. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/CertificateGet.json | +| [certificateListByBatchAccountSample.js][certificatelistbybatchaccountsample] | Lists all of the certificates in the specified account. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/CertificateList.json | +| [certificateUpdateSample.js][certificateupdatesample] | Updates the properties of an existing certificate. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/CertificateUpdate.json | +| [locationCheckNameAvailabilitySample.js][locationchecknameavailabilitysample] | Checks whether the Batch account name is available in the specified region. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/LocationCheckNameAvailability_AlreadyExists.json | +| [locationGetQuotasSample.js][locationgetquotassample] | Gets the Batch service quotas for the specified subscription at the given location. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/LocationGetQuotas.json | +| [locationListSupportedCloudServiceSkusSample.js][locationlistsupportedcloudserviceskussample] | Gets the list of Batch supported Cloud Service VM sizes available at the given location. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/LocationListCloudServiceSkus.json | +| [locationListSupportedVirtualMachineSkusSample.js][locationlistsupportedvirtualmachineskussample] | Gets the list of Batch supported Virtual Machine VM sizes available at the given location. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/LocationListVirtualMachineSkus.json | +| [operationsListSample.js][operationslistsample] | Lists available operations for the Microsoft.Batch provider x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/OperationsList.json | +| [poolCreateSample.js][poolcreatesample] | Creates a new pool inside the specified account. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolCreate_SharedImageGallery.json | +| [poolDeleteSample.js][pooldeletesample] | Deletes the specified pool. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolDelete.json | +| [poolDisableAutoScaleSample.js][pooldisableautoscalesample] | Disables automatic scaling for a pool. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolDisableAutoScale.json | +| [poolGetSample.js][poolgetsample] | Gets information about the specified pool. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolGet.json | +| [poolListByBatchAccountSample.js][poollistbybatchaccountsample] | Lists all of the pools in the specified account. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolList.json | +| [poolStopResizeSample.js][poolstopresizesample] | This does not restore the pool to its previous state before the resize operation: it only stops any further changes being made, and the pool maintains its current state. After stopping, the pool stabilizes at the number of nodes it was at when the stop operation was done. During the stop operation, the pool allocation state changes first to stopping and then to steady. A resize operation need not be an explicit resize pool request; this API can also be used to halt the initial sizing of the pool when it is created. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolStopResize.json | +| [poolUpdateSample.js][poolupdatesample] | Updates the properties of an existing pool. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolUpdate_EnableAutoScale.json | +| [privateEndpointConnectionGetSample.js][privateendpointconnectiongetsample] | Gets information about the specified private endpoint connection. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PrivateEndpointConnectionGet.json | +| [privateEndpointConnectionListByBatchAccountSample.js][privateendpointconnectionlistbybatchaccountsample] | Lists all of the private endpoint connections in the specified account. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PrivateEndpointConnectionsList.json | +| [privateEndpointConnectionUpdateSample.js][privateendpointconnectionupdatesample] | Updates the properties of an existing private endpoint connection. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PrivateEndpointConnectionUpdate.json | +| [privateLinkResourceGetSample.js][privatelinkresourcegetsample] | Gets information about the specified private link resource. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PrivateLinkResourceGet.json | +| [privateLinkResourceListByBatchAccountSample.js][privatelinkresourcelistbybatchaccountsample] | Lists all of the private link resources in the specified account. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PrivateLinkResourcesList.json | + +## Prerequisites + +The sample programs are compatible with [LTS versions of Node.js](https://nodejs.org/about/releases/). + +You need [an Azure subscription][freesub] to run these sample programs. + +Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. + +Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. + +## Setup + +To run the samples using the published version of the package: + +1. Install the dependencies using `npm`: + +```bash +npm install +``` + +2. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. + +3. Run whichever samples you like (note that some samples may require additional setup, see the table above): + +```bash +node applicationCreateSample.js +``` + +Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): + +```bash +npx cross-env node applicationCreateSample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[applicationcreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/javascript/applicationCreateSample.js +[applicationdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/javascript/applicationDeleteSample.js +[applicationgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/javascript/applicationGetSample.js +[applicationlistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/javascript/applicationListSample.js +[applicationpackageactivatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/javascript/applicationPackageActivateSample.js +[applicationpackagecreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/javascript/applicationPackageCreateSample.js +[applicationpackagedeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/javascript/applicationPackageDeleteSample.js +[applicationpackagegetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/javascript/applicationPackageGetSample.js +[applicationpackagelistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/javascript/applicationPackageListSample.js +[applicationupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/javascript/applicationUpdateSample.js +[batchaccountcreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/javascript/batchAccountCreateSample.js +[batchaccountdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/javascript/batchAccountDeleteSample.js +[batchaccountgetdetectorsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/javascript/batchAccountGetDetectorSample.js +[batchaccountgetkeyssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/javascript/batchAccountGetKeysSample.js +[batchaccountgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/javascript/batchAccountGetSample.js +[batchaccountlistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/javascript/batchAccountListByResourceGroupSample.js +[batchaccountlistdetectorssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/javascript/batchAccountListDetectorsSample.js +[batchaccountlistoutboundnetworkdependenciesendpointssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/javascript/batchAccountListOutboundNetworkDependenciesEndpointsSample.js +[batchaccountlistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/javascript/batchAccountListSample.js +[batchaccountregeneratekeysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/javascript/batchAccountRegenerateKeySample.js +[batchaccountsynchronizeautostoragekeyssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/javascript/batchAccountSynchronizeAutoStorageKeysSample.js +[batchaccountupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/javascript/batchAccountUpdateSample.js +[certificatecanceldeletionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/javascript/certificateCancelDeletionSample.js +[certificatecreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/javascript/certificateCreateSample.js +[certificatedeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/javascript/certificateDeleteSample.js +[certificategetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/javascript/certificateGetSample.js +[certificatelistbybatchaccountsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/javascript/certificateListByBatchAccountSample.js +[certificateupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/javascript/certificateUpdateSample.js +[locationchecknameavailabilitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/javascript/locationCheckNameAvailabilitySample.js +[locationgetquotassample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/javascript/locationGetQuotasSample.js +[locationlistsupportedcloudserviceskussample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/javascript/locationListSupportedCloudServiceSkusSample.js +[locationlistsupportedvirtualmachineskussample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/javascript/locationListSupportedVirtualMachineSkusSample.js +[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/javascript/operationsListSample.js +[poolcreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/javascript/poolCreateSample.js +[pooldeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/javascript/poolDeleteSample.js +[pooldisableautoscalesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/javascript/poolDisableAutoScaleSample.js +[poolgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/javascript/poolGetSample.js +[poollistbybatchaccountsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/javascript/poolListByBatchAccountSample.js +[poolstopresizesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/javascript/poolStopResizeSample.js +[poolupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/javascript/poolUpdateSample.js +[privateendpointconnectiongetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/javascript/privateEndpointConnectionGetSample.js +[privateendpointconnectionlistbybatchaccountsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/javascript/privateEndpointConnectionListByBatchAccountSample.js +[privateendpointconnectionupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/javascript/privateEndpointConnectionUpdateSample.js +[privatelinkresourcegetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/javascript/privateLinkResourceGetSample.js +[privatelinkresourcelistbybatchaccountsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/javascript/privateLinkResourceListByBatchAccountSample.js +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-batch?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/batch/arm-batch/README.md diff --git a/sdk/batch/arm-batch/samples/v7/javascript/applicationCreateSample.js b/sdk/batch/arm-batch/samples/v7/javascript/applicationCreateSample.js new file mode 100644 index 000000000000..56f40e1f7c78 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/javascript/applicationCreateSample.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 { BatchManagementClient } = require("@azure/arm-batch"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Adds an application to the specified Batch account. + * + * @summary Adds an application to the specified Batch account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationCreate.json + */ +async function applicationCreate() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const applicationName = "app1"; + const parameters = { + allowUpdates: false, + displayName: "myAppName", + }; + const options = { parameters }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.applicationOperations.create( + resourceGroupName, + accountName, + applicationName, + options + ); + console.log(result); +} + +applicationCreate().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/javascript/applicationDeleteSample.js b/sdk/batch/arm-batch/samples/v7/javascript/applicationDeleteSample.js new file mode 100644 index 000000000000..71a4d673c321 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/javascript/applicationDeleteSample.js @@ -0,0 +1,35 @@ +/* + * 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 { BatchManagementClient } = require("@azure/arm-batch"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Deletes an application. + * + * @summary Deletes an application. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationDelete.json + */ +async function applicationDelete() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const applicationName = "app1"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.applicationOperations.delete( + resourceGroupName, + accountName, + applicationName + ); + console.log(result); +} + +applicationDelete().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/javascript/applicationGetSample.js b/sdk/batch/arm-batch/samples/v7/javascript/applicationGetSample.js new file mode 100644 index 000000000000..7968f73d9bb0 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/javascript/applicationGetSample.js @@ -0,0 +1,35 @@ +/* + * 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 { BatchManagementClient } = require("@azure/arm-batch"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Gets information about the specified application. + * + * @summary Gets information about the specified application. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationGet.json + */ +async function applicationGet() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const applicationName = "app1"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.applicationOperations.get( + resourceGroupName, + accountName, + applicationName + ); + console.log(result); +} + +applicationGet().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/javascript/applicationListSample.js b/sdk/batch/arm-batch/samples/v7/javascript/applicationListSample.js new file mode 100644 index 000000000000..e7bdf88cadaf --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/javascript/applicationListSample.js @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { BatchManagementClient } = require("@azure/arm-batch"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Lists all of the applications in the specified account. + * + * @summary Lists all of the applications in the specified account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationList.json + */ +async function applicationList() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.applicationOperations.list(resourceGroupName, accountName)) { + resArray.push(item); + } + console.log(resArray); +} + +applicationList().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/javascript/applicationPackageActivateSample.js b/sdk/batch/arm-batch/samples/v7/javascript/applicationPackageActivateSample.js new file mode 100644 index 000000000000..58d0077317c7 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/javascript/applicationPackageActivateSample.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 { BatchManagementClient } = require("@azure/arm-batch"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Activates the specified application package. This should be done after the `ApplicationPackage` was created and uploaded. This needs to be done before an `ApplicationPackage` can be used on Pools or Tasks. + * + * @summary Activates the specified application package. This should be done after the `ApplicationPackage` was created and uploaded. This needs to be done before an `ApplicationPackage` can be used on Pools or Tasks. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationPackageActivate.json + */ +async function applicationPackageActivate() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const applicationName = "app1"; + const versionName = "1"; + const parameters = { format: "zip" }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.applicationPackageOperations.activate( + resourceGroupName, + accountName, + applicationName, + versionName, + parameters + ); + console.log(result); +} + +applicationPackageActivate().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/javascript/applicationPackageCreateSample.js b/sdk/batch/arm-batch/samples/v7/javascript/applicationPackageCreateSample.js new file mode 100644 index 000000000000..387a316e2fbd --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/javascript/applicationPackageCreateSample.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 { BatchManagementClient } = require("@azure/arm-batch"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Creates an application package record. The record contains a storageUrl where the package should be uploaded to. Once it is uploaded the `ApplicationPackage` needs to be activated using `ApplicationPackageActive` before it can be used. If the auto storage account was configured to use storage keys, the URL returned will contain a SAS. + * + * @summary Creates an application package record. The record contains a storageUrl where the package should be uploaded to. Once it is uploaded the `ApplicationPackage` needs to be activated using `ApplicationPackageActive` before it can be used. If the auto storage account was configured to use storage keys, the URL returned will contain a SAS. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationPackageCreate.json + */ +async function applicationPackageCreate() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const applicationName = "app1"; + const versionName = "1"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.applicationPackageOperations.create( + resourceGroupName, + accountName, + applicationName, + versionName + ); + console.log(result); +} + +applicationPackageCreate().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/javascript/applicationPackageDeleteSample.js b/sdk/batch/arm-batch/samples/v7/javascript/applicationPackageDeleteSample.js new file mode 100644 index 000000000000..d584a88a2be0 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/javascript/applicationPackageDeleteSample.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 { BatchManagementClient } = require("@azure/arm-batch"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Deletes an application package record and its associated binary file. + * + * @summary Deletes an application package record and its associated binary file. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationPackageDelete.json + */ +async function applicationPackageDelete() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const applicationName = "app1"; + const versionName = "1"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.applicationPackageOperations.delete( + resourceGroupName, + accountName, + applicationName, + versionName + ); + console.log(result); +} + +applicationPackageDelete().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/javascript/applicationPackageGetSample.js b/sdk/batch/arm-batch/samples/v7/javascript/applicationPackageGetSample.js new file mode 100644 index 000000000000..7ac1272e2470 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/javascript/applicationPackageGetSample.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 { BatchManagementClient } = require("@azure/arm-batch"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Gets information about the specified application package. + * + * @summary Gets information about the specified application package. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationPackageGet.json + */ +async function applicationPackageGet() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const applicationName = "app1"; + const versionName = "1"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.applicationPackageOperations.get( + resourceGroupName, + accountName, + applicationName, + versionName + ); + console.log(result); +} + +applicationPackageGet().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/javascript/applicationPackageListSample.js b/sdk/batch/arm-batch/samples/v7/javascript/applicationPackageListSample.js new file mode 100644 index 000000000000..02cb8443a0e1 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/javascript/applicationPackageListSample.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 { BatchManagementClient } = require("@azure/arm-batch"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Lists all of the application packages in the specified application. + * + * @summary Lists all of the application packages in the specified application. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationPackageList.json + */ +async function applicationPackageList() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const applicationName = "app1"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.applicationPackageOperations.list( + resourceGroupName, + accountName, + applicationName + )) { + resArray.push(item); + } + console.log(resArray); +} + +applicationPackageList().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/javascript/applicationUpdateSample.js b/sdk/batch/arm-batch/samples/v7/javascript/applicationUpdateSample.js new file mode 100644 index 000000000000..32c8179f8ba1 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/javascript/applicationUpdateSample.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 { BatchManagementClient } = require("@azure/arm-batch"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Updates settings for the specified application. + * + * @summary Updates settings for the specified application. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationUpdate.json + */ +async function applicationUpdate() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const applicationName = "app1"; + const parameters = { + allowUpdates: true, + defaultVersion: "2", + displayName: "myAppName", + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.applicationOperations.update( + resourceGroupName, + accountName, + applicationName, + parameters + ); + console.log(result); +} + +applicationUpdate().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/javascript/batchAccountCreateSample.js b/sdk/batch/arm-batch/samples/v7/javascript/batchAccountCreateSample.js new file mode 100644 index 000000000000..66680a0a7e68 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/javascript/batchAccountCreateSample.js @@ -0,0 +1,175 @@ +/* + * 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 { BatchManagementClient } = require("@azure/arm-batch"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and should instead be updated with the Update Batch Account API. + * + * @summary Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and should instead be updated with the Update Batch Account API. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountCreate_BYOS.json + */ +async function batchAccountCreateByos() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const parameters = { + autoStorage: { + storageAccountId: + "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage", + }, + keyVaultReference: { + id: "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.KeyVault/vaults/sample", + url: "http://sample.vault.azure.net/", + }, + location: "japaneast", + poolAllocationMode: "UserSubscription", + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.batchAccountOperations.beginCreateAndWait( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +batchAccountCreateByos().catch(console.error); + +/** + * This sample demonstrates how to Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and should instead be updated with the Update Batch Account API. + * + * @summary Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and should instead be updated with the Update Batch Account API. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountCreate_Default.json + */ +async function batchAccountCreateDefault() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const parameters = { + autoStorage: { + storageAccountId: + "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage", + }, + location: "japaneast", + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.batchAccountOperations.beginCreateAndWait( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +batchAccountCreateDefault().catch(console.error); + +/** + * This sample demonstrates how to Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and should instead be updated with the Update Batch Account API. + * + * @summary Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and should instead be updated with the Update Batch Account API. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountCreate_SystemAssignedIdentity.json + */ +async function batchAccountCreateSystemAssignedIdentity() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const parameters = { + autoStorage: { + storageAccountId: + "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage", + }, + identity: { type: "SystemAssigned" }, + location: "japaneast", + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.batchAccountOperations.beginCreateAndWait( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +batchAccountCreateSystemAssignedIdentity().catch(console.error); + +/** + * This sample demonstrates how to Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and should instead be updated with the Update Batch Account API. + * + * @summary Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and should instead be updated with the Update Batch Account API. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountCreate_UserAssignedIdentity.json + */ +async function batchAccountCreateUserAssignedIdentity() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const parameters = { + autoStorage: { + storageAccountId: + "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage", + }, + identity: { + type: "UserAssigned", + userAssignedIdentities: { + "/subscriptions/subid/resourceGroups/defaultAzurebatchJapaneast/providers/MicrosoftManagedIdentity/userAssignedIdentities/id1": + {}, + }, + }, + location: "japaneast", + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.batchAccountOperations.beginCreateAndWait( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +batchAccountCreateUserAssignedIdentity().catch(console.error); + +/** + * This sample demonstrates how to Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and should instead be updated with the Update Batch Account API. + * + * @summary Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and should instead be updated with the Update Batch Account API. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PrivateBatchAccountCreate.json + */ +async function privateBatchAccountCreate() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const parameters = { + autoStorage: { + storageAccountId: + "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage", + }, + keyVaultReference: { + id: "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.KeyVault/vaults/sample", + url: "http://sample.vault.azure.net/", + }, + location: "japaneast", + publicNetworkAccess: "Disabled", + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.batchAccountOperations.beginCreateAndWait( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +privateBatchAccountCreate().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/javascript/batchAccountDeleteSample.js b/sdk/batch/arm-batch/samples/v7/javascript/batchAccountDeleteSample.js new file mode 100644 index 000000000000..35c0626f915e --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/javascript/batchAccountDeleteSample.js @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { BatchManagementClient } = require("@azure/arm-batch"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Deletes the specified Batch account. + * + * @summary Deletes the specified Batch account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountDelete.json + */ +async function batchAccountDelete() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.batchAccountOperations.beginDeleteAndWait( + resourceGroupName, + accountName + ); + console.log(result); +} + +batchAccountDelete().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/javascript/batchAccountGetDetectorSample.js b/sdk/batch/arm-batch/samples/v7/javascript/batchAccountGetDetectorSample.js new file mode 100644 index 000000000000..b31c4a6e27a2 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/javascript/batchAccountGetDetectorSample.js @@ -0,0 +1,35 @@ +/* + * 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 { BatchManagementClient } = require("@azure/arm-batch"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Gets information about the given detector for a given Batch account. + * + * @summary Gets information about the given detector for a given Batch account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/DetectorGet.json + */ +async function getDetector() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const detectorId = "poolsAndNodes"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.batchAccountOperations.getDetector( + resourceGroupName, + accountName, + detectorId + ); + console.log(result); +} + +getDetector().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/javascript/batchAccountGetKeysSample.js b/sdk/batch/arm-batch/samples/v7/javascript/batchAccountGetKeysSample.js new file mode 100644 index 000000000000..cf452e370cb3 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/javascript/batchAccountGetKeysSample.js @@ -0,0 +1,30 @@ +/* + * 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 { BatchManagementClient } = require("@azure/arm-batch"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to This operation applies only to Batch accounts with allowedAuthenticationModes containing 'SharedKey'. If the Batch account doesn't contain 'SharedKey' in its allowedAuthenticationMode, clients cannot use shared keys to authenticate, and must use another allowedAuthenticationModes instead. In this case, getting the keys will fail. + * + * @summary This operation applies only to Batch accounts with allowedAuthenticationModes containing 'SharedKey'. If the Batch account doesn't contain 'SharedKey' in its allowedAuthenticationMode, clients cannot use shared keys to authenticate, and must use another allowedAuthenticationModes instead. In this case, getting the keys will fail. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountGetKeys.json + */ +async function batchAccountGetKeys() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.batchAccountOperations.getKeys(resourceGroupName, accountName); + console.log(result); +} + +batchAccountGetKeys().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/javascript/batchAccountGetSample.js b/sdk/batch/arm-batch/samples/v7/javascript/batchAccountGetSample.js new file mode 100644 index 000000000000..921ce4e1a2ca --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/javascript/batchAccountGetSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { BatchManagementClient } = require("@azure/arm-batch"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Gets information about the specified Batch account. + * + * @summary Gets information about the specified Batch account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountGet.json + */ +async function batchAccountGet() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.batchAccountOperations.get(resourceGroupName, accountName); + console.log(result); +} + +batchAccountGet().catch(console.error); + +/** + * This sample demonstrates how to Gets information about the specified Batch account. + * + * @summary Gets information about the specified Batch account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PrivateBatchAccountGet.json + */ +async function privateBatchAccountGet() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.batchAccountOperations.get(resourceGroupName, accountName); + console.log(result); +} + +privateBatchAccountGet().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/javascript/batchAccountListByResourceGroupSample.js b/sdk/batch/arm-batch/samples/v7/javascript/batchAccountListByResourceGroupSample.js new file mode 100644 index 000000000000..2937d6db1a02 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/javascript/batchAccountListByResourceGroupSample.js @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { BatchManagementClient } = require("@azure/arm-batch"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Gets information about the Batch accounts associated with the specified resource group. + * + * @summary Gets information about the Batch accounts associated with the specified resource group. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountListByResourceGroup.json + */ +async function batchAccountListByResourceGroup() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.batchAccountOperations.listByResourceGroup(resourceGroupName)) { + resArray.push(item); + } + console.log(resArray); +} + +batchAccountListByResourceGroup().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/javascript/batchAccountListDetectorsSample.js b/sdk/batch/arm-batch/samples/v7/javascript/batchAccountListDetectorsSample.js new file mode 100644 index 000000000000..868e3bd5cefd --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/javascript/batchAccountListDetectorsSample.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 { BatchManagementClient } = require("@azure/arm-batch"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Gets information about the detectors available for a given Batch account. + * + * @summary Gets information about the detectors available for a given Batch account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/DetectorList.json + */ +async function listDetectors() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.batchAccountOperations.listDetectors( + resourceGroupName, + accountName + )) { + resArray.push(item); + } + console.log(resArray); +} + +listDetectors().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/javascript/batchAccountListOutboundNetworkDependenciesEndpointsSample.js b/sdk/batch/arm-batch/samples/v7/javascript/batchAccountListOutboundNetworkDependenciesEndpointsSample.js new file mode 100644 index 000000000000..d4f893508e33 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/javascript/batchAccountListOutboundNetworkDependenciesEndpointsSample.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 { BatchManagementClient } = require("@azure/arm-batch"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Lists the endpoints that a Batch Compute Node under this Batch Account may call as part of Batch service administration. If you are deploying a Pool inside of a virtual network that you specify, you must make sure your network allows outbound access to these endpoints. Failure to allow access to these endpoints may cause Batch to mark the affected nodes as unusable. For more information about creating a pool inside of a virtual network, see https://docs.microsoft.com/en-us/azure/batch/batch-virtual-network. + * + * @summary Lists the endpoints that a Batch Compute Node under this Batch Account may call as part of Batch service administration. If you are deploying a Pool inside of a virtual network that you specify, you must make sure your network allows outbound access to these endpoints. Failure to allow access to these endpoints may cause Batch to mark the affected nodes as unusable. For more information about creating a pool inside of a virtual network, see https://docs.microsoft.com/en-us/azure/batch/batch-virtual-network. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountListOutboundNetworkDependenciesEndpoints.json + */ +async function listOutboundNetworkDependencies() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.batchAccountOperations.listOutboundNetworkDependenciesEndpoints( + resourceGroupName, + accountName + )) { + resArray.push(item); + } + console.log(resArray); +} + +listOutboundNetworkDependencies().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/javascript/batchAccountListSample.js b/sdk/batch/arm-batch/samples/v7/javascript/batchAccountListSample.js new file mode 100644 index 000000000000..93e92f90d58b --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/javascript/batchAccountListSample.js @@ -0,0 +1,31 @@ +/* + * 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 { BatchManagementClient } = require("@azure/arm-batch"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Gets information about the Batch accounts associated with the subscription. + * + * @summary Gets information about the Batch accounts associated with the subscription. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountList.json + */ +async function batchAccountList() { + const subscriptionId = "subid"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.batchAccountOperations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +batchAccountList().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/javascript/batchAccountRegenerateKeySample.js b/sdk/batch/arm-batch/samples/v7/javascript/batchAccountRegenerateKeySample.js new file mode 100644 index 000000000000..ecf26ebbbe89 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/javascript/batchAccountRegenerateKeySample.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 { BatchManagementClient } = require("@azure/arm-batch"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to This operation applies only to Batch accounts with allowedAuthenticationModes containing 'SharedKey'. If the Batch account doesn't contain 'SharedKey' in its allowedAuthenticationMode, clients cannot use shared keys to authenticate, and must use another allowedAuthenticationModes instead. In this case, regenerating the keys will fail. + * + * @summary This operation applies only to Batch accounts with allowedAuthenticationModes containing 'SharedKey'. If the Batch account doesn't contain 'SharedKey' in its allowedAuthenticationMode, clients cannot use shared keys to authenticate, and must use another allowedAuthenticationModes instead. In this case, regenerating the keys will fail. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountRegenerateKey.json + */ +async function batchAccountRegenerateKey() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const parameters = { + keyName: "Primary", + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.batchAccountOperations.regenerateKey( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +batchAccountRegenerateKey().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/javascript/batchAccountSynchronizeAutoStorageKeysSample.js b/sdk/batch/arm-batch/samples/v7/javascript/batchAccountSynchronizeAutoStorageKeysSample.js new file mode 100644 index 000000000000..d12d3d59625d --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/javascript/batchAccountSynchronizeAutoStorageKeysSample.js @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { BatchManagementClient } = require("@azure/arm-batch"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Synchronizes access keys for the auto-storage account configured for the specified Batch account, only if storage key authentication is being used. + * + * @summary Synchronizes access keys for the auto-storage account configured for the specified Batch account, only if storage key authentication is being used. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountSynchronizeAutoStorageKeys.json + */ +async function batchAccountSynchronizeAutoStorageKeys() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.batchAccountOperations.synchronizeAutoStorageKeys( + resourceGroupName, + accountName + ); + console.log(result); +} + +batchAccountSynchronizeAutoStorageKeys().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/javascript/batchAccountUpdateSample.js b/sdk/batch/arm-batch/samples/v7/javascript/batchAccountUpdateSample.js new file mode 100644 index 000000000000..d863d8e8bc8b --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/javascript/batchAccountUpdateSample.js @@ -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. +const { BatchManagementClient } = require("@azure/arm-batch"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Updates the properties of an existing Batch account. + * + * @summary Updates the properties of an existing Batch account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountUpdate.json + */ +async function batchAccountUpdate() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const parameters = { + autoStorage: { + storageAccountId: + "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage", + }, + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.batchAccountOperations.update( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +batchAccountUpdate().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/javascript/certificateCancelDeletionSample.js b/sdk/batch/arm-batch/samples/v7/javascript/certificateCancelDeletionSample.js new file mode 100644 index 000000000000..530894548ee7 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/javascript/certificateCancelDeletionSample.js @@ -0,0 +1,35 @@ +/* + * 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 { BatchManagementClient } = require("@azure/arm-batch"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to If you try to delete a certificate that is being used by a pool or compute node, the status of the certificate changes to deleteFailed. If you decide that you want to continue using the certificate, you can use this operation to set the status of the certificate back to active. If you intend to delete the certificate, you do not need to run this operation after the deletion failed. You must make sure that the certificate is not being used by any resources, and then you can try again to delete the certificate. + * + * @summary If you try to delete a certificate that is being used by a pool or compute node, the status of the certificate changes to deleteFailed. If you decide that you want to continue using the certificate, you can use this operation to set the status of the certificate back to active. If you intend to delete the certificate, you do not need to run this operation after the deletion failed. You must make sure that the certificate is not being used by any resources, and then you can try again to delete the certificate. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/CertificateCancelDeletion.json + */ +async function certificateCancelDeletion() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const certificateName = "sha1-0a0e4f50d51beadeac1d35afc5116098e7902e6e"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.certificateOperations.cancelDeletion( + resourceGroupName, + accountName, + certificateName + ); + console.log(result); +} + +certificateCancelDeletion().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/javascript/certificateCreateSample.js b/sdk/batch/arm-batch/samples/v7/javascript/certificateCreateSample.js new file mode 100644 index 000000000000..ce8c7f85e4eb --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/javascript/certificateCreateSample.js @@ -0,0 +1,99 @@ +/* + * 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 { BatchManagementClient } = require("@azure/arm-batch"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Creates a new certificate inside the specified account. + * + * @summary Creates a new certificate inside the specified account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/CertificateCreate_Full.json + */ +async function createCertificateFull() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const certificateName = "sha1-0a0e4f50d51beadeac1d35afc5116098e7902e6e"; + const parameters = { + format: "Pfx", + data: "MIIJsgIBAzCCCW4GCSqGSIb3DQE...", + password: "", + thumbprint: "0a0e4f50d51beadeac1d35afc5116098e7902e6e", + thumbprintAlgorithm: "sha1", + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.certificateOperations.create( + resourceGroupName, + accountName, + certificateName, + parameters + ); + console.log(result); +} + +createCertificateFull().catch(console.error); + +/** + * This sample demonstrates how to Creates a new certificate inside the specified account. + * + * @summary Creates a new certificate inside the specified account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/CertificateCreate_MinimalCer.json + */ +async function createCertificateMinimalCer() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const certificateName = "sha1-0a0e4f50d51beadeac1d35afc5116098e7902e6e"; + const parameters = { + format: "Cer", + data: "MIICrjCCAZagAwI...", + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.certificateOperations.create( + resourceGroupName, + accountName, + certificateName, + parameters + ); + console.log(result); +} + +createCertificateMinimalCer().catch(console.error); + +/** + * This sample demonstrates how to Creates a new certificate inside the specified account. + * + * @summary Creates a new certificate inside the specified account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/CertificateCreate_Minimal.json + */ +async function createCertificateMinimalPfx() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const certificateName = "sha1-0a0e4f50d51beadeac1d35afc5116098e7902e6e"; + const parameters = { + data: "MIIJsgIBAzCCCW4GCSqGSIb3DQE...", + password: "", + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.certificateOperations.create( + resourceGroupName, + accountName, + certificateName, + parameters + ); + console.log(result); +} + +createCertificateMinimalPfx().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/javascript/certificateDeleteSample.js b/sdk/batch/arm-batch/samples/v7/javascript/certificateDeleteSample.js new file mode 100644 index 000000000000..4d287ca30f05 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/javascript/certificateDeleteSample.js @@ -0,0 +1,35 @@ +/* + * 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 { BatchManagementClient } = require("@azure/arm-batch"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Deletes the specified certificate. + * + * @summary Deletes the specified certificate. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/CertificateDelete.json + */ +async function certificateDelete() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const certificateName = "sha1-0a0e4f50d51beadeac1d35afc5116098e7902e6e"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.certificateOperations.beginDeleteAndWait( + resourceGroupName, + accountName, + certificateName + ); + console.log(result); +} + +certificateDelete().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/javascript/certificateGetSample.js b/sdk/batch/arm-batch/samples/v7/javascript/certificateGetSample.js new file mode 100644 index 000000000000..93f8064cfb97 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/javascript/certificateGetSample.js @@ -0,0 +1,58 @@ +/* + * 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 { BatchManagementClient } = require("@azure/arm-batch"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Gets information about the specified certificate. + * + * @summary Gets information about the specified certificate. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/CertificateGet.json + */ +async function getCertificate() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const certificateName = "sha1-0a0e4f50d51beadeac1d35afc5116098e7902e6e"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.certificateOperations.get( + resourceGroupName, + accountName, + certificateName + ); + console.log(result); +} + +getCertificate().catch(console.error); + +/** + * This sample demonstrates how to Gets information about the specified certificate. + * + * @summary Gets information about the specified certificate. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/CertificateGetWithDeletionError.json + */ +async function getCertificateWithDeletionError() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const certificateName = "sha1-0a0e4f50d51beadeac1d35afc5116098e7902e6e"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.certificateOperations.get( + resourceGroupName, + accountName, + certificateName + ); + console.log(result); +} + +getCertificateWithDeletionError().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/javascript/certificateListByBatchAccountSample.js b/sdk/batch/arm-batch/samples/v7/javascript/certificateListByBatchAccountSample.js new file mode 100644 index 000000000000..32d8cd1dfa9c --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/javascript/certificateListByBatchAccountSample.js @@ -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. +const { BatchManagementClient } = require("@azure/arm-batch"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Lists all of the certificates in the specified account. + * + * @summary Lists all of the certificates in the specified account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/CertificateList.json + */ +async function listCertificates() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.certificateOperations.listByBatchAccount( + resourceGroupName, + accountName + )) { + resArray.push(item); + } + console.log(resArray); +} + +listCertificates().catch(console.error); + +/** + * This sample demonstrates how to Lists all of the certificates in the specified account. + * + * @summary Lists all of the certificates in the specified account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/CertificateListWithFilter.json + */ +async function listCertificatesFilterAndSelect() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const select = "properties/format,properties/provisioningState"; + const filter = + "properties/provisioningStateTransitionTime gt '2017-05-01' or properties/provisioningState eq 'Failed'"; + const options = { + select, + filter, + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.certificateOperations.listByBatchAccount( + resourceGroupName, + accountName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +listCertificatesFilterAndSelect().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/javascript/certificateUpdateSample.js b/sdk/batch/arm-batch/samples/v7/javascript/certificateUpdateSample.js new file mode 100644 index 000000000000..afba569401a8 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/javascript/certificateUpdateSample.js @@ -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. +const { BatchManagementClient } = require("@azure/arm-batch"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Updates the properties of an existing certificate. + * + * @summary Updates the properties of an existing certificate. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/CertificateUpdate.json + */ +async function updateCertificate() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const certificateName = "sha1-0a0e4f50d51beadeac1d35afc5116098e7902e6e"; + const parameters = { + data: "MIIJsgIBAzCCCW4GCSqGSIb3DQE...", + password: "", + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.certificateOperations.update( + resourceGroupName, + accountName, + certificateName, + parameters + ); + console.log(result); +} + +updateCertificate().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/javascript/locationCheckNameAvailabilitySample.js b/sdk/batch/arm-batch/samples/v7/javascript/locationCheckNameAvailabilitySample.js new file mode 100644 index 000000000000..393c4dd35bcd --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/javascript/locationCheckNameAvailabilitySample.js @@ -0,0 +1,54 @@ +/* + * 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 { BatchManagementClient } = require("@azure/arm-batch"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Checks whether the Batch account name is available in the specified region. + * + * @summary Checks whether the Batch account name is available in the specified region. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/LocationCheckNameAvailability_AlreadyExists.json + */ +async function locationCheckNameAvailabilityAlreadyExists() { + const subscriptionId = "subid"; + const locationName = "japaneast"; + const parameters = { + name: "existingaccountname", + type: "Microsoft.Batch/batchAccounts", + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.location.checkNameAvailability(locationName, parameters); + console.log(result); +} + +locationCheckNameAvailabilityAlreadyExists().catch(console.error); + +/** + * This sample demonstrates how to Checks whether the Batch account name is available in the specified region. + * + * @summary Checks whether the Batch account name is available in the specified region. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/LocationCheckNameAvailability_Available.json + */ +async function locationCheckNameAvailabilityAvailable() { + const subscriptionId = "subid"; + const locationName = "japaneast"; + const parameters = { + name: "newaccountname", + type: "Microsoft.Batch/batchAccounts", + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.location.checkNameAvailability(locationName, parameters); + console.log(result); +} + +locationCheckNameAvailabilityAvailable().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/javascript/locationGetQuotasSample.js b/sdk/batch/arm-batch/samples/v7/javascript/locationGetQuotasSample.js new file mode 100644 index 000000000000..a6a0d351fca0 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/javascript/locationGetQuotasSample.js @@ -0,0 +1,29 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { BatchManagementClient } = require("@azure/arm-batch"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Gets the Batch service quotas for the specified subscription at the given location. + * + * @summary Gets the Batch service quotas for the specified subscription at the given location. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/LocationGetQuotas.json + */ +async function locationGetQuotas() { + const subscriptionId = "subid"; + const locationName = "japaneast"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.location.getQuotas(locationName); + console.log(result); +} + +locationGetQuotas().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/javascript/locationListSupportedCloudServiceSkusSample.js b/sdk/batch/arm-batch/samples/v7/javascript/locationListSupportedCloudServiceSkusSample.js new file mode 100644 index 000000000000..4b956cdf69e4 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/javascript/locationListSupportedCloudServiceSkusSample.js @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { BatchManagementClient } = require("@azure/arm-batch"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Gets the list of Batch supported Cloud Service VM sizes available at the given location. + * + * @summary Gets the list of Batch supported Cloud Service VM sizes available at the given location. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/LocationListCloudServiceSkus.json + */ +async function locationListCloudServiceSkus() { + const subscriptionId = "subid"; + const locationName = "japaneast"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.location.listSupportedCloudServiceSkus(locationName)) { + resArray.push(item); + } + console.log(resArray); +} + +locationListCloudServiceSkus().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/javascript/locationListSupportedVirtualMachineSkusSample.js b/sdk/batch/arm-batch/samples/v7/javascript/locationListSupportedVirtualMachineSkusSample.js new file mode 100644 index 000000000000..0e7a859ae4bf --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/javascript/locationListSupportedVirtualMachineSkusSample.js @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { BatchManagementClient } = require("@azure/arm-batch"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Gets the list of Batch supported Virtual Machine VM sizes available at the given location. + * + * @summary Gets the list of Batch supported Virtual Machine VM sizes available at the given location. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/LocationListVirtualMachineSkus.json + */ +async function locationListVirtualMachineSkus() { + const subscriptionId = "subid"; + const locationName = "japaneast"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.location.listSupportedVirtualMachineSkus(locationName)) { + resArray.push(item); + } + console.log(resArray); +} + +locationListVirtualMachineSkus().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/javascript/operationsListSample.js b/sdk/batch/arm-batch/samples/v7/javascript/operationsListSample.js new file mode 100644 index 000000000000..152c79da0fcb --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/javascript/operationsListSample.js @@ -0,0 +1,31 @@ +/* + * 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 { BatchManagementClient } = require("@azure/arm-batch"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Lists available operations for the Microsoft.Batch provider + * + * @summary Lists available operations for the Microsoft.Batch provider + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/OperationsList.json + */ +async function operationsList() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +operationsList().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/javascript/package.json b/sdk/batch/arm-batch/samples/v7/javascript/package.json new file mode 100644 index 000000000000..ed2e114445c6 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/javascript/package.json @@ -0,0 +1,32 @@ +{ + "name": "azure-arm-batch-samples-js", + "private": true, + "version": "1.0.0", + "description": " client library samples for JavaScript", + "engines": { + "node": ">=12.0.0" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/batch/arm-batch" + }, + "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/batch/arm-batch", + "dependencies": { + "@azure/arm-batch": "latest", + "dotenv": "latest", + "@azure/identity": "^2.0.1" + } +} diff --git a/sdk/batch/arm-batch/samples/v7/javascript/poolCreateSample.js b/sdk/batch/arm-batch/samples/v7/javascript/poolCreateSample.js new file mode 100644 index 000000000000..c1cab45d0720 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/javascript/poolCreateSample.js @@ -0,0 +1,505 @@ +/* + * 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 { BatchManagementClient } = require("@azure/arm-batch"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Creates a new pool inside the specified account. + * + * @summary Creates a new pool inside the specified account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolCreate_SharedImageGallery.json + */ +async function createPoolCustomImage() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const poolName = "testpool"; + const parameters = { + deploymentConfiguration: { + virtualMachineConfiguration: { + imageReference: { + id: "/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1", + }, + nodeAgentSkuId: "batch.node.ubuntu 18.04", + }, + }, + vmSize: "STANDARD_D4", + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.poolOperations.create( + resourceGroupName, + accountName, + poolName, + parameters + ); + console.log(result); +} + +createPoolCustomImage().catch(console.error); + +/** + * This sample demonstrates how to Creates a new pool inside the specified account. + * + * @summary Creates a new pool inside the specified account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolCreate_CloudServiceConfiguration.json + */ +async function createPoolFullCloudServiceConfiguration() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const poolName = "testpool"; + const parameters = { + applicationLicenses: ["app-license0", "app-license1"], + applicationPackages: [ + { + id: "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool/applications/app_1234", + version: "asdf", + }, + ], + certificates: [ + { + id: "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool/certificates/sha1-1234567", + storeLocation: "LocalMachine", + storeName: "MY", + visibility: ["RemoteUser"], + }, + ], + deploymentConfiguration: { + cloudServiceConfiguration: { + osFamily: "4", + osVersion: "WA-GUEST-OS-4.45_201708-01", + }, + }, + displayName: "my-pool-name", + interNodeCommunication: "Enabled", + metadata: [ + { name: "metadata-1", value: "value-1" }, + { name: "metadata-2", value: "value-2" }, + ], + networkConfiguration: { + publicIPAddressConfiguration: { + ipAddressIds: [ + "/subscriptions/subid1/resourceGroups/rg13/providers/Microsoft.Network/publicIPAddresses/ip135", + "/subscriptions/subid2/resourceGroups/rg24/providers/Microsoft.Network/publicIPAddresses/ip268", + ], + provision: "UserManaged", + }, + subnetId: + "/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123", + }, + scaleSettings: { + fixedScale: { + nodeDeallocationOption: "TaskCompletion", + resizeTimeout: "PT8M", + targetDedicatedNodes: 6, + targetLowPriorityNodes: 28, + }, + }, + startTask: { + commandLine: "cmd /c SET", + environmentSettings: [{ name: "MYSET", value: "1234" }], + maxTaskRetryCount: 6, + resourceFiles: [ + { + fileMode: "777", + filePath: "c:\tempgohere", + httpUrl: "https://testaccount.blob.core.windows.net/example-blob-file", + }, + ], + userIdentity: { autoUser: { elevationLevel: "Admin", scope: "Pool" } }, + waitForSuccess: true, + }, + taskSchedulingPolicy: { nodeFillType: "Pack" }, + taskSlotsPerNode: 13, + userAccounts: [ + { + name: "username1", + elevationLevel: "Admin", + linuxUserConfiguration: { + gid: 4567, + sshPrivateKey: "sshprivatekeyvalue", + uid: 1234, + }, + password: "", + }, + ], + vmSize: "STANDARD_D4", + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.poolOperations.create( + resourceGroupName, + accountName, + poolName, + parameters + ); + console.log(result); +} + +createPoolFullCloudServiceConfiguration().catch(console.error); + +/** + * This sample demonstrates how to Creates a new pool inside the specified account. + * + * @summary Creates a new pool inside the specified account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolCreate_VirtualMachineConfiguration.json + */ +async function createPoolFullVirtualMachineConfiguration() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const poolName = "testpool"; + const parameters = { + deploymentConfiguration: { + virtualMachineConfiguration: { + dataDisks: [ + { + caching: "ReadWrite", + diskSizeGB: 30, + lun: 0, + storageAccountType: "Premium_LRS", + }, + { + caching: "None", + diskSizeGB: 200, + lun: 1, + storageAccountType: "Standard_LRS", + }, + ], + diskEncryptionConfiguration: { targets: ["OsDisk", "TemporaryDisk"] }, + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter-SmallDisk", + version: "latest", + }, + licenseType: "Windows_Server", + nodeAgentSkuId: "batch.node.windows amd64", + nodePlacementConfiguration: { policy: "Zonal" }, + osDisk: { ephemeralOSDiskSettings: { placement: "CacheDisk" } }, + windowsConfiguration: { enableAutomaticUpdates: false }, + }, + }, + networkConfiguration: { + endpointConfiguration: { + inboundNatPools: [ + { + name: "testnat", + backendPort: 12001, + frontendPortRangeEnd: 15100, + frontendPortRangeStart: 15000, + networkSecurityGroupRules: [ + { + access: "Allow", + priority: 150, + sourceAddressPrefix: "192.100.12.45", + sourcePortRanges: ["1", "2"], + }, + { + access: "Deny", + priority: 3500, + sourceAddressPrefix: "*", + sourcePortRanges: ["*"], + }, + ], + protocol: "TCP", + }, + ], + }, + }, + scaleSettings: { + autoScale: { + evaluationInterval: "PT5M", + formula: "$TargetDedicatedNodes=1", + }, + }, + vmSize: "STANDARD_D4", + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.poolOperations.create( + resourceGroupName, + accountName, + poolName, + parameters + ); + console.log(result); +} + +createPoolFullVirtualMachineConfiguration().catch(console.error); + +/** + * This sample demonstrates how to Creates a new pool inside the specified account. + * + * @summary Creates a new pool inside the specified account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolCreate_MinimalCloudServiceConfiguration.json + */ +async function createPoolMinimalCloudServiceConfiguration() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const poolName = "testpool"; + const parameters = { + deploymentConfiguration: { cloudServiceConfiguration: { osFamily: "5" } }, + scaleSettings: { fixedScale: { targetDedicatedNodes: 3 } }, + vmSize: "STANDARD_D4", + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.poolOperations.create( + resourceGroupName, + accountName, + poolName, + parameters + ); + console.log(result); +} + +createPoolMinimalCloudServiceConfiguration().catch(console.error); + +/** + * This sample demonstrates how to Creates a new pool inside the specified account. + * + * @summary Creates a new pool inside the specified account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolCreate_MinimalVirtualMachineConfiguration.json + */ +async function createPoolMinimalVirtualMachineConfiguration() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const poolName = "testpool"; + const parameters = { + deploymentConfiguration: { + virtualMachineConfiguration: { + imageReference: { + offer: "UbuntuServer", + publisher: "Canonical", + sku: "18.04-LTS", + version: "latest", + }, + nodeAgentSkuId: "batch.node.ubuntu 18.04", + }, + }, + scaleSettings: { + autoScale: { + evaluationInterval: "PT5M", + formula: "$TargetDedicatedNodes=1", + }, + }, + vmSize: "STANDARD_D4", + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.poolOperations.create( + resourceGroupName, + accountName, + poolName, + parameters + ); + console.log(result); +} + +createPoolMinimalVirtualMachineConfiguration().catch(console.error); + +/** + * This sample demonstrates how to Creates a new pool inside the specified account. + * + * @summary Creates a new pool inside the specified account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolCreate_NoPublicIPAddresses.json + */ +async function createPoolNoPublicIP() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const poolName = "testpool"; + const parameters = { + deploymentConfiguration: { + virtualMachineConfiguration: { + imageReference: { + id: "/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1", + }, + nodeAgentSkuId: "batch.node.ubuntu 18.04", + }, + }, + networkConfiguration: { + publicIPAddressConfiguration: { provision: "NoPublicIPAddresses" }, + subnetId: + "/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123", + }, + vmSize: "STANDARD_D4", + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.poolOperations.create( + resourceGroupName, + accountName, + poolName, + parameters + ); + console.log(result); +} + +createPoolNoPublicIP().catch(console.error); + +/** + * This sample demonstrates how to Creates a new pool inside the specified account. + * + * @summary Creates a new pool inside the specified account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolCreate_PublicIPs.json + */ +async function createPoolPublicIPs() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const poolName = "testpool"; + const parameters = { + deploymentConfiguration: { + virtualMachineConfiguration: { + imageReference: { + id: "/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1", + }, + nodeAgentSkuId: "batch.node.ubuntu 18.04", + }, + }, + networkConfiguration: { + publicIPAddressConfiguration: { + ipAddressIds: [ + "/subscriptions/subid1/resourceGroups/rg13/providers/Microsoft.Network/publicIPAddresses/ip135", + ], + provision: "UserManaged", + }, + subnetId: + "/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123", + }, + vmSize: "STANDARD_D4", + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.poolOperations.create( + resourceGroupName, + accountName, + poolName, + parameters + ); + console.log(result); +} + +createPoolPublicIPs().catch(console.error); + +/** + * This sample demonstrates how to Creates a new pool inside the specified account. + * + * @summary Creates a new pool inside the specified account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolCreate_UserAssignedIdentities.json + */ +async function createPoolUserAssignedIdentities() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const poolName = "testpool"; + const parameters = { + deploymentConfiguration: { + virtualMachineConfiguration: { + imageReference: { + offer: "UbuntuServer", + publisher: "Canonical", + sku: "18.04-LTS", + version: "latest", + }, + nodeAgentSkuId: "batch.node.ubuntu 18.04", + }, + }, + identity: { + type: "UserAssigned", + userAssignedIdentities: { + "/subscriptions/subid/resourceGroups/defaultAzurebatchJapaneast/providers/MicrosoftManagedIdentity/userAssignedIdentities/id1": + {}, + "/subscriptions/subid/resourceGroups/defaultAzurebatchJapaneast/providers/MicrosoftManagedIdentity/userAssignedIdentities/id2": + {}, + }, + }, + scaleSettings: { + autoScale: { + evaluationInterval: "PT5M", + formula: "$TargetDedicatedNodes=1", + }, + }, + vmSize: "STANDARD_D4", + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.poolOperations.create( + resourceGroupName, + accountName, + poolName, + parameters + ); + console.log(result); +} + +createPoolUserAssignedIdentities().catch(console.error); + +/** + * This sample demonstrates how to Creates a new pool inside the specified account. + * + * @summary Creates a new pool inside the specified account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolCreate_VirtualMachineConfiguration_Extensions.json + */ +async function createPoolVirtualMachineConfigurationExtensions() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const poolName = "testpool"; + const parameters = { + deploymentConfiguration: { + virtualMachineConfiguration: { + imageReference: { + offer: "0001-com-ubuntu-server-focal", + publisher: "Canonical", + sku: "20_04-lts", + }, + nodeAgentSkuId: "batch.node.ubuntu 20.04", + extensions: [ + { + name: "batchextension1", + type: "SecurityMonitoringForLinux", + autoUpgradeMinorVersion: true, + protectedSettings: { + protectedSettingsKey: "protectedSettingsValue", + }, + publisher: "Microsoft.Azure.Security.Monitoring", + settings: { settingsKey: "settingsValue" }, + typeHandlerVersion: "1.0", + }, + ], + }, + }, + scaleSettings: { + autoScale: { + evaluationInterval: "PT5M", + formula: "$TargetDedicatedNodes=1", + }, + }, + vmSize: "STANDARD_D4", + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.poolOperations.create( + resourceGroupName, + accountName, + poolName, + parameters + ); + console.log(result); +} + +createPoolVirtualMachineConfigurationExtensions().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/javascript/poolDeleteSample.js b/sdk/batch/arm-batch/samples/v7/javascript/poolDeleteSample.js new file mode 100644 index 000000000000..dd1302c45e11 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/javascript/poolDeleteSample.js @@ -0,0 +1,35 @@ +/* + * 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 { BatchManagementClient } = require("@azure/arm-batch"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Deletes the specified pool. + * + * @summary Deletes the specified pool. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolDelete.json + */ +async function deletePool() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const poolName = "testpool"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.poolOperations.beginDeleteAndWait( + resourceGroupName, + accountName, + poolName + ); + console.log(result); +} + +deletePool().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/javascript/poolDisableAutoScaleSample.js b/sdk/batch/arm-batch/samples/v7/javascript/poolDisableAutoScaleSample.js new file mode 100644 index 000000000000..8b62e511286f --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/javascript/poolDisableAutoScaleSample.js @@ -0,0 +1,35 @@ +/* + * 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 { BatchManagementClient } = require("@azure/arm-batch"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Disables automatic scaling for a pool. + * + * @summary Disables automatic scaling for a pool. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolDisableAutoScale.json + */ +async function disableAutoScale() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const poolName = "testpool"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.poolOperations.disableAutoScale( + resourceGroupName, + accountName, + poolName + ); + console.log(result); +} + +disableAutoScale().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/javascript/poolGetSample.js b/sdk/batch/arm-batch/samples/v7/javascript/poolGetSample.js new file mode 100644 index 000000000000..a7750e7c0e2b --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/javascript/poolGetSample.js @@ -0,0 +1,50 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { BatchManagementClient } = require("@azure/arm-batch"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Gets information about the specified pool. + * + * @summary Gets information about the specified pool. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolGet.json + */ +async function getPool() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const poolName = "testpool"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.poolOperations.get(resourceGroupName, accountName, poolName); + console.log(result); +} + +getPool().catch(console.error); + +/** + * This sample demonstrates how to Gets information about the specified pool. + * + * @summary Gets information about the specified pool. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolGet_VirtualMachineConfiguration_Extensions.json + */ +async function getPoolVirtualMachineConfigurationExtensions() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const poolName = "testpool"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.poolOperations.get(resourceGroupName, accountName, poolName); + console.log(result); +} + +getPoolVirtualMachineConfigurationExtensions().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/javascript/poolListByBatchAccountSample.js b/sdk/batch/arm-batch/samples/v7/javascript/poolListByBatchAccountSample.js new file mode 100644 index 000000000000..fdd87fb9c415 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/javascript/poolListByBatchAccountSample.js @@ -0,0 +1,63 @@ +/* + * 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 { BatchManagementClient } = require("@azure/arm-batch"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Lists all of the pools in the specified account. + * + * @summary Lists all of the pools in the specified account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolList.json + */ +async function listPool() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.poolOperations.listByBatchAccount(resourceGroupName, accountName)) { + resArray.push(item); + } + console.log(resArray); +} + +listPool().catch(console.error); + +/** + * This sample demonstrates how to Lists all of the pools in the specified account. + * + * @summary Lists all of the pools in the specified account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolListWithFilter.json + */ +async function listPoolWithFilter() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const select = + "properties/allocationState,properties/provisioningStateTransitionTime,properties/currentDedicatedNodes,properties/currentLowPriorityNodes"; + const filter = + "startswith(name, 'po') or (properties/allocationState eq 'Steady' and properties/provisioningStateTransitionTime lt datetime'2017-02-02')"; + const options = { select, filter }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.poolOperations.listByBatchAccount( + resourceGroupName, + accountName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +listPoolWithFilter().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/javascript/poolStopResizeSample.js b/sdk/batch/arm-batch/samples/v7/javascript/poolStopResizeSample.js new file mode 100644 index 000000000000..a1eef0f4f07b --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/javascript/poolStopResizeSample.js @@ -0,0 +1,31 @@ +/* + * 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 { BatchManagementClient } = require("@azure/arm-batch"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to This does not restore the pool to its previous state before the resize operation: it only stops any further changes being made, and the pool maintains its current state. After stopping, the pool stabilizes at the number of nodes it was at when the stop operation was done. During the stop operation, the pool allocation state changes first to stopping and then to steady. A resize operation need not be an explicit resize pool request; this API can also be used to halt the initial sizing of the pool when it is created. + * + * @summary This does not restore the pool to its previous state before the resize operation: it only stops any further changes being made, and the pool maintains its current state. After stopping, the pool stabilizes at the number of nodes it was at when the stop operation was done. During the stop operation, the pool allocation state changes first to stopping and then to steady. A resize operation need not be an explicit resize pool request; this API can also be used to halt the initial sizing of the pool when it is created. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolStopResize.json + */ +async function stopPoolResize() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const poolName = "testpool"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.poolOperations.stopResize(resourceGroupName, accountName, poolName); + console.log(result); +} + +stopPoolResize().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/javascript/poolUpdateSample.js b/sdk/batch/arm-batch/samples/v7/javascript/poolUpdateSample.js new file mode 100644 index 000000000000..5a11ccc43a5f --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/javascript/poolUpdateSample.js @@ -0,0 +1,141 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { BatchManagementClient } = require("@azure/arm-batch"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Updates the properties of an existing pool. + * + * @summary Updates the properties of an existing pool. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolUpdate_EnableAutoScale.json + */ +async function updatePoolEnableAutoscale() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const poolName = "testpool"; + const parameters = { + scaleSettings: { autoScale: { formula: "$TargetDedicatedNodes=34" } }, + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.poolOperations.update( + resourceGroupName, + accountName, + poolName, + parameters + ); + console.log(result); +} + +updatePoolEnableAutoscale().catch(console.error); + +/** + * This sample demonstrates how to Updates the properties of an existing pool. + * + * @summary Updates the properties of an existing pool. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolUpdate_OtherProperties.json + */ +async function updatePoolOtherProperties() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const poolName = "testpool"; + const parameters = { + applicationPackages: [ + { + id: "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool/applications/app_1234", + }, + { + id: "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool/applications/app_5678", + version: "1.0", + }, + ], + certificates: [ + { + id: "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool/certificates/sha1-1234567", + storeLocation: "LocalMachine", + storeName: "MY", + }, + ], + metadata: [{ name: "key1", value: "value1" }], + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.poolOperations.update( + resourceGroupName, + accountName, + poolName, + parameters + ); + console.log(result); +} + +updatePoolOtherProperties().catch(console.error); + +/** + * This sample demonstrates how to Updates the properties of an existing pool. + * + * @summary Updates the properties of an existing pool. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolUpdate_RemoveStartTask.json + */ +async function updatePoolRemoveStartTask() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const poolName = "testpool"; + const parameters = { startTask: {} }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.poolOperations.update( + resourceGroupName, + accountName, + poolName, + parameters + ); + console.log(result); +} + +updatePoolRemoveStartTask().catch(console.error); + +/** + * This sample demonstrates how to Updates the properties of an existing pool. + * + * @summary Updates the properties of an existing pool. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolUpdate_ResizePool.json + */ +async function updatePoolResizePool() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const poolName = "testpool"; + const parameters = { + scaleSettings: { + fixedScale: { + nodeDeallocationOption: "TaskCompletion", + resizeTimeout: "PT8M", + targetDedicatedNodes: 5, + targetLowPriorityNodes: 0, + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.poolOperations.update( + resourceGroupName, + accountName, + poolName, + parameters + ); + console.log(result); +} + +updatePoolResizePool().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/javascript/privateEndpointConnectionGetSample.js b/sdk/batch/arm-batch/samples/v7/javascript/privateEndpointConnectionGetSample.js new file mode 100644 index 000000000000..cc26e79a9562 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/javascript/privateEndpointConnectionGetSample.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 { BatchManagementClient } = require("@azure/arm-batch"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Gets information about the specified private endpoint connection. + * + * @summary Gets information about the specified private endpoint connection. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PrivateEndpointConnectionGet.json + */ +async function getPrivateEndpointConnection() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const privateEndpointConnectionName = + "testprivateEndpointConnection5testprivateEndpointConnection5.24d6b4b5-e65c-4330-bbe9-3a290d62f8e0"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.privateEndpointConnectionOperations.get( + resourceGroupName, + accountName, + privateEndpointConnectionName + ); + console.log(result); +} + +getPrivateEndpointConnection().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/javascript/privateEndpointConnectionListByBatchAccountSample.js b/sdk/batch/arm-batch/samples/v7/javascript/privateEndpointConnectionListByBatchAccountSample.js new file mode 100644 index 000000000000..86b4d61a9b2c --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/javascript/privateEndpointConnectionListByBatchAccountSample.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 { BatchManagementClient } = require("@azure/arm-batch"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Lists all of the private endpoint connections in the specified account. + * + * @summary Lists all of the private endpoint connections in the specified account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PrivateEndpointConnectionsList.json + */ +async function listPrivateEndpointConnections() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.privateEndpointConnectionOperations.listByBatchAccount( + resourceGroupName, + accountName + )) { + resArray.push(item); + } + console.log(resArray); +} + +listPrivateEndpointConnections().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/javascript/privateEndpointConnectionUpdateSample.js b/sdk/batch/arm-batch/samples/v7/javascript/privateEndpointConnectionUpdateSample.js new file mode 100644 index 000000000000..f6b15c9ff98c --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/javascript/privateEndpointConnectionUpdateSample.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 { BatchManagementClient } = require("@azure/arm-batch"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Updates the properties of an existing private endpoint connection. + * + * @summary Updates the properties of an existing private endpoint connection. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PrivateEndpointConnectionUpdate.json + */ +async function updatePrivateEndpointConnection() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const privateEndpointConnectionName = + "testprivateEndpointConnection5.24d6b4b5-e65c-4330-bbe9-3a290d62f8e0"; + const parameters = { + privateLinkServiceConnectionState: { + description: "Approved by xyz.abc@company.com", + status: "Approved", + }, + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.privateEndpointConnectionOperations.beginUpdateAndWait( + resourceGroupName, + accountName, + privateEndpointConnectionName, + parameters + ); + console.log(result); +} + +updatePrivateEndpointConnection().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/javascript/privateLinkResourceGetSample.js b/sdk/batch/arm-batch/samples/v7/javascript/privateLinkResourceGetSample.js new file mode 100644 index 000000000000..fb31fc6927ce --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/javascript/privateLinkResourceGetSample.js @@ -0,0 +1,35 @@ +/* + * 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 { BatchManagementClient } = require("@azure/arm-batch"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Gets information about the specified private link resource. + * + * @summary Gets information about the specified private link resource. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PrivateLinkResourceGet.json + */ +async function getPrivateLinkResource() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const privateLinkResourceName = "sampleacct"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.privateLinkResourceOperations.get( + resourceGroupName, + accountName, + privateLinkResourceName + ); + console.log(result); +} + +getPrivateLinkResource().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/javascript/privateLinkResourceListByBatchAccountSample.js b/sdk/batch/arm-batch/samples/v7/javascript/privateLinkResourceListByBatchAccountSample.js new file mode 100644 index 000000000000..1946d35d949d --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/javascript/privateLinkResourceListByBatchAccountSample.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 { BatchManagementClient } = require("@azure/arm-batch"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Lists all of the private link resources in the specified account. + * + * @summary Lists all of the private link resources in the specified account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PrivateLinkResourcesList.json + */ +async function listPrivateLinkResource() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.privateLinkResourceOperations.listByBatchAccount( + resourceGroupName, + accountName + )) { + resArray.push(item); + } + console.log(resArray); +} + +listPrivateLinkResource().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/javascript/sample.env b/sdk/batch/arm-batch/samples/v7/javascript/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/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/batch/arm-batch/samples/v7/typescript/README.md b/sdk/batch/arm-batch/samples/v7/typescript/README.md new file mode 100644 index 000000000000..c455716a703e --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/typescript/README.md @@ -0,0 +1,151 @@ +# client library samples for TypeScript + +These sample programs show how to use the TypeScript client libraries for in some common scenarios. + +| **File Name** | **Description** | +| --------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [applicationCreateSample.ts][applicationcreatesample] | Adds an application to the specified Batch account. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationCreate.json | +| [applicationDeleteSample.ts][applicationdeletesample] | Deletes an application. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationDelete.json | +| [applicationGetSample.ts][applicationgetsample] | Gets information about the specified application. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationGet.json | +| [applicationListSample.ts][applicationlistsample] | Lists all of the applications in the specified account. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationList.json | +| [applicationPackageActivateSample.ts][applicationpackageactivatesample] | Activates the specified application package. This should be done after the `ApplicationPackage` was created and uploaded. This needs to be done before an `ApplicationPackage` can be used on Pools or Tasks. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationPackageActivate.json | +| [applicationPackageCreateSample.ts][applicationpackagecreatesample] | Creates an application package record. The record contains a storageUrl where the package should be uploaded to. Once it is uploaded the `ApplicationPackage` needs to be activated using `ApplicationPackageActive` before it can be used. If the auto storage account was configured to use storage keys, the URL returned will contain a SAS. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationPackageCreate.json | +| [applicationPackageDeleteSample.ts][applicationpackagedeletesample] | Deletes an application package record and its associated binary file. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationPackageDelete.json | +| [applicationPackageGetSample.ts][applicationpackagegetsample] | Gets information about the specified application package. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationPackageGet.json | +| [applicationPackageListSample.ts][applicationpackagelistsample] | Lists all of the application packages in the specified application. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationPackageList.json | +| [applicationUpdateSample.ts][applicationupdatesample] | Updates settings for the specified application. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationUpdate.json | +| [batchAccountCreateSample.ts][batchaccountcreatesample] | Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and should instead be updated with the Update Batch Account API. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountCreate_BYOS.json | +| [batchAccountDeleteSample.ts][batchaccountdeletesample] | Deletes the specified Batch account. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountDelete.json | +| [batchAccountGetDetectorSample.ts][batchaccountgetdetectorsample] | Gets information about the given detector for a given Batch account. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/DetectorGet.json | +| [batchAccountGetKeysSample.ts][batchaccountgetkeyssample] | This operation applies only to Batch accounts with allowedAuthenticationModes containing 'SharedKey'. If the Batch account doesn't contain 'SharedKey' in its allowedAuthenticationMode, clients cannot use shared keys to authenticate, and must use another allowedAuthenticationModes instead. In this case, getting the keys will fail. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountGetKeys.json | +| [batchAccountGetSample.ts][batchaccountgetsample] | Gets information about the specified Batch account. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountGet.json | +| [batchAccountListByResourceGroupSample.ts][batchaccountlistbyresourcegroupsample] | Gets information about the Batch accounts associated with the specified resource group. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountListByResourceGroup.json | +| [batchAccountListDetectorsSample.ts][batchaccountlistdetectorssample] | Gets information about the detectors available for a given Batch account. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/DetectorList.json | +| [batchAccountListOutboundNetworkDependenciesEndpointsSample.ts][batchaccountlistoutboundnetworkdependenciesendpointssample] | Lists the endpoints that a Batch Compute Node under this Batch Account may call as part of Batch service administration. If you are deploying a Pool inside of a virtual network that you specify, you must make sure your network allows outbound access to these endpoints. Failure to allow access to these endpoints may cause Batch to mark the affected nodes as unusable. For more information about creating a pool inside of a virtual network, see https://docs.microsoft.com/en-us/azure/batch/batch-virtual-network. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountListOutboundNetworkDependenciesEndpoints.json | +| [batchAccountListSample.ts][batchaccountlistsample] | Gets information about the Batch accounts associated with the subscription. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountList.json | +| [batchAccountRegenerateKeySample.ts][batchaccountregeneratekeysample] | This operation applies only to Batch accounts with allowedAuthenticationModes containing 'SharedKey'. If the Batch account doesn't contain 'SharedKey' in its allowedAuthenticationMode, clients cannot use shared keys to authenticate, and must use another allowedAuthenticationModes instead. In this case, regenerating the keys will fail. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountRegenerateKey.json | +| [batchAccountSynchronizeAutoStorageKeysSample.ts][batchaccountsynchronizeautostoragekeyssample] | Synchronizes access keys for the auto-storage account configured for the specified Batch account, only if storage key authentication is being used. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountSynchronizeAutoStorageKeys.json | +| [batchAccountUpdateSample.ts][batchaccountupdatesample] | Updates the properties of an existing Batch account. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountUpdate.json | +| [certificateCancelDeletionSample.ts][certificatecanceldeletionsample] | If you try to delete a certificate that is being used by a pool or compute node, the status of the certificate changes to deleteFailed. If you decide that you want to continue using the certificate, you can use this operation to set the status of the certificate back to active. If you intend to delete the certificate, you do not need to run this operation after the deletion failed. You must make sure that the certificate is not being used by any resources, and then you can try again to delete the certificate. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/CertificateCancelDeletion.json | +| [certificateCreateSample.ts][certificatecreatesample] | Creates a new certificate inside the specified account. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/CertificateCreate_Full.json | +| [certificateDeleteSample.ts][certificatedeletesample] | Deletes the specified certificate. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/CertificateDelete.json | +| [certificateGetSample.ts][certificategetsample] | Gets information about the specified certificate. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/CertificateGet.json | +| [certificateListByBatchAccountSample.ts][certificatelistbybatchaccountsample] | Lists all of the certificates in the specified account. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/CertificateList.json | +| [certificateUpdateSample.ts][certificateupdatesample] | Updates the properties of an existing certificate. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/CertificateUpdate.json | +| [locationCheckNameAvailabilitySample.ts][locationchecknameavailabilitysample] | Checks whether the Batch account name is available in the specified region. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/LocationCheckNameAvailability_AlreadyExists.json | +| [locationGetQuotasSample.ts][locationgetquotassample] | Gets the Batch service quotas for the specified subscription at the given location. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/LocationGetQuotas.json | +| [locationListSupportedCloudServiceSkusSample.ts][locationlistsupportedcloudserviceskussample] | Gets the list of Batch supported Cloud Service VM sizes available at the given location. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/LocationListCloudServiceSkus.json | +| [locationListSupportedVirtualMachineSkusSample.ts][locationlistsupportedvirtualmachineskussample] | Gets the list of Batch supported Virtual Machine VM sizes available at the given location. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/LocationListVirtualMachineSkus.json | +| [operationsListSample.ts][operationslistsample] | Lists available operations for the Microsoft.Batch provider x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/OperationsList.json | +| [poolCreateSample.ts][poolcreatesample] | Creates a new pool inside the specified account. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolCreate_SharedImageGallery.json | +| [poolDeleteSample.ts][pooldeletesample] | Deletes the specified pool. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolDelete.json | +| [poolDisableAutoScaleSample.ts][pooldisableautoscalesample] | Disables automatic scaling for a pool. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolDisableAutoScale.json | +| [poolGetSample.ts][poolgetsample] | Gets information about the specified pool. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolGet.json | +| [poolListByBatchAccountSample.ts][poollistbybatchaccountsample] | Lists all of the pools in the specified account. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolList.json | +| [poolStopResizeSample.ts][poolstopresizesample] | This does not restore the pool to its previous state before the resize operation: it only stops any further changes being made, and the pool maintains its current state. After stopping, the pool stabilizes at the number of nodes it was at when the stop operation was done. During the stop operation, the pool allocation state changes first to stopping and then to steady. A resize operation need not be an explicit resize pool request; this API can also be used to halt the initial sizing of the pool when it is created. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolStopResize.json | +| [poolUpdateSample.ts][poolupdatesample] | Updates the properties of an existing pool. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolUpdate_EnableAutoScale.json | +| [privateEndpointConnectionGetSample.ts][privateendpointconnectiongetsample] | Gets information about the specified private endpoint connection. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PrivateEndpointConnectionGet.json | +| [privateEndpointConnectionListByBatchAccountSample.ts][privateendpointconnectionlistbybatchaccountsample] | Lists all of the private endpoint connections in the specified account. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PrivateEndpointConnectionsList.json | +| [privateEndpointConnectionUpdateSample.ts][privateendpointconnectionupdatesample] | Updates the properties of an existing private endpoint connection. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PrivateEndpointConnectionUpdate.json | +| [privateLinkResourceGetSample.ts][privatelinkresourcegetsample] | Gets information about the specified private link resource. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PrivateLinkResourceGet.json | +| [privateLinkResourceListByBatchAccountSample.ts][privatelinkresourcelistbybatchaccountsample] | Lists all of the private link resources in the specified account. x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PrivateLinkResourcesList.json | + +## Prerequisites + +The sample programs are compatible with [LTS versions of Node.js](https://nodejs.org/about/releases/). + +Before running the samples in Node, they must be compiled to JavaScript using the TypeScript compiler. For more information on TypeScript, see the [TypeScript documentation][typescript]. Install the TypeScript compiler using: + +```bash +npm install -g typescript +``` + +You need [an Azure subscription][freesub] to run these sample programs. + +Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. + +Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. + +## Setup + +To run the samples using the published version of the package: + +1. Install the dependencies using `npm`: + +```bash +npm install +``` + +2. Compile the samples: + +```bash +npm run build +``` + +3. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. + +4. Run whichever samples you like (note that some samples may require additional setup, see the table above): + +```bash +node dist/applicationCreateSample.js +``` + +Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): + +```bash +npx cross-env node dist/applicationCreateSample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[applicationcreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/typescript/src/applicationCreateSample.ts +[applicationdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/typescript/src/applicationDeleteSample.ts +[applicationgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/typescript/src/applicationGetSample.ts +[applicationlistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/typescript/src/applicationListSample.ts +[applicationpackageactivatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/typescript/src/applicationPackageActivateSample.ts +[applicationpackagecreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/typescript/src/applicationPackageCreateSample.ts +[applicationpackagedeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/typescript/src/applicationPackageDeleteSample.ts +[applicationpackagegetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/typescript/src/applicationPackageGetSample.ts +[applicationpackagelistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/typescript/src/applicationPackageListSample.ts +[applicationupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/typescript/src/applicationUpdateSample.ts +[batchaccountcreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/typescript/src/batchAccountCreateSample.ts +[batchaccountdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/typescript/src/batchAccountDeleteSample.ts +[batchaccountgetdetectorsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/typescript/src/batchAccountGetDetectorSample.ts +[batchaccountgetkeyssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/typescript/src/batchAccountGetKeysSample.ts +[batchaccountgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/typescript/src/batchAccountGetSample.ts +[batchaccountlistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/typescript/src/batchAccountListByResourceGroupSample.ts +[batchaccountlistdetectorssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/typescript/src/batchAccountListDetectorsSample.ts +[batchaccountlistoutboundnetworkdependenciesendpointssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/typescript/src/batchAccountListOutboundNetworkDependenciesEndpointsSample.ts +[batchaccountlistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/typescript/src/batchAccountListSample.ts +[batchaccountregeneratekeysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/typescript/src/batchAccountRegenerateKeySample.ts +[batchaccountsynchronizeautostoragekeyssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/typescript/src/batchAccountSynchronizeAutoStorageKeysSample.ts +[batchaccountupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/typescript/src/batchAccountUpdateSample.ts +[certificatecanceldeletionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/typescript/src/certificateCancelDeletionSample.ts +[certificatecreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/typescript/src/certificateCreateSample.ts +[certificatedeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/typescript/src/certificateDeleteSample.ts +[certificategetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/typescript/src/certificateGetSample.ts +[certificatelistbybatchaccountsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/typescript/src/certificateListByBatchAccountSample.ts +[certificateupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/typescript/src/certificateUpdateSample.ts +[locationchecknameavailabilitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/typescript/src/locationCheckNameAvailabilitySample.ts +[locationgetquotassample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/typescript/src/locationGetQuotasSample.ts +[locationlistsupportedcloudserviceskussample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/typescript/src/locationListSupportedCloudServiceSkusSample.ts +[locationlistsupportedvirtualmachineskussample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/typescript/src/locationListSupportedVirtualMachineSkusSample.ts +[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/typescript/src/operationsListSample.ts +[poolcreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/typescript/src/poolCreateSample.ts +[pooldeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/typescript/src/poolDeleteSample.ts +[pooldisableautoscalesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/typescript/src/poolDisableAutoScaleSample.ts +[poolgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/typescript/src/poolGetSample.ts +[poollistbybatchaccountsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/typescript/src/poolListByBatchAccountSample.ts +[poolstopresizesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/typescript/src/poolStopResizeSample.ts +[poolupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/typescript/src/poolUpdateSample.ts +[privateendpointconnectiongetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/typescript/src/privateEndpointConnectionGetSample.ts +[privateendpointconnectionlistbybatchaccountsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/typescript/src/privateEndpointConnectionListByBatchAccountSample.ts +[privateendpointconnectionupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/typescript/src/privateEndpointConnectionUpdateSample.ts +[privatelinkresourcegetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/typescript/src/privateLinkResourceGetSample.ts +[privatelinkresourcelistbybatchaccountsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/batch/arm-batch/samples/v7/typescript/src/privateLinkResourceListByBatchAccountSample.ts +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-batch?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/batch/arm-batch/README.md +[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/batch/arm-batch/samples/v7/typescript/package.json b/sdk/batch/arm-batch/samples/v7/typescript/package.json new file mode 100644 index 000000000000..e70b2318d6e3 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/typescript/package.json @@ -0,0 +1,41 @@ +{ + "name": "azure-arm-batch-samples-ts", + "private": true, + "version": "1.0.0", + "description": " client library samples for TypeScript", + "engines": { + "node": ">=12.0.0" + }, + "scripts": { + "build": "tsc", + "prebuild": "rimraf dist/" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/batch/arm-batch" + }, + "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/batch/arm-batch", + "dependencies": { + "@azure/arm-batch": "latest", + "dotenv": "latest", + "@azure/identity": "^2.0.1" + }, + "devDependencies": { + "@types/node": "^12.0.0", + "typescript": "~4.4.0", + "rimraf": "latest" + } +} diff --git a/sdk/batch/arm-batch/samples/v7/typescript/sample.env b/sdk/batch/arm-batch/samples/v7/typescript/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/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/batch/arm-batch/samples/v7/typescript/src/applicationCreateSample.ts b/sdk/batch/arm-batch/samples/v7/typescript/src/applicationCreateSample.ts new file mode 100644 index 000000000000..679a379232ba --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/typescript/src/applicationCreateSample.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 { + Application, + ApplicationCreateOptionalParams, + BatchManagementClient +} from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Adds an application to the specified Batch account. + * + * @summary Adds an application to the specified Batch account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationCreate.json + */ +async function applicationCreate() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const applicationName = "app1"; + const parameters: Application = { + allowUpdates: false, + displayName: "myAppName" + }; + const options: ApplicationCreateOptionalParams = { parameters }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.applicationOperations.create( + resourceGroupName, + accountName, + applicationName, + options + ); + console.log(result); +} + +applicationCreate().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/typescript/src/applicationDeleteSample.ts b/sdk/batch/arm-batch/samples/v7/typescript/src/applicationDeleteSample.ts new file mode 100644 index 000000000000..669116ae294e --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/typescript/src/applicationDeleteSample.ts @@ -0,0 +1,35 @@ +/* + * 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 { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Deletes an application. + * + * @summary Deletes an application. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationDelete.json + */ +async function applicationDelete() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const applicationName = "app1"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.applicationOperations.delete( + resourceGroupName, + accountName, + applicationName + ); + console.log(result); +} + +applicationDelete().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/typescript/src/applicationGetSample.ts b/sdk/batch/arm-batch/samples/v7/typescript/src/applicationGetSample.ts new file mode 100644 index 000000000000..71d0ad31352f --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/typescript/src/applicationGetSample.ts @@ -0,0 +1,35 @@ +/* + * 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 { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets information about the specified application. + * + * @summary Gets information about the specified application. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationGet.json + */ +async function applicationGet() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const applicationName = "app1"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.applicationOperations.get( + resourceGroupName, + accountName, + applicationName + ); + console.log(result); +} + +applicationGet().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/typescript/src/applicationListSample.ts b/sdk/batch/arm-batch/samples/v7/typescript/src/applicationListSample.ts new file mode 100644 index 000000000000..3bb6a73216a5 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/typescript/src/applicationListSample.ts @@ -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. +import { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Lists all of the applications in the specified account. + * + * @summary Lists all of the applications in the specified account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationList.json + */ +async function applicationList() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.applicationOperations.list( + resourceGroupName, + accountName + )) { + resArray.push(item); + } + console.log(resArray); +} + +applicationList().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/typescript/src/applicationPackageActivateSample.ts b/sdk/batch/arm-batch/samples/v7/typescript/src/applicationPackageActivateSample.ts new file mode 100644 index 000000000000..85cb7868a533 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/typescript/src/applicationPackageActivateSample.ts @@ -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. +import { + ActivateApplicationPackageParameters, + BatchManagementClient +} from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Activates the specified application package. This should be done after the `ApplicationPackage` was created and uploaded. This needs to be done before an `ApplicationPackage` can be used on Pools or Tasks. + * + * @summary Activates the specified application package. This should be done after the `ApplicationPackage` was created and uploaded. This needs to be done before an `ApplicationPackage` can be used on Pools or Tasks. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationPackageActivate.json + */ +async function applicationPackageActivate() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const applicationName = "app1"; + const versionName = "1"; + const parameters: ActivateApplicationPackageParameters = { format: "zip" }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.applicationPackageOperations.activate( + resourceGroupName, + accountName, + applicationName, + versionName, + parameters + ); + console.log(result); +} + +applicationPackageActivate().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/typescript/src/applicationPackageCreateSample.ts b/sdk/batch/arm-batch/samples/v7/typescript/src/applicationPackageCreateSample.ts new file mode 100644 index 000000000000..6d29ac601293 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/typescript/src/applicationPackageCreateSample.ts @@ -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. +import { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Creates an application package record. The record contains a storageUrl where the package should be uploaded to. Once it is uploaded the `ApplicationPackage` needs to be activated using `ApplicationPackageActive` before it can be used. If the auto storage account was configured to use storage keys, the URL returned will contain a SAS. + * + * @summary Creates an application package record. The record contains a storageUrl where the package should be uploaded to. Once it is uploaded the `ApplicationPackage` needs to be activated using `ApplicationPackageActive` before it can be used. If the auto storage account was configured to use storage keys, the URL returned will contain a SAS. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationPackageCreate.json + */ +async function applicationPackageCreate() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const applicationName = "app1"; + const versionName = "1"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.applicationPackageOperations.create( + resourceGroupName, + accountName, + applicationName, + versionName + ); + console.log(result); +} + +applicationPackageCreate().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/typescript/src/applicationPackageDeleteSample.ts b/sdk/batch/arm-batch/samples/v7/typescript/src/applicationPackageDeleteSample.ts new file mode 100644 index 000000000000..ccd5b0a210a8 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/typescript/src/applicationPackageDeleteSample.ts @@ -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. +import { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Deletes an application package record and its associated binary file. + * + * @summary Deletes an application package record and its associated binary file. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationPackageDelete.json + */ +async function applicationPackageDelete() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const applicationName = "app1"; + const versionName = "1"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.applicationPackageOperations.delete( + resourceGroupName, + accountName, + applicationName, + versionName + ); + console.log(result); +} + +applicationPackageDelete().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/typescript/src/applicationPackageGetSample.ts b/sdk/batch/arm-batch/samples/v7/typescript/src/applicationPackageGetSample.ts new file mode 100644 index 000000000000..c5eeb9794eba --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/typescript/src/applicationPackageGetSample.ts @@ -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. +import { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets information about the specified application package. + * + * @summary Gets information about the specified application package. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationPackageGet.json + */ +async function applicationPackageGet() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const applicationName = "app1"; + const versionName = "1"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.applicationPackageOperations.get( + resourceGroupName, + accountName, + applicationName, + versionName + ); + console.log(result); +} + +applicationPackageGet().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/typescript/src/applicationPackageListSample.ts b/sdk/batch/arm-batch/samples/v7/typescript/src/applicationPackageListSample.ts new file mode 100644 index 000000000000..6721a6fc067a --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/typescript/src/applicationPackageListSample.ts @@ -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. +import { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Lists all of the application packages in the specified application. + * + * @summary Lists all of the application packages in the specified application. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationPackageList.json + */ +async function applicationPackageList() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const applicationName = "app1"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.applicationPackageOperations.list( + resourceGroupName, + accountName, + applicationName + )) { + resArray.push(item); + } + console.log(resArray); +} + +applicationPackageList().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/typescript/src/applicationUpdateSample.ts b/sdk/batch/arm-batch/samples/v7/typescript/src/applicationUpdateSample.ts new file mode 100644 index 000000000000..e4c58c14907f --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/typescript/src/applicationUpdateSample.ts @@ -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. +import { Application, BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Updates settings for the specified application. + * + * @summary Updates settings for the specified application. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationUpdate.json + */ +async function applicationUpdate() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const applicationName = "app1"; + const parameters: Application = { + allowUpdates: true, + defaultVersion: "2", + displayName: "myAppName" + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.applicationOperations.update( + resourceGroupName, + accountName, + applicationName, + parameters + ); + console.log(result); +} + +applicationUpdate().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/typescript/src/batchAccountCreateSample.ts b/sdk/batch/arm-batch/samples/v7/typescript/src/batchAccountCreateSample.ts new file mode 100644 index 000000000000..6b24738d5f02 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/typescript/src/batchAccountCreateSample.ts @@ -0,0 +1,179 @@ +/* + * 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 { + BatchAccountCreateParameters, + BatchManagementClient +} from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and should instead be updated with the Update Batch Account API. + * + * @summary Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and should instead be updated with the Update Batch Account API. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountCreate_BYOS.json + */ +async function batchAccountCreateByos() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const parameters: BatchAccountCreateParameters = { + autoStorage: { + storageAccountId: + "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage" + }, + keyVaultReference: { + id: + "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.KeyVault/vaults/sample", + url: "http://sample.vault.azure.net/" + }, + location: "japaneast", + poolAllocationMode: "UserSubscription" + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.batchAccountOperations.beginCreateAndWait( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +batchAccountCreateByos().catch(console.error); + +/** + * This sample demonstrates how to Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and should instead be updated with the Update Batch Account API. + * + * @summary Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and should instead be updated with the Update Batch Account API. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountCreate_Default.json + */ +async function batchAccountCreateDefault() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const parameters: BatchAccountCreateParameters = { + autoStorage: { + storageAccountId: + "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage" + }, + location: "japaneast" + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.batchAccountOperations.beginCreateAndWait( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +batchAccountCreateDefault().catch(console.error); + +/** + * This sample demonstrates how to Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and should instead be updated with the Update Batch Account API. + * + * @summary Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and should instead be updated with the Update Batch Account API. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountCreate_SystemAssignedIdentity.json + */ +async function batchAccountCreateSystemAssignedIdentity() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const parameters: BatchAccountCreateParameters = { + autoStorage: { + storageAccountId: + "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage" + }, + identity: { type: "SystemAssigned" }, + location: "japaneast" + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.batchAccountOperations.beginCreateAndWait( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +batchAccountCreateSystemAssignedIdentity().catch(console.error); + +/** + * This sample demonstrates how to Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and should instead be updated with the Update Batch Account API. + * + * @summary Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and should instead be updated with the Update Batch Account API. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountCreate_UserAssignedIdentity.json + */ +async function batchAccountCreateUserAssignedIdentity() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const parameters: BatchAccountCreateParameters = { + autoStorage: { + storageAccountId: + "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage" + }, + identity: { + type: "UserAssigned", + userAssignedIdentities: { + "/subscriptions/subid/resourceGroups/defaultAzurebatchJapaneast/providers/MicrosoftManagedIdentity/userAssignedIdentities/id1": {} + } + }, + location: "japaneast" + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.batchAccountOperations.beginCreateAndWait( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +batchAccountCreateUserAssignedIdentity().catch(console.error); + +/** + * This sample demonstrates how to Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and should instead be updated with the Update Batch Account API. + * + * @summary Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and should instead be updated with the Update Batch Account API. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PrivateBatchAccountCreate.json + */ +async function privateBatchAccountCreate() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const parameters: BatchAccountCreateParameters = { + autoStorage: { + storageAccountId: + "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage" + }, + keyVaultReference: { + id: + "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.KeyVault/vaults/sample", + url: "http://sample.vault.azure.net/" + }, + location: "japaneast", + publicNetworkAccess: "Disabled" + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.batchAccountOperations.beginCreateAndWait( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +privateBatchAccountCreate().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/typescript/src/batchAccountDeleteSample.ts b/sdk/batch/arm-batch/samples/v7/typescript/src/batchAccountDeleteSample.ts new file mode 100644 index 000000000000..8196f63d2564 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/typescript/src/batchAccountDeleteSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Deletes the specified Batch account. + * + * @summary Deletes the specified Batch account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountDelete.json + */ +async function batchAccountDelete() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.batchAccountOperations.beginDeleteAndWait( + resourceGroupName, + accountName + ); + console.log(result); +} + +batchAccountDelete().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/typescript/src/batchAccountGetDetectorSample.ts b/sdk/batch/arm-batch/samples/v7/typescript/src/batchAccountGetDetectorSample.ts new file mode 100644 index 000000000000..5ddeab460cc3 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/typescript/src/batchAccountGetDetectorSample.ts @@ -0,0 +1,35 @@ +/* + * 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 { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets information about the given detector for a given Batch account. + * + * @summary Gets information about the given detector for a given Batch account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/DetectorGet.json + */ +async function getDetector() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const detectorId = "poolsAndNodes"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.batchAccountOperations.getDetector( + resourceGroupName, + accountName, + detectorId + ); + console.log(result); +} + +getDetector().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/typescript/src/batchAccountGetKeysSample.ts b/sdk/batch/arm-batch/samples/v7/typescript/src/batchAccountGetKeysSample.ts new file mode 100644 index 000000000000..0d0642d79ebd --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/typescript/src/batchAccountGetKeysSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to This operation applies only to Batch accounts with allowedAuthenticationModes containing 'SharedKey'. If the Batch account doesn't contain 'SharedKey' in its allowedAuthenticationMode, clients cannot use shared keys to authenticate, and must use another allowedAuthenticationModes instead. In this case, getting the keys will fail. + * + * @summary This operation applies only to Batch accounts with allowedAuthenticationModes containing 'SharedKey'. If the Batch account doesn't contain 'SharedKey' in its allowedAuthenticationMode, clients cannot use shared keys to authenticate, and must use another allowedAuthenticationModes instead. In this case, getting the keys will fail. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountGetKeys.json + */ +async function batchAccountGetKeys() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.batchAccountOperations.getKeys( + resourceGroupName, + accountName + ); + console.log(result); +} + +batchAccountGetKeys().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/typescript/src/batchAccountGetSample.ts b/sdk/batch/arm-batch/samples/v7/typescript/src/batchAccountGetSample.ts new file mode 100644 index 000000000000..d7a140a16a2c --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/typescript/src/batchAccountGetSample.ts @@ -0,0 +1,54 @@ +/* + * 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 { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets information about the specified Batch account. + * + * @summary Gets information about the specified Batch account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountGet.json + */ +async function batchAccountGet() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.batchAccountOperations.get( + resourceGroupName, + accountName + ); + console.log(result); +} + +batchAccountGet().catch(console.error); + +/** + * This sample demonstrates how to Gets information about the specified Batch account. + * + * @summary Gets information about the specified Batch account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PrivateBatchAccountGet.json + */ +async function privateBatchAccountGet() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.batchAccountOperations.get( + resourceGroupName, + accountName + ); + console.log(result); +} + +privateBatchAccountGet().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/typescript/src/batchAccountListByResourceGroupSample.ts b/sdk/batch/arm-batch/samples/v7/typescript/src/batchAccountListByResourceGroupSample.ts new file mode 100644 index 000000000000..0c397bff08e9 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/typescript/src/batchAccountListByResourceGroupSample.ts @@ -0,0 +1,34 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets information about the Batch accounts associated with the specified resource group. + * + * @summary Gets information about the Batch accounts associated with the specified resource group. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountListByResourceGroup.json + */ +async function batchAccountListByResourceGroup() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.batchAccountOperations.listByResourceGroup( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +batchAccountListByResourceGroup().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/typescript/src/batchAccountListDetectorsSample.ts b/sdk/batch/arm-batch/samples/v7/typescript/src/batchAccountListDetectorsSample.ts new file mode 100644 index 000000000000..5b04846a2f14 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/typescript/src/batchAccountListDetectorsSample.ts @@ -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. +import { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets information about the detectors available for a given Batch account. + * + * @summary Gets information about the detectors available for a given Batch account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/DetectorList.json + */ +async function listDetectors() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.batchAccountOperations.listDetectors( + resourceGroupName, + accountName + )) { + resArray.push(item); + } + console.log(resArray); +} + +listDetectors().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/typescript/src/batchAccountListOutboundNetworkDependenciesEndpointsSample.ts b/sdk/batch/arm-batch/samples/v7/typescript/src/batchAccountListOutboundNetworkDependenciesEndpointsSample.ts new file mode 100644 index 000000000000..7b76f19d96c5 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/typescript/src/batchAccountListOutboundNetworkDependenciesEndpointsSample.ts @@ -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. +import { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Lists the endpoints that a Batch Compute Node under this Batch Account may call as part of Batch service administration. If you are deploying a Pool inside of a virtual network that you specify, you must make sure your network allows outbound access to these endpoints. Failure to allow access to these endpoints may cause Batch to mark the affected nodes as unusable. For more information about creating a pool inside of a virtual network, see https://docs.microsoft.com/en-us/azure/batch/batch-virtual-network. + * + * @summary Lists the endpoints that a Batch Compute Node under this Batch Account may call as part of Batch service administration. If you are deploying a Pool inside of a virtual network that you specify, you must make sure your network allows outbound access to these endpoints. Failure to allow access to these endpoints may cause Batch to mark the affected nodes as unusable. For more information about creating a pool inside of a virtual network, see https://docs.microsoft.com/en-us/azure/batch/batch-virtual-network. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountListOutboundNetworkDependenciesEndpoints.json + */ +async function listOutboundNetworkDependencies() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.batchAccountOperations.listOutboundNetworkDependenciesEndpoints( + resourceGroupName, + accountName + )) { + resArray.push(item); + } + console.log(resArray); +} + +listOutboundNetworkDependencies().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/typescript/src/batchAccountListSample.ts b/sdk/batch/arm-batch/samples/v7/typescript/src/batchAccountListSample.ts new file mode 100644 index 000000000000..bb2de024199e --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/typescript/src/batchAccountListSample.ts @@ -0,0 +1,31 @@ +/* + * 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 { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets information about the Batch accounts associated with the subscription. + * + * @summary Gets information about the Batch accounts associated with the subscription. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountList.json + */ +async function batchAccountList() { + const subscriptionId = "subid"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.batchAccountOperations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +batchAccountList().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/typescript/src/batchAccountRegenerateKeySample.ts b/sdk/batch/arm-batch/samples/v7/typescript/src/batchAccountRegenerateKeySample.ts new file mode 100644 index 000000000000..e390bc2f0793 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/typescript/src/batchAccountRegenerateKeySample.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 { + BatchAccountRegenerateKeyParameters, + BatchManagementClient +} from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to This operation applies only to Batch accounts with allowedAuthenticationModes containing 'SharedKey'. If the Batch account doesn't contain 'SharedKey' in its allowedAuthenticationMode, clients cannot use shared keys to authenticate, and must use another allowedAuthenticationModes instead. In this case, regenerating the keys will fail. + * + * @summary This operation applies only to Batch accounts with allowedAuthenticationModes containing 'SharedKey'. If the Batch account doesn't contain 'SharedKey' in its allowedAuthenticationMode, clients cannot use shared keys to authenticate, and must use another allowedAuthenticationModes instead. In this case, regenerating the keys will fail. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountRegenerateKey.json + */ +async function batchAccountRegenerateKey() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const parameters: BatchAccountRegenerateKeyParameters = { + keyName: "Primary" + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.batchAccountOperations.regenerateKey( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +batchAccountRegenerateKey().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/typescript/src/batchAccountSynchronizeAutoStorageKeysSample.ts b/sdk/batch/arm-batch/samples/v7/typescript/src/batchAccountSynchronizeAutoStorageKeysSample.ts new file mode 100644 index 000000000000..4fc3820e2174 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/typescript/src/batchAccountSynchronizeAutoStorageKeysSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Synchronizes access keys for the auto-storage account configured for the specified Batch account, only if storage key authentication is being used. + * + * @summary Synchronizes access keys for the auto-storage account configured for the specified Batch account, only if storage key authentication is being used. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountSynchronizeAutoStorageKeys.json + */ +async function batchAccountSynchronizeAutoStorageKeys() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.batchAccountOperations.synchronizeAutoStorageKeys( + resourceGroupName, + accountName + ); + console.log(result); +} + +batchAccountSynchronizeAutoStorageKeys().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/typescript/src/batchAccountUpdateSample.ts b/sdk/batch/arm-batch/samples/v7/typescript/src/batchAccountUpdateSample.ts new file mode 100644 index 000000000000..0a558f108957 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/typescript/src/batchAccountUpdateSample.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 { + BatchAccountUpdateParameters, + BatchManagementClient +} from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Updates the properties of an existing Batch account. + * + * @summary Updates the properties of an existing Batch account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountUpdate.json + */ +async function batchAccountUpdate() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const parameters: BatchAccountUpdateParameters = { + autoStorage: { + storageAccountId: + "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage" + } + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.batchAccountOperations.update( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +batchAccountUpdate().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/typescript/src/certificateCancelDeletionSample.ts b/sdk/batch/arm-batch/samples/v7/typescript/src/certificateCancelDeletionSample.ts new file mode 100644 index 000000000000..b436f708c6aa --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/typescript/src/certificateCancelDeletionSample.ts @@ -0,0 +1,35 @@ +/* + * 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 { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to If you try to delete a certificate that is being used by a pool or compute node, the status of the certificate changes to deleteFailed. If you decide that you want to continue using the certificate, you can use this operation to set the status of the certificate back to active. If you intend to delete the certificate, you do not need to run this operation after the deletion failed. You must make sure that the certificate is not being used by any resources, and then you can try again to delete the certificate. + * + * @summary If you try to delete a certificate that is being used by a pool or compute node, the status of the certificate changes to deleteFailed. If you decide that you want to continue using the certificate, you can use this operation to set the status of the certificate back to active. If you intend to delete the certificate, you do not need to run this operation after the deletion failed. You must make sure that the certificate is not being used by any resources, and then you can try again to delete the certificate. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/CertificateCancelDeletion.json + */ +async function certificateCancelDeletion() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const certificateName = "sha1-0a0e4f50d51beadeac1d35afc5116098e7902e6e"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.certificateOperations.cancelDeletion( + resourceGroupName, + accountName, + certificateName + ); + console.log(result); +} + +certificateCancelDeletion().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/typescript/src/certificateCreateSample.ts b/sdk/batch/arm-batch/samples/v7/typescript/src/certificateCreateSample.ts new file mode 100644 index 000000000000..a35ee5c3864c --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/typescript/src/certificateCreateSample.ts @@ -0,0 +1,102 @@ +/* + * 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 { + CertificateCreateOrUpdateParameters, + BatchManagementClient +} from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Creates a new certificate inside the specified account. + * + * @summary Creates a new certificate inside the specified account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/CertificateCreate_Full.json + */ +async function createCertificateFull() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const certificateName = "sha1-0a0e4f50d51beadeac1d35afc5116098e7902e6e"; + const parameters: CertificateCreateOrUpdateParameters = { + format: "Pfx", + data: "MIIJsgIBAzCCCW4GCSqGSIb3DQE...", + password: "", + thumbprint: "0a0e4f50d51beadeac1d35afc5116098e7902e6e", + thumbprintAlgorithm: "sha1" + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.certificateOperations.create( + resourceGroupName, + accountName, + certificateName, + parameters + ); + console.log(result); +} + +createCertificateFull().catch(console.error); + +/** + * This sample demonstrates how to Creates a new certificate inside the specified account. + * + * @summary Creates a new certificate inside the specified account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/CertificateCreate_MinimalCer.json + */ +async function createCertificateMinimalCer() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const certificateName = "sha1-0a0e4f50d51beadeac1d35afc5116098e7902e6e"; + const parameters: CertificateCreateOrUpdateParameters = { + format: "Cer", + data: "MIICrjCCAZagAwI..." + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.certificateOperations.create( + resourceGroupName, + accountName, + certificateName, + parameters + ); + console.log(result); +} + +createCertificateMinimalCer().catch(console.error); + +/** + * This sample demonstrates how to Creates a new certificate inside the specified account. + * + * @summary Creates a new certificate inside the specified account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/CertificateCreate_Minimal.json + */ +async function createCertificateMinimalPfx() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const certificateName = "sha1-0a0e4f50d51beadeac1d35afc5116098e7902e6e"; + const parameters: CertificateCreateOrUpdateParameters = { + data: "MIIJsgIBAzCCCW4GCSqGSIb3DQE...", + password: "" + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.certificateOperations.create( + resourceGroupName, + accountName, + certificateName, + parameters + ); + console.log(result); +} + +createCertificateMinimalPfx().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/typescript/src/certificateDeleteSample.ts b/sdk/batch/arm-batch/samples/v7/typescript/src/certificateDeleteSample.ts new file mode 100644 index 000000000000..1b16bacd2ed8 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/typescript/src/certificateDeleteSample.ts @@ -0,0 +1,35 @@ +/* + * 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 { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Deletes the specified certificate. + * + * @summary Deletes the specified certificate. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/CertificateDelete.json + */ +async function certificateDelete() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const certificateName = "sha1-0a0e4f50d51beadeac1d35afc5116098e7902e6e"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.certificateOperations.beginDeleteAndWait( + resourceGroupName, + accountName, + certificateName + ); + console.log(result); +} + +certificateDelete().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/typescript/src/certificateGetSample.ts b/sdk/batch/arm-batch/samples/v7/typescript/src/certificateGetSample.ts new file mode 100644 index 000000000000..6cd0239f3682 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/typescript/src/certificateGetSample.ts @@ -0,0 +1,58 @@ +/* + * 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 { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets information about the specified certificate. + * + * @summary Gets information about the specified certificate. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/CertificateGet.json + */ +async function getCertificate() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const certificateName = "sha1-0a0e4f50d51beadeac1d35afc5116098e7902e6e"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.certificateOperations.get( + resourceGroupName, + accountName, + certificateName + ); + console.log(result); +} + +getCertificate().catch(console.error); + +/** + * This sample demonstrates how to Gets information about the specified certificate. + * + * @summary Gets information about the specified certificate. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/CertificateGetWithDeletionError.json + */ +async function getCertificateWithDeletionError() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const certificateName = "sha1-0a0e4f50d51beadeac1d35afc5116098e7902e6e"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.certificateOperations.get( + resourceGroupName, + accountName, + certificateName + ); + console.log(result); +} + +getCertificateWithDeletionError().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/typescript/src/certificateListByBatchAccountSample.ts b/sdk/batch/arm-batch/samples/v7/typescript/src/certificateListByBatchAccountSample.ts new file mode 100644 index 000000000000..62996221d136 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/typescript/src/certificateListByBatchAccountSample.ts @@ -0,0 +1,71 @@ +/* + * 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 { + CertificateListByBatchAccountOptionalParams, + BatchManagementClient +} from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Lists all of the certificates in the specified account. + * + * @summary Lists all of the certificates in the specified account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/CertificateList.json + */ +async function listCertificates() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.certificateOperations.listByBatchAccount( + resourceGroupName, + accountName + )) { + resArray.push(item); + } + console.log(resArray); +} + +listCertificates().catch(console.error); + +/** + * This sample demonstrates how to Lists all of the certificates in the specified account. + * + * @summary Lists all of the certificates in the specified account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/CertificateListWithFilter.json + */ +async function listCertificatesFilterAndSelect() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const select = "properties/format,properties/provisioningState"; + const filter = + "properties/provisioningStateTransitionTime gt '2017-05-01' or properties/provisioningState eq 'Failed'"; + const options: CertificateListByBatchAccountOptionalParams = { + select, + filter + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.certificateOperations.listByBatchAccount( + resourceGroupName, + accountName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +listCertificatesFilterAndSelect().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/typescript/src/certificateUpdateSample.ts b/sdk/batch/arm-batch/samples/v7/typescript/src/certificateUpdateSample.ts new file mode 100644 index 000000000000..ea1bdc4fb99e --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/typescript/src/certificateUpdateSample.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 { + CertificateCreateOrUpdateParameters, + BatchManagementClient +} from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Updates the properties of an existing certificate. + * + * @summary Updates the properties of an existing certificate. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/CertificateUpdate.json + */ +async function updateCertificate() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const certificateName = "sha1-0a0e4f50d51beadeac1d35afc5116098e7902e6e"; + const parameters: CertificateCreateOrUpdateParameters = { + data: "MIIJsgIBAzCCCW4GCSqGSIb3DQE...", + password: "" + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.certificateOperations.update( + resourceGroupName, + accountName, + certificateName, + parameters + ); + console.log(result); +} + +updateCertificate().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/typescript/src/locationCheckNameAvailabilitySample.ts b/sdk/batch/arm-batch/samples/v7/typescript/src/locationCheckNameAvailabilitySample.ts new file mode 100644 index 000000000000..56a8f4d7549c --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/typescript/src/locationCheckNameAvailabilitySample.ts @@ -0,0 +1,63 @@ +/* + * 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 { + CheckNameAvailabilityParameters, + BatchManagementClient +} from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Checks whether the Batch account name is available in the specified region. + * + * @summary Checks whether the Batch account name is available in the specified region. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/LocationCheckNameAvailability_AlreadyExists.json + */ +async function locationCheckNameAvailabilityAlreadyExists() { + const subscriptionId = "subid"; + const locationName = "japaneast"; + const parameters: CheckNameAvailabilityParameters = { + name: "existingaccountname", + type: "Microsoft.Batch/batchAccounts" + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.location.checkNameAvailability( + locationName, + parameters + ); + console.log(result); +} + +locationCheckNameAvailabilityAlreadyExists().catch(console.error); + +/** + * This sample demonstrates how to Checks whether the Batch account name is available in the specified region. + * + * @summary Checks whether the Batch account name is available in the specified region. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/LocationCheckNameAvailability_Available.json + */ +async function locationCheckNameAvailabilityAvailable() { + const subscriptionId = "subid"; + const locationName = "japaneast"; + const parameters: CheckNameAvailabilityParameters = { + name: "newaccountname", + type: "Microsoft.Batch/batchAccounts" + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.location.checkNameAvailability( + locationName, + parameters + ); + console.log(result); +} + +locationCheckNameAvailabilityAvailable().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/typescript/src/locationGetQuotasSample.ts b/sdk/batch/arm-batch/samples/v7/typescript/src/locationGetQuotasSample.ts new file mode 100644 index 000000000000..e259385aeec5 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/typescript/src/locationGetQuotasSample.ts @@ -0,0 +1,29 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets the Batch service quotas for the specified subscription at the given location. + * + * @summary Gets the Batch service quotas for the specified subscription at the given location. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/LocationGetQuotas.json + */ +async function locationGetQuotas() { + const subscriptionId = "subid"; + const locationName = "japaneast"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.location.getQuotas(locationName); + console.log(result); +} + +locationGetQuotas().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/typescript/src/locationListSupportedCloudServiceSkusSample.ts b/sdk/batch/arm-batch/samples/v7/typescript/src/locationListSupportedCloudServiceSkusSample.ts new file mode 100644 index 000000000000..dbf9979688c0 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/typescript/src/locationListSupportedCloudServiceSkusSample.ts @@ -0,0 +1,34 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets the list of Batch supported Cloud Service VM sizes available at the given location. + * + * @summary Gets the list of Batch supported Cloud Service VM sizes available at the given location. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/LocationListCloudServiceSkus.json + */ +async function locationListCloudServiceSkus() { + const subscriptionId = "subid"; + const locationName = "japaneast"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.location.listSupportedCloudServiceSkus( + locationName + )) { + resArray.push(item); + } + console.log(resArray); +} + +locationListCloudServiceSkus().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/typescript/src/locationListSupportedVirtualMachineSkusSample.ts b/sdk/batch/arm-batch/samples/v7/typescript/src/locationListSupportedVirtualMachineSkusSample.ts new file mode 100644 index 000000000000..82e940c7fb15 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/typescript/src/locationListSupportedVirtualMachineSkusSample.ts @@ -0,0 +1,34 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets the list of Batch supported Virtual Machine VM sizes available at the given location. + * + * @summary Gets the list of Batch supported Virtual Machine VM sizes available at the given location. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/LocationListVirtualMachineSkus.json + */ +async function locationListVirtualMachineSkus() { + const subscriptionId = "subid"; + const locationName = "japaneast"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.location.listSupportedVirtualMachineSkus( + locationName + )) { + resArray.push(item); + } + console.log(resArray); +} + +locationListVirtualMachineSkus().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/typescript/src/operationsListSample.ts b/sdk/batch/arm-batch/samples/v7/typescript/src/operationsListSample.ts new file mode 100644 index 000000000000..e1d87b331ac9 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/typescript/src/operationsListSample.ts @@ -0,0 +1,31 @@ +/* + * 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 { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Lists available operations for the Microsoft.Batch provider + * + * @summary Lists available operations for the Microsoft.Batch provider + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/OperationsList.json + */ +async function operationsList() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +operationsList().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/typescript/src/poolCreateSample.ts b/sdk/batch/arm-batch/samples/v7/typescript/src/poolCreateSample.ts new file mode 100644 index 000000000000..179e188ccc30 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/typescript/src/poolCreateSample.ts @@ -0,0 +1,508 @@ +/* + * 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 { Pool, BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Creates a new pool inside the specified account. + * + * @summary Creates a new pool inside the specified account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolCreate_SharedImageGallery.json + */ +async function createPoolCustomImage() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const poolName = "testpool"; + const parameters: Pool = { + deploymentConfiguration: { + virtualMachineConfiguration: { + imageReference: { + id: + "/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1" + }, + nodeAgentSkuId: "batch.node.ubuntu 18.04" + } + }, + vmSize: "STANDARD_D4" + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.poolOperations.create( + resourceGroupName, + accountName, + poolName, + parameters + ); + console.log(result); +} + +createPoolCustomImage().catch(console.error); + +/** + * This sample demonstrates how to Creates a new pool inside the specified account. + * + * @summary Creates a new pool inside the specified account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolCreate_CloudServiceConfiguration.json + */ +async function createPoolFullCloudServiceConfiguration() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const poolName = "testpool"; + const parameters: Pool = { + applicationLicenses: ["app-license0", "app-license1"], + applicationPackages: [ + { + id: + "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool/applications/app_1234", + version: "asdf" + } + ], + certificates: [ + { + id: + "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool/certificates/sha1-1234567", + storeLocation: "LocalMachine", + storeName: "MY", + visibility: ["RemoteUser"] + } + ], + deploymentConfiguration: { + cloudServiceConfiguration: { + osFamily: "4", + osVersion: "WA-GUEST-OS-4.45_201708-01" + } + }, + displayName: "my-pool-name", + interNodeCommunication: "Enabled", + metadata: [ + { name: "metadata-1", value: "value-1" }, + { name: "metadata-2", value: "value-2" } + ], + networkConfiguration: { + publicIPAddressConfiguration: { + ipAddressIds: [ + "/subscriptions/subid1/resourceGroups/rg13/providers/Microsoft.Network/publicIPAddresses/ip135", + "/subscriptions/subid2/resourceGroups/rg24/providers/Microsoft.Network/publicIPAddresses/ip268" + ], + provision: "UserManaged" + }, + subnetId: + "/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123" + }, + scaleSettings: { + fixedScale: { + nodeDeallocationOption: "TaskCompletion", + resizeTimeout: "PT8M", + targetDedicatedNodes: 6, + targetLowPriorityNodes: 28 + } + }, + startTask: { + commandLine: "cmd /c SET", + environmentSettings: [{ name: "MYSET", value: "1234" }], + maxTaskRetryCount: 6, + resourceFiles: [ + { + fileMode: "777", + filePath: "c:\tempgohere", + httpUrl: "https://testaccount.blob.core.windows.net/example-blob-file" + } + ], + userIdentity: { autoUser: { elevationLevel: "Admin", scope: "Pool" } }, + waitForSuccess: true + }, + taskSchedulingPolicy: { nodeFillType: "Pack" }, + taskSlotsPerNode: 13, + userAccounts: [ + { + name: "username1", + elevationLevel: "Admin", + linuxUserConfiguration: { + gid: 4567, + sshPrivateKey: "sshprivatekeyvalue", + uid: 1234 + }, + password: "" + } + ], + vmSize: "STANDARD_D4" + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.poolOperations.create( + resourceGroupName, + accountName, + poolName, + parameters + ); + console.log(result); +} + +createPoolFullCloudServiceConfiguration().catch(console.error); + +/** + * This sample demonstrates how to Creates a new pool inside the specified account. + * + * @summary Creates a new pool inside the specified account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolCreate_VirtualMachineConfiguration.json + */ +async function createPoolFullVirtualMachineConfiguration() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const poolName = "testpool"; + const parameters: Pool = { + deploymentConfiguration: { + virtualMachineConfiguration: { + dataDisks: [ + { + caching: "ReadWrite", + diskSizeGB: 30, + lun: 0, + storageAccountType: "Premium_LRS" + }, + { + caching: "None", + diskSizeGB: 200, + lun: 1, + storageAccountType: "Standard_LRS" + } + ], + diskEncryptionConfiguration: { targets: ["OsDisk", "TemporaryDisk"] }, + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter-SmallDisk", + version: "latest" + }, + licenseType: "Windows_Server", + nodeAgentSkuId: "batch.node.windows amd64", + nodePlacementConfiguration: { policy: "Zonal" }, + osDisk: { ephemeralOSDiskSettings: { placement: "CacheDisk" } }, + windowsConfiguration: { enableAutomaticUpdates: false } + } + }, + networkConfiguration: { + endpointConfiguration: { + inboundNatPools: [ + { + name: "testnat", + backendPort: 12001, + frontendPortRangeEnd: 15100, + frontendPortRangeStart: 15000, + networkSecurityGroupRules: [ + { + access: "Allow", + priority: 150, + sourceAddressPrefix: "192.100.12.45", + sourcePortRanges: ["1", "2"] + }, + { + access: "Deny", + priority: 3500, + sourceAddressPrefix: "*", + sourcePortRanges: ["*"] + } + ], + protocol: "TCP" + } + ] + } + }, + scaleSettings: { + autoScale: { + evaluationInterval: "PT5M", + formula: "$TargetDedicatedNodes=1" + } + }, + vmSize: "STANDARD_D4" + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.poolOperations.create( + resourceGroupName, + accountName, + poolName, + parameters + ); + console.log(result); +} + +createPoolFullVirtualMachineConfiguration().catch(console.error); + +/** + * This sample demonstrates how to Creates a new pool inside the specified account. + * + * @summary Creates a new pool inside the specified account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolCreate_MinimalCloudServiceConfiguration.json + */ +async function createPoolMinimalCloudServiceConfiguration() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const poolName = "testpool"; + const parameters: Pool = { + deploymentConfiguration: { cloudServiceConfiguration: { osFamily: "5" } }, + scaleSettings: { fixedScale: { targetDedicatedNodes: 3 } }, + vmSize: "STANDARD_D4" + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.poolOperations.create( + resourceGroupName, + accountName, + poolName, + parameters + ); + console.log(result); +} + +createPoolMinimalCloudServiceConfiguration().catch(console.error); + +/** + * This sample demonstrates how to Creates a new pool inside the specified account. + * + * @summary Creates a new pool inside the specified account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolCreate_MinimalVirtualMachineConfiguration.json + */ +async function createPoolMinimalVirtualMachineConfiguration() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const poolName = "testpool"; + const parameters: Pool = { + deploymentConfiguration: { + virtualMachineConfiguration: { + imageReference: { + offer: "UbuntuServer", + publisher: "Canonical", + sku: "18.04-LTS", + version: "latest" + }, + nodeAgentSkuId: "batch.node.ubuntu 18.04" + } + }, + scaleSettings: { + autoScale: { + evaluationInterval: "PT5M", + formula: "$TargetDedicatedNodes=1" + } + }, + vmSize: "STANDARD_D4" + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.poolOperations.create( + resourceGroupName, + accountName, + poolName, + parameters + ); + console.log(result); +} + +createPoolMinimalVirtualMachineConfiguration().catch(console.error); + +/** + * This sample demonstrates how to Creates a new pool inside the specified account. + * + * @summary Creates a new pool inside the specified account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolCreate_NoPublicIPAddresses.json + */ +async function createPoolNoPublicIP() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const poolName = "testpool"; + const parameters: Pool = { + deploymentConfiguration: { + virtualMachineConfiguration: { + imageReference: { + id: + "/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1" + }, + nodeAgentSkuId: "batch.node.ubuntu 18.04" + } + }, + networkConfiguration: { + publicIPAddressConfiguration: { provision: "NoPublicIPAddresses" }, + subnetId: + "/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123" + }, + vmSize: "STANDARD_D4" + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.poolOperations.create( + resourceGroupName, + accountName, + poolName, + parameters + ); + console.log(result); +} + +createPoolNoPublicIP().catch(console.error); + +/** + * This sample demonstrates how to Creates a new pool inside the specified account. + * + * @summary Creates a new pool inside the specified account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolCreate_PublicIPs.json + */ +async function createPoolPublicIPs() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const poolName = "testpool"; + const parameters: Pool = { + deploymentConfiguration: { + virtualMachineConfiguration: { + imageReference: { + id: + "/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1" + }, + nodeAgentSkuId: "batch.node.ubuntu 18.04" + } + }, + networkConfiguration: { + publicIPAddressConfiguration: { + ipAddressIds: [ + "/subscriptions/subid1/resourceGroups/rg13/providers/Microsoft.Network/publicIPAddresses/ip135" + ], + provision: "UserManaged" + }, + subnetId: + "/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123" + }, + vmSize: "STANDARD_D4" + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.poolOperations.create( + resourceGroupName, + accountName, + poolName, + parameters + ); + console.log(result); +} + +createPoolPublicIPs().catch(console.error); + +/** + * This sample demonstrates how to Creates a new pool inside the specified account. + * + * @summary Creates a new pool inside the specified account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolCreate_UserAssignedIdentities.json + */ +async function createPoolUserAssignedIdentities() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const poolName = "testpool"; + const parameters: Pool = { + deploymentConfiguration: { + virtualMachineConfiguration: { + imageReference: { + offer: "UbuntuServer", + publisher: "Canonical", + sku: "18.04-LTS", + version: "latest" + }, + nodeAgentSkuId: "batch.node.ubuntu 18.04" + } + }, + identity: { + type: "UserAssigned", + userAssignedIdentities: { + "/subscriptions/subid/resourceGroups/defaultAzurebatchJapaneast/providers/MicrosoftManagedIdentity/userAssignedIdentities/id1": {}, + "/subscriptions/subid/resourceGroups/defaultAzurebatchJapaneast/providers/MicrosoftManagedIdentity/userAssignedIdentities/id2": {} + } + }, + scaleSettings: { + autoScale: { + evaluationInterval: "PT5M", + formula: "$TargetDedicatedNodes=1" + } + }, + vmSize: "STANDARD_D4" + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.poolOperations.create( + resourceGroupName, + accountName, + poolName, + parameters + ); + console.log(result); +} + +createPoolUserAssignedIdentities().catch(console.error); + +/** + * This sample demonstrates how to Creates a new pool inside the specified account. + * + * @summary Creates a new pool inside the specified account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolCreate_VirtualMachineConfiguration_Extensions.json + */ +async function createPoolVirtualMachineConfigurationExtensions() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const poolName = "testpool"; + const parameters: Pool = { + deploymentConfiguration: { + virtualMachineConfiguration: { + imageReference: { + offer: "0001-com-ubuntu-server-focal", + publisher: "Canonical", + sku: "20_04-lts" + }, + nodeAgentSkuId: "batch.node.ubuntu 20.04", + extensions: [ + { + name: "batchextension1", + type: "SecurityMonitoringForLinux", + autoUpgradeMinorVersion: true, + protectedSettings: { + protectedSettingsKey: "protectedSettingsValue" + }, + publisher: "Microsoft.Azure.Security.Monitoring", + settings: { settingsKey: "settingsValue" }, + typeHandlerVersion: "1.0" + } + ] + } + }, + scaleSettings: { + autoScale: { + evaluationInterval: "PT5M", + formula: "$TargetDedicatedNodes=1" + } + }, + vmSize: "STANDARD_D4" + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.poolOperations.create( + resourceGroupName, + accountName, + poolName, + parameters + ); + console.log(result); +} + +createPoolVirtualMachineConfigurationExtensions().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/typescript/src/poolDeleteSample.ts b/sdk/batch/arm-batch/samples/v7/typescript/src/poolDeleteSample.ts new file mode 100644 index 000000000000..64017e520897 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/typescript/src/poolDeleteSample.ts @@ -0,0 +1,35 @@ +/* + * 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 { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Deletes the specified pool. + * + * @summary Deletes the specified pool. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolDelete.json + */ +async function deletePool() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const poolName = "testpool"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.poolOperations.beginDeleteAndWait( + resourceGroupName, + accountName, + poolName + ); + console.log(result); +} + +deletePool().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/typescript/src/poolDisableAutoScaleSample.ts b/sdk/batch/arm-batch/samples/v7/typescript/src/poolDisableAutoScaleSample.ts new file mode 100644 index 000000000000..a889dcd6a1c2 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/typescript/src/poolDisableAutoScaleSample.ts @@ -0,0 +1,35 @@ +/* + * 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 { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Disables automatic scaling for a pool. + * + * @summary Disables automatic scaling for a pool. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolDisableAutoScale.json + */ +async function disableAutoScale() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const poolName = "testpool"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.poolOperations.disableAutoScale( + resourceGroupName, + accountName, + poolName + ); + console.log(result); +} + +disableAutoScale().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/typescript/src/poolGetSample.ts b/sdk/batch/arm-batch/samples/v7/typescript/src/poolGetSample.ts new file mode 100644 index 000000000000..88376ecccc53 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/typescript/src/poolGetSample.ts @@ -0,0 +1,58 @@ +/* + * 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 { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets information about the specified pool. + * + * @summary Gets information about the specified pool. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolGet.json + */ +async function getPool() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const poolName = "testpool"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.poolOperations.get( + resourceGroupName, + accountName, + poolName + ); + console.log(result); +} + +getPool().catch(console.error); + +/** + * This sample demonstrates how to Gets information about the specified pool. + * + * @summary Gets information about the specified pool. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolGet_VirtualMachineConfiguration_Extensions.json + */ +async function getPoolVirtualMachineConfigurationExtensions() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const poolName = "testpool"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.poolOperations.get( + resourceGroupName, + accountName, + poolName + ); + console.log(result); +} + +getPoolVirtualMachineConfigurationExtensions().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/typescript/src/poolListByBatchAccountSample.ts b/sdk/batch/arm-batch/samples/v7/typescript/src/poolListByBatchAccountSample.ts new file mode 100644 index 000000000000..b73817a0dbc6 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/typescript/src/poolListByBatchAccountSample.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 { + PoolListByBatchAccountOptionalParams, + BatchManagementClient +} from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Lists all of the pools in the specified account. + * + * @summary Lists all of the pools in the specified account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolList.json + */ +async function listPool() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.poolOperations.listByBatchAccount( + resourceGroupName, + accountName + )) { + resArray.push(item); + } + console.log(resArray); +} + +listPool().catch(console.error); + +/** + * This sample demonstrates how to Lists all of the pools in the specified account. + * + * @summary Lists all of the pools in the specified account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolListWithFilter.json + */ +async function listPoolWithFilter() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const select = + "properties/allocationState,properties/provisioningStateTransitionTime,properties/currentDedicatedNodes,properties/currentLowPriorityNodes"; + const filter = + "startswith(name, 'po') or (properties/allocationState eq 'Steady' and properties/provisioningStateTransitionTime lt datetime'2017-02-02')"; + const options: PoolListByBatchAccountOptionalParams = { select, filter }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.poolOperations.listByBatchAccount( + resourceGroupName, + accountName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +listPoolWithFilter().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/typescript/src/poolStopResizeSample.ts b/sdk/batch/arm-batch/samples/v7/typescript/src/poolStopResizeSample.ts new file mode 100644 index 000000000000..e28c7178f433 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/typescript/src/poolStopResizeSample.ts @@ -0,0 +1,35 @@ +/* + * 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 { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to This does not restore the pool to its previous state before the resize operation: it only stops any further changes being made, and the pool maintains its current state. After stopping, the pool stabilizes at the number of nodes it was at when the stop operation was done. During the stop operation, the pool allocation state changes first to stopping and then to steady. A resize operation need not be an explicit resize pool request; this API can also be used to halt the initial sizing of the pool when it is created. + * + * @summary This does not restore the pool to its previous state before the resize operation: it only stops any further changes being made, and the pool maintains its current state. After stopping, the pool stabilizes at the number of nodes it was at when the stop operation was done. During the stop operation, the pool allocation state changes first to stopping and then to steady. A resize operation need not be an explicit resize pool request; this API can also be used to halt the initial sizing of the pool when it is created. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolStopResize.json + */ +async function stopPoolResize() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const poolName = "testpool"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.poolOperations.stopResize( + resourceGroupName, + accountName, + poolName + ); + console.log(result); +} + +stopPoolResize().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/typescript/src/poolUpdateSample.ts b/sdk/batch/arm-batch/samples/v7/typescript/src/poolUpdateSample.ts new file mode 100644 index 000000000000..f21c34b6b332 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/typescript/src/poolUpdateSample.ts @@ -0,0 +1,144 @@ +/* + * 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 { Pool, BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Updates the properties of an existing pool. + * + * @summary Updates the properties of an existing pool. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolUpdate_EnableAutoScale.json + */ +async function updatePoolEnableAutoscale() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const poolName = "testpool"; + const parameters: Pool = { + scaleSettings: { autoScale: { formula: "$TargetDedicatedNodes=34" } } + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.poolOperations.update( + resourceGroupName, + accountName, + poolName, + parameters + ); + console.log(result); +} + +updatePoolEnableAutoscale().catch(console.error); + +/** + * This sample demonstrates how to Updates the properties of an existing pool. + * + * @summary Updates the properties of an existing pool. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolUpdate_OtherProperties.json + */ +async function updatePoolOtherProperties() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const poolName = "testpool"; + const parameters: Pool = { + applicationPackages: [ + { + id: + "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool/applications/app_1234" + }, + { + id: + "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool/applications/app_5678", + version: "1.0" + } + ], + certificates: [ + { + id: + "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool/certificates/sha1-1234567", + storeLocation: "LocalMachine", + storeName: "MY" + } + ], + metadata: [{ name: "key1", value: "value1" }] + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.poolOperations.update( + resourceGroupName, + accountName, + poolName, + parameters + ); + console.log(result); +} + +updatePoolOtherProperties().catch(console.error); + +/** + * This sample demonstrates how to Updates the properties of an existing pool. + * + * @summary Updates the properties of an existing pool. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolUpdate_RemoveStartTask.json + */ +async function updatePoolRemoveStartTask() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const poolName = "testpool"; + const parameters: Pool = { startTask: {} }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.poolOperations.update( + resourceGroupName, + accountName, + poolName, + parameters + ); + console.log(result); +} + +updatePoolRemoveStartTask().catch(console.error); + +/** + * This sample demonstrates how to Updates the properties of an existing pool. + * + * @summary Updates the properties of an existing pool. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolUpdate_ResizePool.json + */ +async function updatePoolResizePool() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const poolName = "testpool"; + const parameters: Pool = { + scaleSettings: { + fixedScale: { + nodeDeallocationOption: "TaskCompletion", + resizeTimeout: "PT8M", + targetDedicatedNodes: 5, + targetLowPriorityNodes: 0 + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.poolOperations.update( + resourceGroupName, + accountName, + poolName, + parameters + ); + console.log(result); +} + +updatePoolResizePool().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/typescript/src/privateEndpointConnectionGetSample.ts b/sdk/batch/arm-batch/samples/v7/typescript/src/privateEndpointConnectionGetSample.ts new file mode 100644 index 000000000000..760713d49f60 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/typescript/src/privateEndpointConnectionGetSample.ts @@ -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. +import { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets information about the specified private endpoint connection. + * + * @summary Gets information about the specified private endpoint connection. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PrivateEndpointConnectionGet.json + */ +async function getPrivateEndpointConnection() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const privateEndpointConnectionName = + "testprivateEndpointConnection5testprivateEndpointConnection5.24d6b4b5-e65c-4330-bbe9-3a290d62f8e0"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.privateEndpointConnectionOperations.get( + resourceGroupName, + accountName, + privateEndpointConnectionName + ); + console.log(result); +} + +getPrivateEndpointConnection().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/typescript/src/privateEndpointConnectionListByBatchAccountSample.ts b/sdk/batch/arm-batch/samples/v7/typescript/src/privateEndpointConnectionListByBatchAccountSample.ts new file mode 100644 index 000000000000..235cc5ddf8a7 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/typescript/src/privateEndpointConnectionListByBatchAccountSample.ts @@ -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. +import { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Lists all of the private endpoint connections in the specified account. + * + * @summary Lists all of the private endpoint connections in the specified account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PrivateEndpointConnectionsList.json + */ +async function listPrivateEndpointConnections() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.privateEndpointConnectionOperations.listByBatchAccount( + resourceGroupName, + accountName + )) { + resArray.push(item); + } + console.log(resArray); +} + +listPrivateEndpointConnections().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/typescript/src/privateEndpointConnectionUpdateSample.ts b/sdk/batch/arm-batch/samples/v7/typescript/src/privateEndpointConnectionUpdateSample.ts new file mode 100644 index 000000000000..94fe980b2f78 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/typescript/src/privateEndpointConnectionUpdateSample.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 { + PrivateEndpointConnection, + BatchManagementClient +} from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Updates the properties of an existing private endpoint connection. + * + * @summary Updates the properties of an existing private endpoint connection. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PrivateEndpointConnectionUpdate.json + */ +async function updatePrivateEndpointConnection() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const privateEndpointConnectionName = + "testprivateEndpointConnection5.24d6b4b5-e65c-4330-bbe9-3a290d62f8e0"; + const parameters: PrivateEndpointConnection = { + privateLinkServiceConnectionState: { + description: "Approved by xyz.abc@company.com", + status: "Approved" + } + }; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.privateEndpointConnectionOperations.beginUpdateAndWait( + resourceGroupName, + accountName, + privateEndpointConnectionName, + parameters + ); + console.log(result); +} + +updatePrivateEndpointConnection().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/typescript/src/privateLinkResourceGetSample.ts b/sdk/batch/arm-batch/samples/v7/typescript/src/privateLinkResourceGetSample.ts new file mode 100644 index 000000000000..52d6b30fb81e --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/typescript/src/privateLinkResourceGetSample.ts @@ -0,0 +1,35 @@ +/* + * 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 { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Gets information about the specified private link resource. + * + * @summary Gets information about the specified private link resource. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PrivateLinkResourceGet.json + */ +async function getPrivateLinkResource() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const privateLinkResourceName = "sampleacct"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const result = await client.privateLinkResourceOperations.get( + resourceGroupName, + accountName, + privateLinkResourceName + ); + console.log(result); +} + +getPrivateLinkResource().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/typescript/src/privateLinkResourceListByBatchAccountSample.ts b/sdk/batch/arm-batch/samples/v7/typescript/src/privateLinkResourceListByBatchAccountSample.ts new file mode 100644 index 000000000000..05a019a98064 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/typescript/src/privateLinkResourceListByBatchAccountSample.ts @@ -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. +import { BatchManagementClient } from "@azure/arm-batch"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Lists all of the private link resources in the specified account. + * + * @summary Lists all of the private link resources in the specified account. + * x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PrivateLinkResourcesList.json + */ +async function listPrivateLinkResource() { + const subscriptionId = "subid"; + const resourceGroupName = "default-azurebatch-japaneast"; + const accountName = "sampleacct"; + const credential = new DefaultAzureCredential(); + const client = new BatchManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.privateLinkResourceOperations.listByBatchAccount( + resourceGroupName, + accountName + )) { + resArray.push(item); + } + console.log(resArray); +} + +listPrivateLinkResource().catch(console.error); diff --git a/sdk/batch/arm-batch/samples/v7/typescript/tsconfig.json b/sdk/batch/arm-batch/samples/v7/typescript/tsconfig.json new file mode 100644 index 000000000000..416c2dd82e00 --- /dev/null +++ b/sdk/batch/arm-batch/samples/v7/typescript/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "target": "ES2018", + "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/batch/arm-batch/src/batchManagementClient.ts b/sdk/batch/arm-batch/src/batchManagementClient.ts index 7c3c80e9ea77..4942eddbe002 100644 --- a/sdk/batch/arm-batch/src/batchManagementClient.ts +++ b/sdk/batch/arm-batch/src/batchManagementClient.ts @@ -65,7 +65,7 @@ export class BatchManagementClient extends coreClient.ServiceClient { credential: credentials }; - const packageDetails = `azsdk-js-arm-batch/7.0.0`; + const packageDetails = `azsdk-js-arm-batch/7.1.0`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` @@ -88,7 +88,7 @@ export class BatchManagementClient extends coreClient.ServiceClient { // Assigning values to Constant parameters this.$host = options.$host || "https://management.azure.com"; - this.apiVersion = options.apiVersion || "2021-06-01"; + this.apiVersion = options.apiVersion || "2022-01-01"; this.batchAccountOperations = new BatchAccountOperationsImpl(this); this.applicationPackageOperations = new ApplicationPackageOperationsImpl( this diff --git a/sdk/batch/arm-batch/src/models/index.ts b/sdk/batch/arm-batch/src/models/index.ts index 34c4a9e86a9d..80de72fc780b 100644 --- a/sdk/batch/arm-batch/src/models/index.ts +++ b/sdk/batch/arm-batch/src/models/index.ts @@ -426,6 +426,14 @@ export interface CertificateBaseProperties { format?: CertificateFormat; } +/** Values returned by the List operation. */ +export interface DetectorListResult { + /** The collection of Batch account detectors returned by the listing operation. */ + value?: DetectorResponse[]; + /** The URL to get the next set of results. */ + nextLink?: string; +} + /** Values returned by the List operation. */ export interface ListPrivateLinkResourcesResult { /** The collection of returned private link resources. */ @@ -502,7 +510,7 @@ export interface ImageReference { publisher?: string; /** For example, UbuntuServer or WindowsServer. */ offer?: string; - /** For example, 18.04-LTS or 2019-Datacenter. */ + /** For example, 18.04-LTS or 2022-datacenter. */ sku?: string; /** A value of 'latest' can be specified to select the latest version of an image. If omitted, the default is 'latest'. */ version?: string; @@ -659,6 +667,8 @@ export interface AutoScaleRunError { export interface NetworkConfiguration { /** The virtual network must be in the same region and subscription as the Azure Batch account. The specified subnet should have enough free IP addresses to accommodate the number of nodes in the pool. If the subnet doesn't have enough free IP addresses, the pool will partially allocate compute nodes and a resize error will occur. The 'MicrosoftAzureBatch' service principal must have the 'Classic Virtual Machine Contributor' Role-Based Access Control (RBAC) role for the specified VNet. The specified subnet must allow communication from the Azure Batch service to be able to schedule tasks on the compute nodes. This can be verified by checking if the specified VNet has any associated Network Security Groups (NSG). If communication to the compute nodes in the specified subnet is denied by an NSG, then the Batch service will set the state of the compute nodes to unusable. If the specified VNet has any associated Network Security Groups (NSG), then a few reserved system ports must be enabled for inbound communication. For pools created with a virtual machine configuration, enable ports 29876 and 29877, as well as port 22 for Linux and port 3389 for Windows. For pools created with a cloud service configuration, enable ports 10100, 20100, and 30100. Also enable outbound connections to Azure Storage on port 443. For cloudServiceConfiguration pools, only 'classic' VNETs are supported. For more details see: https://docs.microsoft.com/en-us/azure/batch/batch-api-basics#virtual-network-vnet-and-firewall-configuration */ subnetId?: string; + /** The scope of dynamic vnet assignment. */ + dynamicVNetAssignmentScope?: DynamicVNetAssignmentScope; /** Pool endpoint configuration is only supported on pools with the virtualMachineConfiguration property. */ endpointConfiguration?: PoolEndpointConfiguration; /** This property is only supported on Pools with the virtualMachineConfiguration property. */ @@ -703,7 +713,7 @@ export interface NetworkSecurityGroupRule { export interface PublicIPAddressConfiguration { /** The default value is BatchManaged */ provision?: IPAddressProvisioningType; - /** The number of IPs specified here limits the maximum size of the Pool - 100 dedicated nodes or 100 low-priority nodes can be allocated for each public IP. For example, a pool needing 250 dedicated VMs would need at least 3 public IPs specified. Each element of this collection is of the form: /subscriptions/{subscription}/resourceGroups/{group}/providers/Microsoft.Network/publicIPAddresses/{ip}. */ + /** The number of IPs specified here limits the maximum size of the Pool - 100 dedicated nodes or 100 Spot/low-priority nodes can be allocated for each public IP. For example, a pool needing 250 dedicated VMs would need at least 3 public IPs specified. Each element of this collection is of the form: /subscriptions/{subscription}/resourceGroups/{group}/providers/Microsoft.Network/publicIPAddresses/{ip}. */ ipAddressIds?: string[]; } @@ -847,7 +857,7 @@ export interface ApplicationPackageReference { export interface ResizeOperationStatus { /** The desired number of dedicated compute nodes in the pool. */ targetDedicatedNodes?: number; - /** The desired number of low-priority compute nodes in the pool. */ + /** The desired number of Spot/low-priority compute nodes in the pool. */ targetLowPriorityNodes?: number; /** The default value is 15 minutes. The minimum value is 5 minutes. If you specify a value less than 5 minutes, the Batch service returns an error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). */ resizeTimeout?: string; @@ -1107,6 +1117,12 @@ export type CertificateCreateOrUpdateParameters = ProxyResource & { password?: string; }; +/** Contains the information for a detector. */ +export type DetectorResponse = ProxyResource & { + /** A base64 encoded string that represents the content of a detector. */ + value?: string; +}; + /** Contains information about a private link resource. */ export type PrivateLinkResource = ProxyResource & { /** @@ -1172,7 +1188,7 @@ export type Pool = ProxyResource & { */ readonly currentDedicatedNodes?: number; /** - * The number of low-priority compute nodes currently in the pool. + * The number of Spot/low-priority compute nodes currently in the pool. * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly currentLowPriorityNodes?: number; @@ -1492,6 +1508,8 @@ export type ComputeNodeDeallocationOption = | "RetainedData"; /** Defines values for InterNodeCommunicationState. */ export type InterNodeCommunicationState = "Enabled" | "Disabled"; +/** Defines values for DynamicVNetAssignmentScope. */ +export type DynamicVNetAssignmentScope = "none" | "job"; /** Defines values for InboundEndpointProtocol. */ export type InboundEndpointProtocol = "TCP" | "UDP"; /** Defines values for NetworkSecurityGroupRuleAccess. */ @@ -1587,6 +1605,20 @@ export interface BatchAccountGetKeysOptionalParams /** Contains response data for the getKeys operation. */ export type BatchAccountGetKeysResponse = BatchAccountKeys; +/** Optional parameters. */ +export interface BatchAccountListDetectorsOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listDetectors operation. */ +export type BatchAccountListDetectorsResponse = DetectorListResult; + +/** Optional parameters. */ +export interface BatchAccountGetDetectorOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getDetector operation. */ +export type BatchAccountGetDetectorResponse = DetectorResponse; + /** Optional parameters. */ export interface BatchAccountListOutboundNetworkDependenciesEndpointsOptionalParams extends coreClient.OperationOptions {} @@ -1608,6 +1640,13 @@ export interface BatchAccountListByResourceGroupNextOptionalParams /** Contains response data for the listByResourceGroupNext operation. */ export type BatchAccountListByResourceGroupNextResponse = BatchAccountListResult; +/** Optional parameters. */ +export interface BatchAccountListDetectorsNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listDetectorsNext operation. */ +export type BatchAccountListDetectorsNextResponse = DetectorListResult; + /** Optional parameters. */ export interface BatchAccountListOutboundNetworkDependenciesEndpointsNextOptionalParams extends coreClient.OperationOptions {} diff --git a/sdk/batch/arm-batch/src/models/mappers.ts b/sdk/batch/arm-batch/src/models/mappers.ts index 53269a449d52..734a747f9fbd 100644 --- a/sdk/batch/arm-batch/src/models/mappers.ts +++ b/sdk/batch/arm-batch/src/models/mappers.ts @@ -1013,6 +1013,33 @@ export const CertificateBaseProperties: coreClient.CompositeMapper = { } }; +export const DetectorListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DetectorListResult", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "DetectorResponse" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + export const ListPrivateLinkResourcesResult: coreClient.CompositeMapper = { type: { name: "Composite", @@ -1688,6 +1715,13 @@ export const NetworkConfiguration: coreClient.CompositeMapper = { name: "String" } }, + dynamicVNetAssignmentScope: { + serializedName: "dynamicVNetAssignmentScope", + type: { + name: "Enum", + allowedValues: ["none", "job"] + } + }, endpointConfiguration: { serializedName: "endpointConfiguration", type: { @@ -2935,6 +2969,22 @@ export const CertificateCreateOrUpdateParameters: coreClient.CompositeMapper = { } }; +export const DetectorResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DetectorResponse", + modelProperties: { + ...ProxyResource.type.modelProperties, + value: { + serializedName: "properties.value", + type: { + name: "String" + } + } + } + } +}; + export const PrivateLinkResource: coreClient.CompositeMapper = { type: { name: "Composite", diff --git a/sdk/batch/arm-batch/src/models/parameters.ts b/sdk/batch/arm-batch/src/models/parameters.ts index 3815a96a0fec..1610c3503209 100644 --- a/sdk/batch/arm-batch/src/models/parameters.ts +++ b/sdk/batch/arm-batch/src/models/parameters.ts @@ -95,7 +95,7 @@ export const accountName: OperationURLParameter = { export const apiVersion: OperationQueryParameter = { parameterPath: "apiVersion", mapper: { - defaultValue: "2021-06-01", + defaultValue: "2022-01-01", isConstant: true, serializedName: "api-version", type: { @@ -141,6 +141,17 @@ export const parameters2: OperationParameter = { mapper: BatchAccountRegenerateKeyParametersMapper }; +export const detectorId: OperationURLParameter = { + parameterPath: "detectorId", + mapper: { + serializedName: "detectorId", + required: true, + type: { + name: "String" + } + } +}; + export const nextLink: OperationURLParameter = { parameterPath: "nextLink", mapper: { diff --git a/sdk/batch/arm-batch/src/operations/batchAccountOperations.ts b/sdk/batch/arm-batch/src/operations/batchAccountOperations.ts index 792bb2d50249..63142c666ef9 100644 --- a/sdk/batch/arm-batch/src/operations/batchAccountOperations.ts +++ b/sdk/batch/arm-batch/src/operations/batchAccountOperations.ts @@ -20,6 +20,9 @@ import { BatchAccountListOptionalParams, BatchAccountListByResourceGroupNextOptionalParams, BatchAccountListByResourceGroupOptionalParams, + DetectorResponse, + BatchAccountListDetectorsNextOptionalParams, + BatchAccountListDetectorsOptionalParams, OutboundEnvironmentEndpoint, BatchAccountListOutboundNetworkDependenciesEndpointsNextOptionalParams, BatchAccountListOutboundNetworkDependenciesEndpointsOptionalParams, @@ -40,9 +43,13 @@ import { BatchAccountRegenerateKeyResponse, BatchAccountGetKeysOptionalParams, BatchAccountGetKeysResponse, + BatchAccountListDetectorsResponse, + BatchAccountGetDetectorOptionalParams, + BatchAccountGetDetectorResponse, BatchAccountListOutboundNetworkDependenciesEndpointsResponse, BatchAccountListNextResponse, BatchAccountListByResourceGroupNextResponse, + BatchAccountListDetectorsNextResponse, BatchAccountListOutboundNetworkDependenciesEndpointsNextResponse } from "../models"; @@ -154,6 +161,77 @@ export class BatchAccountOperationsImpl implements BatchAccountOperations { } } + /** + * Gets information about the detectors available for a given Batch account. + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param options The options parameters. + */ + public listDetectors( + resourceGroupName: string, + accountName: string, + options?: BatchAccountListDetectorsOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listDetectorsPagingAll( + resourceGroupName, + accountName, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listDetectorsPagingPage( + resourceGroupName, + accountName, + options + ); + } + }; + } + + private async *listDetectorsPagingPage( + resourceGroupName: string, + accountName: string, + options?: BatchAccountListDetectorsOptionalParams + ): AsyncIterableIterator { + let result = await this._listDetectors( + resourceGroupName, + accountName, + options + ); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listDetectorsNext( + resourceGroupName, + accountName, + continuationToken, + options + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listDetectorsPagingAll( + resourceGroupName: string, + accountName: string, + options?: BatchAccountListDetectorsOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listDetectorsPagingPage( + resourceGroupName, + accountName, + options + )) { + yield* page; + } + } + /** * Lists the endpoints that a Batch Compute Node under this Batch Account may call as part of Batch * service administration. If you are deploying a Pool inside of a virtual network that you specify, @@ -531,6 +609,42 @@ export class BatchAccountOperationsImpl implements BatchAccountOperations { ); } + /** + * Gets information about the detectors available for a given Batch account. + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param options The options parameters. + */ + private _listDetectors( + resourceGroupName: string, + accountName: string, + options?: BatchAccountListDetectorsOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, accountName, options }, + listDetectorsOperationSpec + ); + } + + /** + * Gets information about the given detector for a given Batch account. + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param detectorId The name of the detector. + * @param options The options parameters. + */ + getDetector( + resourceGroupName: string, + accountName: string, + detectorId: string, + options?: BatchAccountGetDetectorOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, accountName, detectorId, options }, + getDetectorOperationSpec + ); + } + /** * Lists the endpoints that a Batch Compute Node under this Batch Account may call as part of Batch * service administration. If you are deploying a Pool inside of a virtual network that you specify, @@ -585,6 +699,25 @@ export class BatchAccountOperationsImpl implements BatchAccountOperations { ); } + /** + * ListDetectorsNext + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param nextLink The nextLink from the previous successful call to the ListDetectors method. + * @param options The options parameters. + */ + private _listDetectorsNext( + resourceGroupName: string, + accountName: string, + nextLink: string, + options?: BatchAccountListDetectorsNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, accountName, nextLink, options }, + listDetectorsNextOperationSpec + ); + } + /** * ListOutboundNetworkDependenciesEndpointsNext * @param resourceGroupName The name of the resource group that contains the Batch account. @@ -814,6 +947,51 @@ const getKeysOperationSpec: coreClient.OperationSpec = { headerParameters: [Parameters.accept], serializer }; +const listDetectorsOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/detectors", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DetectorListResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.resourceGroupName, + Parameters.subscriptionId, + Parameters.accountName1 + ], + headerParameters: [Parameters.accept], + serializer +}; +const getDetectorOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/detectors/{detectorId}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DetectorResponse + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.resourceGroupName, + Parameters.subscriptionId, + Parameters.accountName1, + Parameters.detectorId + ], + headerParameters: [Parameters.accept], + serializer +}; const listOutboundNetworkDependenciesEndpointsOperationSpec: coreClient.OperationSpec = { path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/outboundNetworkDependenciesEndpoints", @@ -877,6 +1055,28 @@ const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { headerParameters: [Parameters.accept], serializer }; +const listDetectorsNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DetectorListResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.resourceGroupName, + Parameters.subscriptionId, + Parameters.accountName1, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], + serializer +}; const listOutboundNetworkDependenciesEndpointsNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", httpMethod: "GET", diff --git a/sdk/batch/arm-batch/src/operationsInterfaces/batchAccountOperations.ts b/sdk/batch/arm-batch/src/operationsInterfaces/batchAccountOperations.ts index a8c6d1f4ad2d..24c1be7d5026 100644 --- a/sdk/batch/arm-batch/src/operationsInterfaces/batchAccountOperations.ts +++ b/sdk/batch/arm-batch/src/operationsInterfaces/batchAccountOperations.ts @@ -12,6 +12,8 @@ import { BatchAccount, BatchAccountListOptionalParams, BatchAccountListByResourceGroupOptionalParams, + DetectorResponse, + BatchAccountListDetectorsOptionalParams, OutboundEnvironmentEndpoint, BatchAccountListOutboundNetworkDependenciesEndpointsOptionalParams, BatchAccountCreateParameters, @@ -28,7 +30,9 @@ import { BatchAccountRegenerateKeyOptionalParams, BatchAccountRegenerateKeyResponse, BatchAccountGetKeysOptionalParams, - BatchAccountGetKeysResponse + BatchAccountGetKeysResponse, + BatchAccountGetDetectorOptionalParams, + BatchAccountGetDetectorResponse } from "../models"; /// @@ -50,6 +54,17 @@ export interface BatchAccountOperations { resourceGroupName: string, options?: BatchAccountListByResourceGroupOptionalParams ): PagedAsyncIterableIterator; + /** + * Gets information about the detectors available for a given Batch account. + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param options The options parameters. + */ + listDetectors( + resourceGroupName: string, + accountName: string, + options?: BatchAccountListDetectorsOptionalParams + ): PagedAsyncIterableIterator; /** * Lists the endpoints that a Batch Compute Node under this Batch Account may call as part of Batch * service administration. If you are deploying a Pool inside of a virtual network that you specify, @@ -193,4 +208,17 @@ export interface BatchAccountOperations { accountName: string, options?: BatchAccountGetKeysOptionalParams ): Promise; + /** + * Gets information about the given detector for a given Batch account. + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param detectorId The name of the detector. + * @param options The options parameters. + */ + getDetector( + resourceGroupName: string, + accountName: string, + detectorId: string, + options?: BatchAccountGetDetectorOptionalParams + ): Promise; } diff --git a/sdk/batch/arm-batch/test/sampleTest.ts b/sdk/batch/arm-batch/test/batch_examples.ts similarity index 100% rename from sdk/batch/arm-batch/test/sampleTest.ts rename to sdk/batch/arm-batch/test/batch_examples.ts diff --git a/sdk/batch/arm-batch/tsconfig.json b/sdk/batch/arm-batch/tsconfig.json index 6e3251194117..0e82052bd8fa 100644 --- a/sdk/batch/arm-batch/tsconfig.json +++ b/sdk/batch/arm-batch/tsconfig.json @@ -9,11 +9,25 @@ "esModuleInterop": true, "allowSyntheticDefaultImports": true, "forceConsistentCasingInFileNames": true, - "lib": ["es6", "dom"], + "lib": [ + "es6", + "dom" + ], "declaration": true, "outDir": "./dist-esm", - "importHelpers": true + "importHelpers": true, + "paths": { + "@azure/arm-batch": [ + "./src/index" + ] + } }, - "include": ["./src/**/*.ts", "./test/**/*.ts"], - "exclude": ["node_modules"] -} + "include": [ + "./src/**/*.ts", + "./test/**/*.ts", + "samples-dev/**/*.ts" + ], + "exclude": [ + "node_modules" + ] +} \ No newline at end of file diff --git a/sdk/batch/ci.mgmt.yml b/sdk/batch/ci.mgmt.yml index 8f8f7b115ca6..d205e78ecd98 100644 --- a/sdk/batch/ci.mgmt.yml +++ b/sdk/batch/ci.mgmt.yml @@ -1,5 +1,5 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. - + trigger: branches: include: @@ -10,6 +10,7 @@ trigger: include: - sdk/batch/ci.mgmt.yml - sdk/batch/arm-batch/ + - sdk/batch/arm-batch pr: branches: include: @@ -23,11 +24,11 @@ pr: include: - sdk/batch/ci.mgmt.yml - sdk/batch/arm-batch/ - + - sdk/batch/arm-batch extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: ServiceDirectory: batch Artifacts: - name: azure-arm-batch - safeName: azurearmbatch \ No newline at end of file + safeName: azurearmbatch