diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 10d96b0c0283..e98765aabb60 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -9643,7 +9643,7 @@ packages: dev: false file:projects/arm-containerservice.tgz: - resolution: {integrity: sha512-STrGtnpGFgclL7s1N5GRsvljL1Uh1mSG1qbAOxBRsrtSCTC0T14g1rRQp+wKUZpQaVT/WxqGSDL8u9Yqn1stiA==, tarball: file:projects/arm-containerservice.tgz} + resolution: {integrity: sha512-oye2yulUr6kusYddNkMMtfCuRfT1/icYs0U1XUhaeJ1z+IDLvpOaowsVliE1WtxCNMBWtAfs0DQ0W4KxWev6LA==, tarball: file:projects/arm-containerservice.tgz} name: '@rush-temp/arm-containerservice' version: 0.0.0 dependencies: @@ -9651,18 +9651,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' - encoding - supports-color dev: false diff --git a/sdk/containerservice/arm-containerservice/CHANGELOG.md b/sdk/containerservice/arm-containerservice/CHANGELOG.md index 55f2171f618e..ec5c2d4b6663 100644 --- a/sdk/containerservice/arm-containerservice/CHANGELOG.md +++ b/sdk/containerservice/arm-containerservice/CHANGELOG.md @@ -1,15 +1,14 @@ # Release History - -## 15.0.1 (Unreleased) - -### Features Added - -### Breaking Changes - -### Bugs Fixed - -### Other Changes - + +## 15.1.0 (2022-02-24) + +**Features** + + - Added Type Alias Format + - Interface ManagedClustersListClusterUserCredentialsOptionalParams has a new optional parameter format + - Added Enum KnownFormat + + ## 15.0.0 (2021-12-09) The package of @azure/arm-containerservice is using our next generation design principles since version 15.0.0, which contains breaking changes. diff --git a/sdk/containerservice/arm-containerservice/LICENSE b/sdk/containerservice/arm-containerservice/LICENSE index ccb63b166732..5d1d36e0af80 100644 --- a/sdk/containerservice/arm-containerservice/LICENSE +++ b/sdk/containerservice/arm-containerservice/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/containerservice/arm-containerservice/README.md b/sdk/containerservice/arm-containerservice/README.md index af59cad6e49a..e82804d19418 100644 --- a/sdk/containerservice/arm-containerservice/README.md +++ b/sdk/containerservice/arm-containerservice/README.md @@ -16,6 +16,8 @@ The Container Service 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 { ContainerServiceClient } = require("@azure/arm-containerservice"); 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 ContainerServiceClient(new DefaultAzureCredential(), subscriptionId); + +// For client-side applications running in the browser, use this code instead: +// const credential = new InteractiveBrowserCredential({ +// tenantId: "", +// clientId: "" +// }); +// const client = new ContainerServiceClient(credential, subscriptionId); ``` diff --git a/sdk/containerservice/arm-containerservice/_meta.json b/sdk/containerservice/arm-containerservice/_meta.json index ba49f5c170eb..2cd25d537556 100644 --- a/sdk/containerservice/arm-containerservice/_meta.json +++ b/sdk/containerservice/arm-containerservice/_meta.json @@ -1,7 +1,7 @@ { - "commit": "d710fb7f40338ca6ef00e0a9680be0a3d4cf5059", + "commit": "9f48feaf684784644513d11ddb7bd0ac2e32f48e", "readme": "specification/containerservice/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/containerservice/resource-manager/readme.md --use=@autorest/typescript@6.0.0-alpha.16.20211130.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/containerservice/resource-manager/readme.md --use=@autorest/typescript@6.0.0-alpha.16.20220221.1 --generate-sample=true", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "use": "@autorest/typescript@6.0.0-alpha.16.20211130.1" + "use": "@autorest/typescript@6.0.0-alpha.16.20220221.1" } \ No newline at end of file diff --git a/sdk/containerservice/arm-containerservice/api-extractor.json b/sdk/containerservice/arm-containerservice/api-extractor.json index 35b49c274684..6594c3bc4da3 100644 --- a/sdk/containerservice/arm-containerservice/api-extractor.json +++ b/sdk/containerservice/arm-containerservice/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-containerservice.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/containerservice/arm-containerservice/package.json b/sdk/containerservice/arm-containerservice/package.json index ced3e849ecb1..368d65a45ad0 100644 --- a/sdk/containerservice/arm-containerservice/package.json +++ b/sdk/containerservice/arm-containerservice/package.json @@ -3,7 +3,7 @@ "sdk-type": "mgmt", "author": "Microsoft Corporation", "description": "A generated SDK for ContainerServiceClient.", - "version": "15.0.1", + "version": "15.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", @@ -98,5 +98,21 @@ "docs": "echo skipped" }, "sideEffects": false, - "autoPublish": true + "//metadata": { + "constantPaths": [ + { + "path": "src/containerServiceClient.ts", + "prefix": "packageDetails" + } + ] + }, + "autoPublish": true, + "//sampleConfiguration": { + "productName": "", + "productSlugs": [ + "azure" + ], + "disableDocsMs": true, + "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-containerservice?view=azure-node-preview" + } } diff --git a/sdk/containerservice/arm-containerservice/review/arm-containerservice.api.md b/sdk/containerservice/arm-containerservice/review/arm-containerservice.api.md index b0aa28d16cbc..4c095d9e0f20 100644 --- a/sdk/containerservice/arm-containerservice/review/arm-containerservice.api.md +++ b/sdk/containerservice/arm-containerservice/review/arm-containerservice.api.md @@ -345,6 +345,9 @@ export interface ExtendedLocation { // @public export type ExtendedLocationTypes = string; +// @public +export type Format = string; + // @public export type GPUInstanceProfile = string; @@ -767,6 +770,12 @@ export enum KnownExtendedLocationTypes { EdgeZone = "EdgeZone" } +// @public +export enum KnownFormat { + Azure = "azure", + Exec = "exec" +} + // @public export enum KnownGPUInstanceProfile { // (undocumented) @@ -1464,6 +1473,7 @@ export type ManagedClustersListClusterMonitoringUserCredentialsResponse = Creden // @public export interface ManagedClustersListClusterUserCredentialsOptionalParams extends coreClient.OperationOptions { + format?: Format; serverFqdn?: string; } diff --git a/sdk/containerservice/arm-containerservice/rollup.config.js b/sdk/containerservice/arm-containerservice/rollup.config.js index 9be1955eb7f1..3f89d7309da5 100644 --- a/sdk/containerservice/arm-containerservice/rollup.config.js +++ b/sdk/containerservice/arm-containerservice/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/containerservice/arm-containerservice/sample.env b/sdk/containerservice/arm-containerservice/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/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/containerservice/arm-containerservice/samples-dev/commandFailedResult.ts b/sdk/containerservice/arm-containerservice/samples-dev/commandFailedResult.ts new file mode 100644 index 000000000000..9cbe6e5acbf3 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/commandFailedResult.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. +/** + * This sample demonstrates how to Gets the results of a command which has been run on the Managed Cluster. + * + * @summary Gets the results of a command which has been run on the Managed Cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/RunCommandResultFailed.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function commandFailedResult() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const commandId = "def7b3ea71bd4f7e9d226ddbc0f00ad9"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.getCommandResult( + resourceGroupName, + resourceName, + commandId + ); + console.log(result); +} + +commandFailedResult().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/commandSucceedResult.ts b/sdk/containerservice/arm-containerservice/samples-dev/commandSucceedResult.ts new file mode 100644 index 000000000000..85dcad6433e6 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/commandSucceedResult.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. +/** + * This sample demonstrates how to Gets the results of a command which has been run on the Managed Cluster. + * + * @summary Gets the results of a command which has been run on the Managed Cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/RunCommandResultSucceed.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function commandSucceedResult() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const commandId = "def7b3ea71bd4f7e9d226ddbc0f00ad9"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.getCommandResult( + resourceGroupName, + resourceName, + commandId + ); + console.log(result); +} + +commandSucceedResult().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/createAgentPoolUsingAnAgentPoolSnapshot.ts b/sdk/containerservice/arm-containerservice/samples-dev/createAgentPoolUsingAnAgentPoolSnapshot.ts new file mode 100644 index 000000000000..5a603cb40100 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/createAgentPoolUsingAnAgentPoolSnapshot.ts @@ -0,0 +1,47 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster. + * + * @summary Creates or updates an agent pool in the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_Snapshot.json + */ +import { AgentPool, ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createAgentPoolUsingAnAgentPoolSnapshot() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const agentPoolName = "agentpool1"; + const parameters: AgentPool = { + count: 3, + creationData: { + sourceResourceId: + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.ContainerService/snapshots/snapshot1" + }, + enableFips: true, + orchestratorVersion: "", + osType: "Linux", + vmSize: "Standard_DS2_v2" + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + agentPoolName, + parameters + ); + console.log(result); +} + +createAgentPoolUsingAnAgentPoolSnapshot().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/createAgentPoolWithEncryptionAtHostEnabled.ts b/sdk/containerservice/arm-containerservice/samples-dev/createAgentPoolWithEncryptionAtHostEnabled.ts new file mode 100644 index 000000000000..615937aecc3d --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/createAgentPoolWithEncryptionAtHostEnabled.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. +/** + * This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster. + * + * @summary Creates or updates an agent pool in the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_EnableEncryptionAtHost.json + */ +import { AgentPool, ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createAgentPoolWithEncryptionAtHostEnabled() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const agentPoolName = "agentpool1"; + const parameters: AgentPool = { + count: 3, + enableEncryptionAtHost: true, + orchestratorVersion: "", + osType: "Linux", + vmSize: "Standard_DS2_v2" + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + agentPoolName, + parameters + ); + console.log(result); +} + +createAgentPoolWithEncryptionAtHostEnabled().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/createAgentPoolWithEphemeralOSDisk.ts b/sdk/containerservice/arm-containerservice/samples-dev/createAgentPoolWithEphemeralOSDisk.ts new file mode 100644 index 000000000000..d6ae50f316bf --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/createAgentPoolWithEphemeralOSDisk.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster. + * + * @summary Creates or updates an agent pool in the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_Ephemeral.json + */ +import { AgentPool, ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createAgentPoolWithEphemeralOSDisk() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const agentPoolName = "agentpool1"; + const parameters: AgentPool = { + count: 3, + orchestratorVersion: "", + osDiskSizeGB: 64, + osDiskType: "Ephemeral", + osType: "Linux", + vmSize: "Standard_DS2_v2" + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + agentPoolName, + parameters + ); + console.log(result); +} + +createAgentPoolWithEphemeralOSDisk().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/createAgentPoolWithFipsEnabledOS.ts b/sdk/containerservice/arm-containerservice/samples-dev/createAgentPoolWithFipsEnabledOS.ts new file mode 100644 index 000000000000..10b8598d5f1c --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/createAgentPoolWithFipsEnabledOS.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. +/** + * This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster. + * + * @summary Creates or updates an agent pool in the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_EnableFIPS.json + */ +import { AgentPool, ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createAgentPoolWithFipsEnabledOS() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const agentPoolName = "agentpool1"; + const parameters: AgentPool = { + count: 3, + enableFips: true, + orchestratorVersion: "", + osType: "Linux", + vmSize: "Standard_DS2_v2" + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + agentPoolName, + parameters + ); + console.log(result); +} + +createAgentPoolWithFipsEnabledOS().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/createAgentPoolWithGpumig.ts b/sdk/containerservice/arm-containerservice/samples-dev/createAgentPoolWithGpumig.ts new file mode 100644 index 000000000000..91d06caaed3b --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/createAgentPoolWithGpumig.ts @@ -0,0 +1,64 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster. + * + * @summary Creates or updates an agent pool in the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_GPUMIG.json + */ +import { AgentPool, ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createAgentPoolWithGpumig() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const agentPoolName = "agentpool1"; + const parameters: AgentPool = { + count: 3, + gpuInstanceProfile: "MIG2g", + kubeletConfig: { + allowedUnsafeSysctls: ["kernel.msg*", "net.core.somaxconn"], + cpuCfsQuota: true, + cpuCfsQuotaPeriod: "200ms", + cpuManagerPolicy: "static", + failSwapOn: false, + imageGcHighThreshold: 90, + imageGcLowThreshold: 70, + topologyManagerPolicy: "best-effort" + }, + linuxOSConfig: { + swapFileSizeMB: 1500, + sysctls: { + kernelThreadsMax: 99999, + netCoreWmemDefault: 12345, + netIpv4IpLocalPortRange: "20000 60000", + netIpv4TcpTwReuse: true + }, + transparentHugePageDefrag: "madvise", + transparentHugePageEnabled: "always" + }, + orchestratorVersion: "", + osType: "Linux", + vmSize: "Standard_ND96asr_v4" + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + agentPoolName, + parameters + ); + console.log(result); +} + +createAgentPoolWithGpumig().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/createAgentPoolWithKrustletAndTheWasiRuntime.ts b/sdk/containerservice/arm-containerservice/samples-dev/createAgentPoolWithKrustletAndTheWasiRuntime.ts new file mode 100644 index 000000000000..4f1575c18522 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/createAgentPoolWithKrustletAndTheWasiRuntime.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. +/** + * This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster. + * + * @summary Creates or updates an agent pool in the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_WasmWasi.json + */ +import { AgentPool, ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createAgentPoolWithKrustletAndTheWasiRuntime() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const agentPoolName = "agentpool1"; + const parameters: AgentPool = { + count: 3, + mode: "User", + orchestratorVersion: "", + osDiskSizeGB: 64, + osType: "Linux", + vmSize: "Standard_DS2_v2", + workloadRuntime: "WasmWasi" + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + agentPoolName, + parameters + ); + console.log(result); +} + +createAgentPoolWithKrustletAndTheWasiRuntime().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/createAgentPoolWithKubeletConfigAndLinuxOSConfig.ts b/sdk/containerservice/arm-containerservice/samples-dev/createAgentPoolWithKubeletConfigAndLinuxOSConfig.ts new file mode 100644 index 000000000000..e3757240cf85 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/createAgentPoolWithKubeletConfigAndLinuxOSConfig.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. +/** + * This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster. + * + * @summary Creates or updates an agent pool in the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_CustomNodeConfig.json + */ +import { AgentPool, ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createAgentPoolWithKubeletConfigAndLinuxOSConfig() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const agentPoolName = "agentpool1"; + const parameters: AgentPool = { + count: 3, + kubeletConfig: { + allowedUnsafeSysctls: ["kernel.msg*", "net.core.somaxconn"], + cpuCfsQuota: true, + cpuCfsQuotaPeriod: "200ms", + cpuManagerPolicy: "static", + failSwapOn: false, + imageGcHighThreshold: 90, + imageGcLowThreshold: 70, + topologyManagerPolicy: "best-effort" + }, + linuxOSConfig: { + swapFileSizeMB: 1500, + sysctls: { + kernelThreadsMax: 99999, + netCoreWmemDefault: 12345, + netIpv4IpLocalPortRange: "20000 60000", + netIpv4TcpTwReuse: true + }, + transparentHugePageDefrag: "madvise", + transparentHugePageEnabled: "always" + }, + orchestratorVersion: "", + osType: "Linux", + vmSize: "Standard_DS2_v2" + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + agentPoolName, + parameters + ); + console.log(result); +} + +createAgentPoolWithKubeletConfigAndLinuxOSConfig().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/createAgentPoolWithOssku.ts b/sdk/containerservice/arm-containerservice/samples-dev/createAgentPoolWithOssku.ts new file mode 100644 index 000000000000..f51c123aa8de --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/createAgentPoolWithOssku.ts @@ -0,0 +1,64 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster. + * + * @summary Creates or updates an agent pool in the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_OSSKU.json + */ +import { AgentPool, ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createAgentPoolWithOssku() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const agentPoolName = "agentpool1"; + const parameters: AgentPool = { + count: 3, + kubeletConfig: { + allowedUnsafeSysctls: ["kernel.msg*", "net.core.somaxconn"], + cpuCfsQuota: true, + cpuCfsQuotaPeriod: "200ms", + cpuManagerPolicy: "static", + failSwapOn: false, + imageGcHighThreshold: 90, + imageGcLowThreshold: 70, + topologyManagerPolicy: "best-effort" + }, + linuxOSConfig: { + swapFileSizeMB: 1500, + sysctls: { + kernelThreadsMax: 99999, + netCoreWmemDefault: 12345, + netIpv4IpLocalPortRange: "20000 60000", + netIpv4TcpTwReuse: true + }, + transparentHugePageDefrag: "madvise", + transparentHugePageEnabled: "always" + }, + orchestratorVersion: "", + osSKU: "CBLMariner", + osType: "Linux", + vmSize: "Standard_DS2_v2" + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + agentPoolName, + parameters + ); + console.log(result); +} + +createAgentPoolWithOssku().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/createAgentPoolWithPpg.ts b/sdk/containerservice/arm-containerservice/samples-dev/createAgentPoolWithPpg.ts new file mode 100644 index 000000000000..1267606f3a53 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/createAgentPoolWithPpg.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster. + * + * @summary Creates or updates an agent pool in the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_PPG.json + */ +import { AgentPool, ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createAgentPoolWithPpg() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const agentPoolName = "agentpool1"; + const parameters: AgentPool = { + count: 3, + orchestratorVersion: "", + osType: "Linux", + proximityPlacementGroupID: + "/subscriptions/subid1/resourcegroups/rg1/providers//Microsoft.Compute/proximityPlacementGroups/ppg1", + vmSize: "Standard_DS2_v2" + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + agentPoolName, + parameters + ); + console.log(result); +} + +createAgentPoolWithPpg().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/createAgentPoolWithUltraSsdEnabled.ts b/sdk/containerservice/arm-containerservice/samples-dev/createAgentPoolWithUltraSsdEnabled.ts new file mode 100644 index 000000000000..0e0fb907fc64 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/createAgentPoolWithUltraSsdEnabled.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. +/** + * This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster. + * + * @summary Creates or updates an agent pool in the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_EnableUltraSSD.json + */ +import { AgentPool, ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createAgentPoolWithUltraSsdEnabled() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const agentPoolName = "agentpool1"; + const parameters: AgentPool = { + count: 3, + enableUltraSSD: true, + orchestratorVersion: "", + osType: "Linux", + vmSize: "Standard_DS2_v2" + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + agentPoolName, + parameters + ); + console.log(result); +} + +createAgentPoolWithUltraSsdEnabled().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/createManagedClusterUsingAnAgentPoolSnapshot.ts b/sdk/containerservice/arm-containerservice/samples-dev/createManagedClusterUsingAnAgentPoolSnapshot.ts new file mode 100644 index 000000000000..5ba30e202d27 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/createManagedClusterUsingAnAgentPoolSnapshot.ts @@ -0,0 +1,80 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_Snapshot.json + */ +import { + ManagedCluster, + ContainerServiceClient +} from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createManagedClusterUsingAnAgentPoolSnapshot() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters: ManagedCluster = { + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + count: 3, + creationData: { + sourceResourceId: + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.ContainerService/snapshots/snapshot1" + }, + enableFips: true, + enableNodePublicIP: true, + mode: "System", + osType: "Linux", + vmSize: "Standard_DS2_v2" + } + ], + autoScalerProfile: { scaleDownDelayAfterAdd: "15m", scanInterval: "20s" }, + diskEncryptionSetID: + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des", + dnsPrefix: "dnsprefix1", + enablePodSecurityPolicy: false, + enableRbac: true, + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] } + }, + location: "location1", + networkProfile: { + loadBalancerProfile: { managedOutboundIPs: { count: 2 } }, + loadBalancerSku: "standard", + outboundType: "loadBalancer" + }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser" + } + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createManagedClusterUsingAnAgentPoolSnapshot().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/createManagedClusterWithAksManagedNatGatewayAsOutboundType.ts b/sdk/containerservice/arm-containerservice/samples-dev/createManagedClusterWithAksManagedNatGatewayAsOutboundType.ts new file mode 100644 index 000000000000..181970a8528a --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/createManagedClusterWithAksManagedNatGatewayAsOutboundType.ts @@ -0,0 +1,77 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_ManagedNATGateway.json + */ +import { + ManagedCluster, + ContainerServiceClient +} from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createManagedClusterWithAksManagedNatGatewayAsOutboundType() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters: ManagedCluster = { + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + count: 3, + enableNodePublicIP: false, + mode: "System", + osType: "Linux", + vmSize: "Standard_DS2_v2" + } + ], + autoScalerProfile: { scaleDownDelayAfterAdd: "15m", scanInterval: "20s" }, + diskEncryptionSetID: + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des", + dnsPrefix: "dnsprefix1", + enablePodSecurityPolicy: true, + enableRbac: true, + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] } + }, + location: "location1", + networkProfile: { + loadBalancerSku: "standard", + natGatewayProfile: { managedOutboundIPProfile: { count: 2 } }, + outboundType: "managedNATGateway" + }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser" + } + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createManagedClusterWithAksManagedNatGatewayAsOutboundType().catch( + console.error +); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/createManagedClusterWithEncryptionAtHostEnabled.ts b/sdk/containerservice/arm-containerservice/samples-dev/createManagedClusterWithEncryptionAtHostEnabled.ts new file mode 100644 index 000000000000..e505c2f2f7e7 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/createManagedClusterWithEncryptionAtHostEnabled.ts @@ -0,0 +1,76 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_EnableEncryptionAtHost.json + */ +import { + ManagedCluster, + ContainerServiceClient +} from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createManagedClusterWithEncryptionAtHostEnabled() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters: ManagedCluster = { + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + count: 3, + enableEncryptionAtHost: true, + enableNodePublicIP: true, + mode: "System", + osType: "Linux", + vmSize: "Standard_DS2_v2" + } + ], + autoScalerProfile: { scaleDownDelayAfterAdd: "15m", scanInterval: "20s" }, + diskEncryptionSetID: + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des", + dnsPrefix: "dnsprefix1", + enablePodSecurityPolicy: true, + enableRbac: true, + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] } + }, + location: "location1", + networkProfile: { + loadBalancerProfile: { managedOutboundIPs: { count: 2 } }, + loadBalancerSku: "standard", + outboundType: "loadBalancer" + }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser" + } + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createManagedClusterWithEncryptionAtHostEnabled().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/createManagedClusterWithFipsEnabledOS.ts b/sdk/containerservice/arm-containerservice/samples-dev/createManagedClusterWithFipsEnabledOS.ts new file mode 100644 index 000000000000..5617fca5d656 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/createManagedClusterWithFipsEnabledOS.ts @@ -0,0 +1,76 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_EnabledFIPS.json + */ +import { + ManagedCluster, + ContainerServiceClient +} from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createManagedClusterWithFipsEnabledOS() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters: ManagedCluster = { + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + count: 3, + enableFips: true, + enableNodePublicIP: true, + mode: "System", + osType: "Linux", + vmSize: "Standard_DS2_v2" + } + ], + autoScalerProfile: { scaleDownDelayAfterAdd: "15m", scanInterval: "20s" }, + diskEncryptionSetID: + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des", + dnsPrefix: "dnsprefix1", + enablePodSecurityPolicy: false, + enableRbac: true, + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] } + }, + location: "location1", + networkProfile: { + loadBalancerProfile: { managedOutboundIPs: { count: 2 } }, + loadBalancerSku: "standard", + outboundType: "loadBalancer" + }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser" + } + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createManagedClusterWithFipsEnabledOS().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/createManagedClusterWithGpumig.ts b/sdk/containerservice/arm-containerservice/samples-dev/createManagedClusterWithGpumig.ts new file mode 100644 index 000000000000..6f3a230b00f8 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/createManagedClusterWithGpumig.ts @@ -0,0 +1,82 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_GPUMIG.json + */ +import { + ManagedCluster, + ContainerServiceClient +} from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createManagedClusterWithGpumig() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters: ManagedCluster = { + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + count: 3, + enableNodePublicIP: true, + gpuInstanceProfile: "MIG3g", + mode: "System", + osType: "Linux", + vmSize: "Standard_ND96asr_v4" + } + ], + autoScalerProfile: { scaleDownDelayAfterAdd: "15m", scanInterval: "20s" }, + diskEncryptionSetID: + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des", + dnsPrefix: "dnsprefix1", + enablePodSecurityPolicy: true, + enableRbac: true, + httpProxyConfig: { + httpProxy: "http://myproxy.server.com:8080", + httpsProxy: "https://myproxy.server.com:8080", + noProxy: ["localhost", "127.0.0.1"], + trustedCa: "Q29uZ3JhdHMhIFlvdSBoYXZlIGZvdW5kIGEgaGlkZGVuIG1lc3NhZ2U=" + }, + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] } + }, + location: "location1", + networkProfile: { + loadBalancerProfile: { managedOutboundIPs: { count: 2 } }, + loadBalancerSku: "standard", + outboundType: "loadBalancer" + }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser" + } + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createManagedClusterWithGpumig().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/createManagedClusterWithHttpProxyConfigured.ts b/sdk/containerservice/arm-containerservice/samples-dev/createManagedClusterWithHttpProxyConfigured.ts new file mode 100644 index 000000000000..4e17d164b0bb --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/createManagedClusterWithHttpProxyConfigured.ts @@ -0,0 +1,81 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_HTTPProxy.json + */ +import { + ManagedCluster, + ContainerServiceClient +} from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createManagedClusterWithHttpProxyConfigured() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters: ManagedCluster = { + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + count: 3, + enableNodePublicIP: true, + mode: "System", + osType: "Linux", + vmSize: "Standard_DS2_v2" + } + ], + autoScalerProfile: { scaleDownDelayAfterAdd: "15m", scanInterval: "20s" }, + diskEncryptionSetID: + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des", + dnsPrefix: "dnsprefix1", + enablePodSecurityPolicy: true, + enableRbac: true, + httpProxyConfig: { + httpProxy: "http://myproxy.server.com:8080", + httpsProxy: "https://myproxy.server.com:8080", + noProxy: ["localhost", "127.0.0.1"], + trustedCa: "Q29uZ3JhdHMhIFlvdSBoYXZlIGZvdW5kIGEgaGlkZGVuIG1lc3NhZ2U=" + }, + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] } + }, + location: "location1", + networkProfile: { + loadBalancerProfile: { managedOutboundIPs: { count: 2 } }, + loadBalancerSku: "standard", + outboundType: "loadBalancer" + }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser" + } + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createManagedClusterWithHttpProxyConfigured().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/createManagedClusterWithNodePublicIPPrefix.ts b/sdk/containerservice/arm-containerservice/samples-dev/createManagedClusterWithNodePublicIPPrefix.ts new file mode 100644 index 000000000000..46634263760a --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/createManagedClusterWithNodePublicIPPrefix.ts @@ -0,0 +1,77 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_NodePublicIPPrefix.json + */ +import { + ManagedCluster, + ContainerServiceClient +} from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createManagedClusterWithNodePublicIPPrefix() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters: ManagedCluster = { + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + count: 3, + enableNodePublicIP: true, + mode: "System", + nodePublicIPPrefixID: + "/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.Network/publicIPPrefixes/public-ip-prefix", + osType: "Linux", + vmSize: "Standard_DS2_v2" + } + ], + autoScalerProfile: { scaleDownDelayAfterAdd: "15m", scanInterval: "20s" }, + diskEncryptionSetID: + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des", + dnsPrefix: "dnsprefix1", + enablePodSecurityPolicy: true, + enableRbac: true, + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] } + }, + location: "location1", + networkProfile: { + loadBalancerProfile: { managedOutboundIPs: { count: 2 } }, + loadBalancerSku: "standard", + outboundType: "loadBalancer" + }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser" + } + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createManagedClusterWithNodePublicIPPrefix().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/createManagedClusterWithOssku.ts b/sdk/containerservice/arm-containerservice/samples-dev/createManagedClusterWithOssku.ts new file mode 100644 index 000000000000..b21e4283e40e --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/createManagedClusterWithOssku.ts @@ -0,0 +1,82 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_OSSKU.json + */ +import { + ManagedCluster, + ContainerServiceClient +} from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createManagedClusterWithOssku() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters: ManagedCluster = { + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + count: 3, + enableNodePublicIP: true, + mode: "System", + osSKU: "CBLMariner", + osType: "Linux", + vmSize: "Standard_DS2_v2" + } + ], + autoScalerProfile: { scaleDownDelayAfterAdd: "15m", scanInterval: "20s" }, + diskEncryptionSetID: + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des", + dnsPrefix: "dnsprefix1", + enablePodSecurityPolicy: true, + enableRbac: true, + httpProxyConfig: { + httpProxy: "http://myproxy.server.com:8080", + httpsProxy: "https://myproxy.server.com:8080", + noProxy: ["localhost", "127.0.0.1"], + trustedCa: "Q29uZ3JhdHMhIFlvdSBoYXZlIGZvdW5kIGEgaGlkZGVuIG1lc3NhZ2U=" + }, + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] } + }, + location: "location1", + networkProfile: { + loadBalancerProfile: { managedOutboundIPs: { count: 2 } }, + loadBalancerSku: "standard", + outboundType: "loadBalancer" + }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser" + } + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createManagedClusterWithOssku().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/createManagedClusterWithPodIdentityEnabled.ts b/sdk/containerservice/arm-containerservice/samples-dev/createManagedClusterWithPodIdentityEnabled.ts new file mode 100644 index 000000000000..baa04d31a2bf --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/createManagedClusterWithPodIdentityEnabled.ts @@ -0,0 +1,76 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_PodIdentity.json + */ +import { + ManagedCluster, + ContainerServiceClient +} from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createManagedClusterWithPodIdentityEnabled() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters: ManagedCluster = { + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + count: 3, + enableNodePublicIP: true, + mode: "System", + osType: "Linux", + vmSize: "Standard_DS2_v2" + } + ], + autoScalerProfile: { scaleDownDelayAfterAdd: "15m", scanInterval: "20s" }, + diskEncryptionSetID: + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des", + dnsPrefix: "dnsprefix1", + enablePodSecurityPolicy: true, + enableRbac: true, + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] } + }, + location: "location1", + networkProfile: { + loadBalancerProfile: { managedOutboundIPs: { count: 2 } }, + loadBalancerSku: "standard", + outboundType: "loadBalancer" + }, + podIdentityProfile: { allowNetworkPluginKubenet: true, enabled: true }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser" + } + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createManagedClusterWithPodIdentityEnabled().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/createManagedClusterWithPpg.ts b/sdk/containerservice/arm-containerservice/samples-dev/createManagedClusterWithPpg.ts new file mode 100644 index 000000000000..af05f09ca833 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/createManagedClusterWithPpg.ts @@ -0,0 +1,77 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_PPG.json + */ +import { + ManagedCluster, + ContainerServiceClient +} from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createManagedClusterWithPpg() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters: ManagedCluster = { + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + count: 3, + enableNodePublicIP: true, + mode: "System", + osType: "Linux", + proximityPlacementGroupID: + "/subscriptions/subid1/resourcegroups/rg1/providers//Microsoft.Compute/proximityPlacementGroups/ppg1", + vmSize: "Standard_DS2_v2" + } + ], + autoScalerProfile: { scaleDownDelayAfterAdd: "15m", scanInterval: "20s" }, + diskEncryptionSetID: + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des", + dnsPrefix: "dnsprefix1", + enablePodSecurityPolicy: true, + enableRbac: true, + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] } + }, + location: "location1", + networkProfile: { + loadBalancerProfile: { managedOutboundIPs: { count: 2 } }, + loadBalancerSku: "standard", + outboundType: "loadBalancer" + }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser" + } + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createManagedClusterWithPpg().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/createManagedClusterWithRunCommandDisabled.ts b/sdk/containerservice/arm-containerservice/samples-dev/createManagedClusterWithRunCommandDisabled.ts new file mode 100644 index 000000000000..9fb35f651f81 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/createManagedClusterWithRunCommandDisabled.ts @@ -0,0 +1,75 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_DisableRunCommand.json + */ +import { + ManagedCluster, + ContainerServiceClient +} from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createManagedClusterWithRunCommandDisabled() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters: ManagedCluster = { + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + count: 3, + enableEncryptionAtHost: true, + enableNodePublicIP: true, + mode: "System", + osType: "Linux", + vmSize: "Standard_DS2_v2" + } + ], + apiServerAccessProfile: { disableRunCommand: true }, + autoScalerProfile: { scaleDownDelayAfterAdd: "15m", scanInterval: "20s" }, + dnsPrefix: "dnsprefix1", + enablePodSecurityPolicy: true, + enableRbac: true, + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] } + }, + location: "location1", + networkProfile: { + loadBalancerProfile: { managedOutboundIPs: { count: 2 } }, + loadBalancerSku: "standard", + outboundType: "loadBalancer" + }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser" + } + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createManagedClusterWithRunCommandDisabled().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/createManagedClusterWithSecurityProfileConfigured.ts b/sdk/containerservice/arm-containerservice/samples-dev/createManagedClusterWithSecurityProfileConfigured.ts new file mode 100644 index 000000000000..da11d929dade --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/createManagedClusterWithSecurityProfileConfigured.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. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_SecurityProfile.json + */ +import { + ManagedCluster, + ContainerServiceClient +} from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createManagedClusterWithSecurityProfileConfigured() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters: ManagedCluster = { + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + count: 3, + enableNodePublicIP: true, + mode: "System", + osType: "Linux", + vmSize: "Standard_DS2_v2" + } + ], + dnsPrefix: "dnsprefix1", + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] } + }, + location: "location1", + networkProfile: { + loadBalancerProfile: { managedOutboundIPs: { count: 2 } }, + loadBalancerSku: "standard", + outboundType: "loadBalancer" + }, + securityProfile: { + azureDefender: { + enabled: true, + logAnalyticsWorkspaceResourceId: + "/subscriptions/SUB_ID/resourcegroups/RG_NAME/providers/microsoft.operationalinsights/workspaces/WORKSPACE_NAME" + } + }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" } + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createManagedClusterWithSecurityProfileConfigured().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/createManagedClusterWithUltraSsdEnabled.ts b/sdk/containerservice/arm-containerservice/samples-dev/createManagedClusterWithUltraSsdEnabled.ts new file mode 100644 index 000000000000..e5fb7f045345 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/createManagedClusterWithUltraSsdEnabled.ts @@ -0,0 +1,76 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_EnableUltraSSD.json + */ +import { + ManagedCluster, + ContainerServiceClient +} from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createManagedClusterWithUltraSsdEnabled() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters: ManagedCluster = { + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + count: 3, + enableNodePublicIP: true, + enableUltraSSD: true, + mode: "System", + osType: "Linux", + vmSize: "Standard_DS2_v2" + } + ], + autoScalerProfile: { scaleDownDelayAfterAdd: "15m", scanInterval: "20s" }, + diskEncryptionSetID: + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des", + dnsPrefix: "dnsprefix1", + enablePodSecurityPolicy: true, + enableRbac: true, + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] } + }, + location: "location1", + networkProfile: { + loadBalancerProfile: { managedOutboundIPs: { count: 2 } }, + loadBalancerSku: "standard", + outboundType: "loadBalancer" + }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser" + } + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createManagedClusterWithUltraSsdEnabled().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/createManagedClusterWithUserAssignedNatGatewayAsOutboundType.ts b/sdk/containerservice/arm-containerservice/samples-dev/createManagedClusterWithUserAssignedNatGatewayAsOutboundType.ts new file mode 100644 index 000000000000..646696e3e0f2 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/createManagedClusterWithUserAssignedNatGatewayAsOutboundType.ts @@ -0,0 +1,76 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_UserAssignedNATGateway.json + */ +import { + ManagedCluster, + ContainerServiceClient +} from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createManagedClusterWithUserAssignedNatGatewayAsOutboundType() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters: ManagedCluster = { + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + count: 3, + enableNodePublicIP: false, + mode: "System", + osType: "Linux", + vmSize: "Standard_DS2_v2" + } + ], + autoScalerProfile: { scaleDownDelayAfterAdd: "15m", scanInterval: "20s" }, + diskEncryptionSetID: + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des", + dnsPrefix: "dnsprefix1", + enablePodSecurityPolicy: true, + enableRbac: true, + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] } + }, + location: "location1", + networkProfile: { + loadBalancerSku: "standard", + outboundType: "userAssignedNATGateway" + }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser" + } + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createManagedClusterWithUserAssignedNatGatewayAsOutboundType().catch( + console.error +); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/createManagedPrivateClusterWithFqdnSubdomainSpecified.ts b/sdk/containerservice/arm-containerservice/samples-dev/createManagedPrivateClusterWithFqdnSubdomainSpecified.ts new file mode 100644 index 000000000000..75e255b95aa5 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/createManagedPrivateClusterWithFqdnSubdomainSpecified.ts @@ -0,0 +1,79 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_PrivateClusterFQDNSubdomain.json + */ +import { + ManagedCluster, + ContainerServiceClient +} from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createManagedPrivateClusterWithFqdnSubdomainSpecified() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters: ManagedCluster = { + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + count: 3, + enableEncryptionAtHost: true, + enableNodePublicIP: true, + mode: "System", + osType: "Linux", + vmSize: "Standard_DS2_v2" + } + ], + apiServerAccessProfile: { + enablePrivateCluster: true, + privateDNSZone: + "/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.Network/privateDnsZones/privatelink.location1.azmk8s.io" + }, + autoScalerProfile: { scaleDownDelayAfterAdd: "15m", scanInterval: "20s" }, + enablePodSecurityPolicy: true, + enableRbac: true, + fqdnSubdomain: "domain1", + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] } + }, + location: "location1", + networkProfile: { + loadBalancerProfile: { managedOutboundIPs: { count: 2 } }, + loadBalancerSku: "standard", + outboundType: "loadBalancer" + }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser" + } + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createManagedPrivateClusterWithFqdnSubdomainSpecified().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/createManagedPrivateClusterWithPublicFqdnSpecified.ts b/sdk/containerservice/arm-containerservice/samples-dev/createManagedPrivateClusterWithPublicFqdnSpecified.ts new file mode 100644 index 000000000000..3e5da0c46707 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/createManagedPrivateClusterWithPublicFqdnSpecified.ts @@ -0,0 +1,78 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_PrivateClusterPublicFQDN.json + */ +import { + ManagedCluster, + ContainerServiceClient +} from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createManagedPrivateClusterWithPublicFqdnSpecified() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters: ManagedCluster = { + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + count: 3, + enableEncryptionAtHost: true, + enableNodePublicIP: true, + mode: "System", + osType: "Linux", + vmSize: "Standard_DS2_v2" + } + ], + apiServerAccessProfile: { + enablePrivateCluster: true, + enablePrivateClusterPublicFqdn: true + }, + autoScalerProfile: { scaleDownDelayAfterAdd: "15m", scanInterval: "20s" }, + dnsPrefix: "dnsprefix1", + enablePodSecurityPolicy: true, + enableRbac: true, + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] } + }, + location: "location1", + networkProfile: { + loadBalancerProfile: { managedOutboundIPs: { count: 2 } }, + loadBalancerSku: "standard", + outboundType: "loadBalancer" + }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser" + } + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createManagedPrivateClusterWithPublicFqdnSpecified().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/createOrUpdateAadManagedClusterWithEnableAzureRbac.ts b/sdk/containerservice/arm-containerservice/samples-dev/createOrUpdateAadManagedClusterWithEnableAzureRbac.ts new file mode 100644 index 000000000000..63110d7ea12f --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/createOrUpdateAadManagedClusterWithEnableAzureRbac.ts @@ -0,0 +1,77 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_UpdateWithEnableAzureRBAC.json + */ +import { + ManagedCluster, + ContainerServiceClient +} from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createOrUpdateAadManagedClusterWithEnableAzureRbac() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters: ManagedCluster = { + aadProfile: { enableAzureRbac: true, managed: true }, + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + availabilityZones: ["1", "2", "3"], + count: 3, + enableNodePublicIP: true, + mode: "System", + osType: "Linux", + vmSize: "Standard_DS1_v2" + } + ], + autoScalerProfile: { scaleDownDelayAfterAdd: "15m", scanInterval: "20s" }, + diskEncryptionSetID: + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des", + dnsPrefix: "dnsprefix1", + enablePodSecurityPolicy: true, + enableRbac: true, + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] } + }, + location: "location1", + networkProfile: { + loadBalancerProfile: { managedOutboundIPs: { count: 2 } }, + loadBalancerSku: "standard", + outboundType: "loadBalancer" + }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser" + } + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createOrUpdateAadManagedClusterWithEnableAzureRbac().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/createOrUpdateAgentPool.ts b/sdk/containerservice/arm-containerservice/samples-dev/createOrUpdateAgentPool.ts new file mode 100644 index 000000000000..349b36b7e42e --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/createOrUpdateAgentPool.ts @@ -0,0 +1,48 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster. + * + * @summary Creates or updates an agent pool in the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_Update.json + */ +import { AgentPool, ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createOrUpdateAgentPool() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const agentPoolName = "agentpool1"; + const parameters: AgentPool = { + count: 3, + mode: "User", + nodeLabels: { key1: "val1" }, + nodeTaints: ["Key1=Value1:NoSchedule"], + orchestratorVersion: "", + osType: "Linux", + scaleSetEvictionPolicy: "Delete", + scaleSetPriority: "Spot", + tags: { name1: "val1" }, + vmSize: "Standard_DS1_v2" + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + agentPoolName, + parameters + ); + console.log(result); +} + +createOrUpdateAgentPool().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/createOrUpdateMaintenanceConfiguration.ts b/sdk/containerservice/arm-containerservice/samples-dev/createOrUpdateMaintenanceConfiguration.ts new file mode 100644 index 000000000000..771591bddf3e --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/createOrUpdateMaintenanceConfiguration.ts @@ -0,0 +1,48 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a maintenance configuration in the specified managed cluster. + * + * @summary Creates or updates a maintenance configuration in the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/MaintenanceConfigurationsCreate_Update.json + */ +import { + MaintenanceConfiguration, + ContainerServiceClient +} from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createOrUpdateMaintenanceConfiguration() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const configName = "default"; + const parameters: MaintenanceConfiguration = { + notAllowedTime: [ + { + end: new Date("2020-11-30T12:00:00Z"), + start: new Date("2020-11-26T03:00:00Z") + } + ], + timeInWeek: [{ day: "Monday", hourSlots: [1, 2] }] + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.maintenanceConfigurations.createOrUpdate( + resourceGroupName, + resourceName, + configName, + parameters + ); + console.log(result); +} + +createOrUpdateMaintenanceConfiguration().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/createOrUpdateManagedCluster.ts b/sdk/containerservice/arm-containerservice/samples-dev/createOrUpdateManagedCluster.ts new file mode 100644 index 000000000000..da3f2aa83499 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/createOrUpdateManagedCluster.ts @@ -0,0 +1,91 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_Update.json + */ +import { + ManagedCluster, + ContainerServiceClient +} from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createOrUpdateManagedCluster() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters: ManagedCluster = { + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + availabilityZones: ["1", "2", "3"], + count: 3, + enableNodePublicIP: true, + mode: "System", + osType: "Linux", + scaleDownMode: "Deallocate", + vmSize: "Standard_DS1_v2" + } + ], + autoScalerProfile: { + balanceSimilarNodeGroups: "true", + expander: "priority", + maxNodeProvisionTime: "15m", + newPodScaleUpDelay: "1m", + scaleDownDelayAfterAdd: "15m", + scanInterval: "20s", + skipNodesWithSystemPods: "false" + }, + diskEncryptionSetID: + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des", + dnsPrefix: "dnsprefix1", + enablePodSecurityPolicy: true, + enableRbac: true, + identity: { + type: "UserAssigned", + userAssignedIdentities: { + "/subscriptions/subid1/resourceGroups/rgName1/providers/MicrosoftManagedIdentity/userAssignedIdentities/identity1": {} + } + }, + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] } + }, + location: "location1", + networkProfile: { + loadBalancerProfile: { managedOutboundIPs: { count: 2 } }, + loadBalancerSku: "standard", + outboundType: "loadBalancer" + }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser" + } + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createOrUpdateManagedCluster().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/createOrUpdateManagedClusterWithDualStackNetworking.ts b/sdk/containerservice/arm-containerservice/samples-dev/createOrUpdateManagedClusterWithDualStackNetworking.ts new file mode 100644 index 000000000000..299da4d06149 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/createOrUpdateManagedClusterWithDualStackNetworking.ts @@ -0,0 +1,92 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_DualStackNetworking.json + */ +import { + ManagedCluster, + ContainerServiceClient +} from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createOrUpdateManagedClusterWithDualStackNetworking() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters: ManagedCluster = { + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + availabilityZones: ["1", "2", "3"], + count: 3, + enableNodePublicIP: true, + mode: "System", + osType: "Linux", + scaleDownMode: "Deallocate", + vmSize: "Standard_DS1_v2" + } + ], + autoScalerProfile: { + balanceSimilarNodeGroups: "true", + expander: "priority", + maxNodeProvisionTime: "15m", + newPodScaleUpDelay: "1m", + scaleDownDelayAfterAdd: "15m", + scanInterval: "20s", + skipNodesWithSystemPods: "false" + }, + diskEncryptionSetID: + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des", + dnsPrefix: "dnsprefix1", + enablePodSecurityPolicy: true, + enableRbac: true, + identity: { + type: "UserAssigned", + userAssignedIdentities: { + "/subscriptions/subid1/resourceGroups/rgName1/providers/MicrosoftManagedIdentity/userAssignedIdentities/identity1": {} + } + }, + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] } + }, + location: "location1", + networkProfile: { + ipFamilies: ["IPv4", "IPv6"], + loadBalancerProfile: { managedOutboundIPs: { count: 2 } }, + loadBalancerSku: "standard", + outboundType: "loadBalancer" + }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser" + } + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createOrUpdateManagedClusterWithDualStackNetworking().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/createOrUpdateManagedClusterWithEnableAhub.ts b/sdk/containerservice/arm-containerservice/samples-dev/createOrUpdateManagedClusterWithEnableAhub.ts new file mode 100644 index 000000000000..1acc1632c1a1 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/createOrUpdateManagedClusterWithEnableAhub.ts @@ -0,0 +1,83 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_UpdateWithAHUB.json + */ +import { + ManagedCluster, + ContainerServiceClient +} from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createOrUpdateManagedClusterWithEnableAhub() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters: ManagedCluster = { + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + availabilityZones: ["1", "2", "3"], + count: 3, + enableNodePublicIP: true, + mode: "System", + osType: "Linux", + vmSize: "Standard_DS1_v2" + } + ], + autoScalerProfile: { scaleDownDelayAfterAdd: "15m", scanInterval: "20s" }, + diskEncryptionSetID: + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des", + dnsPrefix: "dnsprefix1", + enablePodSecurityPolicy: true, + enableRbac: true, + identity: { + type: "UserAssigned", + userAssignedIdentities: { + "/subscriptions/subid1/resourceGroups/rgName1/providers/MicrosoftManagedIdentity/userAssignedIdentities/identity1": {} + } + }, + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] } + }, + location: "location1", + networkProfile: { + loadBalancerProfile: { managedOutboundIPs: { count: 2 } }, + loadBalancerSku: "standard", + outboundType: "loadBalancer" + }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser", + licenseType: "Windows_Server" + } + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createOrUpdateManagedClusterWithEnableAhub().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/createOrUpdateManagedClusterWithWindowsGMsaEnabled.ts b/sdk/containerservice/arm-containerservice/samples-dev/createOrUpdateManagedClusterWithWindowsGMsaEnabled.ts new file mode 100644 index 000000000000..5ee8718cdaa0 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/createOrUpdateManagedClusterWithWindowsGMsaEnabled.ts @@ -0,0 +1,83 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_UpdateWindowsGmsa.json + */ +import { + ManagedCluster, + ContainerServiceClient +} from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createOrUpdateManagedClusterWithWindowsGMsaEnabled() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters: ManagedCluster = { + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + availabilityZones: ["1", "2", "3"], + count: 3, + enableNodePublicIP: true, + mode: "System", + osType: "Linux", + vmSize: "Standard_DS1_v2" + } + ], + autoScalerProfile: { scaleDownDelayAfterAdd: "15m", scanInterval: "20s" }, + diskEncryptionSetID: + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des", + dnsPrefix: "dnsprefix1", + enablePodSecurityPolicy: true, + enableRbac: true, + identity: { + type: "UserAssigned", + userAssignedIdentities: { + "/subscriptions/subid1/resourceGroups/rgName1/providers/MicrosoftManagedIdentity/userAssignedIdentities/identity1": {} + } + }, + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] } + }, + location: "location1", + networkProfile: { + loadBalancerProfile: { managedOutboundIPs: { count: 2 } }, + loadBalancerSku: "standard", + outboundType: "loadBalancer" + }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser", + gmsaProfile: { enabled: true } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createOrUpdateManagedClusterWithWindowsGMsaEnabled().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/createOrUpdateSnapshot.ts b/sdk/containerservice/arm-containerservice/samples-dev/createOrUpdateSnapshot.ts new file mode 100644 index 000000000000..0d67d5eb4bf5 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/createOrUpdateSnapshot.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. +/** + * This sample demonstrates how to Creates or updates a snapshot. + * + * @summary Creates or updates a snapshot. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/SnapshotsCreate.json + */ +import { Snapshot, ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createOrUpdateSnapshot() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "snapshot1"; + const parameters: Snapshot = { + creationData: { + sourceResourceId: + "/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/cluster1/agentPools/pool0" + }, + location: "westus", + tags: { key1: "val1", key2: "val2" } + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.snapshots.createOrUpdate( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createOrUpdateSnapshot().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/createSpotAgentPool.ts b/sdk/containerservice/arm-containerservice/samples-dev/createSpotAgentPool.ts new file mode 100644 index 000000000000..189774c3f7d9 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/createSpotAgentPool.ts @@ -0,0 +1,47 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster. + * + * @summary Creates or updates an agent pool in the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_Spot.json + */ +import { AgentPool, ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createSpotAgentPool() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const agentPoolName = "agentpool1"; + const parameters: AgentPool = { + count: 3, + nodeLabels: { key1: "val1" }, + nodeTaints: ["Key1=Value1:NoSchedule"], + orchestratorVersion: "", + osType: "Linux", + scaleSetEvictionPolicy: "Delete", + scaleSetPriority: "Spot", + tags: { name1: "val1" }, + vmSize: "Standard_DS1_v2" + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + agentPoolName, + parameters + ); + console.log(result); +} + +createSpotAgentPool().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/deleteAgentPool.ts b/sdk/containerservice/arm-containerservice/samples-dev/deleteAgentPool.ts new file mode 100644 index 000000000000..245416a8635e --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/deleteAgentPool.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. +/** + * This sample demonstrates how to Deletes an agent pool in the specified managed cluster. + * + * @summary Deletes an agent pool in the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsDelete.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function deleteAgentPool() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const agentPoolName = "agentpool1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.beginDeleteAndWait( + resourceGroupName, + resourceName, + agentPoolName + ); + console.log(result); +} + +deleteAgentPool().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/deleteMaintenanceConfiguration.ts b/sdk/containerservice/arm-containerservice/samples-dev/deleteMaintenanceConfiguration.ts new file mode 100644 index 000000000000..a06d13b5bc53 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/deleteMaintenanceConfiguration.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. +/** + * This sample demonstrates how to Deletes a maintenance configuration. + * + * @summary Deletes a maintenance configuration. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/MaintenanceConfigurationsDelete.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function deleteMaintenanceConfiguration() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const configName = "default"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.maintenanceConfigurations.delete( + resourceGroupName, + resourceName, + configName + ); + console.log(result); +} + +deleteMaintenanceConfiguration().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/deleteManagedCluster.ts b/sdk/containerservice/arm-containerservice/samples-dev/deleteManagedCluster.ts new file mode 100644 index 000000000000..0f9bb5c77ea6 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/deleteManagedCluster.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. +/** + * This sample demonstrates how to Deletes a managed cluster. + * + * @summary Deletes a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersDelete.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function deleteManagedCluster() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginDeleteAndWait( + resourceGroupName, + resourceName + ); + console.log(result); +} + +deleteManagedCluster().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/deletePrivateEndpointConnection.ts b/sdk/containerservice/arm-containerservice/samples-dev/deletePrivateEndpointConnection.ts new file mode 100644 index 000000000000..5b9e73a1a0fb --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/deletePrivateEndpointConnection.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. +/** + * This sample demonstrates how to Deletes a private endpoint connection. + * + * @summary Deletes a private endpoint connection. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/PrivateEndpointConnectionsDelete.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function deletePrivateEndpointConnection() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const privateEndpointConnectionName = "privateendpointconnection1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.beginDeleteAndWait( + resourceGroupName, + resourceName, + privateEndpointConnectionName + ); + console.log(result); +} + +deletePrivateEndpointConnection().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/deleteSnapshot.ts b/sdk/containerservice/arm-containerservice/samples-dev/deleteSnapshot.ts new file mode 100644 index 000000000000..61aa8776211d --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/deleteSnapshot.ts @@ -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. +/** + * This sample demonstrates how to Deletes a snapshot. + * + * @summary Deletes a snapshot. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/SnapshotsDelete.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function deleteSnapshot() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "snapshot1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.snapshots.delete(resourceGroupName, resourceName); + console.log(result); +} + +deleteSnapshot().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/getAgentPool.ts b/sdk/containerservice/arm-containerservice/samples-dev/getAgentPool.ts new file mode 100644 index 000000000000..8788993c44fb --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/getAgentPool.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. +/** + * This sample demonstrates how to Gets the specified managed cluster agent pool. + * + * @summary Gets the specified managed cluster agent pool. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsGet.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function getAgentPool() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const agentPoolName = "agentpool1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.get( + resourceGroupName, + resourceName, + agentPoolName + ); + console.log(result); +} + +getAgentPool().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/getAvailableVersionsForAgentPool.ts b/sdk/containerservice/arm-containerservice/samples-dev/getAvailableVersionsForAgentPool.ts new file mode 100644 index 000000000000..ad6514519638 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/getAvailableVersionsForAgentPool.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. +/** + * This sample demonstrates how to See [supported Kubernetes versions](https://docs.microsoft.com/azure/aks/supported-kubernetes-versions) for more details about the version lifecycle. + * + * @summary See [supported Kubernetes versions](https://docs.microsoft.com/azure/aks/supported-kubernetes-versions) for more details about the version lifecycle. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsGetAgentPoolAvailableVersions.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function getAvailableVersionsForAgentPool() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.getAvailableAgentPoolVersions( + resourceGroupName, + resourceName + ); + console.log(result); +} + +getAvailableVersionsForAgentPool().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/getContainerServiceOSOptions.ts b/sdk/containerservice/arm-containerservice/samples-dev/getContainerServiceOSOptions.ts new file mode 100644 index 000000000000..f42a58741c0a --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/getContainerServiceOSOptions.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. +/** + * This sample demonstrates how to Gets supported OS options in the specified subscription. + * + * @summary Gets supported OS options in the specified subscription. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ContainerServiceGetOSOptions.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function getContainerServiceOSOptions() { + const subscriptionId = "subid1"; + const location = "location1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.getOSOptions(location); + console.log(result); +} + +getContainerServiceOSOptions().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/getMaintenanceConfiguration.ts b/sdk/containerservice/arm-containerservice/samples-dev/getMaintenanceConfiguration.ts new file mode 100644 index 000000000000..bb4f4c8c3d80 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/getMaintenanceConfiguration.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. +/** + * This sample demonstrates how to Gets the specified maintenance configuration of a managed cluster. + * + * @summary Gets the specified maintenance configuration of a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/MaintenanceConfigurationsGet.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function getMaintenanceConfiguration() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const configName = "default"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.maintenanceConfigurations.get( + resourceGroupName, + resourceName, + configName + ); + console.log(result); +} + +getMaintenanceConfiguration().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/getManagedCluster.ts b/sdk/containerservice/arm-containerservice/samples-dev/getManagedCluster.ts new file mode 100644 index 000000000000..3836bfe3a4d3 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/getManagedCluster.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. +/** + * This sample demonstrates how to Gets a managed cluster. + * + * @summary Gets a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersGet.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function getManagedCluster() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.get( + resourceGroupName, + resourceName + ); + console.log(result); +} + +getManagedCluster().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/getManagedClustersByResourceGroup.ts b/sdk/containerservice/arm-containerservice/samples-dev/getManagedClustersByResourceGroup.ts new file mode 100644 index 000000000000..dec78a9f2d26 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/getManagedClustersByResourceGroup.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. +/** + * This sample demonstrates how to Lists managed clusters in the specified subscription and resource group. + * + * @summary Lists managed clusters in the specified subscription and resource group. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersListByResourceGroup.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function getManagedClustersByResourceGroup() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.managedClusters.listByResourceGroup( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +getManagedClustersByResourceGroup().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/getPrivateEndpointConnection.ts b/sdk/containerservice/arm-containerservice/samples-dev/getPrivateEndpointConnection.ts new file mode 100644 index 000000000000..f8ab7dd6c387 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/getPrivateEndpointConnection.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. +/** + * This sample demonstrates how to To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters + * + * @summary To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/PrivateEndpointConnectionsGet.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function getPrivateEndpointConnection() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const privateEndpointConnectionName = "privateendpointconnection1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.get( + resourceGroupName, + resourceName, + privateEndpointConnectionName + ); + console.log(result); +} + +getPrivateEndpointConnection().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/getSnapshot.ts b/sdk/containerservice/arm-containerservice/samples-dev/getSnapshot.ts new file mode 100644 index 000000000000..66dba8b551fa --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/getSnapshot.ts @@ -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. +/** + * This sample demonstrates how to Gets a snapshot. + * + * @summary Gets a snapshot. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/SnapshotsGet.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function getSnapshot() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "snapshot1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.snapshots.get(resourceGroupName, resourceName); + console.log(result); +} + +getSnapshot().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/getUpgradeProfileForAgentPool.ts b/sdk/containerservice/arm-containerservice/samples-dev/getUpgradeProfileForAgentPool.ts new file mode 100644 index 000000000000..b88f86b90221 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/getUpgradeProfileForAgentPool.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. +/** + * This sample demonstrates how to Gets the upgrade profile for an agent pool. + * + * @summary Gets the upgrade profile for an agent pool. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsGetUpgradeProfile.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function getUpgradeProfileForAgentPool() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const agentPoolName = "agentpool1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.getUpgradeProfile( + resourceGroupName, + resourceName, + agentPoolName + ); + console.log(result); +} + +getUpgradeProfileForAgentPool().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/getUpgradeProfileForManagedCluster.ts b/sdk/containerservice/arm-containerservice/samples-dev/getUpgradeProfileForManagedCluster.ts new file mode 100644 index 000000000000..1531bad68b0c --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/getUpgradeProfileForManagedCluster.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. +/** + * This sample demonstrates how to Gets the upgrade profile of a managed cluster. + * + * @summary Gets the upgrade profile of a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersGetUpgradeProfile.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function getUpgradeProfileForManagedCluster() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.getUpgradeProfile( + resourceGroupName, + resourceName + ); + console.log(result); +} + +getUpgradeProfileForManagedCluster().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/listAgentPoolsByManagedCluster.ts b/sdk/containerservice/arm-containerservice/samples-dev/listAgentPoolsByManagedCluster.ts new file mode 100644 index 000000000000..c169b98e728d --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/listAgentPoolsByManagedCluster.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. +/** + * This sample demonstrates how to Gets a list of agent pools in the specified managed cluster. + * + * @summary Gets a list of agent pools in the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsList.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function listAgentPoolsByManagedCluster() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.agentPools.list( + resourceGroupName, + resourceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +listAgentPoolsByManagedCluster().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/listAvailableOperationsForTheContainerServiceResourceProvider.ts b/sdk/containerservice/arm-containerservice/samples-dev/listAvailableOperationsForTheContainerServiceResourceProvider.ts new file mode 100644 index 000000000000..3f2872f40265 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/listAvailableOperationsForTheContainerServiceResourceProvider.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. +/** + * This sample demonstrates how to Gets a list of operations. + * + * @summary Gets a list of operations. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/Operation_List.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function listAvailableOperationsForTheContainerServiceResourceProvider() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +listAvailableOperationsForTheContainerServiceResourceProvider().catch( + console.error +); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/listMaintenanceConfigurationsByManagedCluster.ts b/sdk/containerservice/arm-containerservice/samples-dev/listMaintenanceConfigurationsByManagedCluster.ts new file mode 100644 index 000000000000..8851d5d4f366 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/listMaintenanceConfigurationsByManagedCluster.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. +/** + * This sample demonstrates how to Gets a list of maintenance configurations in the specified managed cluster. + * + * @summary Gets a list of maintenance configurations in the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/MaintenanceConfigurationsList.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function listMaintenanceConfigurationsByManagedCluster() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.maintenanceConfigurations.listByManagedCluster( + resourceGroupName, + resourceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +listMaintenanceConfigurationsByManagedCluster().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/listManagedClusters.ts b/sdk/containerservice/arm-containerservice/samples-dev/listManagedClusters.ts new file mode 100644 index 000000000000..db2d31fff72d --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/listManagedClusters.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. +/** + * This sample demonstrates how to Gets a list of managed clusters in the specified subscription. + * + * @summary Gets a list of managed clusters in the specified subscription. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersList.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function listManagedClusters() { + const subscriptionId = "subid1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.managedClusters.list()) { + resArray.push(item); + } + console.log(resArray); +} + +listManagedClusters().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/listOutboundNetworkDependenciesEndpointsByManagedCluster.ts b/sdk/containerservice/arm-containerservice/samples-dev/listOutboundNetworkDependenciesEndpointsByManagedCluster.ts new file mode 100644 index 000000000000..aa4127525805 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/listOutboundNetworkDependenciesEndpointsByManagedCluster.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. +/** + * This sample demonstrates how to Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. The operation returns properties of each egress endpoint. + * + * @summary Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. The operation returns properties of each egress endpoint. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/OutboundNetworkDependenciesEndpointsList.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function listOutboundNetworkDependenciesEndpointsByManagedCluster() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.managedClusters.listOutboundNetworkDependenciesEndpoints( + resourceGroupName, + resourceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +listOutboundNetworkDependenciesEndpointsByManagedCluster().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/listPrivateEndpointConnectionsByManagedCluster.ts b/sdk/containerservice/arm-containerservice/samples-dev/listPrivateEndpointConnectionsByManagedCluster.ts new file mode 100644 index 000000000000..efc52f9b27b7 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/listPrivateEndpointConnectionsByManagedCluster.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. +/** + * This sample demonstrates how to To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters + * + * @summary To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/PrivateEndpointConnectionsList.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function listPrivateEndpointConnectionsByManagedCluster() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.list( + resourceGroupName, + resourceName + ); + console.log(result); +} + +listPrivateEndpointConnectionsByManagedCluster().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/listPrivateLinkResourcesByManagedCluster.ts b/sdk/containerservice/arm-containerservice/samples-dev/listPrivateLinkResourcesByManagedCluster.ts new file mode 100644 index 000000000000..b6d6769d5a1f --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/listPrivateLinkResourcesByManagedCluster.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. +/** + * This sample demonstrates how to To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters + * + * @summary To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/PrivateLinkResourcesList.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function listPrivateLinkResourcesByManagedCluster() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.privateLinkResources.list( + resourceGroupName, + resourceName + ); + console.log(result); +} + +listPrivateLinkResourcesByManagedCluster().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/listSnapshots.ts b/sdk/containerservice/arm-containerservice/samples-dev/listSnapshots.ts new file mode 100644 index 000000000000..886b67511f26 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/listSnapshots.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. +/** + * This sample demonstrates how to Gets a list of snapshots in the specified subscription. + * + * @summary Gets a list of snapshots in the specified subscription. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/SnapshotsList.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function listSnapshots() { + const subscriptionId = "subid1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.snapshots.list()) { + resArray.push(item); + } + console.log(resArray); +} + +listSnapshots().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/listSnapshotsByResourceGroup.ts b/sdk/containerservice/arm-containerservice/samples-dev/listSnapshotsByResourceGroup.ts new file mode 100644 index 000000000000..902260abc84e --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/listSnapshotsByResourceGroup.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. +/** + * This sample demonstrates how to Lists snapshots in the specified subscription and resource group. + * + * @summary Lists snapshots in the specified subscription and resource group. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/SnapshotsListByResourceGroup.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function listSnapshotsByResourceGroup() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.snapshots.listByResourceGroup( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +listSnapshotsByResourceGroup().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/resetAadProfile.ts b/sdk/containerservice/arm-containerservice/samples-dev/resetAadProfile.ts new file mode 100644 index 000000000000..d452ca0f6cdb --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/resetAadProfile.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. +/** + * This sample demonstrates how to Reset the AAD Profile of a managed cluster. + * + * @summary Reset the AAD Profile of a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersResetAADProfile.json + */ +import { + ManagedClusterAADProfile, + ContainerServiceClient +} from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function resetAadProfile() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters: ManagedClusterAADProfile = { + clientAppID: "clientappid", + serverAppID: "serverappid", + serverAppSecret: "serverappsecret", + tenantID: "tenantid" + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginResetAADProfileAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +resetAadProfile().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/resetServicePrincipalProfile.ts b/sdk/containerservice/arm-containerservice/samples-dev/resetServicePrincipalProfile.ts new file mode 100644 index 000000000000..f33bf51974a0 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/resetServicePrincipalProfile.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. +/** + * This sample demonstrates how to This action cannot be performed on a cluster that is not using a service principal + * + * @summary This action cannot be performed on a cluster that is not using a service principal + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersResetServicePrincipalProfile.json + */ +import { + ManagedClusterServicePrincipalProfile, + ContainerServiceClient +} from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function resetServicePrincipalProfile() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters: ManagedClusterServicePrincipalProfile = { + clientId: "clientid", + secret: "secret" + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginResetServicePrincipalProfileAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +resetServicePrincipalProfile().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/resolveThePrivateLinkServiceIdForManagedCluster.ts b/sdk/containerservice/arm-containerservice/samples-dev/resolveThePrivateLinkServiceIdForManagedCluster.ts new file mode 100644 index 000000000000..dff4d8559a95 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/resolveThePrivateLinkServiceIdForManagedCluster.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. +/** + * This sample demonstrates how to Gets the private link service ID for the specified managed cluster. + * + * @summary Gets the private link service ID for the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ResolvePrivateLinkServiceId.json + */ +import { + PrivateLinkResource, + ContainerServiceClient +} from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function resolveThePrivateLinkServiceIdForManagedCluster() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters: PrivateLinkResource = { name: "management" }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.resolvePrivateLinkServiceId.post( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +resolveThePrivateLinkServiceIdForManagedCluster().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/rotateClusterCertificates.ts b/sdk/containerservice/arm-containerservice/samples-dev/rotateClusterCertificates.ts new file mode 100644 index 000000000000..002290ef1f4a --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/rotateClusterCertificates.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. +/** + * This sample demonstrates how to See [Certificate rotation](https://docs.microsoft.com/azure/aks/certificate-rotation) for more details about rotating managed cluster certificates. + * + * @summary See [Certificate rotation](https://docs.microsoft.com/azure/aks/certificate-rotation) for more details about rotating managed cluster certificates. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersRotateClusterCertificates.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function rotateClusterCertificates() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginRotateClusterCertificatesAndWait( + resourceGroupName, + resourceName + ); + console.log(result); +} + +rotateClusterCertificates().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/startAgentPool.ts b/sdk/containerservice/arm-containerservice/samples-dev/startAgentPool.ts new file mode 100644 index 000000000000..da11fe149751 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/startAgentPool.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. +/** + * This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster. + * + * @summary Creates or updates an agent pool in the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPools_Start.json + */ +import { AgentPool, ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function startAgentPool() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const agentPoolName = "agentpool1"; + const parameters: AgentPool = { powerState: { code: "Running" } }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + agentPoolName, + parameters + ); + console.log(result); +} + +startAgentPool().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/startManagedCluster.ts b/sdk/containerservice/arm-containerservice/samples-dev/startManagedCluster.ts new file mode 100644 index 000000000000..c651026cee93 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/startManagedCluster.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. +/** + * This sample demonstrates how to See [starting a cluster](https://docs.microsoft.com/azure/aks/start-stop-cluster) for more details about starting a cluster. + * + * @summary See [starting a cluster](https://docs.microsoft.com/azure/aks/start-stop-cluster) for more details about starting a cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersStart.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function startManagedCluster() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginStartAndWait( + resourceGroupName, + resourceName + ); + console.log(result); +} + +startManagedCluster().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/stopAgentPool.ts b/sdk/containerservice/arm-containerservice/samples-dev/stopAgentPool.ts new file mode 100644 index 000000000000..d097562b4b3d --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/stopAgentPool.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. +/** + * This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster. + * + * @summary Creates or updates an agent pool in the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPools_Stop.json + */ +import { AgentPool, ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function stopAgentPool() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const agentPoolName = "agentpool1"; + const parameters: AgentPool = { powerState: { code: "Stopped" } }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + agentPoolName, + parameters + ); + console.log(result); +} + +stopAgentPool().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/stopManagedCluster.ts b/sdk/containerservice/arm-containerservice/samples-dev/stopManagedCluster.ts new file mode 100644 index 000000000000..ec7580095818 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/stopManagedCluster.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. +/** + * This sample demonstrates how to This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a cluster stops the control plane and agent nodes entirely, while maintaining all object and cluster state. A cluster does not accrue charges while it is stopped. See [stopping a cluster](https://docs.microsoft.com/azure/aks/start-stop-cluster) for more details about stopping a cluster. + * + * @summary This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a cluster stops the control plane and agent nodes entirely, while maintaining all object and cluster state. A cluster does not accrue charges while it is stopped. See [stopping a cluster](https://docs.microsoft.com/azure/aks/start-stop-cluster) for more details about stopping a cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersStop.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function stopManagedCluster() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginStopAndWait( + resourceGroupName, + resourceName + ); + console.log(result); +} + +stopManagedCluster().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/submitNewCommand.ts b/sdk/containerservice/arm-containerservice/samples-dev/submitNewCommand.ts new file mode 100644 index 000000000000..d491445abc39 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/submitNewCommand.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. +/** + * This sample demonstrates how to AKS will create a pod to run the command. This is primarily useful for private clusters. For more information see [AKS Run Command](https://docs.microsoft.com/azure/aks/private-clusters#aks-run-command-preview). + * + * @summary AKS will create a pod to run the command. This is primarily useful for private clusters. For more information see [AKS Run Command](https://docs.microsoft.com/azure/aks/private-clusters#aks-run-command-preview). + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/RunCommandRequest.json + */ +import { + RunCommandRequest, + ContainerServiceClient +} from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function submitNewCommand() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const requestPayload: RunCommandRequest = { + clusterToken: "", + command: "kubectl apply -f ns.yaml", + context: "" + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginRunCommandAndWait( + resourceGroupName, + resourceName, + requestPayload + ); + console.log(result); +} + +submitNewCommand().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/updateAgentPool.ts b/sdk/containerservice/arm-containerservice/samples-dev/updateAgentPool.ts new file mode 100644 index 000000000000..35b855be63cd --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/updateAgentPool.ts @@ -0,0 +1,48 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster. + * + * @summary Creates or updates an agent pool in the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPools_Update.json + */ +import { AgentPool, ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function updateAgentPool() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const agentPoolName = "agentpool1"; + const parameters: AgentPool = { + count: 3, + enableAutoScaling: true, + maxCount: 2, + minCount: 2, + nodeTaints: ["Key1=Value1:NoSchedule"], + orchestratorVersion: "", + osType: "Linux", + scaleSetEvictionPolicy: "Delete", + scaleSetPriority: "Spot", + vmSize: "Standard_DS1_v2" + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + agentPoolName, + parameters + ); + console.log(result); +} + +updateAgentPool().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/updateManagedClusterTags.ts b/sdk/containerservice/arm-containerservice/samples-dev/updateManagedClusterTags.ts new file mode 100644 index 000000000000..710cc39e6dbc --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/updateManagedClusterTags.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. +/** + * This sample demonstrates how to Updates tags on a managed cluster. + * + * @summary Updates tags on a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersUpdateTags.json + */ +import { + TagsObject, + ContainerServiceClient +} from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function updateManagedClusterTags() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters: TagsObject = { tags: { archv3: "", tier: "testing" } }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginUpdateTagsAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +updateManagedClusterTags().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/updatePrivateEndpointConnection.ts b/sdk/containerservice/arm-containerservice/samples-dev/updatePrivateEndpointConnection.ts new file mode 100644 index 000000000000..0d77112cd0ab --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/updatePrivateEndpointConnection.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. +/** + * This sample demonstrates how to Updates a private endpoint connection. + * + * @summary Updates a private endpoint connection. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/PrivateEndpointConnectionsUpdate.json + */ +import { + PrivateEndpointConnection, + ContainerServiceClient +} from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function updatePrivateEndpointConnection() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const privateEndpointConnectionName = "privateendpointconnection1"; + const parameters: PrivateEndpointConnection = { + privateLinkServiceConnectionState: { status: "Approved" } + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.update( + resourceGroupName, + resourceName, + privateEndpointConnectionName, + parameters + ); + console.log(result); +} + +updatePrivateEndpointConnection().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/updateSnapshotTags.ts b/sdk/containerservice/arm-containerservice/samples-dev/updateSnapshotTags.ts new file mode 100644 index 000000000000..f98829e3ea01 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/updateSnapshotTags.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. +/** + * This sample demonstrates how to Updates tags on a snapshot. + * + * @summary Updates tags on a snapshot. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/SnapshotsUpdateTags.json + */ +import { + TagsObject, + ContainerServiceClient +} from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function updateSnapshotTags() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "snapshot1"; + const parameters: TagsObject = { tags: { key2: "new-val2", key3: "val3" } }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.snapshots.updateTags( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +updateSnapshotTags().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples-dev/upgradeAgentPoolNodeImageVersion.ts b/sdk/containerservice/arm-containerservice/samples-dev/upgradeAgentPoolNodeImageVersion.ts new file mode 100644 index 000000000000..e4b7d5d4e892 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples-dev/upgradeAgentPoolNodeImageVersion.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. +/** + * This sample demonstrates how to Upgrading the node image version of an agent pool applies the newest OS and runtime updates to the nodes. AKS provides one new image per week with the latest updates. For more details on node image versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade + * + * @summary Upgrading the node image version of an agent pool applies the newest OS and runtime updates to the nodes. AKS provides one new image per week with the latest updates. For more details on node image versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsUpgradeNodeImageVersion.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function upgradeAgentPoolNodeImageVersion() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const agentPoolName = "agentpool1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.beginUpgradeNodeImageVersionAndWait( + resourceGroupName, + resourceName, + agentPoolName + ); + console.log(result); +} + +upgradeAgentPoolNodeImageVersion().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/README.md b/sdk/containerservice/arm-containerservice/samples/v15/javascript/README.md new file mode 100644 index 000000000000..b1250515f3af --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/README.md @@ -0,0 +1,198 @@ +# client library samples for JavaScript + +These sample programs show how to use the JavaScript client libraries for in some common scenarios. + +| **File Name** | **Description** | +| --------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| [commandFailedResult.js][commandfailedresult] | Gets the results of a command which has been run on the Managed Cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/RunCommandResultFailed.json | +| [commandSucceedResult.js][commandsucceedresult] | Gets the results of a command which has been run on the Managed Cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/RunCommandResultSucceed.json | +| [createAgentPoolUsingAnAgentPoolSnapshot.js][createagentpoolusinganagentpoolsnapshot] | Creates or updates an agent pool in the specified managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_Snapshot.json | +| [createAgentPoolWithEncryptionAtHostEnabled.js][createagentpoolwithencryptionathostenabled] | Creates or updates an agent pool in the specified managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_EnableEncryptionAtHost.json | +| [createAgentPoolWithEphemeralOSDisk.js][createagentpoolwithephemeralosdisk] | Creates or updates an agent pool in the specified managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_Ephemeral.json | +| [createAgentPoolWithFipsEnabledOS.js][createagentpoolwithfipsenabledos] | Creates or updates an agent pool in the specified managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_EnableFIPS.json | +| [createAgentPoolWithGpumig.js][createagentpoolwithgpumig] | Creates or updates an agent pool in the specified managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_GPUMIG.json | +| [createAgentPoolWithKrustletAndTheWasiRuntime.js][createagentpoolwithkrustletandthewasiruntime] | Creates or updates an agent pool in the specified managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_WasmWasi.json | +| [createAgentPoolWithKubeletConfigAndLinuxOSConfig.js][createagentpoolwithkubeletconfigandlinuxosconfig] | Creates or updates an agent pool in the specified managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_CustomNodeConfig.json | +| [createAgentPoolWithOssku.js][createagentpoolwithossku] | Creates or updates an agent pool in the specified managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_OSSKU.json | +| [createAgentPoolWithPpg.js][createagentpoolwithppg] | Creates or updates an agent pool in the specified managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_PPG.json | +| [createAgentPoolWithUltraSsdEnabled.js][createagentpoolwithultrassdenabled] | Creates or updates an agent pool in the specified managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_EnableUltraSSD.json | +| [createManagedClusterUsingAnAgentPoolSnapshot.js][createmanagedclusterusinganagentpoolsnapshot] | Creates or updates a managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_Snapshot.json | +| [createManagedClusterWithAksManagedNatGatewayAsOutboundType.js][createmanagedclusterwithaksmanagednatgatewayasoutboundtype] | Creates or updates a managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_ManagedNATGateway.json | +| [createManagedClusterWithEncryptionAtHostEnabled.js][createmanagedclusterwithencryptionathostenabled] | Creates or updates a managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_EnableEncryptionAtHost.json | +| [createManagedClusterWithFipsEnabledOS.js][createmanagedclusterwithfipsenabledos] | Creates or updates a managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_EnabledFIPS.json | +| [createManagedClusterWithGpumig.js][createmanagedclusterwithgpumig] | Creates or updates a managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_GPUMIG.json | +| [createManagedClusterWithHttpProxyConfigured.js][createmanagedclusterwithhttpproxyconfigured] | Creates or updates a managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_HTTPProxy.json | +| [createManagedClusterWithNodePublicIPPrefix.js][createmanagedclusterwithnodepublicipprefix] | Creates or updates a managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_NodePublicIPPrefix.json | +| [createManagedClusterWithOssku.js][createmanagedclusterwithossku] | Creates or updates a managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_OSSKU.json | +| [createManagedClusterWithPodIdentityEnabled.js][createmanagedclusterwithpodidentityenabled] | Creates or updates a managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_PodIdentity.json | +| [createManagedClusterWithPpg.js][createmanagedclusterwithppg] | Creates or updates a managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_PPG.json | +| [createManagedClusterWithRunCommandDisabled.js][createmanagedclusterwithruncommanddisabled] | Creates or updates a managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_DisableRunCommand.json | +| [createManagedClusterWithSecurityProfileConfigured.js][createmanagedclusterwithsecurityprofileconfigured] | Creates or updates a managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_SecurityProfile.json | +| [createManagedClusterWithUltraSsdEnabled.js][createmanagedclusterwithultrassdenabled] | Creates or updates a managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_EnableUltraSSD.json | +| [createManagedClusterWithUserAssignedNatGatewayAsOutboundType.js][createmanagedclusterwithuserassignednatgatewayasoutboundtype] | Creates or updates a managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_UserAssignedNATGateway.json | +| [createManagedPrivateClusterWithFqdnSubdomainSpecified.js][createmanagedprivateclusterwithfqdnsubdomainspecified] | Creates or updates a managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_PrivateClusterFQDNSubdomain.json | +| [createManagedPrivateClusterWithPublicFqdnSpecified.js][createmanagedprivateclusterwithpublicfqdnspecified] | Creates or updates a managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_PrivateClusterPublicFQDN.json | +| [createOrUpdateAadManagedClusterWithEnableAzureRbac.js][createorupdateaadmanagedclusterwithenableazurerbac] | Creates or updates a managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_UpdateWithEnableAzureRBAC.json | +| [createOrUpdateAgentPool.js][createorupdateagentpool] | Creates or updates an agent pool in the specified managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_Update.json | +| [createOrUpdateMaintenanceConfiguration.js][createorupdatemaintenanceconfiguration] | Creates or updates a maintenance configuration in the specified managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/MaintenanceConfigurationsCreate_Update.json | +| [createOrUpdateManagedCluster.js][createorupdatemanagedcluster] | Creates or updates a managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_Update.json | +| [createOrUpdateManagedClusterWithDualStackNetworking.js][createorupdatemanagedclusterwithdualstacknetworking] | Creates or updates a managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_DualStackNetworking.json | +| [createOrUpdateManagedClusterWithEnableAhub.js][createorupdatemanagedclusterwithenableahub] | Creates or updates a managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_UpdateWithAHUB.json | +| [createOrUpdateManagedClusterWithWindowsGMsaEnabled.js][createorupdatemanagedclusterwithwindowsgmsaenabled] | Creates or updates a managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_UpdateWindowsGmsa.json | +| [createOrUpdateSnapshot.js][createorupdatesnapshot] | Creates or updates a snapshot. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/SnapshotsCreate.json | +| [createSpotAgentPool.js][createspotagentpool] | Creates or updates an agent pool in the specified managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_Spot.json | +| [deleteAgentPool.js][deleteagentpool] | Deletes an agent pool in the specified managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsDelete.json | +| [deleteMaintenanceConfiguration.js][deletemaintenanceconfiguration] | Deletes a maintenance configuration. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/MaintenanceConfigurationsDelete.json | +| [deleteManagedCluster.js][deletemanagedcluster] | Deletes a managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersDelete.json | +| [deletePrivateEndpointConnection.js][deleteprivateendpointconnection] | Deletes a private endpoint connection. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/PrivateEndpointConnectionsDelete.json | +| [deleteSnapshot.js][deletesnapshot] | Deletes a snapshot. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/SnapshotsDelete.json | +| [getAgentPool.js][getagentpool] | Gets the specified managed cluster agent pool. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsGet.json | +| [getAvailableVersionsForAgentPool.js][getavailableversionsforagentpool] | See [supported Kubernetes versions](https://docs.microsoft.com/azure/aks/supported-kubernetes-versions) for more details about the version lifecycle. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsGetAgentPoolAvailableVersions.json | +| [getContainerServiceOSOptions.js][getcontainerserviceosoptions] | Gets supported OS options in the specified subscription. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ContainerServiceGetOSOptions.json | +| [getMaintenanceConfiguration.js][getmaintenanceconfiguration] | Gets the specified maintenance configuration of a managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/MaintenanceConfigurationsGet.json | +| [getManagedCluster.js][getmanagedcluster] | Gets a managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersGet.json | +| [getManagedClustersByResourceGroup.js][getmanagedclustersbyresourcegroup] | Lists managed clusters in the specified subscription and resource group. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersListByResourceGroup.json | +| [getPrivateEndpointConnection.js][getprivateendpointconnection] | To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/PrivateEndpointConnectionsGet.json | +| [getSnapshot.js][getsnapshot] | Gets a snapshot. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/SnapshotsGet.json | +| [getUpgradeProfileForAgentPool.js][getupgradeprofileforagentpool] | Gets the upgrade profile for an agent pool. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsGetUpgradeProfile.json | +| [getUpgradeProfileForManagedCluster.js][getupgradeprofileformanagedcluster] | Gets the upgrade profile of a managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersGetUpgradeProfile.json | +| [listAgentPoolsByManagedCluster.js][listagentpoolsbymanagedcluster] | Gets a list of agent pools in the specified managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsList.json | +| [listAvailableOperationsForTheContainerServiceResourceProvider.js][listavailableoperationsforthecontainerserviceresourceprovider] | Gets a list of operations. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/Operation_List.json | +| [listMaintenanceConfigurationsByManagedCluster.js][listmaintenanceconfigurationsbymanagedcluster] | Gets a list of maintenance configurations in the specified managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/MaintenanceConfigurationsList.json | +| [listManagedClusters.js][listmanagedclusters] | Gets a list of managed clusters in the specified subscription. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersList.json | +| [listOutboundNetworkDependenciesEndpointsByManagedCluster.js][listoutboundnetworkdependenciesendpointsbymanagedcluster] | Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. The operation returns properties of each egress endpoint. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/OutboundNetworkDependenciesEndpointsList.json | +| [listPrivateEndpointConnectionsByManagedCluster.js][listprivateendpointconnectionsbymanagedcluster] | To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/PrivateEndpointConnectionsList.json | +| [listPrivateLinkResourcesByManagedCluster.js][listprivatelinkresourcesbymanagedcluster] | To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/PrivateLinkResourcesList.json | +| [listSnapshots.js][listsnapshots] | Gets a list of snapshots in the specified subscription. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/SnapshotsList.json | +| [listSnapshotsByResourceGroup.js][listsnapshotsbyresourcegroup] | Lists snapshots in the specified subscription and resource group. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/SnapshotsListByResourceGroup.json | +| [resetAadProfile.js][resetaadprofile] | Reset the AAD Profile of a managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersResetAADProfile.json | +| [resetServicePrincipalProfile.js][resetserviceprincipalprofile] | This action cannot be performed on a cluster that is not using a service principal x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersResetServicePrincipalProfile.json | +| [resolveThePrivateLinkServiceIdForManagedCluster.js][resolvetheprivatelinkserviceidformanagedcluster] | Gets the private link service ID for the specified managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ResolvePrivateLinkServiceId.json | +| [rotateClusterCertificates.js][rotateclustercertificates] | See [Certificate rotation](https://docs.microsoft.com/azure/aks/certificate-rotation) for more details about rotating managed cluster certificates. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersRotateClusterCertificates.json | +| [startAgentPool.js][startagentpool] | Creates or updates an agent pool in the specified managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPools_Start.json | +| [startManagedCluster.js][startmanagedcluster] | See [starting a cluster](https://docs.microsoft.com/azure/aks/start-stop-cluster) for more details about starting a cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersStart.json | +| [stopAgentPool.js][stopagentpool] | Creates or updates an agent pool in the specified managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPools_Stop.json | +| [stopManagedCluster.js][stopmanagedcluster] | This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a cluster stops the control plane and agent nodes entirely, while maintaining all object and cluster state. A cluster does not accrue charges while it is stopped. See [stopping a cluster](https://docs.microsoft.com/azure/aks/start-stop-cluster) for more details about stopping a cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersStop.json | +| [submitNewCommand.js][submitnewcommand] | AKS will create a pod to run the command. This is primarily useful for private clusters. For more information see [AKS Run Command](https://docs.microsoft.com/azure/aks/private-clusters#aks-run-command-preview). x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/RunCommandRequest.json | +| [updateAgentPool.js][updateagentpool] | Creates or updates an agent pool in the specified managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPools_Update.json | +| [updateManagedClusterTags.js][updatemanagedclustertags] | Updates tags on a managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersUpdateTags.json | +| [updatePrivateEndpointConnection.js][updateprivateendpointconnection] | Updates a private endpoint connection. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/PrivateEndpointConnectionsUpdate.json | +| [updateSnapshotTags.js][updatesnapshottags] | Updates tags on a snapshot. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/SnapshotsUpdateTags.json | +| [upgradeAgentPoolNodeImageVersion.js][upgradeagentpoolnodeimageversion] | Upgrading the node image version of an agent pool applies the newest OS and runtime updates to the nodes. AKS provides one new image per week with the latest updates. For more details on node image versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsUpgradeNodeImageVersion.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 commandFailedResult.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 commandFailedResult.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[commandfailedresult]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/commandFailedResult.js +[commandsucceedresult]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/commandSucceedResult.js +[createagentpoolusinganagentpoolsnapshot]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/createAgentPoolUsingAnAgentPoolSnapshot.js +[createagentpoolwithencryptionathostenabled]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/createAgentPoolWithEncryptionAtHostEnabled.js +[createagentpoolwithephemeralosdisk]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/createAgentPoolWithEphemeralOSDisk.js +[createagentpoolwithfipsenabledos]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/createAgentPoolWithFipsEnabledOS.js +[createagentpoolwithgpumig]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/createAgentPoolWithGpumig.js +[createagentpoolwithkrustletandthewasiruntime]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/createAgentPoolWithKrustletAndTheWasiRuntime.js +[createagentpoolwithkubeletconfigandlinuxosconfig]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/createAgentPoolWithKubeletConfigAndLinuxOSConfig.js +[createagentpoolwithossku]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/createAgentPoolWithOssku.js +[createagentpoolwithppg]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/createAgentPoolWithPpg.js +[createagentpoolwithultrassdenabled]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/createAgentPoolWithUltraSsdEnabled.js +[createmanagedclusterusinganagentpoolsnapshot]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedClusterUsingAnAgentPoolSnapshot.js +[createmanagedclusterwithaksmanagednatgatewayasoutboundtype]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedClusterWithAksManagedNatGatewayAsOutboundType.js +[createmanagedclusterwithencryptionathostenabled]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedClusterWithEncryptionAtHostEnabled.js +[createmanagedclusterwithfipsenabledos]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedClusterWithFipsEnabledOS.js +[createmanagedclusterwithgpumig]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedClusterWithGpumig.js +[createmanagedclusterwithhttpproxyconfigured]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedClusterWithHttpProxyConfigured.js +[createmanagedclusterwithnodepublicipprefix]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedClusterWithNodePublicIPPrefix.js +[createmanagedclusterwithossku]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedClusterWithOssku.js +[createmanagedclusterwithpodidentityenabled]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedClusterWithPodIdentityEnabled.js +[createmanagedclusterwithppg]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedClusterWithPpg.js +[createmanagedclusterwithruncommanddisabled]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedClusterWithRunCommandDisabled.js +[createmanagedclusterwithsecurityprofileconfigured]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedClusterWithSecurityProfileConfigured.js +[createmanagedclusterwithultrassdenabled]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedClusterWithUltraSsdEnabled.js +[createmanagedclusterwithuserassignednatgatewayasoutboundtype]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedClusterWithUserAssignedNatGatewayAsOutboundType.js +[createmanagedprivateclusterwithfqdnsubdomainspecified]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedPrivateClusterWithFqdnSubdomainSpecified.js +[createmanagedprivateclusterwithpublicfqdnspecified]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedPrivateClusterWithPublicFqdnSpecified.js +[createorupdateaadmanagedclusterwithenableazurerbac]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/createOrUpdateAadManagedClusterWithEnableAzureRbac.js +[createorupdateagentpool]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/createOrUpdateAgentPool.js +[createorupdatemaintenanceconfiguration]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/createOrUpdateMaintenanceConfiguration.js +[createorupdatemanagedcluster]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/createOrUpdateManagedCluster.js +[createorupdatemanagedclusterwithdualstacknetworking]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/createOrUpdateManagedClusterWithDualStackNetworking.js +[createorupdatemanagedclusterwithenableahub]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/createOrUpdateManagedClusterWithEnableAhub.js +[createorupdatemanagedclusterwithwindowsgmsaenabled]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/createOrUpdateManagedClusterWithWindowsGMsaEnabled.js +[createorupdatesnapshot]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/createOrUpdateSnapshot.js +[createspotagentpool]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/createSpotAgentPool.js +[deleteagentpool]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/deleteAgentPool.js +[deletemaintenanceconfiguration]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/deleteMaintenanceConfiguration.js +[deletemanagedcluster]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/deleteManagedCluster.js +[deleteprivateendpointconnection]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/deletePrivateEndpointConnection.js +[deletesnapshot]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/deleteSnapshot.js +[getagentpool]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/getAgentPool.js +[getavailableversionsforagentpool]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/getAvailableVersionsForAgentPool.js +[getcontainerserviceosoptions]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/getContainerServiceOSOptions.js +[getmaintenanceconfiguration]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/getMaintenanceConfiguration.js +[getmanagedcluster]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/getManagedCluster.js +[getmanagedclustersbyresourcegroup]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/getManagedClustersByResourceGroup.js +[getprivateendpointconnection]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/getPrivateEndpointConnection.js +[getsnapshot]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/getSnapshot.js +[getupgradeprofileforagentpool]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/getUpgradeProfileForAgentPool.js +[getupgradeprofileformanagedcluster]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/getUpgradeProfileForManagedCluster.js +[listagentpoolsbymanagedcluster]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/listAgentPoolsByManagedCluster.js +[listavailableoperationsforthecontainerserviceresourceprovider]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/listAvailableOperationsForTheContainerServiceResourceProvider.js +[listmaintenanceconfigurationsbymanagedcluster]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/listMaintenanceConfigurationsByManagedCluster.js +[listmanagedclusters]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/listManagedClusters.js +[listoutboundnetworkdependenciesendpointsbymanagedcluster]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/listOutboundNetworkDependenciesEndpointsByManagedCluster.js +[listprivateendpointconnectionsbymanagedcluster]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/listPrivateEndpointConnectionsByManagedCluster.js +[listprivatelinkresourcesbymanagedcluster]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/listPrivateLinkResourcesByManagedCluster.js +[listsnapshots]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/listSnapshots.js +[listsnapshotsbyresourcegroup]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/listSnapshotsByResourceGroup.js +[resetaadprofile]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/resetAadProfile.js +[resetserviceprincipalprofile]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/resetServicePrincipalProfile.js +[resolvetheprivatelinkserviceidformanagedcluster]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/resolveThePrivateLinkServiceIdForManagedCluster.js +[rotateclustercertificates]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/rotateClusterCertificates.js +[startagentpool]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/startAgentPool.js +[startmanagedcluster]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/startManagedCluster.js +[stopagentpool]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/stopAgentPool.js +[stopmanagedcluster]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/stopManagedCluster.js +[submitnewcommand]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/submitNewCommand.js +[updateagentpool]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/updateAgentPool.js +[updatemanagedclustertags]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/updateManagedClusterTags.js +[updateprivateendpointconnection]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/updatePrivateEndpointConnection.js +[updatesnapshottags]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/updateSnapshotTags.js +[upgradeagentpoolnodeimageversion]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/javascript/upgradeAgentPoolNodeImageVersion.js +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-containerservice?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/containerservice/arm-containerservice/README.md diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/commandFailedResult.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/commandFailedResult.js new file mode 100644 index 000000000000..73629ae3b1ef --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/commandFailedResult.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. +/** + * This sample demonstrates how to Gets the results of a command which has been run on the Managed Cluster. + * + * @summary Gets the results of a command which has been run on the Managed Cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/RunCommandResultFailed.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function commandFailedResult() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const commandId = "def7b3ea71bd4f7e9d226ddbc0f00ad9"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.getCommandResult( + resourceGroupName, + resourceName, + commandId + ); + console.log(result); +} + +commandFailedResult().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/commandSucceedResult.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/commandSucceedResult.js new file mode 100644 index 000000000000..5f0e49e89be4 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/commandSucceedResult.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. +/** + * This sample demonstrates how to Gets the results of a command which has been run on the Managed Cluster. + * + * @summary Gets the results of a command which has been run on the Managed Cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/RunCommandResultSucceed.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function commandSucceedResult() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const commandId = "def7b3ea71bd4f7e9d226ddbc0f00ad9"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.getCommandResult( + resourceGroupName, + resourceName, + commandId + ); + console.log(result); +} + +commandSucceedResult().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/createAgentPoolUsingAnAgentPoolSnapshot.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createAgentPoolUsingAnAgentPoolSnapshot.js new file mode 100644 index 000000000000..87d3faad1f5a --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createAgentPoolUsingAnAgentPoolSnapshot.js @@ -0,0 +1,47 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster. + * + * @summary Creates or updates an agent pool in the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_Snapshot.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function createAgentPoolUsingAnAgentPoolSnapshot() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const agentPoolName = "agentpool1"; + const parameters = { + count: 3, + creationData: { + sourceResourceId: + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.ContainerService/snapshots/snapshot1", + }, + enableFips: true, + orchestratorVersion: "", + osType: "Linux", + vmSize: "Standard_DS2_v2", + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + agentPoolName, + parameters + ); + console.log(result); +} + +createAgentPoolUsingAnAgentPoolSnapshot().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/createAgentPoolWithEncryptionAtHostEnabled.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createAgentPoolWithEncryptionAtHostEnabled.js new file mode 100644 index 000000000000..62c86b7b4f0f --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createAgentPoolWithEncryptionAtHostEnabled.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. +/** + * This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster. + * + * @summary Creates or updates an agent pool in the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_EnableEncryptionAtHost.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function createAgentPoolWithEncryptionAtHostEnabled() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const agentPoolName = "agentpool1"; + const parameters = { + count: 3, + enableEncryptionAtHost: true, + orchestratorVersion: "", + osType: "Linux", + vmSize: "Standard_DS2_v2", + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + agentPoolName, + parameters + ); + console.log(result); +} + +createAgentPoolWithEncryptionAtHostEnabled().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/createAgentPoolWithEphemeralOSDisk.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createAgentPoolWithEphemeralOSDisk.js new file mode 100644 index 000000000000..d10a4df0ccf3 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createAgentPoolWithEphemeralOSDisk.js @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster. + * + * @summary Creates or updates an agent pool in the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_Ephemeral.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function createAgentPoolWithEphemeralOSDisk() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const agentPoolName = "agentpool1"; + const parameters = { + count: 3, + orchestratorVersion: "", + osDiskSizeGB: 64, + osDiskType: "Ephemeral", + osType: "Linux", + vmSize: "Standard_DS2_v2", + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + agentPoolName, + parameters + ); + console.log(result); +} + +createAgentPoolWithEphemeralOSDisk().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/createAgentPoolWithFipsEnabledOS.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createAgentPoolWithFipsEnabledOS.js new file mode 100644 index 000000000000..c3762ee0cee1 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createAgentPoolWithFipsEnabledOS.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. +/** + * This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster. + * + * @summary Creates or updates an agent pool in the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_EnableFIPS.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function createAgentPoolWithFipsEnabledOS() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const agentPoolName = "agentpool1"; + const parameters = { + count: 3, + enableFips: true, + orchestratorVersion: "", + osType: "Linux", + vmSize: "Standard_DS2_v2", + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + agentPoolName, + parameters + ); + console.log(result); +} + +createAgentPoolWithFipsEnabledOS().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/createAgentPoolWithGpumig.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createAgentPoolWithGpumig.js new file mode 100644 index 000000000000..69465952ec47 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createAgentPoolWithGpumig.js @@ -0,0 +1,64 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster. + * + * @summary Creates or updates an agent pool in the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_GPUMIG.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function createAgentPoolWithGpumig() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const agentPoolName = "agentpool1"; + const parameters = { + count: 3, + gpuInstanceProfile: "MIG2g", + kubeletConfig: { + allowedUnsafeSysctls: ["kernel.msg*", "net.core.somaxconn"], + cpuCfsQuota: true, + cpuCfsQuotaPeriod: "200ms", + cpuManagerPolicy: "static", + failSwapOn: false, + imageGcHighThreshold: 90, + imageGcLowThreshold: 70, + topologyManagerPolicy: "best-effort", + }, + linuxOSConfig: { + swapFileSizeMB: 1500, + sysctls: { + kernelThreadsMax: 99999, + netCoreWmemDefault: 12345, + netIpv4IpLocalPortRange: "20000 60000", + netIpv4TcpTwReuse: true, + }, + transparentHugePageDefrag: "madvise", + transparentHugePageEnabled: "always", + }, + orchestratorVersion: "", + osType: "Linux", + vmSize: "Standard_ND96asr_v4", + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + agentPoolName, + parameters + ); + console.log(result); +} + +createAgentPoolWithGpumig().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/createAgentPoolWithKrustletAndTheWasiRuntime.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createAgentPoolWithKrustletAndTheWasiRuntime.js new file mode 100644 index 000000000000..76b0c11652e3 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createAgentPoolWithKrustletAndTheWasiRuntime.js @@ -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. +/** + * This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster. + * + * @summary Creates or updates an agent pool in the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_WasmWasi.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function createAgentPoolWithKrustletAndTheWasiRuntime() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const agentPoolName = "agentpool1"; + const parameters = { + count: 3, + mode: "User", + orchestratorVersion: "", + osDiskSizeGB: 64, + osType: "Linux", + vmSize: "Standard_DS2_v2", + workloadRuntime: "WasmWasi", + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + agentPoolName, + parameters + ); + console.log(result); +} + +createAgentPoolWithKrustletAndTheWasiRuntime().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/createAgentPoolWithKubeletConfigAndLinuxOSConfig.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createAgentPoolWithKubeletConfigAndLinuxOSConfig.js new file mode 100644 index 000000000000..db2846213f02 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createAgentPoolWithKubeletConfigAndLinuxOSConfig.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. +/** + * This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster. + * + * @summary Creates or updates an agent pool in the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_CustomNodeConfig.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function createAgentPoolWithKubeletConfigAndLinuxOSConfig() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const agentPoolName = "agentpool1"; + const parameters = { + count: 3, + kubeletConfig: { + allowedUnsafeSysctls: ["kernel.msg*", "net.core.somaxconn"], + cpuCfsQuota: true, + cpuCfsQuotaPeriod: "200ms", + cpuManagerPolicy: "static", + failSwapOn: false, + imageGcHighThreshold: 90, + imageGcLowThreshold: 70, + topologyManagerPolicy: "best-effort", + }, + linuxOSConfig: { + swapFileSizeMB: 1500, + sysctls: { + kernelThreadsMax: 99999, + netCoreWmemDefault: 12345, + netIpv4IpLocalPortRange: "20000 60000", + netIpv4TcpTwReuse: true, + }, + transparentHugePageDefrag: "madvise", + transparentHugePageEnabled: "always", + }, + orchestratorVersion: "", + osType: "Linux", + vmSize: "Standard_DS2_v2", + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + agentPoolName, + parameters + ); + console.log(result); +} + +createAgentPoolWithKubeletConfigAndLinuxOSConfig().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/createAgentPoolWithOssku.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createAgentPoolWithOssku.js new file mode 100644 index 000000000000..2f863fb82123 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createAgentPoolWithOssku.js @@ -0,0 +1,64 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster. + * + * @summary Creates or updates an agent pool in the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_OSSKU.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function createAgentPoolWithOssku() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const agentPoolName = "agentpool1"; + const parameters = { + count: 3, + kubeletConfig: { + allowedUnsafeSysctls: ["kernel.msg*", "net.core.somaxconn"], + cpuCfsQuota: true, + cpuCfsQuotaPeriod: "200ms", + cpuManagerPolicy: "static", + failSwapOn: false, + imageGcHighThreshold: 90, + imageGcLowThreshold: 70, + topologyManagerPolicy: "best-effort", + }, + linuxOSConfig: { + swapFileSizeMB: 1500, + sysctls: { + kernelThreadsMax: 99999, + netCoreWmemDefault: 12345, + netIpv4IpLocalPortRange: "20000 60000", + netIpv4TcpTwReuse: true, + }, + transparentHugePageDefrag: "madvise", + transparentHugePageEnabled: "always", + }, + orchestratorVersion: "", + osSKU: "CBLMariner", + osType: "Linux", + vmSize: "Standard_DS2_v2", + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + agentPoolName, + parameters + ); + console.log(result); +} + +createAgentPoolWithOssku().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/createAgentPoolWithPpg.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createAgentPoolWithPpg.js new file mode 100644 index 000000000000..158ce4268b59 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createAgentPoolWithPpg.js @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster. + * + * @summary Creates or updates an agent pool in the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_PPG.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function createAgentPoolWithPpg() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const agentPoolName = "agentpool1"; + const parameters = { + count: 3, + orchestratorVersion: "", + osType: "Linux", + proximityPlacementGroupID: + "/subscriptions/subid1/resourcegroups/rg1/providers//Microsoft.Compute/proximityPlacementGroups/ppg1", + vmSize: "Standard_DS2_v2", + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + agentPoolName, + parameters + ); + console.log(result); +} + +createAgentPoolWithPpg().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/createAgentPoolWithUltraSsdEnabled.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createAgentPoolWithUltraSsdEnabled.js new file mode 100644 index 000000000000..8229692ab5c2 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createAgentPoolWithUltraSsdEnabled.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. +/** + * This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster. + * + * @summary Creates or updates an agent pool in the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_EnableUltraSSD.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function createAgentPoolWithUltraSsdEnabled() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const agentPoolName = "agentpool1"; + const parameters = { + count: 3, + enableUltraSSD: true, + orchestratorVersion: "", + osType: "Linux", + vmSize: "Standard_DS2_v2", + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + agentPoolName, + parameters + ); + console.log(result); +} + +createAgentPoolWithUltraSsdEnabled().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedClusterUsingAnAgentPoolSnapshot.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedClusterUsingAnAgentPoolSnapshot.js new file mode 100644 index 000000000000..2f214767ad31 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedClusterUsingAnAgentPoolSnapshot.js @@ -0,0 +1,77 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_Snapshot.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function createManagedClusterUsingAnAgentPoolSnapshot() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters = { + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + count: 3, + creationData: { + sourceResourceId: + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.ContainerService/snapshots/snapshot1", + }, + enableFips: true, + enableNodePublicIP: true, + mode: "System", + osType: "Linux", + vmSize: "Standard_DS2_v2", + }, + ], + autoScalerProfile: { scaleDownDelayAfterAdd: "15m", scanInterval: "20s" }, + diskEncryptionSetID: + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des", + dnsPrefix: "dnsprefix1", + enablePodSecurityPolicy: false, + enableRbac: true, + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] }, + }, + location: "location1", + networkProfile: { + loadBalancerProfile: { managedOutboundIPs: { count: 2 } }, + loadBalancerSku: "standard", + outboundType: "loadBalancer", + }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser", + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createManagedClusterUsingAnAgentPoolSnapshot().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedClusterWithAksManagedNatGatewayAsOutboundType.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedClusterWithAksManagedNatGatewayAsOutboundType.js new file mode 100644 index 000000000000..8fee1589afc1 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedClusterWithAksManagedNatGatewayAsOutboundType.js @@ -0,0 +1,72 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_ManagedNATGateway.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function createManagedClusterWithAksManagedNatGatewayAsOutboundType() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters = { + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + count: 3, + enableNodePublicIP: false, + mode: "System", + osType: "Linux", + vmSize: "Standard_DS2_v2", + }, + ], + autoScalerProfile: { scaleDownDelayAfterAdd: "15m", scanInterval: "20s" }, + diskEncryptionSetID: + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des", + dnsPrefix: "dnsprefix1", + enablePodSecurityPolicy: true, + enableRbac: true, + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] }, + }, + location: "location1", + networkProfile: { + loadBalancerSku: "standard", + natGatewayProfile: { managedOutboundIPProfile: { count: 2 } }, + outboundType: "managedNATGateway", + }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser", + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createManagedClusterWithAksManagedNatGatewayAsOutboundType().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedClusterWithEncryptionAtHostEnabled.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedClusterWithEncryptionAtHostEnabled.js new file mode 100644 index 000000000000..84cf0d6fe071 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedClusterWithEncryptionAtHostEnabled.js @@ -0,0 +1,73 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_EnableEncryptionAtHost.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function createManagedClusterWithEncryptionAtHostEnabled() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters = { + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + count: 3, + enableEncryptionAtHost: true, + enableNodePublicIP: true, + mode: "System", + osType: "Linux", + vmSize: "Standard_DS2_v2", + }, + ], + autoScalerProfile: { scaleDownDelayAfterAdd: "15m", scanInterval: "20s" }, + diskEncryptionSetID: + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des", + dnsPrefix: "dnsprefix1", + enablePodSecurityPolicy: true, + enableRbac: true, + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] }, + }, + location: "location1", + networkProfile: { + loadBalancerProfile: { managedOutboundIPs: { count: 2 } }, + loadBalancerSku: "standard", + outboundType: "loadBalancer", + }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser", + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createManagedClusterWithEncryptionAtHostEnabled().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedClusterWithFipsEnabledOS.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedClusterWithFipsEnabledOS.js new file mode 100644 index 000000000000..33d248add827 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedClusterWithFipsEnabledOS.js @@ -0,0 +1,73 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_EnabledFIPS.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function createManagedClusterWithFipsEnabledOS() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters = { + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + count: 3, + enableFips: true, + enableNodePublicIP: true, + mode: "System", + osType: "Linux", + vmSize: "Standard_DS2_v2", + }, + ], + autoScalerProfile: { scaleDownDelayAfterAdd: "15m", scanInterval: "20s" }, + diskEncryptionSetID: + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des", + dnsPrefix: "dnsprefix1", + enablePodSecurityPolicy: false, + enableRbac: true, + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] }, + }, + location: "location1", + networkProfile: { + loadBalancerProfile: { managedOutboundIPs: { count: 2 } }, + loadBalancerSku: "standard", + outboundType: "loadBalancer", + }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser", + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createManagedClusterWithFipsEnabledOS().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedClusterWithGpumig.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedClusterWithGpumig.js new file mode 100644 index 000000000000..c30f611d5ee6 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedClusterWithGpumig.js @@ -0,0 +1,79 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_GPUMIG.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function createManagedClusterWithGpumig() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters = { + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + count: 3, + enableNodePublicIP: true, + gpuInstanceProfile: "MIG3g", + mode: "System", + osType: "Linux", + vmSize: "Standard_ND96asr_v4", + }, + ], + autoScalerProfile: { scaleDownDelayAfterAdd: "15m", scanInterval: "20s" }, + diskEncryptionSetID: + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des", + dnsPrefix: "dnsprefix1", + enablePodSecurityPolicy: true, + enableRbac: true, + httpProxyConfig: { + httpProxy: "http://myproxy.server.com:8080", + httpsProxy: "https://myproxy.server.com:8080", + noProxy: ["localhost", "127.0.0.1"], + trustedCa: "Q29uZ3JhdHMhIFlvdSBoYXZlIGZvdW5kIGEgaGlkZGVuIG1lc3NhZ2U=", + }, + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] }, + }, + location: "location1", + networkProfile: { + loadBalancerProfile: { managedOutboundIPs: { count: 2 } }, + loadBalancerSku: "standard", + outboundType: "loadBalancer", + }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser", + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createManagedClusterWithGpumig().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedClusterWithHttpProxyConfigured.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedClusterWithHttpProxyConfigured.js new file mode 100644 index 000000000000..dee98cf6bad3 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedClusterWithHttpProxyConfigured.js @@ -0,0 +1,78 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_HTTPProxy.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function createManagedClusterWithHttpProxyConfigured() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters = { + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + count: 3, + enableNodePublicIP: true, + mode: "System", + osType: "Linux", + vmSize: "Standard_DS2_v2", + }, + ], + autoScalerProfile: { scaleDownDelayAfterAdd: "15m", scanInterval: "20s" }, + diskEncryptionSetID: + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des", + dnsPrefix: "dnsprefix1", + enablePodSecurityPolicy: true, + enableRbac: true, + httpProxyConfig: { + httpProxy: "http://myproxy.server.com:8080", + httpsProxy: "https://myproxy.server.com:8080", + noProxy: ["localhost", "127.0.0.1"], + trustedCa: "Q29uZ3JhdHMhIFlvdSBoYXZlIGZvdW5kIGEgaGlkZGVuIG1lc3NhZ2U=", + }, + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] }, + }, + location: "location1", + networkProfile: { + loadBalancerProfile: { managedOutboundIPs: { count: 2 } }, + loadBalancerSku: "standard", + outboundType: "loadBalancer", + }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser", + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createManagedClusterWithHttpProxyConfigured().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedClusterWithNodePublicIPPrefix.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedClusterWithNodePublicIPPrefix.js new file mode 100644 index 000000000000..e60d26b4ce57 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedClusterWithNodePublicIPPrefix.js @@ -0,0 +1,74 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_NodePublicIPPrefix.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function createManagedClusterWithNodePublicIPPrefix() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters = { + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + count: 3, + enableNodePublicIP: true, + mode: "System", + nodePublicIPPrefixID: + "/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.Network/publicIPPrefixes/public-ip-prefix", + osType: "Linux", + vmSize: "Standard_DS2_v2", + }, + ], + autoScalerProfile: { scaleDownDelayAfterAdd: "15m", scanInterval: "20s" }, + diskEncryptionSetID: + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des", + dnsPrefix: "dnsprefix1", + enablePodSecurityPolicy: true, + enableRbac: true, + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] }, + }, + location: "location1", + networkProfile: { + loadBalancerProfile: { managedOutboundIPs: { count: 2 } }, + loadBalancerSku: "standard", + outboundType: "loadBalancer", + }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser", + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createManagedClusterWithNodePublicIPPrefix().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedClusterWithOssku.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedClusterWithOssku.js new file mode 100644 index 000000000000..e2436d1825a6 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedClusterWithOssku.js @@ -0,0 +1,79 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_OSSKU.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function createManagedClusterWithOssku() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters = { + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + count: 3, + enableNodePublicIP: true, + mode: "System", + osSKU: "CBLMariner", + osType: "Linux", + vmSize: "Standard_DS2_v2", + }, + ], + autoScalerProfile: { scaleDownDelayAfterAdd: "15m", scanInterval: "20s" }, + diskEncryptionSetID: + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des", + dnsPrefix: "dnsprefix1", + enablePodSecurityPolicy: true, + enableRbac: true, + httpProxyConfig: { + httpProxy: "http://myproxy.server.com:8080", + httpsProxy: "https://myproxy.server.com:8080", + noProxy: ["localhost", "127.0.0.1"], + trustedCa: "Q29uZ3JhdHMhIFlvdSBoYXZlIGZvdW5kIGEgaGlkZGVuIG1lc3NhZ2U=", + }, + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] }, + }, + location: "location1", + networkProfile: { + loadBalancerProfile: { managedOutboundIPs: { count: 2 } }, + loadBalancerSku: "standard", + outboundType: "loadBalancer", + }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser", + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createManagedClusterWithOssku().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedClusterWithPodIdentityEnabled.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedClusterWithPodIdentityEnabled.js new file mode 100644 index 000000000000..cd9317cc8def --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedClusterWithPodIdentityEnabled.js @@ -0,0 +1,73 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_PodIdentity.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function createManagedClusterWithPodIdentityEnabled() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters = { + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + count: 3, + enableNodePublicIP: true, + mode: "System", + osType: "Linux", + vmSize: "Standard_DS2_v2", + }, + ], + autoScalerProfile: { scaleDownDelayAfterAdd: "15m", scanInterval: "20s" }, + diskEncryptionSetID: + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des", + dnsPrefix: "dnsprefix1", + enablePodSecurityPolicy: true, + enableRbac: true, + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] }, + }, + location: "location1", + networkProfile: { + loadBalancerProfile: { managedOutboundIPs: { count: 2 } }, + loadBalancerSku: "standard", + outboundType: "loadBalancer", + }, + podIdentityProfile: { allowNetworkPluginKubenet: true, enabled: true }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser", + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createManagedClusterWithPodIdentityEnabled().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedClusterWithPpg.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedClusterWithPpg.js new file mode 100644 index 000000000000..2b93d9e4eff7 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedClusterWithPpg.js @@ -0,0 +1,74 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_PPG.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function createManagedClusterWithPpg() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters = { + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + count: 3, + enableNodePublicIP: true, + mode: "System", + osType: "Linux", + proximityPlacementGroupID: + "/subscriptions/subid1/resourcegroups/rg1/providers//Microsoft.Compute/proximityPlacementGroups/ppg1", + vmSize: "Standard_DS2_v2", + }, + ], + autoScalerProfile: { scaleDownDelayAfterAdd: "15m", scanInterval: "20s" }, + diskEncryptionSetID: + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des", + dnsPrefix: "dnsprefix1", + enablePodSecurityPolicy: true, + enableRbac: true, + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] }, + }, + location: "location1", + networkProfile: { + loadBalancerProfile: { managedOutboundIPs: { count: 2 } }, + loadBalancerSku: "standard", + outboundType: "loadBalancer", + }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser", + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createManagedClusterWithPpg().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedClusterWithRunCommandDisabled.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedClusterWithRunCommandDisabled.js new file mode 100644 index 000000000000..9d8bb6b9029a --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedClusterWithRunCommandDisabled.js @@ -0,0 +1,72 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_DisableRunCommand.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function createManagedClusterWithRunCommandDisabled() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters = { + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + count: 3, + enableEncryptionAtHost: true, + enableNodePublicIP: true, + mode: "System", + osType: "Linux", + vmSize: "Standard_DS2_v2", + }, + ], + apiServerAccessProfile: { disableRunCommand: true }, + autoScalerProfile: { scaleDownDelayAfterAdd: "15m", scanInterval: "20s" }, + dnsPrefix: "dnsprefix1", + enablePodSecurityPolicy: true, + enableRbac: true, + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] }, + }, + location: "location1", + networkProfile: { + loadBalancerProfile: { managedOutboundIPs: { count: 2 } }, + loadBalancerSku: "standard", + outboundType: "loadBalancer", + }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser", + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createManagedClusterWithRunCommandDisabled().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedClusterWithSecurityProfileConfigured.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedClusterWithSecurityProfileConfigured.js new file mode 100644 index 000000000000..915745a55dcf --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedClusterWithSecurityProfileConfigured.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. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_SecurityProfile.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function createManagedClusterWithSecurityProfileConfigured() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters = { + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + count: 3, + enableNodePublicIP: true, + mode: "System", + osType: "Linux", + vmSize: "Standard_DS2_v2", + }, + ], + dnsPrefix: "dnsprefix1", + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] }, + }, + location: "location1", + networkProfile: { + loadBalancerProfile: { managedOutboundIPs: { count: 2 } }, + loadBalancerSku: "standard", + outboundType: "loadBalancer", + }, + securityProfile: { + azureDefender: { + enabled: true, + logAnalyticsWorkspaceResourceId: + "/subscriptions/SUB_ID/resourcegroups/RG_NAME/providers/microsoft.operationalinsights/workspaces/WORKSPACE_NAME", + }, + }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createManagedClusterWithSecurityProfileConfigured().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedClusterWithUltraSsdEnabled.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedClusterWithUltraSsdEnabled.js new file mode 100644 index 000000000000..db8c43cb0193 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedClusterWithUltraSsdEnabled.js @@ -0,0 +1,73 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_EnableUltraSSD.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function createManagedClusterWithUltraSsdEnabled() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters = { + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + count: 3, + enableNodePublicIP: true, + enableUltraSSD: true, + mode: "System", + osType: "Linux", + vmSize: "Standard_DS2_v2", + }, + ], + autoScalerProfile: { scaleDownDelayAfterAdd: "15m", scanInterval: "20s" }, + diskEncryptionSetID: + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des", + dnsPrefix: "dnsprefix1", + enablePodSecurityPolicy: true, + enableRbac: true, + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] }, + }, + location: "location1", + networkProfile: { + loadBalancerProfile: { managedOutboundIPs: { count: 2 } }, + loadBalancerSku: "standard", + outboundType: "loadBalancer", + }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser", + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createManagedClusterWithUltraSsdEnabled().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedClusterWithUserAssignedNatGatewayAsOutboundType.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedClusterWithUserAssignedNatGatewayAsOutboundType.js new file mode 100644 index 000000000000..6a5a4eb6c895 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedClusterWithUserAssignedNatGatewayAsOutboundType.js @@ -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. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_UserAssignedNATGateway.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function createManagedClusterWithUserAssignedNatGatewayAsOutboundType() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters = { + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + count: 3, + enableNodePublicIP: false, + mode: "System", + osType: "Linux", + vmSize: "Standard_DS2_v2", + }, + ], + autoScalerProfile: { scaleDownDelayAfterAdd: "15m", scanInterval: "20s" }, + diskEncryptionSetID: + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des", + dnsPrefix: "dnsprefix1", + enablePodSecurityPolicy: true, + enableRbac: true, + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] }, + }, + location: "location1", + networkProfile: { + loadBalancerSku: "standard", + outboundType: "userAssignedNATGateway", + }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser", + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createManagedClusterWithUserAssignedNatGatewayAsOutboundType().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedPrivateClusterWithFqdnSubdomainSpecified.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedPrivateClusterWithFqdnSubdomainSpecified.js new file mode 100644 index 000000000000..04a6c745e775 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedPrivateClusterWithFqdnSubdomainSpecified.js @@ -0,0 +1,76 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_PrivateClusterFQDNSubdomain.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function createManagedPrivateClusterWithFqdnSubdomainSpecified() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters = { + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + count: 3, + enableEncryptionAtHost: true, + enableNodePublicIP: true, + mode: "System", + osType: "Linux", + vmSize: "Standard_DS2_v2", + }, + ], + apiServerAccessProfile: { + enablePrivateCluster: true, + privateDNSZone: + "/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.Network/privateDnsZones/privatelink.location1.azmk8s.io", + }, + autoScalerProfile: { scaleDownDelayAfterAdd: "15m", scanInterval: "20s" }, + enablePodSecurityPolicy: true, + enableRbac: true, + fqdnSubdomain: "domain1", + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] }, + }, + location: "location1", + networkProfile: { + loadBalancerProfile: { managedOutboundIPs: { count: 2 } }, + loadBalancerSku: "standard", + outboundType: "loadBalancer", + }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser", + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createManagedPrivateClusterWithFqdnSubdomainSpecified().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedPrivateClusterWithPublicFqdnSpecified.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedPrivateClusterWithPublicFqdnSpecified.js new file mode 100644 index 000000000000..b86f085e81c7 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createManagedPrivateClusterWithPublicFqdnSpecified.js @@ -0,0 +1,75 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_PrivateClusterPublicFQDN.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function createManagedPrivateClusterWithPublicFqdnSpecified() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters = { + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + count: 3, + enableEncryptionAtHost: true, + enableNodePublicIP: true, + mode: "System", + osType: "Linux", + vmSize: "Standard_DS2_v2", + }, + ], + apiServerAccessProfile: { + enablePrivateCluster: true, + enablePrivateClusterPublicFqdn: true, + }, + autoScalerProfile: { scaleDownDelayAfterAdd: "15m", scanInterval: "20s" }, + dnsPrefix: "dnsprefix1", + enablePodSecurityPolicy: true, + enableRbac: true, + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] }, + }, + location: "location1", + networkProfile: { + loadBalancerProfile: { managedOutboundIPs: { count: 2 } }, + loadBalancerSku: "standard", + outboundType: "loadBalancer", + }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser", + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createManagedPrivateClusterWithPublicFqdnSpecified().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/createOrUpdateAadManagedClusterWithEnableAzureRbac.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createOrUpdateAadManagedClusterWithEnableAzureRbac.js new file mode 100644 index 000000000000..261231b58887 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createOrUpdateAadManagedClusterWithEnableAzureRbac.js @@ -0,0 +1,74 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_UpdateWithEnableAzureRBAC.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function createOrUpdateAadManagedClusterWithEnableAzureRbac() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters = { + aadProfile: { enableAzureRbac: true, managed: true }, + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + availabilityZones: ["1", "2", "3"], + count: 3, + enableNodePublicIP: true, + mode: "System", + osType: "Linux", + vmSize: "Standard_DS1_v2", + }, + ], + autoScalerProfile: { scaleDownDelayAfterAdd: "15m", scanInterval: "20s" }, + diskEncryptionSetID: + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des", + dnsPrefix: "dnsprefix1", + enablePodSecurityPolicy: true, + enableRbac: true, + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] }, + }, + location: "location1", + networkProfile: { + loadBalancerProfile: { managedOutboundIPs: { count: 2 } }, + loadBalancerSku: "standard", + outboundType: "loadBalancer", + }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser", + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createOrUpdateAadManagedClusterWithEnableAzureRbac().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/createOrUpdateAgentPool.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createOrUpdateAgentPool.js new file mode 100644 index 000000000000..363b1f032713 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createOrUpdateAgentPool.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. +/** + * This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster. + * + * @summary Creates or updates an agent pool in the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_Update.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function createOrUpdateAgentPool() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const agentPoolName = "agentpool1"; + const parameters = { + count: 3, + mode: "User", + nodeLabels: { key1: "val1" }, + nodeTaints: ["Key1=Value1:NoSchedule"], + orchestratorVersion: "", + osType: "Linux", + scaleSetEvictionPolicy: "Delete", + scaleSetPriority: "Spot", + tags: { name1: "val1" }, + vmSize: "Standard_DS1_v2", + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + agentPoolName, + parameters + ); + console.log(result); +} + +createOrUpdateAgentPool().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/createOrUpdateMaintenanceConfiguration.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createOrUpdateMaintenanceConfiguration.js new file mode 100644 index 000000000000..40869e8fd926 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createOrUpdateMaintenanceConfiguration.js @@ -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. +/** + * This sample demonstrates how to Creates or updates a maintenance configuration in the specified managed cluster. + * + * @summary Creates or updates a maintenance configuration in the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/MaintenanceConfigurationsCreate_Update.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function createOrUpdateMaintenanceConfiguration() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const configName = "default"; + const parameters = { + notAllowedTime: [ + { + end: new Date("2020-11-30T12:00:00Z"), + start: new Date("2020-11-26T03:00:00Z"), + }, + ], + timeInWeek: [{ day: "Monday", hourSlots: [1, 2] }], + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.maintenanceConfigurations.createOrUpdate( + resourceGroupName, + resourceName, + configName, + parameters + ); + console.log(result); +} + +createOrUpdateMaintenanceConfiguration().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/createOrUpdateManagedCluster.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createOrUpdateManagedCluster.js new file mode 100644 index 000000000000..a6f726ff95e4 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createOrUpdateManagedCluster.js @@ -0,0 +1,89 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_Update.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function createOrUpdateManagedCluster() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters = { + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + availabilityZones: ["1", "2", "3"], + count: 3, + enableNodePublicIP: true, + mode: "System", + osType: "Linux", + scaleDownMode: "Deallocate", + vmSize: "Standard_DS1_v2", + }, + ], + autoScalerProfile: { + balanceSimilarNodeGroups: "true", + expander: "priority", + maxNodeProvisionTime: "15m", + newPodScaleUpDelay: "1m", + scaleDownDelayAfterAdd: "15m", + scanInterval: "20s", + skipNodesWithSystemPods: "false", + }, + diskEncryptionSetID: + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des", + dnsPrefix: "dnsprefix1", + enablePodSecurityPolicy: true, + enableRbac: true, + identity: { + type: "UserAssigned", + userAssignedIdentities: { + "/subscriptions/subid1/resourceGroups/rgName1/providers/MicrosoftManagedIdentity/userAssignedIdentities/identity1": + {}, + }, + }, + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] }, + }, + location: "location1", + networkProfile: { + loadBalancerProfile: { managedOutboundIPs: { count: 2 } }, + loadBalancerSku: "standard", + outboundType: "loadBalancer", + }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser", + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createOrUpdateManagedCluster().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/createOrUpdateManagedClusterWithDualStackNetworking.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createOrUpdateManagedClusterWithDualStackNetworking.js new file mode 100644 index 000000000000..305dbe59c98b --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createOrUpdateManagedClusterWithDualStackNetworking.js @@ -0,0 +1,90 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_DualStackNetworking.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function createOrUpdateManagedClusterWithDualStackNetworking() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters = { + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + availabilityZones: ["1", "2", "3"], + count: 3, + enableNodePublicIP: true, + mode: "System", + osType: "Linux", + scaleDownMode: "Deallocate", + vmSize: "Standard_DS1_v2", + }, + ], + autoScalerProfile: { + balanceSimilarNodeGroups: "true", + expander: "priority", + maxNodeProvisionTime: "15m", + newPodScaleUpDelay: "1m", + scaleDownDelayAfterAdd: "15m", + scanInterval: "20s", + skipNodesWithSystemPods: "false", + }, + diskEncryptionSetID: + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des", + dnsPrefix: "dnsprefix1", + enablePodSecurityPolicy: true, + enableRbac: true, + identity: { + type: "UserAssigned", + userAssignedIdentities: { + "/subscriptions/subid1/resourceGroups/rgName1/providers/MicrosoftManagedIdentity/userAssignedIdentities/identity1": + {}, + }, + }, + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] }, + }, + location: "location1", + networkProfile: { + ipFamilies: ["IPv4", "IPv6"], + loadBalancerProfile: { managedOutboundIPs: { count: 2 } }, + loadBalancerSku: "standard", + outboundType: "loadBalancer", + }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser", + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createOrUpdateManagedClusterWithDualStackNetworking().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/createOrUpdateManagedClusterWithEnableAhub.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createOrUpdateManagedClusterWithEnableAhub.js new file mode 100644 index 000000000000..319cfb8ad065 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createOrUpdateManagedClusterWithEnableAhub.js @@ -0,0 +1,81 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_UpdateWithAHUB.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function createOrUpdateManagedClusterWithEnableAhub() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters = { + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + availabilityZones: ["1", "2", "3"], + count: 3, + enableNodePublicIP: true, + mode: "System", + osType: "Linux", + vmSize: "Standard_DS1_v2", + }, + ], + autoScalerProfile: { scaleDownDelayAfterAdd: "15m", scanInterval: "20s" }, + diskEncryptionSetID: + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des", + dnsPrefix: "dnsprefix1", + enablePodSecurityPolicy: true, + enableRbac: true, + identity: { + type: "UserAssigned", + userAssignedIdentities: { + "/subscriptions/subid1/resourceGroups/rgName1/providers/MicrosoftManagedIdentity/userAssignedIdentities/identity1": + {}, + }, + }, + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] }, + }, + location: "location1", + networkProfile: { + loadBalancerProfile: { managedOutboundIPs: { count: 2 } }, + loadBalancerSku: "standard", + outboundType: "loadBalancer", + }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser", + licenseType: "Windows_Server", + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createOrUpdateManagedClusterWithEnableAhub().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/createOrUpdateManagedClusterWithWindowsGMsaEnabled.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createOrUpdateManagedClusterWithWindowsGMsaEnabled.js new file mode 100644 index 000000000000..aa8e7209b1ec --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createOrUpdateManagedClusterWithWindowsGMsaEnabled.js @@ -0,0 +1,81 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_UpdateWindowsGmsa.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function createOrUpdateManagedClusterWithWindowsGMsaEnabled() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters = { + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + availabilityZones: ["1", "2", "3"], + count: 3, + enableNodePublicIP: true, + mode: "System", + osType: "Linux", + vmSize: "Standard_DS1_v2", + }, + ], + autoScalerProfile: { scaleDownDelayAfterAdd: "15m", scanInterval: "20s" }, + diskEncryptionSetID: + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des", + dnsPrefix: "dnsprefix1", + enablePodSecurityPolicy: true, + enableRbac: true, + identity: { + type: "UserAssigned", + userAssignedIdentities: { + "/subscriptions/subid1/resourceGroups/rgName1/providers/MicrosoftManagedIdentity/userAssignedIdentities/identity1": + {}, + }, + }, + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] }, + }, + location: "location1", + networkProfile: { + loadBalancerProfile: { managedOutboundIPs: { count: 2 } }, + loadBalancerSku: "standard", + outboundType: "loadBalancer", + }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser", + gmsaProfile: { enabled: true }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createOrUpdateManagedClusterWithWindowsGMsaEnabled().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/createOrUpdateSnapshot.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createOrUpdateSnapshot.js new file mode 100644 index 000000000000..950cf4929188 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createOrUpdateSnapshot.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. +/** + * This sample demonstrates how to Creates or updates a snapshot. + * + * @summary Creates or updates a snapshot. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/SnapshotsCreate.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function createOrUpdateSnapshot() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "snapshot1"; + const parameters = { + creationData: { + sourceResourceId: + "/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/cluster1/agentPools/pool0", + }, + location: "westus", + tags: { key1: "val1", key2: "val2" }, + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.snapshots.createOrUpdate(resourceGroupName, resourceName, parameters); + console.log(result); +} + +createOrUpdateSnapshot().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/createSpotAgentPool.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createSpotAgentPool.js new file mode 100644 index 000000000000..484cf75f6fa6 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/createSpotAgentPool.js @@ -0,0 +1,47 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster. + * + * @summary Creates or updates an agent pool in the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_Spot.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function createSpotAgentPool() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const agentPoolName = "agentpool1"; + const parameters = { + count: 3, + nodeLabels: { key1: "val1" }, + nodeTaints: ["Key1=Value1:NoSchedule"], + orchestratorVersion: "", + osType: "Linux", + scaleSetEvictionPolicy: "Delete", + scaleSetPriority: "Spot", + tags: { name1: "val1" }, + vmSize: "Standard_DS1_v2", + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + agentPoolName, + parameters + ); + console.log(result); +} + +createSpotAgentPool().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/deleteAgentPool.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/deleteAgentPool.js new file mode 100644 index 000000000000..1be7ff9fb4ac --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/deleteAgentPool.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. +/** + * This sample demonstrates how to Deletes an agent pool in the specified managed cluster. + * + * @summary Deletes an agent pool in the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsDelete.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function deleteAgentPool() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const agentPoolName = "agentpool1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.beginDeleteAndWait( + resourceGroupName, + resourceName, + agentPoolName + ); + console.log(result); +} + +deleteAgentPool().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/deleteMaintenanceConfiguration.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/deleteMaintenanceConfiguration.js new file mode 100644 index 000000000000..7808ad14dc6e --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/deleteMaintenanceConfiguration.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. +/** + * This sample demonstrates how to Deletes a maintenance configuration. + * + * @summary Deletes a maintenance configuration. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/MaintenanceConfigurationsDelete.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function deleteMaintenanceConfiguration() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const configName = "default"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.maintenanceConfigurations.delete( + resourceGroupName, + resourceName, + configName + ); + console.log(result); +} + +deleteMaintenanceConfiguration().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/deleteManagedCluster.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/deleteManagedCluster.js new file mode 100644 index 000000000000..4bc6c2cefc5c --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/deleteManagedCluster.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. +/** + * This sample demonstrates how to Deletes a managed cluster. + * + * @summary Deletes a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersDelete.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function deleteManagedCluster() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginDeleteAndWait(resourceGroupName, resourceName); + console.log(result); +} + +deleteManagedCluster().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/deletePrivateEndpointConnection.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/deletePrivateEndpointConnection.js new file mode 100644 index 000000000000..195570ba5a3b --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/deletePrivateEndpointConnection.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. +/** + * This sample demonstrates how to Deletes a private endpoint connection. + * + * @summary Deletes a private endpoint connection. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/PrivateEndpointConnectionsDelete.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function deletePrivateEndpointConnection() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const privateEndpointConnectionName = "privateendpointconnection1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.beginDeleteAndWait( + resourceGroupName, + resourceName, + privateEndpointConnectionName + ); + console.log(result); +} + +deletePrivateEndpointConnection().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/deleteSnapshot.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/deleteSnapshot.js new file mode 100644 index 000000000000..1c9cf3f681b3 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/deleteSnapshot.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. +/** + * This sample demonstrates how to Deletes a snapshot. + * + * @summary Deletes a snapshot. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/SnapshotsDelete.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function deleteSnapshot() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "snapshot1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.snapshots.delete(resourceGroupName, resourceName); + console.log(result); +} + +deleteSnapshot().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/getAgentPool.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/getAgentPool.js new file mode 100644 index 000000000000..e7e37bfe2426 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/getAgentPool.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. +/** + * This sample demonstrates how to Gets the specified managed cluster agent pool. + * + * @summary Gets the specified managed cluster agent pool. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsGet.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function getAgentPool() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const agentPoolName = "agentpool1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.get(resourceGroupName, resourceName, agentPoolName); + console.log(result); +} + +getAgentPool().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/getAvailableVersionsForAgentPool.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/getAvailableVersionsForAgentPool.js new file mode 100644 index 000000000000..9820804ab6f2 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/getAvailableVersionsForAgentPool.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. +/** + * This sample demonstrates how to See [supported Kubernetes versions](https://docs.microsoft.com/azure/aks/supported-kubernetes-versions) for more details about the version lifecycle. + * + * @summary See [supported Kubernetes versions](https://docs.microsoft.com/azure/aks/supported-kubernetes-versions) for more details about the version lifecycle. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsGetAgentPoolAvailableVersions.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function getAvailableVersionsForAgentPool() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.getAvailableAgentPoolVersions( + resourceGroupName, + resourceName + ); + console.log(result); +} + +getAvailableVersionsForAgentPool().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/getContainerServiceOSOptions.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/getContainerServiceOSOptions.js new file mode 100644 index 000000000000..0ad1bda643c0 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/getContainerServiceOSOptions.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. +/** + * This sample demonstrates how to Gets supported OS options in the specified subscription. + * + * @summary Gets supported OS options in the specified subscription. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ContainerServiceGetOSOptions.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function getContainerServiceOSOptions() { + const subscriptionId = "subid1"; + const location = "location1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.getOSOptions(location); + console.log(result); +} + +getContainerServiceOSOptions().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/getMaintenanceConfiguration.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/getMaintenanceConfiguration.js new file mode 100644 index 000000000000..e5259f26615d --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/getMaintenanceConfiguration.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. +/** + * This sample demonstrates how to Gets the specified maintenance configuration of a managed cluster. + * + * @summary Gets the specified maintenance configuration of a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/MaintenanceConfigurationsGet.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function getMaintenanceConfiguration() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const configName = "default"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.maintenanceConfigurations.get( + resourceGroupName, + resourceName, + configName + ); + console.log(result); +} + +getMaintenanceConfiguration().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/getManagedCluster.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/getManagedCluster.js new file mode 100644 index 000000000000..bb58d0367806 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/getManagedCluster.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. +/** + * This sample demonstrates how to Gets a managed cluster. + * + * @summary Gets a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersGet.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function getManagedCluster() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.get(resourceGroupName, resourceName); + console.log(result); +} + +getManagedCluster().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/getManagedClustersByResourceGroup.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/getManagedClustersByResourceGroup.js new file mode 100644 index 000000000000..0f093f125b26 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/getManagedClustersByResourceGroup.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. +/** + * This sample demonstrates how to Lists managed clusters in the specified subscription and resource group. + * + * @summary Lists managed clusters in the specified subscription and resource group. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersListByResourceGroup.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function getManagedClustersByResourceGroup() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.managedClusters.listByResourceGroup(resourceGroupName)) { + resArray.push(item); + } + console.log(resArray); +} + +getManagedClustersByResourceGroup().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/getPrivateEndpointConnection.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/getPrivateEndpointConnection.js new file mode 100644 index 000000000000..cfa27e25428a --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/getPrivateEndpointConnection.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. +/** + * This sample demonstrates how to To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters + * + * @summary To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/PrivateEndpointConnectionsGet.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function getPrivateEndpointConnection() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const privateEndpointConnectionName = "privateendpointconnection1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.get( + resourceGroupName, + resourceName, + privateEndpointConnectionName + ); + console.log(result); +} + +getPrivateEndpointConnection().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/getSnapshot.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/getSnapshot.js new file mode 100644 index 000000000000..7efb39639237 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/getSnapshot.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. +/** + * This sample demonstrates how to Gets a snapshot. + * + * @summary Gets a snapshot. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/SnapshotsGet.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function getSnapshot() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "snapshot1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.snapshots.get(resourceGroupName, resourceName); + console.log(result); +} + +getSnapshot().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/getUpgradeProfileForAgentPool.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/getUpgradeProfileForAgentPool.js new file mode 100644 index 000000000000..04201a47715a --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/getUpgradeProfileForAgentPool.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. +/** + * This sample demonstrates how to Gets the upgrade profile for an agent pool. + * + * @summary Gets the upgrade profile for an agent pool. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsGetUpgradeProfile.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function getUpgradeProfileForAgentPool() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const agentPoolName = "agentpool1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.getUpgradeProfile( + resourceGroupName, + resourceName, + agentPoolName + ); + console.log(result); +} + +getUpgradeProfileForAgentPool().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/getUpgradeProfileForManagedCluster.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/getUpgradeProfileForManagedCluster.js new file mode 100644 index 000000000000..66d391247cae --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/getUpgradeProfileForManagedCluster.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. +/** + * This sample demonstrates how to Gets the upgrade profile of a managed cluster. + * + * @summary Gets the upgrade profile of a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersGetUpgradeProfile.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function getUpgradeProfileForManagedCluster() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.getUpgradeProfile(resourceGroupName, resourceName); + console.log(result); +} + +getUpgradeProfileForManagedCluster().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/listAgentPoolsByManagedCluster.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/listAgentPoolsByManagedCluster.js new file mode 100644 index 000000000000..d46bdd85cb0c --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/listAgentPoolsByManagedCluster.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. +/** + * This sample demonstrates how to Gets a list of agent pools in the specified managed cluster. + * + * @summary Gets a list of agent pools in the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsList.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function listAgentPoolsByManagedCluster() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.agentPools.list(resourceGroupName, resourceName)) { + resArray.push(item); + } + console.log(resArray); +} + +listAgentPoolsByManagedCluster().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/listAvailableOperationsForTheContainerServiceResourceProvider.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/listAvailableOperationsForTheContainerServiceResourceProvider.js new file mode 100644 index 000000000000..832f25008893 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/listAvailableOperationsForTheContainerServiceResourceProvider.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. +/** + * This sample demonstrates how to Gets a list of operations. + * + * @summary Gets a list of operations. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/Operation_List.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function listAvailableOperationsForTheContainerServiceResourceProvider() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +listAvailableOperationsForTheContainerServiceResourceProvider().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/listMaintenanceConfigurationsByManagedCluster.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/listMaintenanceConfigurationsByManagedCluster.js new file mode 100644 index 000000000000..813faef67060 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/listMaintenanceConfigurationsByManagedCluster.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. +/** + * This sample demonstrates how to Gets a list of maintenance configurations in the specified managed cluster. + * + * @summary Gets a list of maintenance configurations in the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/MaintenanceConfigurationsList.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function listMaintenanceConfigurationsByManagedCluster() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.maintenanceConfigurations.listByManagedCluster( + resourceGroupName, + resourceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +listMaintenanceConfigurationsByManagedCluster().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/listManagedClusters.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/listManagedClusters.js new file mode 100644 index 000000000000..8c81bd209a2c --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/listManagedClusters.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. +/** + * This sample demonstrates how to Gets a list of managed clusters in the specified subscription. + * + * @summary Gets a list of managed clusters in the specified subscription. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersList.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function listManagedClusters() { + const subscriptionId = "subid1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.managedClusters.list()) { + resArray.push(item); + } + console.log(resArray); +} + +listManagedClusters().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/listOutboundNetworkDependenciesEndpointsByManagedCluster.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/listOutboundNetworkDependenciesEndpointsByManagedCluster.js new file mode 100644 index 000000000000..67ec0e54a2cf --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/listOutboundNetworkDependenciesEndpointsByManagedCluster.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. +/** + * This sample demonstrates how to Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. The operation returns properties of each egress endpoint. + * + * @summary Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. The operation returns properties of each egress endpoint. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/OutboundNetworkDependenciesEndpointsList.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function listOutboundNetworkDependenciesEndpointsByManagedCluster() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.managedClusters.listOutboundNetworkDependenciesEndpoints( + resourceGroupName, + resourceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +listOutboundNetworkDependenciesEndpointsByManagedCluster().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/listPrivateEndpointConnectionsByManagedCluster.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/listPrivateEndpointConnectionsByManagedCluster.js new file mode 100644 index 000000000000..413c36392717 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/listPrivateEndpointConnectionsByManagedCluster.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. +/** + * This sample demonstrates how to To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters + * + * @summary To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/PrivateEndpointConnectionsList.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function listPrivateEndpointConnectionsByManagedCluster() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.list(resourceGroupName, resourceName); + console.log(result); +} + +listPrivateEndpointConnectionsByManagedCluster().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/listPrivateLinkResourcesByManagedCluster.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/listPrivateLinkResourcesByManagedCluster.js new file mode 100644 index 000000000000..94aeffb357e4 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/listPrivateLinkResourcesByManagedCluster.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. +/** + * This sample demonstrates how to To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters + * + * @summary To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/PrivateLinkResourcesList.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function listPrivateLinkResourcesByManagedCluster() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.privateLinkResources.list(resourceGroupName, resourceName); + console.log(result); +} + +listPrivateLinkResourcesByManagedCluster().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/listSnapshots.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/listSnapshots.js new file mode 100644 index 000000000000..44ece47204c1 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/listSnapshots.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. +/** + * This sample demonstrates how to Gets a list of snapshots in the specified subscription. + * + * @summary Gets a list of snapshots in the specified subscription. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/SnapshotsList.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function listSnapshots() { + const subscriptionId = "subid1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.snapshots.list()) { + resArray.push(item); + } + console.log(resArray); +} + +listSnapshots().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/listSnapshotsByResourceGroup.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/listSnapshotsByResourceGroup.js new file mode 100644 index 000000000000..8fe36c3de87e --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/listSnapshotsByResourceGroup.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. +/** + * This sample demonstrates how to Lists snapshots in the specified subscription and resource group. + * + * @summary Lists snapshots in the specified subscription and resource group. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/SnapshotsListByResourceGroup.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function listSnapshotsByResourceGroup() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.snapshots.listByResourceGroup(resourceGroupName)) { + resArray.push(item); + } + console.log(resArray); +} + +listSnapshotsByResourceGroup().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/package.json b/sdk/containerservice/arm-containerservice/samples/v15/javascript/package.json new file mode 100644 index 000000000000..447230cbb422 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/package.json @@ -0,0 +1,32 @@ +{ + "name": "azure-arm-containerservice-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/containerservice/arm-containerservice" + }, + "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/containerservice/arm-containerservice", + "dependencies": { + "@azure/arm-containerservice": "latest", + "dotenv": "latest", + "@azure/identity": "^2.0.1" + } +} diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/resetAadProfile.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/resetAadProfile.js new file mode 100644 index 000000000000..4a67f8d62add --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/resetAadProfile.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. +/** + * This sample demonstrates how to Reset the AAD Profile of a managed cluster. + * + * @summary Reset the AAD Profile of a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersResetAADProfile.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function resetAadProfile() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters = { + clientAppID: "clientappid", + serverAppID: "serverappid", + serverAppSecret: "serverappsecret", + tenantID: "tenantid", + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginResetAADProfileAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +resetAadProfile().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/resetServicePrincipalProfile.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/resetServicePrincipalProfile.js new file mode 100644 index 000000000000..adf16181626c --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/resetServicePrincipalProfile.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. +/** + * This sample demonstrates how to This action cannot be performed on a cluster that is not using a service principal + * + * @summary This action cannot be performed on a cluster that is not using a service principal + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersResetServicePrincipalProfile.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function resetServicePrincipalProfile() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters = { + clientId: "clientid", + secret: "secret", + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginResetServicePrincipalProfileAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +resetServicePrincipalProfile().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/resolveThePrivateLinkServiceIdForManagedCluster.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/resolveThePrivateLinkServiceIdForManagedCluster.js new file mode 100644 index 000000000000..e99122f3969f --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/resolveThePrivateLinkServiceIdForManagedCluster.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. +/** + * This sample demonstrates how to Gets the private link service ID for the specified managed cluster. + * + * @summary Gets the private link service ID for the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ResolvePrivateLinkServiceId.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function resolveThePrivateLinkServiceIdForManagedCluster() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters = { name: "management" }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.resolvePrivateLinkServiceId.post( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +resolveThePrivateLinkServiceIdForManagedCluster().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/rotateClusterCertificates.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/rotateClusterCertificates.js new file mode 100644 index 000000000000..8b591182309c --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/rotateClusterCertificates.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. +/** + * This sample demonstrates how to See [Certificate rotation](https://docs.microsoft.com/azure/aks/certificate-rotation) for more details about rotating managed cluster certificates. + * + * @summary See [Certificate rotation](https://docs.microsoft.com/azure/aks/certificate-rotation) for more details about rotating managed cluster certificates. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersRotateClusterCertificates.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function rotateClusterCertificates() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginRotateClusterCertificatesAndWait( + resourceGroupName, + resourceName + ); + console.log(result); +} + +rotateClusterCertificates().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/sample.env b/sdk/containerservice/arm-containerservice/samples/v15/javascript/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/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/containerservice/arm-containerservice/samples/v15/javascript/startAgentPool.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/startAgentPool.js new file mode 100644 index 000000000000..0780151e860b --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/startAgentPool.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. +/** + * This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster. + * + * @summary Creates or updates an agent pool in the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPools_Start.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function startAgentPool() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const agentPoolName = "agentpool1"; + const parameters = { powerState: { code: "Running" } }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + agentPoolName, + parameters + ); + console.log(result); +} + +startAgentPool().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/startManagedCluster.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/startManagedCluster.js new file mode 100644 index 000000000000..c0a38c5e48fa --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/startManagedCluster.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. +/** + * This sample demonstrates how to See [starting a cluster](https://docs.microsoft.com/azure/aks/start-stop-cluster) for more details about starting a cluster. + * + * @summary See [starting a cluster](https://docs.microsoft.com/azure/aks/start-stop-cluster) for more details about starting a cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersStart.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function startManagedCluster() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginStartAndWait(resourceGroupName, resourceName); + console.log(result); +} + +startManagedCluster().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/stopAgentPool.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/stopAgentPool.js new file mode 100644 index 000000000000..ce63fdf520f0 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/stopAgentPool.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. +/** + * This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster. + * + * @summary Creates or updates an agent pool in the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPools_Stop.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function stopAgentPool() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const agentPoolName = "agentpool1"; + const parameters = { powerState: { code: "Stopped" } }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + agentPoolName, + parameters + ); + console.log(result); +} + +stopAgentPool().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/stopManagedCluster.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/stopManagedCluster.js new file mode 100644 index 000000000000..602aa781a82b --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/stopManagedCluster.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. +/** + * This sample demonstrates how to This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a cluster stops the control plane and agent nodes entirely, while maintaining all object and cluster state. A cluster does not accrue charges while it is stopped. See [stopping a cluster](https://docs.microsoft.com/azure/aks/start-stop-cluster) for more details about stopping a cluster. + * + * @summary This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a cluster stops the control plane and agent nodes entirely, while maintaining all object and cluster state. A cluster does not accrue charges while it is stopped. See [stopping a cluster](https://docs.microsoft.com/azure/aks/start-stop-cluster) for more details about stopping a cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersStop.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function stopManagedCluster() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginStopAndWait(resourceGroupName, resourceName); + console.log(result); +} + +stopManagedCluster().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/submitNewCommand.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/submitNewCommand.js new file mode 100644 index 000000000000..38dddc196b31 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/submitNewCommand.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. +/** + * This sample demonstrates how to AKS will create a pod to run the command. This is primarily useful for private clusters. For more information see [AKS Run Command](https://docs.microsoft.com/azure/aks/private-clusters#aks-run-command-preview). + * + * @summary AKS will create a pod to run the command. This is primarily useful for private clusters. For more information see [AKS Run Command](https://docs.microsoft.com/azure/aks/private-clusters#aks-run-command-preview). + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/RunCommandRequest.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function submitNewCommand() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const requestPayload = { + clusterToken: "", + command: "kubectl apply -f ns.yaml", + context: "", + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginRunCommandAndWait( + resourceGroupName, + resourceName, + requestPayload + ); + console.log(result); +} + +submitNewCommand().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/updateAgentPool.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/updateAgentPool.js new file mode 100644 index 000000000000..f764ba5d3d43 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/updateAgentPool.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. +/** + * This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster. + * + * @summary Creates or updates an agent pool in the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPools_Update.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function updateAgentPool() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const agentPoolName = "agentpool1"; + const parameters = { + count: 3, + enableAutoScaling: true, + maxCount: 2, + minCount: 2, + nodeTaints: ["Key1=Value1:NoSchedule"], + orchestratorVersion: "", + osType: "Linux", + scaleSetEvictionPolicy: "Delete", + scaleSetPriority: "Spot", + vmSize: "Standard_DS1_v2", + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + agentPoolName, + parameters + ); + console.log(result); +} + +updateAgentPool().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/updateManagedClusterTags.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/updateManagedClusterTags.js new file mode 100644 index 000000000000..c35c2c855494 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/updateManagedClusterTags.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. +/** + * This sample demonstrates how to Updates tags on a managed cluster. + * + * @summary Updates tags on a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersUpdateTags.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function updateManagedClusterTags() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters = { tags: { archv3: "", tier: "testing" } }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginUpdateTagsAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +updateManagedClusterTags().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/updatePrivateEndpointConnection.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/updatePrivateEndpointConnection.js new file mode 100644 index 000000000000..f1dbc72f8dd0 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/updatePrivateEndpointConnection.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. +/** + * This sample demonstrates how to Updates a private endpoint connection. + * + * @summary Updates a private endpoint connection. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/PrivateEndpointConnectionsUpdate.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function updatePrivateEndpointConnection() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const privateEndpointConnectionName = "privateendpointconnection1"; + const parameters = { + privateLinkServiceConnectionState: { status: "Approved" }, + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.update( + resourceGroupName, + resourceName, + privateEndpointConnectionName, + parameters + ); + console.log(result); +} + +updatePrivateEndpointConnection().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/updateSnapshotTags.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/updateSnapshotTags.js new file mode 100644 index 000000000000..e841a03b8f02 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/updateSnapshotTags.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. +/** + * This sample demonstrates how to Updates tags on a snapshot. + * + * @summary Updates tags on a snapshot. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/SnapshotsUpdateTags.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function updateSnapshotTags() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "snapshot1"; + const parameters = { tags: { key2: "new-val2", key3: "val3" } }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.snapshots.updateTags(resourceGroupName, resourceName, parameters); + console.log(result); +} + +updateSnapshotTags().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/javascript/upgradeAgentPoolNodeImageVersion.js b/sdk/containerservice/arm-containerservice/samples/v15/javascript/upgradeAgentPoolNodeImageVersion.js new file mode 100644 index 000000000000..5ad0efbfa5d0 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/javascript/upgradeAgentPoolNodeImageVersion.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. +/** + * This sample demonstrates how to Upgrading the node image version of an agent pool applies the newest OS and runtime updates to the nodes. AKS provides one new image per week with the latest updates. For more details on node image versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade + * + * @summary Upgrading the node image version of an agent pool applies the newest OS and runtime updates to the nodes. AKS provides one new image per week with the latest updates. For more details on node image versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsUpgradeNodeImageVersion.json + */ +const { ContainerServiceClient } = require("@azure/arm-containerservice"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function upgradeAgentPoolNodeImageVersion() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const agentPoolName = "agentpool1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.beginUpgradeNodeImageVersionAndWait( + resourceGroupName, + resourceName, + agentPoolName + ); + console.log(result); +} + +upgradeAgentPoolNodeImageVersion().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/README.md b/sdk/containerservice/arm-containerservice/samples/v15/typescript/README.md new file mode 100644 index 000000000000..ec6ea5d976cb --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/README.md @@ -0,0 +1,211 @@ +# client library samples for TypeScript + +These sample programs show how to use the TypeScript client libraries for in some common scenarios. + +| **File Name** | **Description** | +| --------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| [commandFailedResult.ts][commandfailedresult] | Gets the results of a command which has been run on the Managed Cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/RunCommandResultFailed.json | +| [commandSucceedResult.ts][commandsucceedresult] | Gets the results of a command which has been run on the Managed Cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/RunCommandResultSucceed.json | +| [createAgentPoolUsingAnAgentPoolSnapshot.ts][createagentpoolusinganagentpoolsnapshot] | Creates or updates an agent pool in the specified managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_Snapshot.json | +| [createAgentPoolWithEncryptionAtHostEnabled.ts][createagentpoolwithencryptionathostenabled] | Creates or updates an agent pool in the specified managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_EnableEncryptionAtHost.json | +| [createAgentPoolWithEphemeralOSDisk.ts][createagentpoolwithephemeralosdisk] | Creates or updates an agent pool in the specified managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_Ephemeral.json | +| [createAgentPoolWithFipsEnabledOS.ts][createagentpoolwithfipsenabledos] | Creates or updates an agent pool in the specified managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_EnableFIPS.json | +| [createAgentPoolWithGpumig.ts][createagentpoolwithgpumig] | Creates or updates an agent pool in the specified managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_GPUMIG.json | +| [createAgentPoolWithKrustletAndTheWasiRuntime.ts][createagentpoolwithkrustletandthewasiruntime] | Creates or updates an agent pool in the specified managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_WasmWasi.json | +| [createAgentPoolWithKubeletConfigAndLinuxOSConfig.ts][createagentpoolwithkubeletconfigandlinuxosconfig] | Creates or updates an agent pool in the specified managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_CustomNodeConfig.json | +| [createAgentPoolWithOssku.ts][createagentpoolwithossku] | Creates or updates an agent pool in the specified managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_OSSKU.json | +| [createAgentPoolWithPpg.ts][createagentpoolwithppg] | Creates or updates an agent pool in the specified managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_PPG.json | +| [createAgentPoolWithUltraSsdEnabled.ts][createagentpoolwithultrassdenabled] | Creates or updates an agent pool in the specified managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_EnableUltraSSD.json | +| [createManagedClusterUsingAnAgentPoolSnapshot.ts][createmanagedclusterusinganagentpoolsnapshot] | Creates or updates a managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_Snapshot.json | +| [createManagedClusterWithAksManagedNatGatewayAsOutboundType.ts][createmanagedclusterwithaksmanagednatgatewayasoutboundtype] | Creates or updates a managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_ManagedNATGateway.json | +| [createManagedClusterWithEncryptionAtHostEnabled.ts][createmanagedclusterwithencryptionathostenabled] | Creates or updates a managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_EnableEncryptionAtHost.json | +| [createManagedClusterWithFipsEnabledOS.ts][createmanagedclusterwithfipsenabledos] | Creates or updates a managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_EnabledFIPS.json | +| [createManagedClusterWithGpumig.ts][createmanagedclusterwithgpumig] | Creates or updates a managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_GPUMIG.json | +| [createManagedClusterWithHttpProxyConfigured.ts][createmanagedclusterwithhttpproxyconfigured] | Creates or updates a managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_HTTPProxy.json | +| [createManagedClusterWithNodePublicIPPrefix.ts][createmanagedclusterwithnodepublicipprefix] | Creates or updates a managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_NodePublicIPPrefix.json | +| [createManagedClusterWithOssku.ts][createmanagedclusterwithossku] | Creates or updates a managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_OSSKU.json | +| [createManagedClusterWithPodIdentityEnabled.ts][createmanagedclusterwithpodidentityenabled] | Creates or updates a managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_PodIdentity.json | +| [createManagedClusterWithPpg.ts][createmanagedclusterwithppg] | Creates or updates a managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_PPG.json | +| [createManagedClusterWithRunCommandDisabled.ts][createmanagedclusterwithruncommanddisabled] | Creates or updates a managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_DisableRunCommand.json | +| [createManagedClusterWithSecurityProfileConfigured.ts][createmanagedclusterwithsecurityprofileconfigured] | Creates or updates a managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_SecurityProfile.json | +| [createManagedClusterWithUltraSsdEnabled.ts][createmanagedclusterwithultrassdenabled] | Creates or updates a managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_EnableUltraSSD.json | +| [createManagedClusterWithUserAssignedNatGatewayAsOutboundType.ts][createmanagedclusterwithuserassignednatgatewayasoutboundtype] | Creates or updates a managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_UserAssignedNATGateway.json | +| [createManagedPrivateClusterWithFqdnSubdomainSpecified.ts][createmanagedprivateclusterwithfqdnsubdomainspecified] | Creates or updates a managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_PrivateClusterFQDNSubdomain.json | +| [createManagedPrivateClusterWithPublicFqdnSpecified.ts][createmanagedprivateclusterwithpublicfqdnspecified] | Creates or updates a managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_PrivateClusterPublicFQDN.json | +| [createOrUpdateAadManagedClusterWithEnableAzureRbac.ts][createorupdateaadmanagedclusterwithenableazurerbac] | Creates or updates a managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_UpdateWithEnableAzureRBAC.json | +| [createOrUpdateAgentPool.ts][createorupdateagentpool] | Creates or updates an agent pool in the specified managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_Update.json | +| [createOrUpdateMaintenanceConfiguration.ts][createorupdatemaintenanceconfiguration] | Creates or updates a maintenance configuration in the specified managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/MaintenanceConfigurationsCreate_Update.json | +| [createOrUpdateManagedCluster.ts][createorupdatemanagedcluster] | Creates or updates a managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_Update.json | +| [createOrUpdateManagedClusterWithDualStackNetworking.ts][createorupdatemanagedclusterwithdualstacknetworking] | Creates or updates a managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_DualStackNetworking.json | +| [createOrUpdateManagedClusterWithEnableAhub.ts][createorupdatemanagedclusterwithenableahub] | Creates or updates a managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_UpdateWithAHUB.json | +| [createOrUpdateManagedClusterWithWindowsGMsaEnabled.ts][createorupdatemanagedclusterwithwindowsgmsaenabled] | Creates or updates a managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_UpdateWindowsGmsa.json | +| [createOrUpdateSnapshot.ts][createorupdatesnapshot] | Creates or updates a snapshot. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/SnapshotsCreate.json | +| [createSpotAgentPool.ts][createspotagentpool] | Creates or updates an agent pool in the specified managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_Spot.json | +| [deleteAgentPool.ts][deleteagentpool] | Deletes an agent pool in the specified managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsDelete.json | +| [deleteMaintenanceConfiguration.ts][deletemaintenanceconfiguration] | Deletes a maintenance configuration. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/MaintenanceConfigurationsDelete.json | +| [deleteManagedCluster.ts][deletemanagedcluster] | Deletes a managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersDelete.json | +| [deletePrivateEndpointConnection.ts][deleteprivateendpointconnection] | Deletes a private endpoint connection. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/PrivateEndpointConnectionsDelete.json | +| [deleteSnapshot.ts][deletesnapshot] | Deletes a snapshot. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/SnapshotsDelete.json | +| [getAgentPool.ts][getagentpool] | Gets the specified managed cluster agent pool. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsGet.json | +| [getAvailableVersionsForAgentPool.ts][getavailableversionsforagentpool] | See [supported Kubernetes versions](https://docs.microsoft.com/azure/aks/supported-kubernetes-versions) for more details about the version lifecycle. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsGetAgentPoolAvailableVersions.json | +| [getContainerServiceOSOptions.ts][getcontainerserviceosoptions] | Gets supported OS options in the specified subscription. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ContainerServiceGetOSOptions.json | +| [getMaintenanceConfiguration.ts][getmaintenanceconfiguration] | Gets the specified maintenance configuration of a managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/MaintenanceConfigurationsGet.json | +| [getManagedCluster.ts][getmanagedcluster] | Gets a managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersGet.json | +| [getManagedClustersByResourceGroup.ts][getmanagedclustersbyresourcegroup] | Lists managed clusters in the specified subscription and resource group. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersListByResourceGroup.json | +| [getPrivateEndpointConnection.ts][getprivateendpointconnection] | To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/PrivateEndpointConnectionsGet.json | +| [getSnapshot.ts][getsnapshot] | Gets a snapshot. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/SnapshotsGet.json | +| [getUpgradeProfileForAgentPool.ts][getupgradeprofileforagentpool] | Gets the upgrade profile for an agent pool. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsGetUpgradeProfile.json | +| [getUpgradeProfileForManagedCluster.ts][getupgradeprofileformanagedcluster] | Gets the upgrade profile of a managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersGetUpgradeProfile.json | +| [listAgentPoolsByManagedCluster.ts][listagentpoolsbymanagedcluster] | Gets a list of agent pools in the specified managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsList.json | +| [listAvailableOperationsForTheContainerServiceResourceProvider.ts][listavailableoperationsforthecontainerserviceresourceprovider] | Gets a list of operations. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/Operation_List.json | +| [listMaintenanceConfigurationsByManagedCluster.ts][listmaintenanceconfigurationsbymanagedcluster] | Gets a list of maintenance configurations in the specified managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/MaintenanceConfigurationsList.json | +| [listManagedClusters.ts][listmanagedclusters] | Gets a list of managed clusters in the specified subscription. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersList.json | +| [listOutboundNetworkDependenciesEndpointsByManagedCluster.ts][listoutboundnetworkdependenciesendpointsbymanagedcluster] | Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. The operation returns properties of each egress endpoint. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/OutboundNetworkDependenciesEndpointsList.json | +| [listPrivateEndpointConnectionsByManagedCluster.ts][listprivateendpointconnectionsbymanagedcluster] | To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/PrivateEndpointConnectionsList.json | +| [listPrivateLinkResourcesByManagedCluster.ts][listprivatelinkresourcesbymanagedcluster] | To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/PrivateLinkResourcesList.json | +| [listSnapshots.ts][listsnapshots] | Gets a list of snapshots in the specified subscription. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/SnapshotsList.json | +| [listSnapshotsByResourceGroup.ts][listsnapshotsbyresourcegroup] | Lists snapshots in the specified subscription and resource group. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/SnapshotsListByResourceGroup.json | +| [resetAadProfile.ts][resetaadprofile] | Reset the AAD Profile of a managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersResetAADProfile.json | +| [resetServicePrincipalProfile.ts][resetserviceprincipalprofile] | This action cannot be performed on a cluster that is not using a service principal x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersResetServicePrincipalProfile.json | +| [resolveThePrivateLinkServiceIdForManagedCluster.ts][resolvetheprivatelinkserviceidformanagedcluster] | Gets the private link service ID for the specified managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ResolvePrivateLinkServiceId.json | +| [rotateClusterCertificates.ts][rotateclustercertificates] | See [Certificate rotation](https://docs.microsoft.com/azure/aks/certificate-rotation) for more details about rotating managed cluster certificates. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersRotateClusterCertificates.json | +| [startAgentPool.ts][startagentpool] | Creates or updates an agent pool in the specified managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPools_Start.json | +| [startManagedCluster.ts][startmanagedcluster] | See [starting a cluster](https://docs.microsoft.com/azure/aks/start-stop-cluster) for more details about starting a cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersStart.json | +| [stopAgentPool.ts][stopagentpool] | Creates or updates an agent pool in the specified managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPools_Stop.json | +| [stopManagedCluster.ts][stopmanagedcluster] | This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a cluster stops the control plane and agent nodes entirely, while maintaining all object and cluster state. A cluster does not accrue charges while it is stopped. See [stopping a cluster](https://docs.microsoft.com/azure/aks/start-stop-cluster) for more details about stopping a cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersStop.json | +| [submitNewCommand.ts][submitnewcommand] | AKS will create a pod to run the command. This is primarily useful for private clusters. For more information see [AKS Run Command](https://docs.microsoft.com/azure/aks/private-clusters#aks-run-command-preview). x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/RunCommandRequest.json | +| [updateAgentPool.ts][updateagentpool] | Creates or updates an agent pool in the specified managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPools_Update.json | +| [updateManagedClusterTags.ts][updatemanagedclustertags] | Updates tags on a managed cluster. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersUpdateTags.json | +| [updatePrivateEndpointConnection.ts][updateprivateendpointconnection] | Updates a private endpoint connection. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/PrivateEndpointConnectionsUpdate.json | +| [updateSnapshotTags.ts][updatesnapshottags] | Updates tags on a snapshot. x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/SnapshotsUpdateTags.json | +| [upgradeAgentPoolNodeImageVersion.ts][upgradeagentpoolnodeimageversion] | Upgrading the node image version of an agent pool applies the newest OS and runtime updates to the nodes. AKS provides one new image per week with the latest updates. For more details on node image versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsUpgradeNodeImageVersion.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/commandFailedResult.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/commandFailedResult.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[commandfailedresult]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/commandFailedResult.ts +[commandsucceedresult]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/commandSucceedResult.ts +[createagentpoolusinganagentpoolsnapshot]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createAgentPoolUsingAnAgentPoolSnapshot.ts +[createagentpoolwithencryptionathostenabled]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createAgentPoolWithEncryptionAtHostEnabled.ts +[createagentpoolwithephemeralosdisk]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createAgentPoolWithEphemeralOSDisk.ts +[createagentpoolwithfipsenabledos]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createAgentPoolWithFipsEnabledOS.ts +[createagentpoolwithgpumig]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createAgentPoolWithGpumig.ts +[createagentpoolwithkrustletandthewasiruntime]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createAgentPoolWithKrustletAndTheWasiRuntime.ts +[createagentpoolwithkubeletconfigandlinuxosconfig]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createAgentPoolWithKubeletConfigAndLinuxOSConfig.ts +[createagentpoolwithossku]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createAgentPoolWithOssku.ts +[createagentpoolwithppg]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createAgentPoolWithPpg.ts +[createagentpoolwithultrassdenabled]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createAgentPoolWithUltraSsdEnabled.ts +[createmanagedclusterusinganagentpoolsnapshot]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedClusterUsingAnAgentPoolSnapshot.ts +[createmanagedclusterwithaksmanagednatgatewayasoutboundtype]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedClusterWithAksManagedNatGatewayAsOutboundType.ts +[createmanagedclusterwithencryptionathostenabled]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedClusterWithEncryptionAtHostEnabled.ts +[createmanagedclusterwithfipsenabledos]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedClusterWithFipsEnabledOS.ts +[createmanagedclusterwithgpumig]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedClusterWithGpumig.ts +[createmanagedclusterwithhttpproxyconfigured]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedClusterWithHttpProxyConfigured.ts +[createmanagedclusterwithnodepublicipprefix]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedClusterWithNodePublicIPPrefix.ts +[createmanagedclusterwithossku]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedClusterWithOssku.ts +[createmanagedclusterwithpodidentityenabled]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedClusterWithPodIdentityEnabled.ts +[createmanagedclusterwithppg]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedClusterWithPpg.ts +[createmanagedclusterwithruncommanddisabled]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedClusterWithRunCommandDisabled.ts +[createmanagedclusterwithsecurityprofileconfigured]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedClusterWithSecurityProfileConfigured.ts +[createmanagedclusterwithultrassdenabled]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedClusterWithUltraSsdEnabled.ts +[createmanagedclusterwithuserassignednatgatewayasoutboundtype]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedClusterWithUserAssignedNatGatewayAsOutboundType.ts +[createmanagedprivateclusterwithfqdnsubdomainspecified]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedPrivateClusterWithFqdnSubdomainSpecified.ts +[createmanagedprivateclusterwithpublicfqdnspecified]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedPrivateClusterWithPublicFqdnSpecified.ts +[createorupdateaadmanagedclusterwithenableazurerbac]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createOrUpdateAadManagedClusterWithEnableAzureRbac.ts +[createorupdateagentpool]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createOrUpdateAgentPool.ts +[createorupdatemaintenanceconfiguration]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createOrUpdateMaintenanceConfiguration.ts +[createorupdatemanagedcluster]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createOrUpdateManagedCluster.ts +[createorupdatemanagedclusterwithdualstacknetworking]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createOrUpdateManagedClusterWithDualStackNetworking.ts +[createorupdatemanagedclusterwithenableahub]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createOrUpdateManagedClusterWithEnableAhub.ts +[createorupdatemanagedclusterwithwindowsgmsaenabled]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createOrUpdateManagedClusterWithWindowsGMsaEnabled.ts +[createorupdatesnapshot]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createOrUpdateSnapshot.ts +[createspotagentpool]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createSpotAgentPool.ts +[deleteagentpool]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/deleteAgentPool.ts +[deletemaintenanceconfiguration]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/deleteMaintenanceConfiguration.ts +[deletemanagedcluster]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/deleteManagedCluster.ts +[deleteprivateendpointconnection]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/deletePrivateEndpointConnection.ts +[deletesnapshot]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/deleteSnapshot.ts +[getagentpool]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/getAgentPool.ts +[getavailableversionsforagentpool]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/getAvailableVersionsForAgentPool.ts +[getcontainerserviceosoptions]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/getContainerServiceOSOptions.ts +[getmaintenanceconfiguration]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/getMaintenanceConfiguration.ts +[getmanagedcluster]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/getManagedCluster.ts +[getmanagedclustersbyresourcegroup]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/getManagedClustersByResourceGroup.ts +[getprivateendpointconnection]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/getPrivateEndpointConnection.ts +[getsnapshot]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/getSnapshot.ts +[getupgradeprofileforagentpool]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/getUpgradeProfileForAgentPool.ts +[getupgradeprofileformanagedcluster]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/getUpgradeProfileForManagedCluster.ts +[listagentpoolsbymanagedcluster]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/listAgentPoolsByManagedCluster.ts +[listavailableoperationsforthecontainerserviceresourceprovider]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/listAvailableOperationsForTheContainerServiceResourceProvider.ts +[listmaintenanceconfigurationsbymanagedcluster]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/listMaintenanceConfigurationsByManagedCluster.ts +[listmanagedclusters]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/listManagedClusters.ts +[listoutboundnetworkdependenciesendpointsbymanagedcluster]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/listOutboundNetworkDependenciesEndpointsByManagedCluster.ts +[listprivateendpointconnectionsbymanagedcluster]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/listPrivateEndpointConnectionsByManagedCluster.ts +[listprivatelinkresourcesbymanagedcluster]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/listPrivateLinkResourcesByManagedCluster.ts +[listsnapshots]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/listSnapshots.ts +[listsnapshotsbyresourcegroup]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/listSnapshotsByResourceGroup.ts +[resetaadprofile]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/resetAadProfile.ts +[resetserviceprincipalprofile]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/resetServicePrincipalProfile.ts +[resolvetheprivatelinkserviceidformanagedcluster]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/resolveThePrivateLinkServiceIdForManagedCluster.ts +[rotateclustercertificates]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/rotateClusterCertificates.ts +[startagentpool]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/startAgentPool.ts +[startmanagedcluster]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/startManagedCluster.ts +[stopagentpool]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/stopAgentPool.ts +[stopmanagedcluster]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/stopManagedCluster.ts +[submitnewcommand]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/submitNewCommand.ts +[updateagentpool]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/updateAgentPool.ts +[updatemanagedclustertags]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/updateManagedClusterTags.ts +[updateprivateendpointconnection]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/updatePrivateEndpointConnection.ts +[updatesnapshottags]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/updateSnapshotTags.ts +[upgradeagentpoolnodeimageversion]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/upgradeAgentPoolNodeImageVersion.ts +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-containerservice?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/containerservice/arm-containerservice/README.md +[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/package.json b/sdk/containerservice/arm-containerservice/samples/v15/typescript/package.json new file mode 100644 index 000000000000..571fc8ad43a5 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/package.json @@ -0,0 +1,41 @@ +{ + "name": "azure-arm-containerservice-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/containerservice/arm-containerservice" + }, + "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/containerservice/arm-containerservice", + "dependencies": { + "@azure/arm-containerservice": "latest", + "dotenv": "latest", + "@azure/identity": "^2.0.1" + }, + "devDependencies": { + "@types/node": "^12.0.0", + "typescript": "~4.4.0", + "rimraf": "latest" + } +} diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/sample.env b/sdk/containerservice/arm-containerservice/samples/v15/typescript/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/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/containerservice/arm-containerservice/samples/v15/typescript/src/commandFailedResult.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/commandFailedResult.ts new file mode 100644 index 000000000000..9cbe6e5acbf3 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/commandFailedResult.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. +/** + * This sample demonstrates how to Gets the results of a command which has been run on the Managed Cluster. + * + * @summary Gets the results of a command which has been run on the Managed Cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/RunCommandResultFailed.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function commandFailedResult() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const commandId = "def7b3ea71bd4f7e9d226ddbc0f00ad9"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.getCommandResult( + resourceGroupName, + resourceName, + commandId + ); + console.log(result); +} + +commandFailedResult().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/commandSucceedResult.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/commandSucceedResult.ts new file mode 100644 index 000000000000..85dcad6433e6 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/commandSucceedResult.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. +/** + * This sample demonstrates how to Gets the results of a command which has been run on the Managed Cluster. + * + * @summary Gets the results of a command which has been run on the Managed Cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/RunCommandResultSucceed.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function commandSucceedResult() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const commandId = "def7b3ea71bd4f7e9d226ddbc0f00ad9"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.getCommandResult( + resourceGroupName, + resourceName, + commandId + ); + console.log(result); +} + +commandSucceedResult().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createAgentPoolUsingAnAgentPoolSnapshot.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createAgentPoolUsingAnAgentPoolSnapshot.ts new file mode 100644 index 000000000000..5a603cb40100 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createAgentPoolUsingAnAgentPoolSnapshot.ts @@ -0,0 +1,47 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster. + * + * @summary Creates or updates an agent pool in the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_Snapshot.json + */ +import { AgentPool, ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createAgentPoolUsingAnAgentPoolSnapshot() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const agentPoolName = "agentpool1"; + const parameters: AgentPool = { + count: 3, + creationData: { + sourceResourceId: + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.ContainerService/snapshots/snapshot1" + }, + enableFips: true, + orchestratorVersion: "", + osType: "Linux", + vmSize: "Standard_DS2_v2" + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + agentPoolName, + parameters + ); + console.log(result); +} + +createAgentPoolUsingAnAgentPoolSnapshot().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createAgentPoolWithEncryptionAtHostEnabled.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createAgentPoolWithEncryptionAtHostEnabled.ts new file mode 100644 index 000000000000..615937aecc3d --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createAgentPoolWithEncryptionAtHostEnabled.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. +/** + * This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster. + * + * @summary Creates or updates an agent pool in the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_EnableEncryptionAtHost.json + */ +import { AgentPool, ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createAgentPoolWithEncryptionAtHostEnabled() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const agentPoolName = "agentpool1"; + const parameters: AgentPool = { + count: 3, + enableEncryptionAtHost: true, + orchestratorVersion: "", + osType: "Linux", + vmSize: "Standard_DS2_v2" + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + agentPoolName, + parameters + ); + console.log(result); +} + +createAgentPoolWithEncryptionAtHostEnabled().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createAgentPoolWithEphemeralOSDisk.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createAgentPoolWithEphemeralOSDisk.ts new file mode 100644 index 000000000000..d6ae50f316bf --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createAgentPoolWithEphemeralOSDisk.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster. + * + * @summary Creates or updates an agent pool in the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_Ephemeral.json + */ +import { AgentPool, ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createAgentPoolWithEphemeralOSDisk() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const agentPoolName = "agentpool1"; + const parameters: AgentPool = { + count: 3, + orchestratorVersion: "", + osDiskSizeGB: 64, + osDiskType: "Ephemeral", + osType: "Linux", + vmSize: "Standard_DS2_v2" + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + agentPoolName, + parameters + ); + console.log(result); +} + +createAgentPoolWithEphemeralOSDisk().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createAgentPoolWithFipsEnabledOS.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createAgentPoolWithFipsEnabledOS.ts new file mode 100644 index 000000000000..10b8598d5f1c --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createAgentPoolWithFipsEnabledOS.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. +/** + * This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster. + * + * @summary Creates or updates an agent pool in the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_EnableFIPS.json + */ +import { AgentPool, ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createAgentPoolWithFipsEnabledOS() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const agentPoolName = "agentpool1"; + const parameters: AgentPool = { + count: 3, + enableFips: true, + orchestratorVersion: "", + osType: "Linux", + vmSize: "Standard_DS2_v2" + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + agentPoolName, + parameters + ); + console.log(result); +} + +createAgentPoolWithFipsEnabledOS().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createAgentPoolWithGpumig.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createAgentPoolWithGpumig.ts new file mode 100644 index 000000000000..91d06caaed3b --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createAgentPoolWithGpumig.ts @@ -0,0 +1,64 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster. + * + * @summary Creates or updates an agent pool in the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_GPUMIG.json + */ +import { AgentPool, ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createAgentPoolWithGpumig() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const agentPoolName = "agentpool1"; + const parameters: AgentPool = { + count: 3, + gpuInstanceProfile: "MIG2g", + kubeletConfig: { + allowedUnsafeSysctls: ["kernel.msg*", "net.core.somaxconn"], + cpuCfsQuota: true, + cpuCfsQuotaPeriod: "200ms", + cpuManagerPolicy: "static", + failSwapOn: false, + imageGcHighThreshold: 90, + imageGcLowThreshold: 70, + topologyManagerPolicy: "best-effort" + }, + linuxOSConfig: { + swapFileSizeMB: 1500, + sysctls: { + kernelThreadsMax: 99999, + netCoreWmemDefault: 12345, + netIpv4IpLocalPortRange: "20000 60000", + netIpv4TcpTwReuse: true + }, + transparentHugePageDefrag: "madvise", + transparentHugePageEnabled: "always" + }, + orchestratorVersion: "", + osType: "Linux", + vmSize: "Standard_ND96asr_v4" + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + agentPoolName, + parameters + ); + console.log(result); +} + +createAgentPoolWithGpumig().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createAgentPoolWithKrustletAndTheWasiRuntime.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createAgentPoolWithKrustletAndTheWasiRuntime.ts new file mode 100644 index 000000000000..4f1575c18522 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createAgentPoolWithKrustletAndTheWasiRuntime.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. +/** + * This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster. + * + * @summary Creates or updates an agent pool in the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_WasmWasi.json + */ +import { AgentPool, ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createAgentPoolWithKrustletAndTheWasiRuntime() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const agentPoolName = "agentpool1"; + const parameters: AgentPool = { + count: 3, + mode: "User", + orchestratorVersion: "", + osDiskSizeGB: 64, + osType: "Linux", + vmSize: "Standard_DS2_v2", + workloadRuntime: "WasmWasi" + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + agentPoolName, + parameters + ); + console.log(result); +} + +createAgentPoolWithKrustletAndTheWasiRuntime().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createAgentPoolWithKubeletConfigAndLinuxOSConfig.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createAgentPoolWithKubeletConfigAndLinuxOSConfig.ts new file mode 100644 index 000000000000..e3757240cf85 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createAgentPoolWithKubeletConfigAndLinuxOSConfig.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. +/** + * This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster. + * + * @summary Creates or updates an agent pool in the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_CustomNodeConfig.json + */ +import { AgentPool, ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createAgentPoolWithKubeletConfigAndLinuxOSConfig() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const agentPoolName = "agentpool1"; + const parameters: AgentPool = { + count: 3, + kubeletConfig: { + allowedUnsafeSysctls: ["kernel.msg*", "net.core.somaxconn"], + cpuCfsQuota: true, + cpuCfsQuotaPeriod: "200ms", + cpuManagerPolicy: "static", + failSwapOn: false, + imageGcHighThreshold: 90, + imageGcLowThreshold: 70, + topologyManagerPolicy: "best-effort" + }, + linuxOSConfig: { + swapFileSizeMB: 1500, + sysctls: { + kernelThreadsMax: 99999, + netCoreWmemDefault: 12345, + netIpv4IpLocalPortRange: "20000 60000", + netIpv4TcpTwReuse: true + }, + transparentHugePageDefrag: "madvise", + transparentHugePageEnabled: "always" + }, + orchestratorVersion: "", + osType: "Linux", + vmSize: "Standard_DS2_v2" + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + agentPoolName, + parameters + ); + console.log(result); +} + +createAgentPoolWithKubeletConfigAndLinuxOSConfig().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createAgentPoolWithOssku.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createAgentPoolWithOssku.ts new file mode 100644 index 000000000000..f51c123aa8de --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createAgentPoolWithOssku.ts @@ -0,0 +1,64 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster. + * + * @summary Creates or updates an agent pool in the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_OSSKU.json + */ +import { AgentPool, ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createAgentPoolWithOssku() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const agentPoolName = "agentpool1"; + const parameters: AgentPool = { + count: 3, + kubeletConfig: { + allowedUnsafeSysctls: ["kernel.msg*", "net.core.somaxconn"], + cpuCfsQuota: true, + cpuCfsQuotaPeriod: "200ms", + cpuManagerPolicy: "static", + failSwapOn: false, + imageGcHighThreshold: 90, + imageGcLowThreshold: 70, + topologyManagerPolicy: "best-effort" + }, + linuxOSConfig: { + swapFileSizeMB: 1500, + sysctls: { + kernelThreadsMax: 99999, + netCoreWmemDefault: 12345, + netIpv4IpLocalPortRange: "20000 60000", + netIpv4TcpTwReuse: true + }, + transparentHugePageDefrag: "madvise", + transparentHugePageEnabled: "always" + }, + orchestratorVersion: "", + osSKU: "CBLMariner", + osType: "Linux", + vmSize: "Standard_DS2_v2" + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + agentPoolName, + parameters + ); + console.log(result); +} + +createAgentPoolWithOssku().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createAgentPoolWithPpg.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createAgentPoolWithPpg.ts new file mode 100644 index 000000000000..1267606f3a53 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createAgentPoolWithPpg.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster. + * + * @summary Creates or updates an agent pool in the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_PPG.json + */ +import { AgentPool, ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createAgentPoolWithPpg() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const agentPoolName = "agentpool1"; + const parameters: AgentPool = { + count: 3, + orchestratorVersion: "", + osType: "Linux", + proximityPlacementGroupID: + "/subscriptions/subid1/resourcegroups/rg1/providers//Microsoft.Compute/proximityPlacementGroups/ppg1", + vmSize: "Standard_DS2_v2" + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + agentPoolName, + parameters + ); + console.log(result); +} + +createAgentPoolWithPpg().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createAgentPoolWithUltraSsdEnabled.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createAgentPoolWithUltraSsdEnabled.ts new file mode 100644 index 000000000000..0e0fb907fc64 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createAgentPoolWithUltraSsdEnabled.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. +/** + * This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster. + * + * @summary Creates or updates an agent pool in the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_EnableUltraSSD.json + */ +import { AgentPool, ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createAgentPoolWithUltraSsdEnabled() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const agentPoolName = "agentpool1"; + const parameters: AgentPool = { + count: 3, + enableUltraSSD: true, + orchestratorVersion: "", + osType: "Linux", + vmSize: "Standard_DS2_v2" + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + agentPoolName, + parameters + ); + console.log(result); +} + +createAgentPoolWithUltraSsdEnabled().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedClusterUsingAnAgentPoolSnapshot.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedClusterUsingAnAgentPoolSnapshot.ts new file mode 100644 index 000000000000..5ba30e202d27 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedClusterUsingAnAgentPoolSnapshot.ts @@ -0,0 +1,80 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_Snapshot.json + */ +import { + ManagedCluster, + ContainerServiceClient +} from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createManagedClusterUsingAnAgentPoolSnapshot() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters: ManagedCluster = { + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + count: 3, + creationData: { + sourceResourceId: + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.ContainerService/snapshots/snapshot1" + }, + enableFips: true, + enableNodePublicIP: true, + mode: "System", + osType: "Linux", + vmSize: "Standard_DS2_v2" + } + ], + autoScalerProfile: { scaleDownDelayAfterAdd: "15m", scanInterval: "20s" }, + diskEncryptionSetID: + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des", + dnsPrefix: "dnsprefix1", + enablePodSecurityPolicy: false, + enableRbac: true, + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] } + }, + location: "location1", + networkProfile: { + loadBalancerProfile: { managedOutboundIPs: { count: 2 } }, + loadBalancerSku: "standard", + outboundType: "loadBalancer" + }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser" + } + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createManagedClusterUsingAnAgentPoolSnapshot().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedClusterWithAksManagedNatGatewayAsOutboundType.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedClusterWithAksManagedNatGatewayAsOutboundType.ts new file mode 100644 index 000000000000..181970a8528a --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedClusterWithAksManagedNatGatewayAsOutboundType.ts @@ -0,0 +1,77 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_ManagedNATGateway.json + */ +import { + ManagedCluster, + ContainerServiceClient +} from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createManagedClusterWithAksManagedNatGatewayAsOutboundType() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters: ManagedCluster = { + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + count: 3, + enableNodePublicIP: false, + mode: "System", + osType: "Linux", + vmSize: "Standard_DS2_v2" + } + ], + autoScalerProfile: { scaleDownDelayAfterAdd: "15m", scanInterval: "20s" }, + diskEncryptionSetID: + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des", + dnsPrefix: "dnsprefix1", + enablePodSecurityPolicy: true, + enableRbac: true, + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] } + }, + location: "location1", + networkProfile: { + loadBalancerSku: "standard", + natGatewayProfile: { managedOutboundIPProfile: { count: 2 } }, + outboundType: "managedNATGateway" + }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser" + } + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createManagedClusterWithAksManagedNatGatewayAsOutboundType().catch( + console.error +); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedClusterWithEncryptionAtHostEnabled.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedClusterWithEncryptionAtHostEnabled.ts new file mode 100644 index 000000000000..e505c2f2f7e7 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedClusterWithEncryptionAtHostEnabled.ts @@ -0,0 +1,76 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_EnableEncryptionAtHost.json + */ +import { + ManagedCluster, + ContainerServiceClient +} from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createManagedClusterWithEncryptionAtHostEnabled() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters: ManagedCluster = { + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + count: 3, + enableEncryptionAtHost: true, + enableNodePublicIP: true, + mode: "System", + osType: "Linux", + vmSize: "Standard_DS2_v2" + } + ], + autoScalerProfile: { scaleDownDelayAfterAdd: "15m", scanInterval: "20s" }, + diskEncryptionSetID: + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des", + dnsPrefix: "dnsprefix1", + enablePodSecurityPolicy: true, + enableRbac: true, + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] } + }, + location: "location1", + networkProfile: { + loadBalancerProfile: { managedOutboundIPs: { count: 2 } }, + loadBalancerSku: "standard", + outboundType: "loadBalancer" + }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser" + } + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createManagedClusterWithEncryptionAtHostEnabled().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedClusterWithFipsEnabledOS.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedClusterWithFipsEnabledOS.ts new file mode 100644 index 000000000000..5617fca5d656 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedClusterWithFipsEnabledOS.ts @@ -0,0 +1,76 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_EnabledFIPS.json + */ +import { + ManagedCluster, + ContainerServiceClient +} from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createManagedClusterWithFipsEnabledOS() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters: ManagedCluster = { + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + count: 3, + enableFips: true, + enableNodePublicIP: true, + mode: "System", + osType: "Linux", + vmSize: "Standard_DS2_v2" + } + ], + autoScalerProfile: { scaleDownDelayAfterAdd: "15m", scanInterval: "20s" }, + diskEncryptionSetID: + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des", + dnsPrefix: "dnsprefix1", + enablePodSecurityPolicy: false, + enableRbac: true, + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] } + }, + location: "location1", + networkProfile: { + loadBalancerProfile: { managedOutboundIPs: { count: 2 } }, + loadBalancerSku: "standard", + outboundType: "loadBalancer" + }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser" + } + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createManagedClusterWithFipsEnabledOS().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedClusterWithGpumig.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedClusterWithGpumig.ts new file mode 100644 index 000000000000..6f3a230b00f8 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedClusterWithGpumig.ts @@ -0,0 +1,82 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_GPUMIG.json + */ +import { + ManagedCluster, + ContainerServiceClient +} from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createManagedClusterWithGpumig() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters: ManagedCluster = { + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + count: 3, + enableNodePublicIP: true, + gpuInstanceProfile: "MIG3g", + mode: "System", + osType: "Linux", + vmSize: "Standard_ND96asr_v4" + } + ], + autoScalerProfile: { scaleDownDelayAfterAdd: "15m", scanInterval: "20s" }, + diskEncryptionSetID: + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des", + dnsPrefix: "dnsprefix1", + enablePodSecurityPolicy: true, + enableRbac: true, + httpProxyConfig: { + httpProxy: "http://myproxy.server.com:8080", + httpsProxy: "https://myproxy.server.com:8080", + noProxy: ["localhost", "127.0.0.1"], + trustedCa: "Q29uZ3JhdHMhIFlvdSBoYXZlIGZvdW5kIGEgaGlkZGVuIG1lc3NhZ2U=" + }, + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] } + }, + location: "location1", + networkProfile: { + loadBalancerProfile: { managedOutboundIPs: { count: 2 } }, + loadBalancerSku: "standard", + outboundType: "loadBalancer" + }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser" + } + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createManagedClusterWithGpumig().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedClusterWithHttpProxyConfigured.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedClusterWithHttpProxyConfigured.ts new file mode 100644 index 000000000000..4e17d164b0bb --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedClusterWithHttpProxyConfigured.ts @@ -0,0 +1,81 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_HTTPProxy.json + */ +import { + ManagedCluster, + ContainerServiceClient +} from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createManagedClusterWithHttpProxyConfigured() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters: ManagedCluster = { + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + count: 3, + enableNodePublicIP: true, + mode: "System", + osType: "Linux", + vmSize: "Standard_DS2_v2" + } + ], + autoScalerProfile: { scaleDownDelayAfterAdd: "15m", scanInterval: "20s" }, + diskEncryptionSetID: + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des", + dnsPrefix: "dnsprefix1", + enablePodSecurityPolicy: true, + enableRbac: true, + httpProxyConfig: { + httpProxy: "http://myproxy.server.com:8080", + httpsProxy: "https://myproxy.server.com:8080", + noProxy: ["localhost", "127.0.0.1"], + trustedCa: "Q29uZ3JhdHMhIFlvdSBoYXZlIGZvdW5kIGEgaGlkZGVuIG1lc3NhZ2U=" + }, + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] } + }, + location: "location1", + networkProfile: { + loadBalancerProfile: { managedOutboundIPs: { count: 2 } }, + loadBalancerSku: "standard", + outboundType: "loadBalancer" + }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser" + } + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createManagedClusterWithHttpProxyConfigured().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedClusterWithNodePublicIPPrefix.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedClusterWithNodePublicIPPrefix.ts new file mode 100644 index 000000000000..46634263760a --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedClusterWithNodePublicIPPrefix.ts @@ -0,0 +1,77 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_NodePublicIPPrefix.json + */ +import { + ManagedCluster, + ContainerServiceClient +} from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createManagedClusterWithNodePublicIPPrefix() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters: ManagedCluster = { + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + count: 3, + enableNodePublicIP: true, + mode: "System", + nodePublicIPPrefixID: + "/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.Network/publicIPPrefixes/public-ip-prefix", + osType: "Linux", + vmSize: "Standard_DS2_v2" + } + ], + autoScalerProfile: { scaleDownDelayAfterAdd: "15m", scanInterval: "20s" }, + diskEncryptionSetID: + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des", + dnsPrefix: "dnsprefix1", + enablePodSecurityPolicy: true, + enableRbac: true, + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] } + }, + location: "location1", + networkProfile: { + loadBalancerProfile: { managedOutboundIPs: { count: 2 } }, + loadBalancerSku: "standard", + outboundType: "loadBalancer" + }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser" + } + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createManagedClusterWithNodePublicIPPrefix().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedClusterWithOssku.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedClusterWithOssku.ts new file mode 100644 index 000000000000..b21e4283e40e --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedClusterWithOssku.ts @@ -0,0 +1,82 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_OSSKU.json + */ +import { + ManagedCluster, + ContainerServiceClient +} from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createManagedClusterWithOssku() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters: ManagedCluster = { + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + count: 3, + enableNodePublicIP: true, + mode: "System", + osSKU: "CBLMariner", + osType: "Linux", + vmSize: "Standard_DS2_v2" + } + ], + autoScalerProfile: { scaleDownDelayAfterAdd: "15m", scanInterval: "20s" }, + diskEncryptionSetID: + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des", + dnsPrefix: "dnsprefix1", + enablePodSecurityPolicy: true, + enableRbac: true, + httpProxyConfig: { + httpProxy: "http://myproxy.server.com:8080", + httpsProxy: "https://myproxy.server.com:8080", + noProxy: ["localhost", "127.0.0.1"], + trustedCa: "Q29uZ3JhdHMhIFlvdSBoYXZlIGZvdW5kIGEgaGlkZGVuIG1lc3NhZ2U=" + }, + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] } + }, + location: "location1", + networkProfile: { + loadBalancerProfile: { managedOutboundIPs: { count: 2 } }, + loadBalancerSku: "standard", + outboundType: "loadBalancer" + }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser" + } + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createManagedClusterWithOssku().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedClusterWithPodIdentityEnabled.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedClusterWithPodIdentityEnabled.ts new file mode 100644 index 000000000000..baa04d31a2bf --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedClusterWithPodIdentityEnabled.ts @@ -0,0 +1,76 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_PodIdentity.json + */ +import { + ManagedCluster, + ContainerServiceClient +} from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createManagedClusterWithPodIdentityEnabled() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters: ManagedCluster = { + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + count: 3, + enableNodePublicIP: true, + mode: "System", + osType: "Linux", + vmSize: "Standard_DS2_v2" + } + ], + autoScalerProfile: { scaleDownDelayAfterAdd: "15m", scanInterval: "20s" }, + diskEncryptionSetID: + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des", + dnsPrefix: "dnsprefix1", + enablePodSecurityPolicy: true, + enableRbac: true, + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] } + }, + location: "location1", + networkProfile: { + loadBalancerProfile: { managedOutboundIPs: { count: 2 } }, + loadBalancerSku: "standard", + outboundType: "loadBalancer" + }, + podIdentityProfile: { allowNetworkPluginKubenet: true, enabled: true }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser" + } + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createManagedClusterWithPodIdentityEnabled().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedClusterWithPpg.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedClusterWithPpg.ts new file mode 100644 index 000000000000..af05f09ca833 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedClusterWithPpg.ts @@ -0,0 +1,77 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_PPG.json + */ +import { + ManagedCluster, + ContainerServiceClient +} from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createManagedClusterWithPpg() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters: ManagedCluster = { + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + count: 3, + enableNodePublicIP: true, + mode: "System", + osType: "Linux", + proximityPlacementGroupID: + "/subscriptions/subid1/resourcegroups/rg1/providers//Microsoft.Compute/proximityPlacementGroups/ppg1", + vmSize: "Standard_DS2_v2" + } + ], + autoScalerProfile: { scaleDownDelayAfterAdd: "15m", scanInterval: "20s" }, + diskEncryptionSetID: + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des", + dnsPrefix: "dnsprefix1", + enablePodSecurityPolicy: true, + enableRbac: true, + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] } + }, + location: "location1", + networkProfile: { + loadBalancerProfile: { managedOutboundIPs: { count: 2 } }, + loadBalancerSku: "standard", + outboundType: "loadBalancer" + }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser" + } + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createManagedClusterWithPpg().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedClusterWithRunCommandDisabled.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedClusterWithRunCommandDisabled.ts new file mode 100644 index 000000000000..9fb35f651f81 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedClusterWithRunCommandDisabled.ts @@ -0,0 +1,75 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_DisableRunCommand.json + */ +import { + ManagedCluster, + ContainerServiceClient +} from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createManagedClusterWithRunCommandDisabled() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters: ManagedCluster = { + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + count: 3, + enableEncryptionAtHost: true, + enableNodePublicIP: true, + mode: "System", + osType: "Linux", + vmSize: "Standard_DS2_v2" + } + ], + apiServerAccessProfile: { disableRunCommand: true }, + autoScalerProfile: { scaleDownDelayAfterAdd: "15m", scanInterval: "20s" }, + dnsPrefix: "dnsprefix1", + enablePodSecurityPolicy: true, + enableRbac: true, + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] } + }, + location: "location1", + networkProfile: { + loadBalancerProfile: { managedOutboundIPs: { count: 2 } }, + loadBalancerSku: "standard", + outboundType: "loadBalancer" + }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser" + } + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createManagedClusterWithRunCommandDisabled().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedClusterWithSecurityProfileConfigured.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedClusterWithSecurityProfileConfigured.ts new file mode 100644 index 000000000000..da11d929dade --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedClusterWithSecurityProfileConfigured.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. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_SecurityProfile.json + */ +import { + ManagedCluster, + ContainerServiceClient +} from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createManagedClusterWithSecurityProfileConfigured() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters: ManagedCluster = { + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + count: 3, + enableNodePublicIP: true, + mode: "System", + osType: "Linux", + vmSize: "Standard_DS2_v2" + } + ], + dnsPrefix: "dnsprefix1", + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] } + }, + location: "location1", + networkProfile: { + loadBalancerProfile: { managedOutboundIPs: { count: 2 } }, + loadBalancerSku: "standard", + outboundType: "loadBalancer" + }, + securityProfile: { + azureDefender: { + enabled: true, + logAnalyticsWorkspaceResourceId: + "/subscriptions/SUB_ID/resourcegroups/RG_NAME/providers/microsoft.operationalinsights/workspaces/WORKSPACE_NAME" + } + }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" } + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createManagedClusterWithSecurityProfileConfigured().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedClusterWithUltraSsdEnabled.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedClusterWithUltraSsdEnabled.ts new file mode 100644 index 000000000000..e5fb7f045345 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedClusterWithUltraSsdEnabled.ts @@ -0,0 +1,76 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_EnableUltraSSD.json + */ +import { + ManagedCluster, + ContainerServiceClient +} from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createManagedClusterWithUltraSsdEnabled() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters: ManagedCluster = { + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + count: 3, + enableNodePublicIP: true, + enableUltraSSD: true, + mode: "System", + osType: "Linux", + vmSize: "Standard_DS2_v2" + } + ], + autoScalerProfile: { scaleDownDelayAfterAdd: "15m", scanInterval: "20s" }, + diskEncryptionSetID: + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des", + dnsPrefix: "dnsprefix1", + enablePodSecurityPolicy: true, + enableRbac: true, + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] } + }, + location: "location1", + networkProfile: { + loadBalancerProfile: { managedOutboundIPs: { count: 2 } }, + loadBalancerSku: "standard", + outboundType: "loadBalancer" + }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser" + } + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createManagedClusterWithUltraSsdEnabled().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedClusterWithUserAssignedNatGatewayAsOutboundType.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedClusterWithUserAssignedNatGatewayAsOutboundType.ts new file mode 100644 index 000000000000..646696e3e0f2 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedClusterWithUserAssignedNatGatewayAsOutboundType.ts @@ -0,0 +1,76 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_UserAssignedNATGateway.json + */ +import { + ManagedCluster, + ContainerServiceClient +} from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createManagedClusterWithUserAssignedNatGatewayAsOutboundType() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters: ManagedCluster = { + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + count: 3, + enableNodePublicIP: false, + mode: "System", + osType: "Linux", + vmSize: "Standard_DS2_v2" + } + ], + autoScalerProfile: { scaleDownDelayAfterAdd: "15m", scanInterval: "20s" }, + diskEncryptionSetID: + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des", + dnsPrefix: "dnsprefix1", + enablePodSecurityPolicy: true, + enableRbac: true, + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] } + }, + location: "location1", + networkProfile: { + loadBalancerSku: "standard", + outboundType: "userAssignedNATGateway" + }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser" + } + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createManagedClusterWithUserAssignedNatGatewayAsOutboundType().catch( + console.error +); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedPrivateClusterWithFqdnSubdomainSpecified.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedPrivateClusterWithFqdnSubdomainSpecified.ts new file mode 100644 index 000000000000..75e255b95aa5 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedPrivateClusterWithFqdnSubdomainSpecified.ts @@ -0,0 +1,79 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_PrivateClusterFQDNSubdomain.json + */ +import { + ManagedCluster, + ContainerServiceClient +} from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createManagedPrivateClusterWithFqdnSubdomainSpecified() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters: ManagedCluster = { + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + count: 3, + enableEncryptionAtHost: true, + enableNodePublicIP: true, + mode: "System", + osType: "Linux", + vmSize: "Standard_DS2_v2" + } + ], + apiServerAccessProfile: { + enablePrivateCluster: true, + privateDNSZone: + "/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.Network/privateDnsZones/privatelink.location1.azmk8s.io" + }, + autoScalerProfile: { scaleDownDelayAfterAdd: "15m", scanInterval: "20s" }, + enablePodSecurityPolicy: true, + enableRbac: true, + fqdnSubdomain: "domain1", + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] } + }, + location: "location1", + networkProfile: { + loadBalancerProfile: { managedOutboundIPs: { count: 2 } }, + loadBalancerSku: "standard", + outboundType: "loadBalancer" + }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser" + } + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createManagedPrivateClusterWithFqdnSubdomainSpecified().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedPrivateClusterWithPublicFqdnSpecified.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedPrivateClusterWithPublicFqdnSpecified.ts new file mode 100644 index 000000000000..3e5da0c46707 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createManagedPrivateClusterWithPublicFqdnSpecified.ts @@ -0,0 +1,78 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_PrivateClusterPublicFQDN.json + */ +import { + ManagedCluster, + ContainerServiceClient +} from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createManagedPrivateClusterWithPublicFqdnSpecified() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters: ManagedCluster = { + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + count: 3, + enableEncryptionAtHost: true, + enableNodePublicIP: true, + mode: "System", + osType: "Linux", + vmSize: "Standard_DS2_v2" + } + ], + apiServerAccessProfile: { + enablePrivateCluster: true, + enablePrivateClusterPublicFqdn: true + }, + autoScalerProfile: { scaleDownDelayAfterAdd: "15m", scanInterval: "20s" }, + dnsPrefix: "dnsprefix1", + enablePodSecurityPolicy: true, + enableRbac: true, + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] } + }, + location: "location1", + networkProfile: { + loadBalancerProfile: { managedOutboundIPs: { count: 2 } }, + loadBalancerSku: "standard", + outboundType: "loadBalancer" + }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser" + } + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createManagedPrivateClusterWithPublicFqdnSpecified().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createOrUpdateAadManagedClusterWithEnableAzureRbac.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createOrUpdateAadManagedClusterWithEnableAzureRbac.ts new file mode 100644 index 000000000000..63110d7ea12f --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createOrUpdateAadManagedClusterWithEnableAzureRbac.ts @@ -0,0 +1,77 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_UpdateWithEnableAzureRBAC.json + */ +import { + ManagedCluster, + ContainerServiceClient +} from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createOrUpdateAadManagedClusterWithEnableAzureRbac() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters: ManagedCluster = { + aadProfile: { enableAzureRbac: true, managed: true }, + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + availabilityZones: ["1", "2", "3"], + count: 3, + enableNodePublicIP: true, + mode: "System", + osType: "Linux", + vmSize: "Standard_DS1_v2" + } + ], + autoScalerProfile: { scaleDownDelayAfterAdd: "15m", scanInterval: "20s" }, + diskEncryptionSetID: + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des", + dnsPrefix: "dnsprefix1", + enablePodSecurityPolicy: true, + enableRbac: true, + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] } + }, + location: "location1", + networkProfile: { + loadBalancerProfile: { managedOutboundIPs: { count: 2 } }, + loadBalancerSku: "standard", + outboundType: "loadBalancer" + }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser" + } + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createOrUpdateAadManagedClusterWithEnableAzureRbac().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createOrUpdateAgentPool.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createOrUpdateAgentPool.ts new file mode 100644 index 000000000000..349b36b7e42e --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createOrUpdateAgentPool.ts @@ -0,0 +1,48 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster. + * + * @summary Creates or updates an agent pool in the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_Update.json + */ +import { AgentPool, ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createOrUpdateAgentPool() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const agentPoolName = "agentpool1"; + const parameters: AgentPool = { + count: 3, + mode: "User", + nodeLabels: { key1: "val1" }, + nodeTaints: ["Key1=Value1:NoSchedule"], + orchestratorVersion: "", + osType: "Linux", + scaleSetEvictionPolicy: "Delete", + scaleSetPriority: "Spot", + tags: { name1: "val1" }, + vmSize: "Standard_DS1_v2" + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + agentPoolName, + parameters + ); + console.log(result); +} + +createOrUpdateAgentPool().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createOrUpdateMaintenanceConfiguration.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createOrUpdateMaintenanceConfiguration.ts new file mode 100644 index 000000000000..771591bddf3e --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createOrUpdateMaintenanceConfiguration.ts @@ -0,0 +1,48 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a maintenance configuration in the specified managed cluster. + * + * @summary Creates or updates a maintenance configuration in the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/MaintenanceConfigurationsCreate_Update.json + */ +import { + MaintenanceConfiguration, + ContainerServiceClient +} from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createOrUpdateMaintenanceConfiguration() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const configName = "default"; + const parameters: MaintenanceConfiguration = { + notAllowedTime: [ + { + end: new Date("2020-11-30T12:00:00Z"), + start: new Date("2020-11-26T03:00:00Z") + } + ], + timeInWeek: [{ day: "Monday", hourSlots: [1, 2] }] + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.maintenanceConfigurations.createOrUpdate( + resourceGroupName, + resourceName, + configName, + parameters + ); + console.log(result); +} + +createOrUpdateMaintenanceConfiguration().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createOrUpdateManagedCluster.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createOrUpdateManagedCluster.ts new file mode 100644 index 000000000000..da3f2aa83499 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createOrUpdateManagedCluster.ts @@ -0,0 +1,91 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_Update.json + */ +import { + ManagedCluster, + ContainerServiceClient +} from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createOrUpdateManagedCluster() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters: ManagedCluster = { + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + availabilityZones: ["1", "2", "3"], + count: 3, + enableNodePublicIP: true, + mode: "System", + osType: "Linux", + scaleDownMode: "Deallocate", + vmSize: "Standard_DS1_v2" + } + ], + autoScalerProfile: { + balanceSimilarNodeGroups: "true", + expander: "priority", + maxNodeProvisionTime: "15m", + newPodScaleUpDelay: "1m", + scaleDownDelayAfterAdd: "15m", + scanInterval: "20s", + skipNodesWithSystemPods: "false" + }, + diskEncryptionSetID: + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des", + dnsPrefix: "dnsprefix1", + enablePodSecurityPolicy: true, + enableRbac: true, + identity: { + type: "UserAssigned", + userAssignedIdentities: { + "/subscriptions/subid1/resourceGroups/rgName1/providers/MicrosoftManagedIdentity/userAssignedIdentities/identity1": {} + } + }, + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] } + }, + location: "location1", + networkProfile: { + loadBalancerProfile: { managedOutboundIPs: { count: 2 } }, + loadBalancerSku: "standard", + outboundType: "loadBalancer" + }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser" + } + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createOrUpdateManagedCluster().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createOrUpdateManagedClusterWithDualStackNetworking.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createOrUpdateManagedClusterWithDualStackNetworking.ts new file mode 100644 index 000000000000..299da4d06149 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createOrUpdateManagedClusterWithDualStackNetworking.ts @@ -0,0 +1,92 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_DualStackNetworking.json + */ +import { + ManagedCluster, + ContainerServiceClient +} from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createOrUpdateManagedClusterWithDualStackNetworking() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters: ManagedCluster = { + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + availabilityZones: ["1", "2", "3"], + count: 3, + enableNodePublicIP: true, + mode: "System", + osType: "Linux", + scaleDownMode: "Deallocate", + vmSize: "Standard_DS1_v2" + } + ], + autoScalerProfile: { + balanceSimilarNodeGroups: "true", + expander: "priority", + maxNodeProvisionTime: "15m", + newPodScaleUpDelay: "1m", + scaleDownDelayAfterAdd: "15m", + scanInterval: "20s", + skipNodesWithSystemPods: "false" + }, + diskEncryptionSetID: + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des", + dnsPrefix: "dnsprefix1", + enablePodSecurityPolicy: true, + enableRbac: true, + identity: { + type: "UserAssigned", + userAssignedIdentities: { + "/subscriptions/subid1/resourceGroups/rgName1/providers/MicrosoftManagedIdentity/userAssignedIdentities/identity1": {} + } + }, + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] } + }, + location: "location1", + networkProfile: { + ipFamilies: ["IPv4", "IPv6"], + loadBalancerProfile: { managedOutboundIPs: { count: 2 } }, + loadBalancerSku: "standard", + outboundType: "loadBalancer" + }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser" + } + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createOrUpdateManagedClusterWithDualStackNetworking().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createOrUpdateManagedClusterWithEnableAhub.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createOrUpdateManagedClusterWithEnableAhub.ts new file mode 100644 index 000000000000..1acc1632c1a1 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createOrUpdateManagedClusterWithEnableAhub.ts @@ -0,0 +1,83 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_UpdateWithAHUB.json + */ +import { + ManagedCluster, + ContainerServiceClient +} from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createOrUpdateManagedClusterWithEnableAhub() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters: ManagedCluster = { + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + availabilityZones: ["1", "2", "3"], + count: 3, + enableNodePublicIP: true, + mode: "System", + osType: "Linux", + vmSize: "Standard_DS1_v2" + } + ], + autoScalerProfile: { scaleDownDelayAfterAdd: "15m", scanInterval: "20s" }, + diskEncryptionSetID: + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des", + dnsPrefix: "dnsprefix1", + enablePodSecurityPolicy: true, + enableRbac: true, + identity: { + type: "UserAssigned", + userAssignedIdentities: { + "/subscriptions/subid1/resourceGroups/rgName1/providers/MicrosoftManagedIdentity/userAssignedIdentities/identity1": {} + } + }, + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] } + }, + location: "location1", + networkProfile: { + loadBalancerProfile: { managedOutboundIPs: { count: 2 } }, + loadBalancerSku: "standard", + outboundType: "loadBalancer" + }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser", + licenseType: "Windows_Server" + } + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createOrUpdateManagedClusterWithEnableAhub().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createOrUpdateManagedClusterWithWindowsGMsaEnabled.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createOrUpdateManagedClusterWithWindowsGMsaEnabled.ts new file mode 100644 index 000000000000..5ee8718cdaa0 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createOrUpdateManagedClusterWithWindowsGMsaEnabled.ts @@ -0,0 +1,83 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a managed cluster. + * + * @summary Creates or updates a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersCreate_UpdateWindowsGmsa.json + */ +import { + ManagedCluster, + ContainerServiceClient +} from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createOrUpdateManagedClusterWithWindowsGMsaEnabled() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters: ManagedCluster = { + addonProfiles: {}, + agentPoolProfiles: [ + { + name: "nodepool1", + type: "VirtualMachineScaleSets", + availabilityZones: ["1", "2", "3"], + count: 3, + enableNodePublicIP: true, + mode: "System", + osType: "Linux", + vmSize: "Standard_DS1_v2" + } + ], + autoScalerProfile: { scaleDownDelayAfterAdd: "15m", scanInterval: "20s" }, + diskEncryptionSetID: + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des", + dnsPrefix: "dnsprefix1", + enablePodSecurityPolicy: true, + enableRbac: true, + identity: { + type: "UserAssigned", + userAssignedIdentities: { + "/subscriptions/subid1/resourceGroups/rgName1/providers/MicrosoftManagedIdentity/userAssignedIdentities/identity1": {} + } + }, + kubernetesVersion: "", + linuxProfile: { + adminUsername: "azureuser", + ssh: { publicKeys: [{ keyData: "keydata" }] } + }, + location: "location1", + networkProfile: { + loadBalancerProfile: { managedOutboundIPs: { count: 2 } }, + loadBalancerSku: "standard", + outboundType: "loadBalancer" + }, + servicePrincipalProfile: { clientId: "clientid", secret: "secret" }, + sku: { name: "Basic", tier: "Free" }, + tags: { archv2: "", tier: "production" }, + windowsProfile: { + adminPassword: "replacePassword1234$", + adminUsername: "azureuser", + gmsaProfile: { enabled: true } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createOrUpdateManagedClusterWithWindowsGMsaEnabled().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createOrUpdateSnapshot.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createOrUpdateSnapshot.ts new file mode 100644 index 000000000000..0d67d5eb4bf5 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createOrUpdateSnapshot.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. +/** + * This sample demonstrates how to Creates or updates a snapshot. + * + * @summary Creates or updates a snapshot. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/SnapshotsCreate.json + */ +import { Snapshot, ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createOrUpdateSnapshot() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "snapshot1"; + const parameters: Snapshot = { + creationData: { + sourceResourceId: + "/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/cluster1/agentPools/pool0" + }, + location: "westus", + tags: { key1: "val1", key2: "val2" } + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.snapshots.createOrUpdate( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +createOrUpdateSnapshot().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createSpotAgentPool.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createSpotAgentPool.ts new file mode 100644 index 000000000000..189774c3f7d9 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/createSpotAgentPool.ts @@ -0,0 +1,47 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster. + * + * @summary Creates or updates an agent pool in the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsCreate_Spot.json + */ +import { AgentPool, ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createSpotAgentPool() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const agentPoolName = "agentpool1"; + const parameters: AgentPool = { + count: 3, + nodeLabels: { key1: "val1" }, + nodeTaints: ["Key1=Value1:NoSchedule"], + orchestratorVersion: "", + osType: "Linux", + scaleSetEvictionPolicy: "Delete", + scaleSetPriority: "Spot", + tags: { name1: "val1" }, + vmSize: "Standard_DS1_v2" + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + agentPoolName, + parameters + ); + console.log(result); +} + +createSpotAgentPool().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/deleteAgentPool.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/deleteAgentPool.ts new file mode 100644 index 000000000000..245416a8635e --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/deleteAgentPool.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. +/** + * This sample demonstrates how to Deletes an agent pool in the specified managed cluster. + * + * @summary Deletes an agent pool in the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsDelete.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function deleteAgentPool() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const agentPoolName = "agentpool1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.beginDeleteAndWait( + resourceGroupName, + resourceName, + agentPoolName + ); + console.log(result); +} + +deleteAgentPool().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/deleteMaintenanceConfiguration.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/deleteMaintenanceConfiguration.ts new file mode 100644 index 000000000000..a06d13b5bc53 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/deleteMaintenanceConfiguration.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. +/** + * This sample demonstrates how to Deletes a maintenance configuration. + * + * @summary Deletes a maintenance configuration. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/MaintenanceConfigurationsDelete.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function deleteMaintenanceConfiguration() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const configName = "default"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.maintenanceConfigurations.delete( + resourceGroupName, + resourceName, + configName + ); + console.log(result); +} + +deleteMaintenanceConfiguration().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/deleteManagedCluster.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/deleteManagedCluster.ts new file mode 100644 index 000000000000..0f9bb5c77ea6 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/deleteManagedCluster.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. +/** + * This sample demonstrates how to Deletes a managed cluster. + * + * @summary Deletes a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersDelete.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function deleteManagedCluster() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginDeleteAndWait( + resourceGroupName, + resourceName + ); + console.log(result); +} + +deleteManagedCluster().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/deletePrivateEndpointConnection.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/deletePrivateEndpointConnection.ts new file mode 100644 index 000000000000..5b9e73a1a0fb --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/deletePrivateEndpointConnection.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. +/** + * This sample demonstrates how to Deletes a private endpoint connection. + * + * @summary Deletes a private endpoint connection. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/PrivateEndpointConnectionsDelete.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function deletePrivateEndpointConnection() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const privateEndpointConnectionName = "privateendpointconnection1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.beginDeleteAndWait( + resourceGroupName, + resourceName, + privateEndpointConnectionName + ); + console.log(result); +} + +deletePrivateEndpointConnection().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/deleteSnapshot.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/deleteSnapshot.ts new file mode 100644 index 000000000000..61aa8776211d --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/deleteSnapshot.ts @@ -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. +/** + * This sample demonstrates how to Deletes a snapshot. + * + * @summary Deletes a snapshot. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/SnapshotsDelete.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function deleteSnapshot() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "snapshot1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.snapshots.delete(resourceGroupName, resourceName); + console.log(result); +} + +deleteSnapshot().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/getAgentPool.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/getAgentPool.ts new file mode 100644 index 000000000000..8788993c44fb --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/getAgentPool.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. +/** + * This sample demonstrates how to Gets the specified managed cluster agent pool. + * + * @summary Gets the specified managed cluster agent pool. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsGet.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function getAgentPool() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const agentPoolName = "agentpool1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.get( + resourceGroupName, + resourceName, + agentPoolName + ); + console.log(result); +} + +getAgentPool().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/getAvailableVersionsForAgentPool.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/getAvailableVersionsForAgentPool.ts new file mode 100644 index 000000000000..ad6514519638 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/getAvailableVersionsForAgentPool.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. +/** + * This sample demonstrates how to See [supported Kubernetes versions](https://docs.microsoft.com/azure/aks/supported-kubernetes-versions) for more details about the version lifecycle. + * + * @summary See [supported Kubernetes versions](https://docs.microsoft.com/azure/aks/supported-kubernetes-versions) for more details about the version lifecycle. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsGetAgentPoolAvailableVersions.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function getAvailableVersionsForAgentPool() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.getAvailableAgentPoolVersions( + resourceGroupName, + resourceName + ); + console.log(result); +} + +getAvailableVersionsForAgentPool().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/getContainerServiceOSOptions.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/getContainerServiceOSOptions.ts new file mode 100644 index 000000000000..f42a58741c0a --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/getContainerServiceOSOptions.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. +/** + * This sample demonstrates how to Gets supported OS options in the specified subscription. + * + * @summary Gets supported OS options in the specified subscription. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ContainerServiceGetOSOptions.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function getContainerServiceOSOptions() { + const subscriptionId = "subid1"; + const location = "location1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.getOSOptions(location); + console.log(result); +} + +getContainerServiceOSOptions().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/getMaintenanceConfiguration.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/getMaintenanceConfiguration.ts new file mode 100644 index 000000000000..bb4f4c8c3d80 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/getMaintenanceConfiguration.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. +/** + * This sample demonstrates how to Gets the specified maintenance configuration of a managed cluster. + * + * @summary Gets the specified maintenance configuration of a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/MaintenanceConfigurationsGet.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function getMaintenanceConfiguration() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const configName = "default"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.maintenanceConfigurations.get( + resourceGroupName, + resourceName, + configName + ); + console.log(result); +} + +getMaintenanceConfiguration().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/getManagedCluster.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/getManagedCluster.ts new file mode 100644 index 000000000000..3836bfe3a4d3 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/getManagedCluster.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. +/** + * This sample demonstrates how to Gets a managed cluster. + * + * @summary Gets a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersGet.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function getManagedCluster() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.get( + resourceGroupName, + resourceName + ); + console.log(result); +} + +getManagedCluster().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/getManagedClustersByResourceGroup.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/getManagedClustersByResourceGroup.ts new file mode 100644 index 000000000000..dec78a9f2d26 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/getManagedClustersByResourceGroup.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. +/** + * This sample demonstrates how to Lists managed clusters in the specified subscription and resource group. + * + * @summary Lists managed clusters in the specified subscription and resource group. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersListByResourceGroup.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function getManagedClustersByResourceGroup() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.managedClusters.listByResourceGroup( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +getManagedClustersByResourceGroup().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/getPrivateEndpointConnection.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/getPrivateEndpointConnection.ts new file mode 100644 index 000000000000..f8ab7dd6c387 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/getPrivateEndpointConnection.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. +/** + * This sample demonstrates how to To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters + * + * @summary To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/PrivateEndpointConnectionsGet.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function getPrivateEndpointConnection() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const privateEndpointConnectionName = "privateendpointconnection1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.get( + resourceGroupName, + resourceName, + privateEndpointConnectionName + ); + console.log(result); +} + +getPrivateEndpointConnection().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/getSnapshot.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/getSnapshot.ts new file mode 100644 index 000000000000..66dba8b551fa --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/getSnapshot.ts @@ -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. +/** + * This sample demonstrates how to Gets a snapshot. + * + * @summary Gets a snapshot. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/SnapshotsGet.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function getSnapshot() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "snapshot1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.snapshots.get(resourceGroupName, resourceName); + console.log(result); +} + +getSnapshot().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/getUpgradeProfileForAgentPool.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/getUpgradeProfileForAgentPool.ts new file mode 100644 index 000000000000..b88f86b90221 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/getUpgradeProfileForAgentPool.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. +/** + * This sample demonstrates how to Gets the upgrade profile for an agent pool. + * + * @summary Gets the upgrade profile for an agent pool. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsGetUpgradeProfile.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function getUpgradeProfileForAgentPool() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const agentPoolName = "agentpool1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.getUpgradeProfile( + resourceGroupName, + resourceName, + agentPoolName + ); + console.log(result); +} + +getUpgradeProfileForAgentPool().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/getUpgradeProfileForManagedCluster.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/getUpgradeProfileForManagedCluster.ts new file mode 100644 index 000000000000..1531bad68b0c --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/getUpgradeProfileForManagedCluster.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. +/** + * This sample demonstrates how to Gets the upgrade profile of a managed cluster. + * + * @summary Gets the upgrade profile of a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersGetUpgradeProfile.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function getUpgradeProfileForManagedCluster() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.getUpgradeProfile( + resourceGroupName, + resourceName + ); + console.log(result); +} + +getUpgradeProfileForManagedCluster().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/listAgentPoolsByManagedCluster.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/listAgentPoolsByManagedCluster.ts new file mode 100644 index 000000000000..c169b98e728d --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/listAgentPoolsByManagedCluster.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. +/** + * This sample demonstrates how to Gets a list of agent pools in the specified managed cluster. + * + * @summary Gets a list of agent pools in the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsList.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function listAgentPoolsByManagedCluster() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.agentPools.list( + resourceGroupName, + resourceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +listAgentPoolsByManagedCluster().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/listAvailableOperationsForTheContainerServiceResourceProvider.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/listAvailableOperationsForTheContainerServiceResourceProvider.ts new file mode 100644 index 000000000000..3f2872f40265 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/listAvailableOperationsForTheContainerServiceResourceProvider.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. +/** + * This sample demonstrates how to Gets a list of operations. + * + * @summary Gets a list of operations. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/Operation_List.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function listAvailableOperationsForTheContainerServiceResourceProvider() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +listAvailableOperationsForTheContainerServiceResourceProvider().catch( + console.error +); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/listMaintenanceConfigurationsByManagedCluster.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/listMaintenanceConfigurationsByManagedCluster.ts new file mode 100644 index 000000000000..8851d5d4f366 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/listMaintenanceConfigurationsByManagedCluster.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. +/** + * This sample demonstrates how to Gets a list of maintenance configurations in the specified managed cluster. + * + * @summary Gets a list of maintenance configurations in the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/MaintenanceConfigurationsList.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function listMaintenanceConfigurationsByManagedCluster() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.maintenanceConfigurations.listByManagedCluster( + resourceGroupName, + resourceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +listMaintenanceConfigurationsByManagedCluster().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/listManagedClusters.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/listManagedClusters.ts new file mode 100644 index 000000000000..db2d31fff72d --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/listManagedClusters.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. +/** + * This sample demonstrates how to Gets a list of managed clusters in the specified subscription. + * + * @summary Gets a list of managed clusters in the specified subscription. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersList.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function listManagedClusters() { + const subscriptionId = "subid1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.managedClusters.list()) { + resArray.push(item); + } + console.log(resArray); +} + +listManagedClusters().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/listOutboundNetworkDependenciesEndpointsByManagedCluster.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/listOutboundNetworkDependenciesEndpointsByManagedCluster.ts new file mode 100644 index 000000000000..aa4127525805 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/listOutboundNetworkDependenciesEndpointsByManagedCluster.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. +/** + * This sample demonstrates how to Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. The operation returns properties of each egress endpoint. + * + * @summary Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. The operation returns properties of each egress endpoint. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/OutboundNetworkDependenciesEndpointsList.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function listOutboundNetworkDependenciesEndpointsByManagedCluster() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.managedClusters.listOutboundNetworkDependenciesEndpoints( + resourceGroupName, + resourceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +listOutboundNetworkDependenciesEndpointsByManagedCluster().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/listPrivateEndpointConnectionsByManagedCluster.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/listPrivateEndpointConnectionsByManagedCluster.ts new file mode 100644 index 000000000000..efc52f9b27b7 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/listPrivateEndpointConnectionsByManagedCluster.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. +/** + * This sample demonstrates how to To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters + * + * @summary To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/PrivateEndpointConnectionsList.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function listPrivateEndpointConnectionsByManagedCluster() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.list( + resourceGroupName, + resourceName + ); + console.log(result); +} + +listPrivateEndpointConnectionsByManagedCluster().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/listPrivateLinkResourcesByManagedCluster.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/listPrivateLinkResourcesByManagedCluster.ts new file mode 100644 index 000000000000..b6d6769d5a1f --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/listPrivateLinkResourcesByManagedCluster.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. +/** + * This sample demonstrates how to To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters + * + * @summary To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/PrivateLinkResourcesList.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function listPrivateLinkResourcesByManagedCluster() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.privateLinkResources.list( + resourceGroupName, + resourceName + ); + console.log(result); +} + +listPrivateLinkResourcesByManagedCluster().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/listSnapshots.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/listSnapshots.ts new file mode 100644 index 000000000000..886b67511f26 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/listSnapshots.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. +/** + * This sample demonstrates how to Gets a list of snapshots in the specified subscription. + * + * @summary Gets a list of snapshots in the specified subscription. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/SnapshotsList.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function listSnapshots() { + const subscriptionId = "subid1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.snapshots.list()) { + resArray.push(item); + } + console.log(resArray); +} + +listSnapshots().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/listSnapshotsByResourceGroup.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/listSnapshotsByResourceGroup.ts new file mode 100644 index 000000000000..902260abc84e --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/listSnapshotsByResourceGroup.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. +/** + * This sample demonstrates how to Lists snapshots in the specified subscription and resource group. + * + * @summary Lists snapshots in the specified subscription and resource group. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/SnapshotsListByResourceGroup.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function listSnapshotsByResourceGroup() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.snapshots.listByResourceGroup( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +listSnapshotsByResourceGroup().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/resetAadProfile.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/resetAadProfile.ts new file mode 100644 index 000000000000..d452ca0f6cdb --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/resetAadProfile.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. +/** + * This sample demonstrates how to Reset the AAD Profile of a managed cluster. + * + * @summary Reset the AAD Profile of a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersResetAADProfile.json + */ +import { + ManagedClusterAADProfile, + ContainerServiceClient +} from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function resetAadProfile() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters: ManagedClusterAADProfile = { + clientAppID: "clientappid", + serverAppID: "serverappid", + serverAppSecret: "serverappsecret", + tenantID: "tenantid" + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginResetAADProfileAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +resetAadProfile().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/resetServicePrincipalProfile.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/resetServicePrincipalProfile.ts new file mode 100644 index 000000000000..f33bf51974a0 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/resetServicePrincipalProfile.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. +/** + * This sample demonstrates how to This action cannot be performed on a cluster that is not using a service principal + * + * @summary This action cannot be performed on a cluster that is not using a service principal + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersResetServicePrincipalProfile.json + */ +import { + ManagedClusterServicePrincipalProfile, + ContainerServiceClient +} from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function resetServicePrincipalProfile() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters: ManagedClusterServicePrincipalProfile = { + clientId: "clientid", + secret: "secret" + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginResetServicePrincipalProfileAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +resetServicePrincipalProfile().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/resolveThePrivateLinkServiceIdForManagedCluster.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/resolveThePrivateLinkServiceIdForManagedCluster.ts new file mode 100644 index 000000000000..dff4d8559a95 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/resolveThePrivateLinkServiceIdForManagedCluster.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. +/** + * This sample demonstrates how to Gets the private link service ID for the specified managed cluster. + * + * @summary Gets the private link service ID for the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ResolvePrivateLinkServiceId.json + */ +import { + PrivateLinkResource, + ContainerServiceClient +} from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function resolveThePrivateLinkServiceIdForManagedCluster() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters: PrivateLinkResource = { name: "management" }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.resolvePrivateLinkServiceId.post( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +resolveThePrivateLinkServiceIdForManagedCluster().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/rotateClusterCertificates.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/rotateClusterCertificates.ts new file mode 100644 index 000000000000..002290ef1f4a --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/rotateClusterCertificates.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. +/** + * This sample demonstrates how to See [Certificate rotation](https://docs.microsoft.com/azure/aks/certificate-rotation) for more details about rotating managed cluster certificates. + * + * @summary See [Certificate rotation](https://docs.microsoft.com/azure/aks/certificate-rotation) for more details about rotating managed cluster certificates. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersRotateClusterCertificates.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function rotateClusterCertificates() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginRotateClusterCertificatesAndWait( + resourceGroupName, + resourceName + ); + console.log(result); +} + +rotateClusterCertificates().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/startAgentPool.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/startAgentPool.ts new file mode 100644 index 000000000000..da11fe149751 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/startAgentPool.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. +/** + * This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster. + * + * @summary Creates or updates an agent pool in the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPools_Start.json + */ +import { AgentPool, ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function startAgentPool() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const agentPoolName = "agentpool1"; + const parameters: AgentPool = { powerState: { code: "Running" } }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + agentPoolName, + parameters + ); + console.log(result); +} + +startAgentPool().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/startManagedCluster.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/startManagedCluster.ts new file mode 100644 index 000000000000..c651026cee93 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/startManagedCluster.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. +/** + * This sample demonstrates how to See [starting a cluster](https://docs.microsoft.com/azure/aks/start-stop-cluster) for more details about starting a cluster. + * + * @summary See [starting a cluster](https://docs.microsoft.com/azure/aks/start-stop-cluster) for more details about starting a cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersStart.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function startManagedCluster() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginStartAndWait( + resourceGroupName, + resourceName + ); + console.log(result); +} + +startManagedCluster().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/stopAgentPool.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/stopAgentPool.ts new file mode 100644 index 000000000000..d097562b4b3d --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/stopAgentPool.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. +/** + * This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster. + * + * @summary Creates or updates an agent pool in the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPools_Stop.json + */ +import { AgentPool, ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function stopAgentPool() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const agentPoolName = "agentpool1"; + const parameters: AgentPool = { powerState: { code: "Stopped" } }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + agentPoolName, + parameters + ); + console.log(result); +} + +stopAgentPool().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/stopManagedCluster.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/stopManagedCluster.ts new file mode 100644 index 000000000000..ec7580095818 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/stopManagedCluster.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. +/** + * This sample demonstrates how to This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a cluster stops the control plane and agent nodes entirely, while maintaining all object and cluster state. A cluster does not accrue charges while it is stopped. See [stopping a cluster](https://docs.microsoft.com/azure/aks/start-stop-cluster) for more details about stopping a cluster. + * + * @summary This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a cluster stops the control plane and agent nodes entirely, while maintaining all object and cluster state. A cluster does not accrue charges while it is stopped. See [stopping a cluster](https://docs.microsoft.com/azure/aks/start-stop-cluster) for more details about stopping a cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersStop.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function stopManagedCluster() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginStopAndWait( + resourceGroupName, + resourceName + ); + console.log(result); +} + +stopManagedCluster().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/submitNewCommand.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/submitNewCommand.ts new file mode 100644 index 000000000000..d491445abc39 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/submitNewCommand.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. +/** + * This sample demonstrates how to AKS will create a pod to run the command. This is primarily useful for private clusters. For more information see [AKS Run Command](https://docs.microsoft.com/azure/aks/private-clusters#aks-run-command-preview). + * + * @summary AKS will create a pod to run the command. This is primarily useful for private clusters. For more information see [AKS Run Command](https://docs.microsoft.com/azure/aks/private-clusters#aks-run-command-preview). + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/RunCommandRequest.json + */ +import { + RunCommandRequest, + ContainerServiceClient +} from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function submitNewCommand() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const requestPayload: RunCommandRequest = { + clusterToken: "", + command: "kubectl apply -f ns.yaml", + context: "" + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginRunCommandAndWait( + resourceGroupName, + resourceName, + requestPayload + ); + console.log(result); +} + +submitNewCommand().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/updateAgentPool.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/updateAgentPool.ts new file mode 100644 index 000000000000..35b855be63cd --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/updateAgentPool.ts @@ -0,0 +1,48 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster. + * + * @summary Creates or updates an agent pool in the specified managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPools_Update.json + */ +import { AgentPool, ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function updateAgentPool() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const agentPoolName = "agentpool1"; + const parameters: AgentPool = { + count: 3, + enableAutoScaling: true, + maxCount: 2, + minCount: 2, + nodeTaints: ["Key1=Value1:NoSchedule"], + orchestratorVersion: "", + osType: "Linux", + scaleSetEvictionPolicy: "Delete", + scaleSetPriority: "Spot", + vmSize: "Standard_DS1_v2" + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + agentPoolName, + parameters + ); + console.log(result); +} + +updateAgentPool().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/updateManagedClusterTags.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/updateManagedClusterTags.ts new file mode 100644 index 000000000000..710cc39e6dbc --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/updateManagedClusterTags.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. +/** + * This sample demonstrates how to Updates tags on a managed cluster. + * + * @summary Updates tags on a managed cluster. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/ManagedClustersUpdateTags.json + */ +import { + TagsObject, + ContainerServiceClient +} from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function updateManagedClusterTags() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const parameters: TagsObject = { tags: { archv3: "", tier: "testing" } }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.managedClusters.beginUpdateTagsAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +updateManagedClusterTags().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/updatePrivateEndpointConnection.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/updatePrivateEndpointConnection.ts new file mode 100644 index 000000000000..0d77112cd0ab --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/updatePrivateEndpointConnection.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. +/** + * This sample demonstrates how to Updates a private endpoint connection. + * + * @summary Updates a private endpoint connection. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/PrivateEndpointConnectionsUpdate.json + */ +import { + PrivateEndpointConnection, + ContainerServiceClient +} from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function updatePrivateEndpointConnection() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const privateEndpointConnectionName = "privateendpointconnection1"; + const parameters: PrivateEndpointConnection = { + privateLinkServiceConnectionState: { status: "Approved" } + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.update( + resourceGroupName, + resourceName, + privateEndpointConnectionName, + parameters + ); + console.log(result); +} + +updatePrivateEndpointConnection().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/updateSnapshotTags.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/updateSnapshotTags.ts new file mode 100644 index 000000000000..f98829e3ea01 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/updateSnapshotTags.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. +/** + * This sample demonstrates how to Updates tags on a snapshot. + * + * @summary Updates tags on a snapshot. + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/SnapshotsUpdateTags.json + */ +import { + TagsObject, + ContainerServiceClient +} from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function updateSnapshotTags() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "snapshot1"; + const parameters: TagsObject = { tags: { key2: "new-val2", key3: "val3" } }; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.snapshots.updateTags( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +updateSnapshotTags().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/upgradeAgentPoolNodeImageVersion.ts b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/upgradeAgentPoolNodeImageVersion.ts new file mode 100644 index 000000000000..e4b7d5d4e892 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/typescript/src/upgradeAgentPoolNodeImageVersion.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. +/** + * This sample demonstrates how to Upgrading the node image version of an agent pool applies the newest OS and runtime updates to the nodes. AKS provides one new image per week with the latest updates. For more details on node image versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade + * + * @summary Upgrading the node image version of an agent pool applies the newest OS and runtime updates to the nodes. AKS provides one new image per week with the latest updates. For more details on node image versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-01-01/examples/AgentPoolsUpgradeNodeImageVersion.json + */ +import { ContainerServiceClient } from "@azure/arm-containerservice"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function upgradeAgentPoolNodeImageVersion() { + const subscriptionId = "subid1"; + const resourceGroupName = "rg1"; + const resourceName = "clustername1"; + const agentPoolName = "agentpool1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.agentPools.beginUpgradeNodeImageVersionAndWait( + resourceGroupName, + resourceName, + agentPoolName + ); + console.log(result); +} + +upgradeAgentPoolNodeImageVersion().catch(console.error); diff --git a/sdk/containerservice/arm-containerservice/samples/v15/typescript/tsconfig.json b/sdk/containerservice/arm-containerservice/samples/v15/typescript/tsconfig.json new file mode 100644 index 000000000000..416c2dd82e00 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/samples/v15/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/containerservice/arm-containerservice/src/containerServiceClient.ts b/sdk/containerservice/arm-containerservice/src/containerServiceClient.ts index 8c52f90e2da1..fe67c9f3448b 100644 --- a/sdk/containerservice/arm-containerservice/src/containerServiceClient.ts +++ b/sdk/containerservice/arm-containerservice/src/containerServiceClient.ts @@ -63,7 +63,7 @@ export class ContainerServiceClient extends coreClient.ServiceClient { credential: credentials }; - const packageDetails = `azsdk-js-arm-containerservice/15.0.0`; + const packageDetails = `azsdk-js-arm-containerservice/15.1.0`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` @@ -86,7 +86,7 @@ export class ContainerServiceClient extends coreClient.ServiceClient { // Assigning values to Constant parameters this.$host = options.$host || "https://management.azure.com"; - this.apiVersion = options.apiVersion || "2021-10-01"; + this.apiVersion = options.apiVersion || "2022-01-01"; this.operations = new OperationsImpl(this); this.managedClusters = new ManagedClustersImpl(this); this.maintenanceConfigurations = new MaintenanceConfigurationsImpl(this); diff --git a/sdk/containerservice/arm-containerservice/src/models/index.ts b/sdk/containerservice/arm-containerservice/src/models/index.ts index b0414fb20a92..a37e638ddfd8 100644 --- a/sdk/containerservice/arm-containerservice/src/models/index.ts +++ b/sdk/containerservice/arm-containerservice/src/models/index.ts @@ -1872,6 +1872,24 @@ export enum KnownPublicNetworkAccess { */ export type PublicNetworkAccess = string; +/** Known values of {@link Format} that the service accepts. */ +export enum KnownFormat { + /** Return azure auth-provider kubeconfig. This format is deprecated in 1.22 and will be fully removed in 1.25. */ + Azure = "azure", + /** Return exec format kubeconfig. This format requires kubelogin binary in the path. */ + Exec = "exec" +} + +/** + * Defines values for Format. \ + * {@link KnownFormat} can be used interchangeably with Format, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **azure**: Return azure auth-provider kubeconfig. This format is deprecated in 1.22 and will be fully removed in 1.25. \ + * **exec**: Return exec format kubeconfig. This format requires kubelogin binary in the path. + */ +export type Format = string; + /** Known values of {@link CreatedByType} that the service accepts. */ export enum KnownCreatedByType { User = "User", @@ -2413,6 +2431,8 @@ export interface ManagedClustersListClusterUserCredentialsOptionalParams extends coreClient.OperationOptions { /** server fqdn type for credentials to be returned */ serverFqdn?: string; + /** Only apply to AAD clusters, specifies the format of returned kubeconfig. Format 'azure' will return azure auth-provider kubeconfig; format 'exec' will return exec format kubeconfig, which requires kubelogin binary in the path. */ + format?: Format; } /** Contains response data for the listClusterUserCredentials operation. */ diff --git a/sdk/containerservice/arm-containerservice/src/models/parameters.ts b/sdk/containerservice/arm-containerservice/src/models/parameters.ts index 8aacf5e75181..9190edbb2e86 100644 --- a/sdk/containerservice/arm-containerservice/src/models/parameters.ts +++ b/sdk/containerservice/arm-containerservice/src/models/parameters.ts @@ -51,7 +51,7 @@ export const $host: OperationURLParameter = { export const apiVersion: OperationQueryParameter = { parameterPath: "apiVersion", mapper: { - defaultValue: "2021-10-01", + defaultValue: "2022-01-01", isConstant: true, serializedName: "api-version", type: { @@ -145,6 +145,16 @@ export const serverFqdn: OperationQueryParameter = { } }; +export const format: OperationQueryParameter = { + parameterPath: ["options", "format"], + mapper: { + serializedName: "format", + type: { + name: "String" + } + } +}; + export const contentType: OperationParameter = { parameterPath: ["options", "contentType"], mapper: { diff --git a/sdk/containerservice/arm-containerservice/src/operations/managedClusters.ts b/sdk/containerservice/arm-containerservice/src/operations/managedClusters.ts index 312079fdb010..5eeb5804c38f 100644 --- a/sdk/containerservice/arm-containerservice/src/operations/managedClusters.ts +++ b/sdk/containerservice/arm-containerservice/src/operations/managedClusters.ts @@ -1399,7 +1399,11 @@ const listClusterUserCredentialsOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.CloudError } }, - queryParameters: [Parameters.apiVersion, Parameters.serverFqdn], + queryParameters: [ + Parameters.apiVersion, + Parameters.serverFqdn, + Parameters.format + ], urlParameters: [ Parameters.$host, Parameters.subscriptionId, diff --git a/sdk/containerservice/arm-containerservice/tsconfig.json b/sdk/containerservice/arm-containerservice/tsconfig.json index 6e3251194117..5bad5556bbfd 100644 --- a/sdk/containerservice/arm-containerservice/tsconfig.json +++ b/sdk/containerservice/arm-containerservice/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-containerservice": [ + "./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