kazrael2119 2023-08-25 14:59:11 +08:00 коммит произвёл GitHub
Родитель e7e552a50d
Коммит da25d88ad0
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
110 изменённых файлов: 14363 добавлений и 1 удалений

1
.github/CODEOWNERS поставляемый
Просмотреть файл

@ -448,6 +448,7 @@
# PRLabel: %Mgmt
/sdk/hdinsight/arm-hdinsight/ @qiaozha @MaryGao
/sdk/hdinsight/arm-hdinsightcontainers/ @qiaozha @MaryGao
/sdk/hdinsight/ci.mgmt.yml @qiaozha @MaryGao
# PRLabel: %Mgmt

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

@ -107,6 +107,7 @@ specifiers:
'@rush-temp/arm-hanaonazure': file:./projects/arm-hanaonazure.tgz
'@rush-temp/arm-hardwaresecuritymodules': file:./projects/arm-hardwaresecuritymodules.tgz
'@rush-temp/arm-hdinsight': file:./projects/arm-hdinsight.tgz
'@rush-temp/arm-hdinsightcontainers': file:./projects/arm-hdinsightcontainers.tgz
'@rush-temp/arm-healthbot': file:./projects/arm-healthbot.tgz
'@rush-temp/arm-healthcareapis': file:./projects/arm-healthcareapis.tgz
'@rush-temp/arm-hybridcompute': file:./projects/arm-hybridcompute.tgz
@ -465,6 +466,7 @@ dependencies:
'@rush-temp/arm-hanaonazure': file:projects/arm-hanaonazure.tgz
'@rush-temp/arm-hardwaresecuritymodules': file:projects/arm-hardwaresecuritymodules.tgz
'@rush-temp/arm-hdinsight': file:projects/arm-hdinsight.tgz
'@rush-temp/arm-hdinsightcontainers': file:projects/arm-hdinsightcontainers.tgz
'@rush-temp/arm-healthbot': file:projects/arm-healthbot.tgz
'@rush-temp/arm-healthcareapis': file:projects/arm-healthcareapis.tgz
'@rush-temp/arm-hybridcompute': file:projects/arm-hybridcompute.tgz
@ -12671,6 +12673,37 @@ packages:
- supports-color
dev: false
file:projects/arm-hdinsightcontainers.tgz:
resolution: {integrity: sha512-zE/47UGK72bxsWWD6ApiVKf7bVMPwKw7UCalUjBL6uYdskLPXjXlYPC5BB/qijGXSF7q4clOKqYg/8F2iJ3NdA==, tarball: file:projects/arm-hdinsightcontainers.tgz}
name: '@rush-temp/arm-hdinsightcontainers'
version: 0.0.0
dependencies:
'@azure/identity': 2.1.0
'@microsoft/api-extractor': 7.36.4_@types+node@14.18.54
'@rollup/plugin-commonjs': 24.1.0_rollup@2.79.1
'@rollup/plugin-json': 6.0.0_rollup@2.79.1
'@rollup/plugin-multi-entry': 6.0.0_rollup@2.79.1
'@rollup/plugin-node-resolve': 13.3.0_rollup@2.79.1
'@types/chai': 4.3.5
'@types/node': 14.18.54
chai: 4.3.7
cross-env: 7.0.3
dotenv: 16.3.1
mkdirp: 2.1.6
mocha: 7.2.0
rimraf: 3.0.2
rollup: 2.79.1
rollup-plugin-sourcemaps: 0.6.3_dmbj5memikchm63lpeyt6ukdau
ts-node: 10.9.1_n7tz6hmpirns3flqdptizaxofa
tslib: 2.6.2
typescript: 5.0.4
uglify-js: 3.17.4
transitivePeerDependencies:
- '@swc/core'
- '@swc/wasm'
- supports-color
dev: false
file:projects/arm-healthbot.tgz:
resolution: {integrity: sha512-z4Q0Vf3rlXcr1G9ovnzaBnQsMVPsE1Hhc6u1CtSxoqT9SHn3Rmh+At7J0pG8KSL3zK30fkIkBzwPnq2K+PULrg==, tarball: file:projects/arm-healthbot.tgz}
name: '@rush-temp/arm-healthbot'

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

@ -27,3 +27,4 @@ https://docs.microsoft.com/javascript/api/@azure/arm-iotfirmwaredefense?view=azu
https://docs.microsoft.com/javascript/api/@azure/arm-quantum?view=azure-node-preview
https://docs.microsoft.com/javascript/api/@azure/arm-sphere?view=azure-node-preview
https://docs.microsoft.com/javascript/api/@azure/arm-defendereasm?view=azure-node-preview
https://docs.microsoft.com/javascript/api/@azure/arm-hdinsightcontainers?view=azure-node-preview

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

@ -2065,10 +2065,15 @@
"projectFolder": "sdk/sphere/arm-sphere",
"versionPolicyName": "management"
},
{
"packageName": "@azure/arm-hdinsightcontainers",
"projectFolder": "sdk/hdinsight/arm-hdinsightcontainers",
"versionPolicyName": "management"
},
{
"packageName": "@azure/arm-defendereasm",
"projectFolder": "sdk/defendereasm/arm-defendereasm",
"versionPolicyName": "management"
}
]
}
}

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

@ -0,0 +1,5 @@
# Release History
## 1.0.0-beta.1 (2023-08-23)
The package of @azure/arm-hdinsightcontainers is using our next generation design principles. To learn more, please refer to our documentation [Quick Start](https://aka.ms/js-track2-quickstart).

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

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2023 Microsoft
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

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

@ -0,0 +1,109 @@
# Azure HDInsightContainersManagement client library for JavaScript
This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure HDInsightContainersManagement client.
HDInsight Containers Management Client
[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/hdinsight/arm-hdinsightcontainers) |
[Package (NPM)](https://www.npmjs.com/package/@azure/arm-hdinsightcontainers) |
[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-hdinsightcontainers?view=azure-node-preview) |
[Samples](https://github.com/Azure-Samples/azure-samples-js-management)
## Getting started
### Currently supported environments
- [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule)
- Latest versions of Safari, Chrome, Edge and Firefox.
See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details.
### Prerequisites
- An [Azure subscription][azure_sub].
### Install the `@azure/arm-hdinsightcontainers` package
Install the Azure HDInsightContainersManagement client library for JavaScript with `npm`:
```bash
npm install @azure/arm-hdinsightcontainers
```
### Create and authenticate a `HDInsightContainersManagementClient`
To create a client object to access the Azure HDInsightContainersManagement API, you will need the `endpoint` of your Azure HDInsightContainersManagement resource and a `credential`. The Azure HDInsightContainersManagement client can use Azure Active Directory credentials to authenticate.
You can find the endpoint for your Azure HDInsightContainersManagement resource in the [Azure Portal][azure_portal].
You can authenticate with Azure Active Directory using a credential from the [@azure/identity][azure_identity] library or [an existing AAD Token](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token).
To use the [DefaultAzureCredential][defaultazurecredential] provider shown below, or other credential providers provided with the Azure SDK, please install the `@azure/identity` package:
```bash
npm install @azure/identity
```
You will also need to **register a new AAD application and grant access to Azure HDInsightContainersManagement** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions).
Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`.
For more information about how to create an Azure AD Application check out [this guide](https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal).
```javascript
const { HDInsightContainersManagementClient } = require("@azure/arm-hdinsightcontainers");
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 HDInsightContainersManagementClient(new DefaultAzureCredential(), subscriptionId);
// For client-side applications running in the browser, use this code instead:
// const credential = new InteractiveBrowserCredential({
// tenantId: "<YOUR_TENANT_ID>",
// clientId: "<YOUR_CLIENT_ID>"
// });
// const client = new HDInsightContainersManagementClient(credential, subscriptionId);
```
### JavaScript Bundle
To use this client library in the browser, first you need to use a bundler. For details on how to do this, please refer to our [bundling documentation](https://aka.ms/AzureSDKBundling).
## Key concepts
### HDInsightContainersManagementClient
`HDInsightContainersManagementClient` is the primary interface for developers using the Azure HDInsightContainersManagement client library. Explore the methods on this client object to understand the different features of the Azure HDInsightContainersManagement service that you can access.
## Troubleshooting
### Logging
Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`:
```javascript
const { setLogLevel } = require("@azure/logger");
setLogLevel("info");
```
For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger).
## Next steps
Please take a look at the [samples](https://github.com/Azure-Samples/azure-samples-js-management) directory for detailed examples on how to use this library.
## Contributing
If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code.
## Related projects
- [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js)
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fhdinsight%2Farm-hdinsightcontainers%2FREADME.png)
[azure_cli]: https://docs.microsoft.com/cli/azure
[azure_sub]: https://azure.microsoft.com/free/
[azure_sub]: https://azure.microsoft.com/free/
[azure_portal]: https://portal.azure.com
[azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity
[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential

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

@ -0,0 +1,8 @@
{
"commit": "6170c4758acf488e78978911a508b359823c5a43",
"readme": "specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/readme.md",
"autorest_command": "autorest --version=3.9.7 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\Git\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\hdinsight\\resource-manager\\Microsoft.HDInsight\\HDInsightOnAks\\readme.md --use=@autorest/typescript@6.0.8 --generate-sample=true",
"repository_url": "https://github.com/Azure/azure-rest-api-specs.git",
"release_tool": "@azure-tools/js-sdk-release-tools@2.7.2",
"use": "@autorest/typescript@6.0.8"
}

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

@ -0,0 +1,31 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"mainEntryPointFilePath": "./dist-esm/src/index.d.ts",
"docModel": {
"enabled": true
},
"apiReport": {
"enabled": true,
"reportFolder": "./review"
},
"dtsRollup": {
"enabled": true,
"untrimmedFilePath": "",
"publicTrimmedFilePath": "./types/arm-hdinsightcontainers.d.ts"
},
"messages": {
"tsdocMessageReporting": {
"default": {
"logLevel": "none"
}
},
"extractorMessageReporting": {
"ae-missing-release-tag": {
"logLevel": "none"
},
"ae-unresolved-link": {
"logLevel": "none"
}
}
}
}

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

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

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

@ -0,0 +1,124 @@
{
"name": "@azure/arm-hdinsightcontainers",
"sdk-type": "mgmt",
"author": "Microsoft Corporation",
"description": "A generated SDK for HDInsightContainersManagementClient.",
"version": "1.0.0-beta.1",
"engines": {
"node": ">=14.0.0"
},
"dependencies": {
"@azure/core-lro": "^2.5.4",
"@azure/abort-controller": "^1.0.0",
"@azure/core-paging": "^1.2.0",
"@azure/core-client": "^1.7.0",
"@azure/core-auth": "^1.3.0",
"@azure/core-rest-pipeline": "^1.12.0",
"tslib": "^2.2.0"
},
"keywords": [
"node",
"azure",
"typescript",
"browser",
"isomorphic"
],
"license": "MIT",
"main": "./dist/index.js",
"module": "./dist-esm/src/index.js",
"types": "./types/arm-hdinsightcontainers.d.ts",
"devDependencies": {
"@microsoft/api-extractor": "^7.31.1",
"@rollup/plugin-commonjs": "^24.0.0",
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-multi-entry": "^6.0.0",
"@rollup/plugin-node-resolve": "^13.1.3",
"mkdirp": "^2.1.2",
"rollup": "^2.66.1",
"rollup-plugin-sourcemaps": "^0.6.3",
"typescript": "~5.0.0",
"uglify-js": "^3.4.9",
"rimraf": "^3.0.0",
"dotenv": "^16.0.0",
"@azure/identity": "^2.0.1",
"@azure-tools/test-recorder": "^3.0.0",
"@azure-tools/test-credential": "^1.0.0",
"mocha": "^7.1.1",
"@types/chai": "^4.2.8",
"chai": "^4.2.0",
"cross-env": "^7.0.2",
"@types/node": "^14.0.0",
"ts-node": "^10.0.0",
"@azure/dev-tool": "^1.0.0"
},
"repository": {
"type": "git",
"url": "https://github.com/Azure/azure-sdk-for-js.git"
},
"bugs": {
"url": "https://github.com/Azure/azure-sdk-for-js/issues"
},
"files": [
"dist/**/*.js",
"dist/**/*.js.map",
"dist/**/*.d.ts",
"dist/**/*.d.ts.map",
"dist-esm/**/*.js",
"dist-esm/**/*.js.map",
"dist-esm/**/*.d.ts",
"dist-esm/**/*.d.ts.map",
"src/**/*.ts",
"README.md",
"LICENSE",
"rollup.config.js",
"tsconfig.json",
"review/*",
"CHANGELOG.md",
"types/*"
],
"scripts": {
"build": "npm run clean && tsc && rollup -c 2>&1 && npm run minify && mkdirp ./review && npm run extract-api",
"minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js",
"prepack": "npm run build",
"pack": "npm pack 2>&1",
"extract-api": "api-extractor run --local",
"lint": "echo skipped",
"audit": "echo skipped",
"clean": "rimraf dist dist-browser dist-esm test-dist temp types *.tgz *.log",
"build:node": "echo skipped",
"build:browser": "echo skipped",
"build:test": "echo skipped",
"build:samples": "echo skipped.",
"check-format": "echo skipped",
"execute:samples": "echo skipped",
"format": "echo skipped",
"test": "npm run integration-test",
"test:node": "echo skipped",
"test:browser": "echo skipped",
"unit-test": "npm run unit-test:node && npm run unit-test:browser",
"unit-test:node": "cross-env TEST_MODE=playback npm run integration-test:node",
"unit-test:browser": "echo skipped",
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
"integration-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 'test/*.ts'",
"integration-test:browser": "echo skipped"
},
"sideEffects": false,
"//metadata": {
"constantPaths": [
{
"path": "src/hDInsightContainersManagementClient.ts",
"prefix": "packageDetails"
}
]
},
"autoPublish": true,
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/hdinsight/arm-hdinsightcontainers",
"//sampleConfiguration": {
"productName": "",
"productSlugs": [
"azure"
],
"disableDocsMs": true,
"apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-hdinsightcontainers?view=azure-node-preview"
}
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -0,0 +1,122 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
import nodeResolve from "@rollup/plugin-node-resolve";
import cjs from "@rollup/plugin-commonjs";
import sourcemaps from "rollup-plugin-sourcemaps";
import multiEntry from "@rollup/plugin-multi-entry";
import json from "@rollup/plugin-json";
import nodeBuiltins from "builtin-modules";
// #region Warning Handler
/**
* 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 ignoreNiseSinonEval(warning) {
return (
warning.code === "EVAL" &&
warning.id &&
(warning.id.includes("node_modules/nise") ||
warning.id.includes("node_modules/sinon")) === true
);
}
function ignoreChaiCircularDependency(warning) {
return (
warning.code === "CIRCULAR_DEPENDENCY" &&
warning.importer && warning.importer.includes("node_modules/chai") === true
);
}
const warningInhibitors = [ignoreChaiCircularDependency, ignoreNiseSinonEval];
/**
* Construct a warning handler for the shared rollup configuration
* that ignores certain warnings that are not relevant to testing.
*/
function makeOnWarnForTesting() {
return (warning, warn) => {
// If every inhibitor returns false (i.e. no inhibitors), then show the warning
if (warningInhibitors.every((inhib) => !inhib(warning))) {
warn(warning);
}
};
}
// #endregion
function makeBrowserTestConfig() {
const config = {
input: {
include: ["dist-esm/test/**/*.spec.js"],
exclude: ["dist-esm/test/**/node/**"]
},
output: {
file: `dist-test/index.browser.js`,
format: "umd",
sourcemap: true
},
preserveSymlinks: false,
plugins: [
multiEntry({ exports: false }),
nodeResolve({
mainFields: ["module", "browser"]
}),
cjs(),
json(),
sourcemaps()
//viz({ filename: "dist-test/browser-stats.html", sourcemap: true })
],
onwarn: makeOnWarnForTesting(),
// Disable tree-shaking of test code. In rollup-plugin-node-resolve@5.0.0,
// rollup started respecting the "sideEffects" field in package.json. Since
// our package.json sets "sideEffects=false", this also applies to test
// code, which causes all tests to be removed by tree-shaking.
treeshake: false
};
return config;
}
const defaultConfigurationOptions = {
disableBrowserBundle: false
};
export function makeConfig(pkg, options) {
options = {
...defaultConfigurationOptions,
...(options || {})
};
const baseConfig = {
// Use the package's module field if it has one
input: pkg["module"] || "dist-esm/src/index.js",
external: [
...nodeBuiltins,
...Object.keys(pkg.dependencies),
...Object.keys(pkg.devDependencies)
],
output: { file: "dist/index.js", format: "cjs", sourcemap: true },
preserveSymlinks: false,
plugins: [sourcemaps(), nodeResolve()]
};
const config = [baseConfig];
if (!options.disableBrowserBundle) {
config.push(makeBrowserTestConfig());
}
return config;
}
export default makeConfig(require("./package.json"));

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

@ -0,0 +1,4 @@
# App registration secret for AAD authentication
AZURE_CLIENT_SECRET=
AZURE_CLIENT_ID=
AZURE_TENANT_ID=

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

@ -0,0 +1,46 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { HDInsightContainersManagementClient } from "@azure/arm-hdinsightcontainers";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Returns a list of available cluster pool versions.
*
* @summary Returns a list of available cluster pool versions.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ListAvailableClusterPoolVersions.json
*/
async function clusterPoolVersionListResult() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] ||
"10e32bab-26da-4cc4-a441-52b318f824e6";
const location = "westus2";
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(
credential,
subscriptionId
);
const resArray = new Array();
for await (let item of client.availableClusterPoolVersions.listByLocation(
location
)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
clusterPoolVersionListResult();
}
main().catch(console.error);

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

@ -0,0 +1,46 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { HDInsightContainersManagementClient } from "@azure/arm-hdinsightcontainers";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Returns a list of available cluster versions.
*
* @summary Returns a list of available cluster versions.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ListAvailableClusterVersions.json
*/
async function clusterVersionListResult() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] ||
"10e32bab-26da-4cc4-a441-52b318f824e6";
const location = "westus2";
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(
credential,
subscriptionId
);
const resArray = new Array();
for await (let item of client.availableClusterVersions.listByLocation(
location
)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
clusterVersionListResult();
}
main().catch(console.error);

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

@ -0,0 +1,51 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { HDInsightContainersManagementClient } from "@azure/arm-hdinsightcontainers";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Get jobs of HDInsight on AKS cluster.
*
* @summary Get jobs of HDInsight on AKS cluster.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ListClusterJobs.json
*/
async function listClusterJobs() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] ||
"10e32bab-26da-4cc4-a441-52b318f824e6";
const resourceGroupName =
process.env["HDINSIGHT_RESOURCE_GROUP"] || "hiloResourcegroup";
const clusterPoolName = "clusterPool1";
const clusterName = "cluster1";
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(
credential,
subscriptionId
);
const resArray = new Array();
for await (let item of client.clusterJobs.list(
resourceGroupName,
clusterPoolName,
clusterName
)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
listClusterJobs();
}
main().catch(console.error);

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

@ -0,0 +1,67 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import {
ClusterJob,
HDInsightContainersManagementClient
} from "@azure/arm-hdinsightcontainers";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Operations on jobs of HDInsight on AKS cluster.
*
* @summary Operations on jobs of HDInsight on AKS cluster.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/RunClusterJob.json
*/
async function runClusterJob() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] ||
"10e32bab-26da-4cc4-a441-52b318f824e6";
const resourceGroupName =
process.env["HDINSIGHT_RESOURCE_GROUP"] || "hiloResourcegroup";
const clusterPoolName = "clusterpool1";
const clusterName = "cluster1";
const clusterJob: ClusterJob = {
properties: {
action: "START",
entryClass: "com.microsoft.hilo.flink.job.streaming.SleepJob",
flinkConfiguration: {
parallelism: "1",
savepointDirectory:
"abfs://flinkjob@hilosa.dfs.core.windows.net/savepoint"
},
jarName: "flink-sleep-job-0.0.1-SNAPSHOT.jar",
jobJarDirectory: "abfs://flinkjob@hilosa.dfs.core.windows.net/jars",
jobName: "flink-job-name",
jobType: "FlinkJob"
}
};
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(
credential,
subscriptionId
);
const result = await client.clusterJobs.beginRunJobAndWait(
resourceGroupName,
clusterPoolName,
clusterName,
clusterJob
);
console.log(result);
}
async function main() {
runClusterJob();
}
main().catch(console.error);

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

@ -0,0 +1,55 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import {
ClusterPool,
HDInsightContainersManagementClient
} from "@azure/arm-hdinsightcontainers";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Creates or updates a cluster pool.
*
* @summary Creates or updates a cluster pool.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/CreateClusterPool.json
*/
async function clusterPoolPut() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] ||
"10e32bab-26da-4cc4-a441-52b318f824e6";
const resourceGroupName =
process.env["HDINSIGHT_RESOURCE_GROUP"] || "hiloResourcegroup";
const clusterPoolName = "clusterpool1";
const clusterPool: ClusterPool = {
clusterPoolProfile: { clusterPoolVersion: "1.2" },
computeProfile: { vmSize: "Standard_D3_v2" },
location: "West US 2"
};
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(
credential,
subscriptionId
);
const result = await client.clusterPools.beginCreateOrUpdateAndWait(
resourceGroupName,
clusterPoolName,
clusterPool
);
console.log(result);
}
async function main() {
clusterPoolPut();
}
main().catch(console.error);

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

@ -0,0 +1,45 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { HDInsightContainersManagementClient } from "@azure/arm-hdinsightcontainers";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Deletes a Cluster Pool.
*
* @summary Deletes a Cluster Pool.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/DeleteClusterPool.json
*/
async function clusterPoolDelete() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] ||
"10e32bab-26da-4cc4-a441-52b318f824e6";
const resourceGroupName = process.env["HDINSIGHT_RESOURCE_GROUP"] || "rg1";
const clusterPoolName = "clusterpool1";
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(
credential,
subscriptionId
);
const result = await client.clusterPools.beginDeleteAndWait(
resourceGroupName,
clusterPoolName
);
console.log(result);
}
async function main() {
clusterPoolDelete();
}
main().catch(console.error);

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

@ -0,0 +1,46 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { HDInsightContainersManagementClient } from "@azure/arm-hdinsightcontainers";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Gets a cluster pool.
*
* @summary Gets a cluster pool.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/GetClusterPool.json
*/
async function clusterPoolGet() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] ||
"10e32bab-26da-4cc4-a441-52b318f824e6";
const resourceGroupName =
process.env["HDINSIGHT_RESOURCE_GROUP"] || "hiloResourcegroup";
const clusterPoolName = "clusterpool1";
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(
credential,
subscriptionId
);
const result = await client.clusterPools.get(
resourceGroupName,
clusterPoolName
);
console.log(result);
}
async function main() {
clusterPoolGet();
}
main().catch(console.error);

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

@ -0,0 +1,47 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { HDInsightContainersManagementClient } from "@azure/arm-hdinsightcontainers";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Lists the HDInsight cluster pools under a resource group.
*
* @summary Lists the HDInsight cluster pools under a resource group.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ListClusterPools.json
*/
async function clusterPoolsListByResourceGroup() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] ||
"10e32bab-26da-4cc4-a441-52b318f824e6";
const resourceGroupName =
process.env["HDINSIGHT_RESOURCE_GROUP"] || "hiloResourcegroup";
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(
credential,
subscriptionId
);
const resArray = new Array();
for await (let item of client.clusterPools.listByResourceGroup(
resourceGroupName
)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
clusterPoolsListByResourceGroup();
}
main().catch(console.error);

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

@ -0,0 +1,43 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { HDInsightContainersManagementClient } from "@azure/arm-hdinsightcontainers";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Gets the list of Cluster Pools within a Subscription.
*
* @summary Gets the list of Cluster Pools within a Subscription.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ListClusterPoolsSubscription.json
*/
async function clusterPoolsListBySubscription() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] ||
"10e32bab-26da-4cc4-a441-52b318f824e6";
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(
credential,
subscriptionId
);
const resArray = new Array();
for await (let item of client.clusterPools.listBySubscription()) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
clusterPoolsListBySubscription();
}
main().catch(console.error);

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

@ -0,0 +1,53 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import {
TagsObject,
HDInsightContainersManagementClient
} from "@azure/arm-hdinsightcontainers";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Updates an existing Cluster Pool Tags.
*
* @summary Updates an existing Cluster Pool Tags.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/PatchClusterPool.json
*/
async function clusterPoolsPatchTags() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] ||
"10e32bab-26da-4cc4-a441-52b318f824e6";
const resourceGroupName =
process.env["HDINSIGHT_RESOURCE_GROUP"] || "hiloResourcegroup";
const clusterPoolName = "clusterpool1";
const clusterPoolTags: TagsObject = {
tags: { tag1: "value1", tag2: "value2" }
};
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(
credential,
subscriptionId
);
const result = await client.clusterPools.beginUpdateTagsAndWait(
resourceGroupName,
clusterPoolName,
clusterPoolTags
);
console.log(result);
}
async function main() {
clusterPoolsPatchTags();
}
main().catch(console.error);

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

@ -0,0 +1,205 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import {
Cluster,
HDInsightContainersManagementClient
} from "@azure/arm-hdinsightcontainers";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Creates a cluster.
*
* @summary Creates a cluster.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/CreateAutoscaleCluster.json
*/
async function hdInsightClusterPut() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] ||
"10e32bab-26da-4cc4-a441-52b318f824e6";
const resourceGroupName =
process.env["HDINSIGHT_RESOURCE_GROUP"] || "hiloResourcegroup";
const clusterPoolName = "clusterpool1";
const clusterName = "cluster1";
const hDInsightCluster: Cluster = {
clusterProfile: {
authorizationProfile: { userIds: ["testuser1", "testuser2"] },
autoscaleProfile: {
autoscaleType: "ScheduleBased",
enabled: true,
gracefulDecommissionTimeout: 3600,
loadBasedConfig: {
cooldownPeriod: 300,
maxNodes: 20,
minNodes: 10,
pollInterval: 60,
scalingRules: [
{
actionType: "scaleup",
comparisonRule: { operator: "greaterThan", threshold: 90 },
evaluationCount: 3,
scalingMetric: "cpu"
},
{
actionType: "scaledown",
comparisonRule: { operator: "lessThan", threshold: 20 },
evaluationCount: 3,
scalingMetric: "cpu"
}
]
},
scheduleBasedConfig: {
defaultCount: 10,
schedules: [
{
count: 20,
days: ["Monday"],
endTime: "12:00",
startTime: "00:00"
},
{
count: 25,
days: ["Sunday"],
endTime: "12:00",
startTime: "00:00"
}
],
timeZone: "Cen. Australia Standard Time"
}
},
clusterVersion: "1.0.1",
identityProfile: {
msiClientId: "de91f1d8-767f-460a-ac11-3cf103f74b34",
msiObjectId: "40491351-c240-4042-91e0-f644a1d2b441",
msiResourceId:
"/subscriptions/subid/resourceGroups/hiloResourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-msi"
},
kafkaProfile: {},
ossVersion: "2.4.1",
sshProfile: { count: 2 }
},
clusterType: "kafka",
computeProfile: {
nodes: [{ type: "worker", count: 4, vmSize: "Standard_D3_v2" }]
},
location: "West US 2"
};
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(
credential,
subscriptionId
);
const result = await client.clusters.beginCreateAndWait(
resourceGroupName,
clusterPoolName,
clusterName,
hDInsightCluster
);
console.log(result);
}
/**
* This sample demonstrates how to Creates a cluster.
*
* @summary Creates a cluster.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/CreateSparkCluster.json
*/
async function hdInsightSparkClusterPut() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] ||
"10e32bab-26da-4cc4-a441-52b318f824e6";
const resourceGroupName =
process.env["HDINSIGHT_RESOURCE_GROUP"] || "hiloResourcegroup";
const clusterPoolName = "clusterpool1";
const clusterName = "cluster1";
const hDInsightCluster: Cluster = {
clusterProfile: {
authorizationProfile: { userIds: ["testuser1", "testuser2"] },
clusterVersion: "0.0.1",
identityProfile: {
msiClientId: "de91f1d8-767f-460a-ac11-3cf103f74b34",
msiObjectId: "40491351-c240-4042-91e0-f644a1d2b441",
msiResourceId:
"/subscriptions/subid/resourceGroups/hiloResourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-msi"
},
ossVersion: "2.2.3",
serviceConfigsProfiles: [
{
configs: [
{
component: "spark-config",
files: [
{
fileName: "spark-defaults.conf",
values: { sparkEventLogEnabled: "true" }
}
]
}
],
serviceName: "spark-service"
},
{
configs: [
{
component: "yarn-config",
files: [
{
fileName: "core-site.xml",
values: {
fsDefaultFS:
"wasb://testcontainer@teststorage.dfs.core.windows.net/",
storageContainer: "testcontainer",
storageKey: "test key",
storageName: "teststorage",
storageProtocol: "wasb"
}
},
{
fileName: "yarn-site.xml",
values: { yarnWebappUi2Enable: "false" }
}
]
}
],
serviceName: "yarn-service"
}
],
sparkProfile: {},
sshProfile: { count: 2 }
},
clusterType: "spark",
computeProfile: {
nodes: [{ type: "worker", count: 4, vmSize: "Standard_D3_v2" }]
},
location: "West US 2"
};
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(
credential,
subscriptionId
);
const result = await client.clusters.beginCreateAndWait(
resourceGroupName,
clusterPoolName,
clusterName,
hDInsightCluster
);
console.log(result);
}
async function main() {
hdInsightClusterPut();
hdInsightSparkClusterPut();
}
main().catch(console.error);

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

@ -0,0 +1,47 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { HDInsightContainersManagementClient } from "@azure/arm-hdinsightcontainers";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Deletes a cluster.
*
* @summary Deletes a cluster.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/DeleteCluster.json
*/
async function hdInsightClustersDelete() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] ||
"10e32bab-26da-4cc4-a441-52b318f824e6";
const resourceGroupName = process.env["HDINSIGHT_RESOURCE_GROUP"] || "rg1";
const clusterPoolName = "clusterpool1";
const clusterName = "cluster1";
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(
credential,
subscriptionId
);
const result = await client.clusters.beginDeleteAndWait(
resourceGroupName,
clusterPoolName,
clusterName
);
console.log(result);
}
async function main() {
hdInsightClustersDelete();
}
main().catch(console.error);

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

@ -0,0 +1,47 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { HDInsightContainersManagementClient } from "@azure/arm-hdinsightcontainers";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Gets the status of a cluster instance.
*
* @summary Gets the status of a cluster instance.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/GetClusterInstanceView.json
*/
async function hdInsightClusterGetInstanceView() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] ||
"10e32bab-26da-4cc4-a441-52b318f824e6";
const resourceGroupName = process.env["HDINSIGHT_RESOURCE_GROUP"] || "rg1";
const clusterPoolName = "clusterPool1";
const clusterName = "cluster1";
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(
credential,
subscriptionId
);
const result = await client.clusters.getInstanceView(
resourceGroupName,
clusterPoolName,
clusterName
);
console.log(result);
}
async function main() {
hdInsightClusterGetInstanceView();
}
main().catch(console.error);

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

@ -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.
import { HDInsightContainersManagementClient } from "@azure/arm-hdinsightcontainers";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Gets a HDInsight cluster.
*
* @summary Gets a HDInsight cluster.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/GetCluster.json
*/
async function hdInsightClusterGet() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] ||
"10e32bab-26da-4cc4-a441-52b318f824e6";
const resourceGroupName =
process.env["HDINSIGHT_RESOURCE_GROUP"] || "hiloResourcegroup";
const clusterPoolName = "clusterpool1";
const clusterName = "cluster1";
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(
credential,
subscriptionId
);
const result = await client.clusters.get(
resourceGroupName,
clusterPoolName,
clusterName
);
console.log(result);
}
async function main() {
hdInsightClusterGet();
}
main().catch(console.error);

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

@ -0,0 +1,49 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { HDInsightContainersManagementClient } from "@azure/arm-hdinsightcontainers";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Lists the HDInsight cluster pools under a resource group.
*
* @summary Lists the HDInsight cluster pools under a resource group.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ListClustersByClusterPoolName.json
*/
async function hdInsightClustersListByClusterPoolName() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] ||
"10e32bab-26da-4cc4-a441-52b318f824e6";
const resourceGroupName =
process.env["HDINSIGHT_RESOURCE_GROUP"] || "hiloResourcegroup";
const clusterPoolName = "clusterpool1";
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(
credential,
subscriptionId
);
const resArray = new Array();
for await (let item of client.clusters.listByClusterPoolName(
resourceGroupName,
clusterPoolName
)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
hdInsightClustersListByClusterPoolName();
}
main().catch(console.error);

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

@ -0,0 +1,50 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { HDInsightContainersManagementClient } from "@azure/arm-hdinsightcontainers";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Lists the lists of instance views
*
* @summary Lists the lists of instance views
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ListClusterInstanceViews.json
*/
async function hdInsightClusterGetInstanceViews() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] ||
"10e32bab-26da-4cc4-a441-52b318f824e6";
const resourceGroupName = process.env["HDINSIGHT_RESOURCE_GROUP"] || "rg1";
const clusterPoolName = "clusterPool1";
const clusterName = "cluster1";
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(
credential,
subscriptionId
);
const resArray = new Array();
for await (let item of client.clusters.listInstanceViews(
resourceGroupName,
clusterPoolName,
clusterName
)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
hdInsightClusterGetInstanceViews();
}
main().catch(console.error);

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

@ -0,0 +1,50 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { HDInsightContainersManagementClient } from "@azure/arm-hdinsightcontainers";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Lists the config dump of all services running in cluster.
*
* @summary Lists the config dump of all services running in cluster.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ListClusterServiceConfigs.json
*/
async function hdInsightClusterGetServiceConfigs() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] ||
"10e32bab-26da-4cc4-a441-52b318f824e6";
const resourceGroupName = process.env["HDINSIGHT_RESOURCE_GROUP"] || "rg1";
const clusterPoolName = "clusterPool1";
const clusterName = "cluster1";
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(
credential,
subscriptionId
);
const resArray = new Array();
for await (let item of client.clusters.listServiceConfigs(
resourceGroupName,
clusterPoolName,
clusterName
)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
hdInsightClusterGetServiceConfigs();
}
main().catch(console.error);

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

@ -0,0 +1,56 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import {
ClusterResizeData,
HDInsightContainersManagementClient
} from "@azure/arm-hdinsightcontainers";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Resize an existing Cluster.
*
* @summary Resize an existing Cluster.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ResizeCluster.json
*/
async function hdInsightClusterResize() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] ||
"10e32bab-26da-4cc4-a441-52b318f824e6";
const resourceGroupName =
process.env["HDINSIGHT_RESOURCE_GROUP"] || "hiloResourcegroup";
const clusterPoolName = "clusterpool1";
const clusterName = "cluster1";
const clusterResizeRequest: ClusterResizeData = {
location: "West US 2",
targetWorkerNodeCount: 5
};
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(
credential,
subscriptionId
);
const result = await client.clusters.beginResizeAndWait(
resourceGroupName,
clusterPoolName,
clusterName,
clusterResizeRequest
);
console.log(result);
}
async function main() {
hdInsightClusterResize();
}
main().catch(console.error);

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

@ -0,0 +1,125 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import {
ClusterPatch,
HDInsightContainersManagementClient
} from "@azure/arm-hdinsightcontainers";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Updates an existing Cluster.
*
* @summary Updates an existing Cluster.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/PatchCluster.json
*/
async function hdInsightClustersPatchTags() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] ||
"10e32bab-26da-4cc4-a441-52b318f824e6";
const resourceGroupName =
process.env["HDINSIGHT_RESOURCE_GROUP"] || "hiloResourcegroup";
const clusterPoolName = "clusterpool1";
const clusterName = "cluster1";
const clusterPatchRequest: ClusterPatch = {
clusterProfile: {
authorizationProfile: { userIds: ["Testuser1", "Testuser2"] },
autoscaleProfile: {
autoscaleType: "ScheduleBased",
enabled: true,
gracefulDecommissionTimeout: -1,
scheduleBasedConfig: {
defaultCount: 3,
schedules: [
{
count: 3,
days: ["Monday, Tuesday, Wednesday"],
endTime: "12:00",
startTime: "00:00"
},
{ count: 3, days: ["Sunday"], endTime: "12:00", startTime: "00:00" }
],
timeZone: "Cen. Australia Standard Time"
}
},
logAnalyticsProfile: {
applicationLogs: { stdErrorEnabled: true, stdOutEnabled: true },
enabled: true,
metricsEnabled: true
},
serviceConfigsProfiles: [
{
configs: [
{
component: "TestComp1",
files: [
{
fileName: "TestFile1",
values: { testConfig1: "1", testConfig2: "2" }
},
{
fileName: "TestFile2",
values: { testConfig3: "3", testConfig4: "4" }
}
]
},
{
component: "TestComp2",
files: [
{
path: "TestPath",
content: "TestContent",
fileName: "TestFile3"
},
{
fileName: "TestFile4",
values: { testConfig7: "7", testConfig8: "8" }
}
]
}
],
serviceName: "TestService1"
},
{
configs: [
{
component: "TestComp3",
files: [{ fileName: "TestFile5", values: { testConfig9: "9" } }]
}
],
serviceName: "TestService2"
}
],
sshProfile: { count: 2 }
},
location: "West US 2"
};
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(
credential,
subscriptionId
);
const result = await client.clusters.beginUpdateAndWait(
resourceGroupName,
clusterPoolName,
clusterName,
clusterPatchRequest
);
console.log(result);
}
async function main() {
hdInsightClustersPatchTags();
}
main().catch(console.error);

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

@ -0,0 +1,51 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import {
NameAvailabilityParameters,
HDInsightContainersManagementClient
} from "@azure/arm-hdinsightcontainers";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Check the availability of the resource name.
*
* @summary Check the availability of the resource name.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/LocationsNameAvailability.json
*/
async function locationsNameAvailability() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] ||
"10e32bab-26da-4cc4-a441-52b318f824e6";
const location = "southeastasia";
const nameAvailabilityParameters: NameAvailabilityParameters = {
name: "contosemember1",
type: "Microsoft.HDInsight/clusterPools/clusters"
};
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(
credential,
subscriptionId
);
const result = await client.locations.checkNameAvailability(
location,
nameAvailabilityParameters
);
console.log(result);
}
async function main() {
locationsNameAvailability();
}
main().catch(console.error);

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

@ -0,0 +1,43 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { HDInsightContainersManagementClient } from "@azure/arm-hdinsightcontainers";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Returns list of operations.
*
* @summary Returns list of operations.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/GetOperations.json
*/
async function listOperations() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(
credential,
subscriptionId
);
const resArray = new Array();
for await (let item of client.operations.list()) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
listOperations();
}
main().catch(console.error);

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

@ -0,0 +1,90 @@
# client library samples for JavaScript (Beta)
These sample programs show how to use the JavaScript client libraries for in some common scenarios.
| **File Name** | **Description** |
| ------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [availableClusterPoolVersionsListByLocationSample.js][availableclusterpoolversionslistbylocationsample] | Returns a list of available cluster pool versions. x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ListAvailableClusterPoolVersions.json |
| [availableClusterVersionsListByLocationSample.js][availableclusterversionslistbylocationsample] | Returns a list of available cluster versions. x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ListAvailableClusterVersions.json |
| [clusterJobsListSample.js][clusterjobslistsample] | Get jobs of HDInsight on AKS cluster. x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ListClusterJobs.json |
| [clusterJobsRunJobSample.js][clusterjobsrunjobsample] | Operations on jobs of HDInsight on AKS cluster. x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/RunClusterJob.json |
| [clusterPoolsCreateOrUpdateSample.js][clusterpoolscreateorupdatesample] | Creates or updates a cluster pool. x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/CreateClusterPool.json |
| [clusterPoolsDeleteSample.js][clusterpoolsdeletesample] | Deletes a Cluster Pool. x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/DeleteClusterPool.json |
| [clusterPoolsGetSample.js][clusterpoolsgetsample] | Gets a cluster pool. x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/GetClusterPool.json |
| [clusterPoolsListByResourceGroupSample.js][clusterpoolslistbyresourcegroupsample] | Lists the HDInsight cluster pools under a resource group. x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ListClusterPools.json |
| [clusterPoolsListBySubscriptionSample.js][clusterpoolslistbysubscriptionsample] | Gets the list of Cluster Pools within a Subscription. x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ListClusterPoolsSubscription.json |
| [clusterPoolsUpdateTagsSample.js][clusterpoolsupdatetagssample] | Updates an existing Cluster Pool Tags. x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/PatchClusterPool.json |
| [clustersCreateSample.js][clusterscreatesample] | Creates a cluster. x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/CreateAutoscaleCluster.json |
| [clustersDeleteSample.js][clustersdeletesample] | Deletes a cluster. x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/DeleteCluster.json |
| [clustersGetInstanceViewSample.js][clustersgetinstanceviewsample] | Gets the status of a cluster instance. x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/GetClusterInstanceView.json |
| [clustersGetSample.js][clustersgetsample] | Gets a HDInsight cluster. x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/GetCluster.json |
| [clustersListByClusterPoolNameSample.js][clusterslistbyclusterpoolnamesample] | Lists the HDInsight cluster pools under a resource group. x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ListClustersByClusterPoolName.json |
| [clustersListInstanceViewsSample.js][clusterslistinstanceviewssample] | Lists the lists of instance views x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ListClusterInstanceViews.json |
| [clustersListServiceConfigsSample.js][clusterslistserviceconfigssample] | Lists the config dump of all services running in cluster. x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ListClusterServiceConfigs.json |
| [clustersResizeSample.js][clustersresizesample] | Resize an existing Cluster. x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ResizeCluster.json |
| [clustersUpdateSample.js][clustersupdatesample] | Updates an existing Cluster. x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/PatchCluster.json |
| [locationsCheckNameAvailabilitySample.js][locationschecknameavailabilitysample] | Check the availability of the resource name. x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/LocationsNameAvailability.json |
| [operationsListSample.js][operationslistsample] | Returns list of operations. x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/GetOperations.json |
## Prerequisites
The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule).
You need [an Azure subscription][freesub] to run these sample programs.
Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function.
Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package].
## Setup
To run the samples using the published version of the package:
1. Install the dependencies using `npm`:
```bash
npm install
```
2. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically.
3. Run whichever samples you like (note that some samples may require additional setup, see the table above):
```bash
node availableClusterPoolVersionsListByLocationSample.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 HDINSIGHT_SUBSCRIPTION_ID="<hdinsight subscription id>" node availableClusterPoolVersionsListByLocationSample.js
```
## Next Steps
Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients.
[availableclusterpoolversionslistbylocationsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/hdinsight/arm-hdinsightcontainers/samples/v1-beta/javascript/availableClusterPoolVersionsListByLocationSample.js
[availableclusterversionslistbylocationsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/hdinsight/arm-hdinsightcontainers/samples/v1-beta/javascript/availableClusterVersionsListByLocationSample.js
[clusterjobslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/hdinsight/arm-hdinsightcontainers/samples/v1-beta/javascript/clusterJobsListSample.js
[clusterjobsrunjobsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/hdinsight/arm-hdinsightcontainers/samples/v1-beta/javascript/clusterJobsRunJobSample.js
[clusterpoolscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/hdinsight/arm-hdinsightcontainers/samples/v1-beta/javascript/clusterPoolsCreateOrUpdateSample.js
[clusterpoolsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/hdinsight/arm-hdinsightcontainers/samples/v1-beta/javascript/clusterPoolsDeleteSample.js
[clusterpoolsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/hdinsight/arm-hdinsightcontainers/samples/v1-beta/javascript/clusterPoolsGetSample.js
[clusterpoolslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/hdinsight/arm-hdinsightcontainers/samples/v1-beta/javascript/clusterPoolsListByResourceGroupSample.js
[clusterpoolslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/hdinsight/arm-hdinsightcontainers/samples/v1-beta/javascript/clusterPoolsListBySubscriptionSample.js
[clusterpoolsupdatetagssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/hdinsight/arm-hdinsightcontainers/samples/v1-beta/javascript/clusterPoolsUpdateTagsSample.js
[clusterscreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/hdinsight/arm-hdinsightcontainers/samples/v1-beta/javascript/clustersCreateSample.js
[clustersdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/hdinsight/arm-hdinsightcontainers/samples/v1-beta/javascript/clustersDeleteSample.js
[clustersgetinstanceviewsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/hdinsight/arm-hdinsightcontainers/samples/v1-beta/javascript/clustersGetInstanceViewSample.js
[clustersgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/hdinsight/arm-hdinsightcontainers/samples/v1-beta/javascript/clustersGetSample.js
[clusterslistbyclusterpoolnamesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/hdinsight/arm-hdinsightcontainers/samples/v1-beta/javascript/clustersListByClusterPoolNameSample.js
[clusterslistinstanceviewssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/hdinsight/arm-hdinsightcontainers/samples/v1-beta/javascript/clustersListInstanceViewsSample.js
[clusterslistserviceconfigssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/hdinsight/arm-hdinsightcontainers/samples/v1-beta/javascript/clustersListServiceConfigsSample.js
[clustersresizesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/hdinsight/arm-hdinsightcontainers/samples/v1-beta/javascript/clustersResizeSample.js
[clustersupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/hdinsight/arm-hdinsightcontainers/samples/v1-beta/javascript/clustersUpdateSample.js
[locationschecknameavailabilitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/hdinsight/arm-hdinsightcontainers/samples/v1-beta/javascript/locationsCheckNameAvailabilitySample.js
[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/hdinsight/arm-hdinsightcontainers/samples/v1-beta/javascript/operationsListSample.js
[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-hdinsightcontainers?view=azure-node-preview
[freesub]: https://azure.microsoft.com/free/
[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/hdinsight/arm-hdinsightcontainers/README.md

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

@ -0,0 +1,38 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { HDInsightContainersManagementClient } = require("@azure/arm-hdinsightcontainers");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Returns a list of available cluster pool versions.
*
* @summary Returns a list of available cluster pool versions.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ListAvailableClusterPoolVersions.json
*/
async function clusterPoolVersionListResult() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] || "10e32bab-26da-4cc4-a441-52b318f824e6";
const location = "westus2";
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.availableClusterPoolVersions.listByLocation(location)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
clusterPoolVersionListResult();
}
main().catch(console.error);

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

@ -0,0 +1,38 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { HDInsightContainersManagementClient } = require("@azure/arm-hdinsightcontainers");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Returns a list of available cluster versions.
*
* @summary Returns a list of available cluster versions.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ListAvailableClusterVersions.json
*/
async function clusterVersionListResult() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] || "10e32bab-26da-4cc4-a441-52b318f824e6";
const location = "westus2";
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.availableClusterVersions.listByLocation(location)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
clusterVersionListResult();
}
main().catch(console.error);

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

@ -0,0 +1,40 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { HDInsightContainersManagementClient } = require("@azure/arm-hdinsightcontainers");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Get jobs of HDInsight on AKS cluster.
*
* @summary Get jobs of HDInsight on AKS cluster.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ListClusterJobs.json
*/
async function listClusterJobs() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] || "10e32bab-26da-4cc4-a441-52b318f824e6";
const resourceGroupName = process.env["HDINSIGHT_RESOURCE_GROUP"] || "hiloResourcegroup";
const clusterPoolName = "clusterPool1";
const clusterName = "cluster1";
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.clusterJobs.list(resourceGroupName, clusterPoolName, clusterName)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
listClusterJobs();
}
main().catch(console.error);

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

@ -0,0 +1,56 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { HDInsightContainersManagementClient } = require("@azure/arm-hdinsightcontainers");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Operations on jobs of HDInsight on AKS cluster.
*
* @summary Operations on jobs of HDInsight on AKS cluster.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/RunClusterJob.json
*/
async function runClusterJob() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] || "10e32bab-26da-4cc4-a441-52b318f824e6";
const resourceGroupName = process.env["HDINSIGHT_RESOURCE_GROUP"] || "hiloResourcegroup";
const clusterPoolName = "clusterpool1";
const clusterName = "cluster1";
const clusterJob = {
properties: {
action: "START",
entryClass: "com.microsoft.hilo.flink.job.streaming.SleepJob",
flinkConfiguration: {
parallelism: "1",
savepointDirectory: "abfs://flinkjob@hilosa.dfs.core.windows.net/savepoint",
},
jarName: "flink-sleep-job-0.0.1-SNAPSHOT.jar",
jobJarDirectory: "abfs://flinkjob@hilosa.dfs.core.windows.net/jars",
jobName: "flink-job-name",
jobType: "FlinkJob",
},
};
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(credential, subscriptionId);
const result = await client.clusterJobs.beginRunJobAndWait(
resourceGroupName,
clusterPoolName,
clusterName,
clusterJob
);
console.log(result);
}
async function main() {
runClusterJob();
}
main().catch(console.error);

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

@ -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.
const { HDInsightContainersManagementClient } = require("@azure/arm-hdinsightcontainers");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Creates or updates a cluster pool.
*
* @summary Creates or updates a cluster pool.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/CreateClusterPool.json
*/
async function clusterPoolPut() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] || "10e32bab-26da-4cc4-a441-52b318f824e6";
const resourceGroupName = process.env["HDINSIGHT_RESOURCE_GROUP"] || "hiloResourcegroup";
const clusterPoolName = "clusterpool1";
const clusterPool = {
clusterPoolProfile: { clusterPoolVersion: "1.2" },
computeProfile: { vmSize: "Standard_D3_v2" },
location: "West US 2",
};
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(credential, subscriptionId);
const result = await client.clusterPools.beginCreateOrUpdateAndWait(
resourceGroupName,
clusterPoolName,
clusterPool
);
console.log(result);
}
async function main() {
clusterPoolPut();
}
main().catch(console.error);

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

@ -0,0 +1,36 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { HDInsightContainersManagementClient } = require("@azure/arm-hdinsightcontainers");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Deletes a Cluster Pool.
*
* @summary Deletes a Cluster Pool.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/DeleteClusterPool.json
*/
async function clusterPoolDelete() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] || "10e32bab-26da-4cc4-a441-52b318f824e6";
const resourceGroupName = process.env["HDINSIGHT_RESOURCE_GROUP"] || "rg1";
const clusterPoolName = "clusterpool1";
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(credential, subscriptionId);
const result = await client.clusterPools.beginDeleteAndWait(resourceGroupName, clusterPoolName);
console.log(result);
}
async function main() {
clusterPoolDelete();
}
main().catch(console.error);

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

@ -0,0 +1,36 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { HDInsightContainersManagementClient } = require("@azure/arm-hdinsightcontainers");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Gets a cluster pool.
*
* @summary Gets a cluster pool.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/GetClusterPool.json
*/
async function clusterPoolGet() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] || "10e32bab-26da-4cc4-a441-52b318f824e6";
const resourceGroupName = process.env["HDINSIGHT_RESOURCE_GROUP"] || "hiloResourcegroup";
const clusterPoolName = "clusterpool1";
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(credential, subscriptionId);
const result = await client.clusterPools.get(resourceGroupName, clusterPoolName);
console.log(result);
}
async function main() {
clusterPoolGet();
}
main().catch(console.error);

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

@ -0,0 +1,38 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { HDInsightContainersManagementClient } = require("@azure/arm-hdinsightcontainers");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Lists the HDInsight cluster pools under a resource group.
*
* @summary Lists the HDInsight cluster pools under a resource group.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ListClusterPools.json
*/
async function clusterPoolsListByResourceGroup() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] || "10e32bab-26da-4cc4-a441-52b318f824e6";
const resourceGroupName = process.env["HDINSIGHT_RESOURCE_GROUP"] || "hiloResourcegroup";
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.clusterPools.listByResourceGroup(resourceGroupName)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
clusterPoolsListByResourceGroup();
}
main().catch(console.error);

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

@ -0,0 +1,37 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { HDInsightContainersManagementClient } = require("@azure/arm-hdinsightcontainers");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Gets the list of Cluster Pools within a Subscription.
*
* @summary Gets the list of Cluster Pools within a Subscription.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ListClusterPoolsSubscription.json
*/
async function clusterPoolsListBySubscription() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] || "10e32bab-26da-4cc4-a441-52b318f824e6";
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.clusterPools.listBySubscription()) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
clusterPoolsListBySubscription();
}
main().catch(console.error);

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

@ -0,0 +1,43 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { HDInsightContainersManagementClient } = require("@azure/arm-hdinsightcontainers");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Updates an existing Cluster Pool Tags.
*
* @summary Updates an existing Cluster Pool Tags.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/PatchClusterPool.json
*/
async function clusterPoolsPatchTags() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] || "10e32bab-26da-4cc4-a441-52b318f824e6";
const resourceGroupName = process.env["HDINSIGHT_RESOURCE_GROUP"] || "hiloResourcegroup";
const clusterPoolName = "clusterpool1";
const clusterPoolTags = {
tags: { tag1: "value1", tag2: "value2" },
};
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(credential, subscriptionId);
const result = await client.clusterPools.beginUpdateTagsAndWait(
resourceGroupName,
clusterPoolName,
clusterPoolTags
);
console.log(result);
}
async function main() {
clusterPoolsPatchTags();
}
main().catch(console.error);

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

@ -0,0 +1,189 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { HDInsightContainersManagementClient } = require("@azure/arm-hdinsightcontainers");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Creates a cluster.
*
* @summary Creates a cluster.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/CreateAutoscaleCluster.json
*/
async function hdInsightClusterPut() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] || "10e32bab-26da-4cc4-a441-52b318f824e6";
const resourceGroupName = process.env["HDINSIGHT_RESOURCE_GROUP"] || "hiloResourcegroup";
const clusterPoolName = "clusterpool1";
const clusterName = "cluster1";
const hDInsightCluster = {
clusterProfile: {
authorizationProfile: { userIds: ["testuser1", "testuser2"] },
autoscaleProfile: {
autoscaleType: "ScheduleBased",
enabled: true,
gracefulDecommissionTimeout: 3600,
loadBasedConfig: {
cooldownPeriod: 300,
maxNodes: 20,
minNodes: 10,
pollInterval: 60,
scalingRules: [
{
actionType: "scaleup",
comparisonRule: { operator: "greaterThan", threshold: 90 },
evaluationCount: 3,
scalingMetric: "cpu",
},
{
actionType: "scaledown",
comparisonRule: { operator: "lessThan", threshold: 20 },
evaluationCount: 3,
scalingMetric: "cpu",
},
],
},
scheduleBasedConfig: {
defaultCount: 10,
schedules: [
{
count: 20,
days: ["Monday"],
endTime: "12:00",
startTime: "00:00",
},
{
count: 25,
days: ["Sunday"],
endTime: "12:00",
startTime: "00:00",
},
],
timeZone: "Cen. Australia Standard Time",
},
},
clusterVersion: "1.0.1",
identityProfile: {
msiClientId: "de91f1d8-767f-460a-ac11-3cf103f74b34",
msiObjectId: "40491351-c240-4042-91e0-f644a1d2b441",
msiResourceId:
"/subscriptions/subid/resourceGroups/hiloResourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-msi",
},
kafkaProfile: {},
ossVersion: "2.4.1",
sshProfile: { count: 2 },
},
clusterType: "kafka",
computeProfile: {
nodes: [{ type: "worker", count: 4, vmSize: "Standard_D3_v2" }],
},
location: "West US 2",
};
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(credential, subscriptionId);
const result = await client.clusters.beginCreateAndWait(
resourceGroupName,
clusterPoolName,
clusterName,
hDInsightCluster
);
console.log(result);
}
/**
* This sample demonstrates how to Creates a cluster.
*
* @summary Creates a cluster.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/CreateSparkCluster.json
*/
async function hdInsightSparkClusterPut() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] || "10e32bab-26da-4cc4-a441-52b318f824e6";
const resourceGroupName = process.env["HDINSIGHT_RESOURCE_GROUP"] || "hiloResourcegroup";
const clusterPoolName = "clusterpool1";
const clusterName = "cluster1";
const hDInsightCluster = {
clusterProfile: {
authorizationProfile: { userIds: ["testuser1", "testuser2"] },
clusterVersion: "0.0.1",
identityProfile: {
msiClientId: "de91f1d8-767f-460a-ac11-3cf103f74b34",
msiObjectId: "40491351-c240-4042-91e0-f644a1d2b441",
msiResourceId:
"/subscriptions/subid/resourceGroups/hiloResourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-msi",
},
ossVersion: "2.2.3",
serviceConfigsProfiles: [
{
configs: [
{
component: "spark-config",
files: [
{
fileName: "spark-defaults.conf",
values: { sparkEventLogEnabled: "true" },
},
],
},
],
serviceName: "spark-service",
},
{
configs: [
{
component: "yarn-config",
files: [
{
fileName: "core-site.xml",
values: {
fsDefaultFS: "wasb://testcontainer@teststorage.dfs.core.windows.net/",
storageContainer: "testcontainer",
storageKey: "test key",
storageName: "teststorage",
storageProtocol: "wasb",
},
},
{
fileName: "yarn-site.xml",
values: { yarnWebappUi2Enable: "false" },
},
],
},
],
serviceName: "yarn-service",
},
],
sparkProfile: {},
sshProfile: { count: 2 },
},
clusterType: "spark",
computeProfile: {
nodes: [{ type: "worker", count: 4, vmSize: "Standard_D3_v2" }],
},
location: "West US 2",
};
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(credential, subscriptionId);
const result = await client.clusters.beginCreateAndWait(
resourceGroupName,
clusterPoolName,
clusterName,
hDInsightCluster
);
console.log(result);
}
async function main() {
hdInsightClusterPut();
hdInsightSparkClusterPut();
}
main().catch(console.error);

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

@ -0,0 +1,41 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { HDInsightContainersManagementClient } = require("@azure/arm-hdinsightcontainers");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Deletes a cluster.
*
* @summary Deletes a cluster.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/DeleteCluster.json
*/
async function hdInsightClustersDelete() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] || "10e32bab-26da-4cc4-a441-52b318f824e6";
const resourceGroupName = process.env["HDINSIGHT_RESOURCE_GROUP"] || "rg1";
const clusterPoolName = "clusterpool1";
const clusterName = "cluster1";
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(credential, subscriptionId);
const result = await client.clusters.beginDeleteAndWait(
resourceGroupName,
clusterPoolName,
clusterName
);
console.log(result);
}
async function main() {
hdInsightClustersDelete();
}
main().catch(console.error);

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

@ -0,0 +1,41 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { HDInsightContainersManagementClient } = require("@azure/arm-hdinsightcontainers");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Gets the status of a cluster instance.
*
* @summary Gets the status of a cluster instance.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/GetClusterInstanceView.json
*/
async function hdInsightClusterGetInstanceView() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] || "10e32bab-26da-4cc4-a441-52b318f824e6";
const resourceGroupName = process.env["HDINSIGHT_RESOURCE_GROUP"] || "rg1";
const clusterPoolName = "clusterPool1";
const clusterName = "cluster1";
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(credential, subscriptionId);
const result = await client.clusters.getInstanceView(
resourceGroupName,
clusterPoolName,
clusterName
);
console.log(result);
}
async function main() {
hdInsightClusterGetInstanceView();
}
main().catch(console.error);

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

@ -0,0 +1,37 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { HDInsightContainersManagementClient } = require("@azure/arm-hdinsightcontainers");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Gets a HDInsight cluster.
*
* @summary Gets a HDInsight cluster.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/GetCluster.json
*/
async function hdInsightClusterGet() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] || "10e32bab-26da-4cc4-a441-52b318f824e6";
const resourceGroupName = process.env["HDINSIGHT_RESOURCE_GROUP"] || "hiloResourcegroup";
const clusterPoolName = "clusterpool1";
const clusterName = "cluster1";
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(credential, subscriptionId);
const result = await client.clusters.get(resourceGroupName, clusterPoolName, clusterName);
console.log(result);
}
async function main() {
hdInsightClusterGet();
}
main().catch(console.error);

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

@ -0,0 +1,42 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { HDInsightContainersManagementClient } = require("@azure/arm-hdinsightcontainers");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Lists the HDInsight cluster pools under a resource group.
*
* @summary Lists the HDInsight cluster pools under a resource group.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ListClustersByClusterPoolName.json
*/
async function hdInsightClustersListByClusterPoolName() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] || "10e32bab-26da-4cc4-a441-52b318f824e6";
const resourceGroupName = process.env["HDINSIGHT_RESOURCE_GROUP"] || "hiloResourcegroup";
const clusterPoolName = "clusterpool1";
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.clusters.listByClusterPoolName(
resourceGroupName,
clusterPoolName
)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
hdInsightClustersListByClusterPoolName();
}
main().catch(console.error);

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

@ -0,0 +1,44 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { HDInsightContainersManagementClient } = require("@azure/arm-hdinsightcontainers");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Lists the lists of instance views
*
* @summary Lists the lists of instance views
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ListClusterInstanceViews.json
*/
async function hdInsightClusterGetInstanceViews() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] || "10e32bab-26da-4cc4-a441-52b318f824e6";
const resourceGroupName = process.env["HDINSIGHT_RESOURCE_GROUP"] || "rg1";
const clusterPoolName = "clusterPool1";
const clusterName = "cluster1";
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.clusters.listInstanceViews(
resourceGroupName,
clusterPoolName,
clusterName
)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
hdInsightClusterGetInstanceViews();
}
main().catch(console.error);

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

@ -0,0 +1,44 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { HDInsightContainersManagementClient } = require("@azure/arm-hdinsightcontainers");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Lists the config dump of all services running in cluster.
*
* @summary Lists the config dump of all services running in cluster.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ListClusterServiceConfigs.json
*/
async function hdInsightClusterGetServiceConfigs() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] || "10e32bab-26da-4cc4-a441-52b318f824e6";
const resourceGroupName = process.env["HDINSIGHT_RESOURCE_GROUP"] || "rg1";
const clusterPoolName = "clusterPool1";
const clusterName = "cluster1";
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.clusters.listServiceConfigs(
resourceGroupName,
clusterPoolName,
clusterName
)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
hdInsightClusterGetServiceConfigs();
}
main().catch(console.error);

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

@ -0,0 +1,46 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { HDInsightContainersManagementClient } = require("@azure/arm-hdinsightcontainers");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Resize an existing Cluster.
*
* @summary Resize an existing Cluster.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ResizeCluster.json
*/
async function hdInsightClusterResize() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] || "10e32bab-26da-4cc4-a441-52b318f824e6";
const resourceGroupName = process.env["HDINSIGHT_RESOURCE_GROUP"] || "hiloResourcegroup";
const clusterPoolName = "clusterpool1";
const clusterName = "cluster1";
const clusterResizeRequest = {
location: "West US 2",
targetWorkerNodeCount: 5,
};
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(credential, subscriptionId);
const result = await client.clusters.beginResizeAndWait(
resourceGroupName,
clusterPoolName,
clusterName,
clusterResizeRequest
);
console.log(result);
}
async function main() {
hdInsightClusterResize();
}
main().catch(console.error);

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

@ -0,0 +1,115 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { HDInsightContainersManagementClient } = require("@azure/arm-hdinsightcontainers");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Updates an existing Cluster.
*
* @summary Updates an existing Cluster.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/PatchCluster.json
*/
async function hdInsightClustersPatchTags() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] || "10e32bab-26da-4cc4-a441-52b318f824e6";
const resourceGroupName = process.env["HDINSIGHT_RESOURCE_GROUP"] || "hiloResourcegroup";
const clusterPoolName = "clusterpool1";
const clusterName = "cluster1";
const clusterPatchRequest = {
clusterProfile: {
authorizationProfile: { userIds: ["Testuser1", "Testuser2"] },
autoscaleProfile: {
autoscaleType: "ScheduleBased",
enabled: true,
gracefulDecommissionTimeout: -1,
scheduleBasedConfig: {
defaultCount: 3,
schedules: [
{
count: 3,
days: ["Monday, Tuesday, Wednesday"],
endTime: "12:00",
startTime: "00:00",
},
{ count: 3, days: ["Sunday"], endTime: "12:00", startTime: "00:00" },
],
timeZone: "Cen. Australia Standard Time",
},
},
logAnalyticsProfile: {
applicationLogs: { stdErrorEnabled: true, stdOutEnabled: true },
enabled: true,
metricsEnabled: true,
},
serviceConfigsProfiles: [
{
configs: [
{
component: "TestComp1",
files: [
{
fileName: "TestFile1",
values: { testConfig1: "1", testConfig2: "2" },
},
{
fileName: "TestFile2",
values: { testConfig3: "3", testConfig4: "4" },
},
],
},
{
component: "TestComp2",
files: [
{
path: "TestPath",
content: "TestContent",
fileName: "TestFile3",
},
{
fileName: "TestFile4",
values: { testConfig7: "7", testConfig8: "8" },
},
],
},
],
serviceName: "TestService1",
},
{
configs: [
{
component: "TestComp3",
files: [{ fileName: "TestFile5", values: { testConfig9: "9" } }],
},
],
serviceName: "TestService2",
},
],
sshProfile: { count: 2 },
},
location: "West US 2",
};
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(credential, subscriptionId);
const result = await client.clusters.beginUpdateAndWait(
resourceGroupName,
clusterPoolName,
clusterName,
clusterPatchRequest
);
console.log(result);
}
async function main() {
hdInsightClustersPatchTags();
}
main().catch(console.error);

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

@ -0,0 +1,39 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { HDInsightContainersManagementClient } = require("@azure/arm-hdinsightcontainers");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Check the availability of the resource name.
*
* @summary Check the availability of the resource name.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/LocationsNameAvailability.json
*/
async function locationsNameAvailability() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] || "10e32bab-26da-4cc4-a441-52b318f824e6";
const location = "southeastasia";
const nameAvailabilityParameters = {
name: "contosemember1",
type: "Microsoft.HDInsight/clusterPools/clusters",
};
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(credential, subscriptionId);
const result = await client.locations.checkNameAvailability(location, nameAvailabilityParameters);
console.log(result);
}
async function main() {
locationsNameAvailability();
}
main().catch(console.error);

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

@ -0,0 +1,37 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { HDInsightContainersManagementClient } = require("@azure/arm-hdinsightcontainers");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Returns list of operations.
*
* @summary Returns list of operations.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/GetOperations.json
*/
async function listOperations() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.operations.list()) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
listOperations();
}
main().catch(console.error);

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

@ -0,0 +1,32 @@
{
"name": "@azure-samples/arm-hdinsightcontainers-js-beta",
"private": true,
"version": "1.0.0",
"description": " client library samples for JavaScript (Beta)",
"engines": {
"node": ">=14.0.0"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Azure/azure-sdk-for-js.git",
"directory": "sdk/hdinsight/arm-hdinsightcontainers"
},
"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/hdinsight/arm-hdinsightcontainers",
"dependencies": {
"@azure/arm-hdinsightcontainers": "next",
"dotenv": "latest",
"@azure/identity": "^2.0.1"
}
}

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

@ -0,0 +1,4 @@
# App registration secret for AAD authentication
AZURE_CLIENT_SECRET=
AZURE_CLIENT_ID=
AZURE_TENANT_ID=

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

@ -0,0 +1,103 @@
# client library samples for TypeScript (Beta)
These sample programs show how to use the TypeScript client libraries for in some common scenarios.
| **File Name** | **Description** |
| ------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [availableClusterPoolVersionsListByLocationSample.ts][availableclusterpoolversionslistbylocationsample] | Returns a list of available cluster pool versions. x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ListAvailableClusterPoolVersions.json |
| [availableClusterVersionsListByLocationSample.ts][availableclusterversionslistbylocationsample] | Returns a list of available cluster versions. x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ListAvailableClusterVersions.json |
| [clusterJobsListSample.ts][clusterjobslistsample] | Get jobs of HDInsight on AKS cluster. x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ListClusterJobs.json |
| [clusterJobsRunJobSample.ts][clusterjobsrunjobsample] | Operations on jobs of HDInsight on AKS cluster. x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/RunClusterJob.json |
| [clusterPoolsCreateOrUpdateSample.ts][clusterpoolscreateorupdatesample] | Creates or updates a cluster pool. x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/CreateClusterPool.json |
| [clusterPoolsDeleteSample.ts][clusterpoolsdeletesample] | Deletes a Cluster Pool. x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/DeleteClusterPool.json |
| [clusterPoolsGetSample.ts][clusterpoolsgetsample] | Gets a cluster pool. x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/GetClusterPool.json |
| [clusterPoolsListByResourceGroupSample.ts][clusterpoolslistbyresourcegroupsample] | Lists the HDInsight cluster pools under a resource group. x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ListClusterPools.json |
| [clusterPoolsListBySubscriptionSample.ts][clusterpoolslistbysubscriptionsample] | Gets the list of Cluster Pools within a Subscription. x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ListClusterPoolsSubscription.json |
| [clusterPoolsUpdateTagsSample.ts][clusterpoolsupdatetagssample] | Updates an existing Cluster Pool Tags. x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/PatchClusterPool.json |
| [clustersCreateSample.ts][clusterscreatesample] | Creates a cluster. x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/CreateAutoscaleCluster.json |
| [clustersDeleteSample.ts][clustersdeletesample] | Deletes a cluster. x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/DeleteCluster.json |
| [clustersGetInstanceViewSample.ts][clustersgetinstanceviewsample] | Gets the status of a cluster instance. x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/GetClusterInstanceView.json |
| [clustersGetSample.ts][clustersgetsample] | Gets a HDInsight cluster. x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/GetCluster.json |
| [clustersListByClusterPoolNameSample.ts][clusterslistbyclusterpoolnamesample] | Lists the HDInsight cluster pools under a resource group. x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ListClustersByClusterPoolName.json |
| [clustersListInstanceViewsSample.ts][clusterslistinstanceviewssample] | Lists the lists of instance views x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ListClusterInstanceViews.json |
| [clustersListServiceConfigsSample.ts][clusterslistserviceconfigssample] | Lists the config dump of all services running in cluster. x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ListClusterServiceConfigs.json |
| [clustersResizeSample.ts][clustersresizesample] | Resize an existing Cluster. x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ResizeCluster.json |
| [clustersUpdateSample.ts][clustersupdatesample] | Updates an existing Cluster. x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/PatchCluster.json |
| [locationsCheckNameAvailabilitySample.ts][locationschecknameavailabilitysample] | Check the availability of the resource name. x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/LocationsNameAvailability.json |
| [operationsListSample.ts][operationslistsample] | Returns list of operations. x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/GetOperations.json |
## Prerequisites
The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule).
Before running the samples in Node, they must be compiled to JavaScript using the TypeScript compiler. For more information on TypeScript, see the [TypeScript documentation][typescript]. Install the TypeScript compiler using:
```bash
npm install -g typescript
```
You need [an Azure subscription][freesub] to run these sample programs.
Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function.
Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package].
## Setup
To run the samples using the published version of the package:
1. Install the dependencies using `npm`:
```bash
npm install
```
2. Compile the samples:
```bash
npm run build
```
3. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically.
4. Run whichever samples you like (note that some samples may require additional setup, see the table above):
```bash
node dist/availableClusterPoolVersionsListByLocationSample.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 HDINSIGHT_SUBSCRIPTION_ID="<hdinsight subscription id>" node dist/availableClusterPoolVersionsListByLocationSample.js
```
## Next Steps
Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients.
[availableclusterpoolversionslistbylocationsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/hdinsight/arm-hdinsightcontainers/samples/v1-beta/typescript/src/availableClusterPoolVersionsListByLocationSample.ts
[availableclusterversionslistbylocationsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/hdinsight/arm-hdinsightcontainers/samples/v1-beta/typescript/src/availableClusterVersionsListByLocationSample.ts
[clusterjobslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/hdinsight/arm-hdinsightcontainers/samples/v1-beta/typescript/src/clusterJobsListSample.ts
[clusterjobsrunjobsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/hdinsight/arm-hdinsightcontainers/samples/v1-beta/typescript/src/clusterJobsRunJobSample.ts
[clusterpoolscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/hdinsight/arm-hdinsightcontainers/samples/v1-beta/typescript/src/clusterPoolsCreateOrUpdateSample.ts
[clusterpoolsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/hdinsight/arm-hdinsightcontainers/samples/v1-beta/typescript/src/clusterPoolsDeleteSample.ts
[clusterpoolsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/hdinsight/arm-hdinsightcontainers/samples/v1-beta/typescript/src/clusterPoolsGetSample.ts
[clusterpoolslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/hdinsight/arm-hdinsightcontainers/samples/v1-beta/typescript/src/clusterPoolsListByResourceGroupSample.ts
[clusterpoolslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/hdinsight/arm-hdinsightcontainers/samples/v1-beta/typescript/src/clusterPoolsListBySubscriptionSample.ts
[clusterpoolsupdatetagssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/hdinsight/arm-hdinsightcontainers/samples/v1-beta/typescript/src/clusterPoolsUpdateTagsSample.ts
[clusterscreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/hdinsight/arm-hdinsightcontainers/samples/v1-beta/typescript/src/clustersCreateSample.ts
[clustersdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/hdinsight/arm-hdinsightcontainers/samples/v1-beta/typescript/src/clustersDeleteSample.ts
[clustersgetinstanceviewsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/hdinsight/arm-hdinsightcontainers/samples/v1-beta/typescript/src/clustersGetInstanceViewSample.ts
[clustersgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/hdinsight/arm-hdinsightcontainers/samples/v1-beta/typescript/src/clustersGetSample.ts
[clusterslistbyclusterpoolnamesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/hdinsight/arm-hdinsightcontainers/samples/v1-beta/typescript/src/clustersListByClusterPoolNameSample.ts
[clusterslistinstanceviewssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/hdinsight/arm-hdinsightcontainers/samples/v1-beta/typescript/src/clustersListInstanceViewsSample.ts
[clusterslistserviceconfigssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/hdinsight/arm-hdinsightcontainers/samples/v1-beta/typescript/src/clustersListServiceConfigsSample.ts
[clustersresizesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/hdinsight/arm-hdinsightcontainers/samples/v1-beta/typescript/src/clustersResizeSample.ts
[clustersupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/hdinsight/arm-hdinsightcontainers/samples/v1-beta/typescript/src/clustersUpdateSample.ts
[locationschecknameavailabilitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/hdinsight/arm-hdinsightcontainers/samples/v1-beta/typescript/src/locationsCheckNameAvailabilitySample.ts
[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/hdinsight/arm-hdinsightcontainers/samples/v1-beta/typescript/src/operationsListSample.ts
[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-hdinsightcontainers?view=azure-node-preview
[freesub]: https://azure.microsoft.com/free/
[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/hdinsight/arm-hdinsightcontainers/README.md
[typescript]: https://www.typescriptlang.org/docs/home.html

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

@ -0,0 +1,41 @@
{
"name": "@azure-samples/arm-hdinsightcontainers-ts-beta",
"private": true,
"version": "1.0.0",
"description": " client library samples for TypeScript (Beta)",
"engines": {
"node": ">=14.0.0"
},
"scripts": {
"build": "tsc",
"prebuild": "rimraf dist/"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Azure/azure-sdk-for-js.git",
"directory": "sdk/hdinsight/arm-hdinsightcontainers"
},
"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/hdinsight/arm-hdinsightcontainers",
"dependencies": {
"@azure/arm-hdinsightcontainers": "next",
"dotenv": "latest",
"@azure/identity": "^2.0.1"
},
"devDependencies": {
"@types/node": "^14.0.0",
"typescript": "~5.0.0",
"rimraf": "latest"
}
}

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

@ -0,0 +1,4 @@
# App registration secret for AAD authentication
AZURE_CLIENT_SECRET=
AZURE_CLIENT_ID=
AZURE_TENANT_ID=

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

@ -0,0 +1,46 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { HDInsightContainersManagementClient } from "@azure/arm-hdinsightcontainers";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Returns a list of available cluster pool versions.
*
* @summary Returns a list of available cluster pool versions.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ListAvailableClusterPoolVersions.json
*/
async function clusterPoolVersionListResult() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] ||
"10e32bab-26da-4cc4-a441-52b318f824e6";
const location = "westus2";
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(
credential,
subscriptionId
);
const resArray = new Array();
for await (let item of client.availableClusterPoolVersions.listByLocation(
location
)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
clusterPoolVersionListResult();
}
main().catch(console.error);

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

@ -0,0 +1,46 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { HDInsightContainersManagementClient } from "@azure/arm-hdinsightcontainers";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Returns a list of available cluster versions.
*
* @summary Returns a list of available cluster versions.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ListAvailableClusterVersions.json
*/
async function clusterVersionListResult() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] ||
"10e32bab-26da-4cc4-a441-52b318f824e6";
const location = "westus2";
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(
credential,
subscriptionId
);
const resArray = new Array();
for await (let item of client.availableClusterVersions.listByLocation(
location
)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
clusterVersionListResult();
}
main().catch(console.error);

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

@ -0,0 +1,51 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { HDInsightContainersManagementClient } from "@azure/arm-hdinsightcontainers";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Get jobs of HDInsight on AKS cluster.
*
* @summary Get jobs of HDInsight on AKS cluster.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ListClusterJobs.json
*/
async function listClusterJobs() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] ||
"10e32bab-26da-4cc4-a441-52b318f824e6";
const resourceGroupName =
process.env["HDINSIGHT_RESOURCE_GROUP"] || "hiloResourcegroup";
const clusterPoolName = "clusterPool1";
const clusterName = "cluster1";
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(
credential,
subscriptionId
);
const resArray = new Array();
for await (let item of client.clusterJobs.list(
resourceGroupName,
clusterPoolName,
clusterName
)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
listClusterJobs();
}
main().catch(console.error);

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

@ -0,0 +1,67 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import {
ClusterJob,
HDInsightContainersManagementClient
} from "@azure/arm-hdinsightcontainers";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Operations on jobs of HDInsight on AKS cluster.
*
* @summary Operations on jobs of HDInsight on AKS cluster.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/RunClusterJob.json
*/
async function runClusterJob() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] ||
"10e32bab-26da-4cc4-a441-52b318f824e6";
const resourceGroupName =
process.env["HDINSIGHT_RESOURCE_GROUP"] || "hiloResourcegroup";
const clusterPoolName = "clusterpool1";
const clusterName = "cluster1";
const clusterJob: ClusterJob = {
properties: {
action: "START",
entryClass: "com.microsoft.hilo.flink.job.streaming.SleepJob",
flinkConfiguration: {
parallelism: "1",
savepointDirectory:
"abfs://flinkjob@hilosa.dfs.core.windows.net/savepoint"
},
jarName: "flink-sleep-job-0.0.1-SNAPSHOT.jar",
jobJarDirectory: "abfs://flinkjob@hilosa.dfs.core.windows.net/jars",
jobName: "flink-job-name",
jobType: "FlinkJob"
}
};
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(
credential,
subscriptionId
);
const result = await client.clusterJobs.beginRunJobAndWait(
resourceGroupName,
clusterPoolName,
clusterName,
clusterJob
);
console.log(result);
}
async function main() {
runClusterJob();
}
main().catch(console.error);

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

@ -0,0 +1,55 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import {
ClusterPool,
HDInsightContainersManagementClient
} from "@azure/arm-hdinsightcontainers";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Creates or updates a cluster pool.
*
* @summary Creates or updates a cluster pool.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/CreateClusterPool.json
*/
async function clusterPoolPut() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] ||
"10e32bab-26da-4cc4-a441-52b318f824e6";
const resourceGroupName =
process.env["HDINSIGHT_RESOURCE_GROUP"] || "hiloResourcegroup";
const clusterPoolName = "clusterpool1";
const clusterPool: ClusterPool = {
clusterPoolProfile: { clusterPoolVersion: "1.2" },
computeProfile: { vmSize: "Standard_D3_v2" },
location: "West US 2"
};
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(
credential,
subscriptionId
);
const result = await client.clusterPools.beginCreateOrUpdateAndWait(
resourceGroupName,
clusterPoolName,
clusterPool
);
console.log(result);
}
async function main() {
clusterPoolPut();
}
main().catch(console.error);

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

@ -0,0 +1,45 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { HDInsightContainersManagementClient } from "@azure/arm-hdinsightcontainers";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Deletes a Cluster Pool.
*
* @summary Deletes a Cluster Pool.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/DeleteClusterPool.json
*/
async function clusterPoolDelete() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] ||
"10e32bab-26da-4cc4-a441-52b318f824e6";
const resourceGroupName = process.env["HDINSIGHT_RESOURCE_GROUP"] || "rg1";
const clusterPoolName = "clusterpool1";
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(
credential,
subscriptionId
);
const result = await client.clusterPools.beginDeleteAndWait(
resourceGroupName,
clusterPoolName
);
console.log(result);
}
async function main() {
clusterPoolDelete();
}
main().catch(console.error);

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

@ -0,0 +1,46 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { HDInsightContainersManagementClient } from "@azure/arm-hdinsightcontainers";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Gets a cluster pool.
*
* @summary Gets a cluster pool.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/GetClusterPool.json
*/
async function clusterPoolGet() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] ||
"10e32bab-26da-4cc4-a441-52b318f824e6";
const resourceGroupName =
process.env["HDINSIGHT_RESOURCE_GROUP"] || "hiloResourcegroup";
const clusterPoolName = "clusterpool1";
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(
credential,
subscriptionId
);
const result = await client.clusterPools.get(
resourceGroupName,
clusterPoolName
);
console.log(result);
}
async function main() {
clusterPoolGet();
}
main().catch(console.error);

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

@ -0,0 +1,47 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { HDInsightContainersManagementClient } from "@azure/arm-hdinsightcontainers";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Lists the HDInsight cluster pools under a resource group.
*
* @summary Lists the HDInsight cluster pools under a resource group.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ListClusterPools.json
*/
async function clusterPoolsListByResourceGroup() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] ||
"10e32bab-26da-4cc4-a441-52b318f824e6";
const resourceGroupName =
process.env["HDINSIGHT_RESOURCE_GROUP"] || "hiloResourcegroup";
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(
credential,
subscriptionId
);
const resArray = new Array();
for await (let item of client.clusterPools.listByResourceGroup(
resourceGroupName
)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
clusterPoolsListByResourceGroup();
}
main().catch(console.error);

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

@ -0,0 +1,43 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { HDInsightContainersManagementClient } from "@azure/arm-hdinsightcontainers";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Gets the list of Cluster Pools within a Subscription.
*
* @summary Gets the list of Cluster Pools within a Subscription.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ListClusterPoolsSubscription.json
*/
async function clusterPoolsListBySubscription() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] ||
"10e32bab-26da-4cc4-a441-52b318f824e6";
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(
credential,
subscriptionId
);
const resArray = new Array();
for await (let item of client.clusterPools.listBySubscription()) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
clusterPoolsListBySubscription();
}
main().catch(console.error);

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

@ -0,0 +1,53 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import {
TagsObject,
HDInsightContainersManagementClient
} from "@azure/arm-hdinsightcontainers";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Updates an existing Cluster Pool Tags.
*
* @summary Updates an existing Cluster Pool Tags.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/PatchClusterPool.json
*/
async function clusterPoolsPatchTags() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] ||
"10e32bab-26da-4cc4-a441-52b318f824e6";
const resourceGroupName =
process.env["HDINSIGHT_RESOURCE_GROUP"] || "hiloResourcegroup";
const clusterPoolName = "clusterpool1";
const clusterPoolTags: TagsObject = {
tags: { tag1: "value1", tag2: "value2" }
};
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(
credential,
subscriptionId
);
const result = await client.clusterPools.beginUpdateTagsAndWait(
resourceGroupName,
clusterPoolName,
clusterPoolTags
);
console.log(result);
}
async function main() {
clusterPoolsPatchTags();
}
main().catch(console.error);

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

@ -0,0 +1,205 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import {
Cluster,
HDInsightContainersManagementClient
} from "@azure/arm-hdinsightcontainers";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Creates a cluster.
*
* @summary Creates a cluster.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/CreateAutoscaleCluster.json
*/
async function hdInsightClusterPut() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] ||
"10e32bab-26da-4cc4-a441-52b318f824e6";
const resourceGroupName =
process.env["HDINSIGHT_RESOURCE_GROUP"] || "hiloResourcegroup";
const clusterPoolName = "clusterpool1";
const clusterName = "cluster1";
const hDInsightCluster: Cluster = {
clusterProfile: {
authorizationProfile: { userIds: ["testuser1", "testuser2"] },
autoscaleProfile: {
autoscaleType: "ScheduleBased",
enabled: true,
gracefulDecommissionTimeout: 3600,
loadBasedConfig: {
cooldownPeriod: 300,
maxNodes: 20,
minNodes: 10,
pollInterval: 60,
scalingRules: [
{
actionType: "scaleup",
comparisonRule: { operator: "greaterThan", threshold: 90 },
evaluationCount: 3,
scalingMetric: "cpu"
},
{
actionType: "scaledown",
comparisonRule: { operator: "lessThan", threshold: 20 },
evaluationCount: 3,
scalingMetric: "cpu"
}
]
},
scheduleBasedConfig: {
defaultCount: 10,
schedules: [
{
count: 20,
days: ["Monday"],
endTime: "12:00",
startTime: "00:00"
},
{
count: 25,
days: ["Sunday"],
endTime: "12:00",
startTime: "00:00"
}
],
timeZone: "Cen. Australia Standard Time"
}
},
clusterVersion: "1.0.1",
identityProfile: {
msiClientId: "de91f1d8-767f-460a-ac11-3cf103f74b34",
msiObjectId: "40491351-c240-4042-91e0-f644a1d2b441",
msiResourceId:
"/subscriptions/subid/resourceGroups/hiloResourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-msi"
},
kafkaProfile: {},
ossVersion: "2.4.1",
sshProfile: { count: 2 }
},
clusterType: "kafka",
computeProfile: {
nodes: [{ type: "worker", count: 4, vmSize: "Standard_D3_v2" }]
},
location: "West US 2"
};
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(
credential,
subscriptionId
);
const result = await client.clusters.beginCreateAndWait(
resourceGroupName,
clusterPoolName,
clusterName,
hDInsightCluster
);
console.log(result);
}
/**
* This sample demonstrates how to Creates a cluster.
*
* @summary Creates a cluster.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/CreateSparkCluster.json
*/
async function hdInsightSparkClusterPut() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] ||
"10e32bab-26da-4cc4-a441-52b318f824e6";
const resourceGroupName =
process.env["HDINSIGHT_RESOURCE_GROUP"] || "hiloResourcegroup";
const clusterPoolName = "clusterpool1";
const clusterName = "cluster1";
const hDInsightCluster: Cluster = {
clusterProfile: {
authorizationProfile: { userIds: ["testuser1", "testuser2"] },
clusterVersion: "0.0.1",
identityProfile: {
msiClientId: "de91f1d8-767f-460a-ac11-3cf103f74b34",
msiObjectId: "40491351-c240-4042-91e0-f644a1d2b441",
msiResourceId:
"/subscriptions/subid/resourceGroups/hiloResourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-msi"
},
ossVersion: "2.2.3",
serviceConfigsProfiles: [
{
configs: [
{
component: "spark-config",
files: [
{
fileName: "spark-defaults.conf",
values: { sparkEventLogEnabled: "true" }
}
]
}
],
serviceName: "spark-service"
},
{
configs: [
{
component: "yarn-config",
files: [
{
fileName: "core-site.xml",
values: {
fsDefaultFS:
"wasb://testcontainer@teststorage.dfs.core.windows.net/",
storageContainer: "testcontainer",
storageKey: "test key",
storageName: "teststorage",
storageProtocol: "wasb"
}
},
{
fileName: "yarn-site.xml",
values: { yarnWebappUi2Enable: "false" }
}
]
}
],
serviceName: "yarn-service"
}
],
sparkProfile: {},
sshProfile: { count: 2 }
},
clusterType: "spark",
computeProfile: {
nodes: [{ type: "worker", count: 4, vmSize: "Standard_D3_v2" }]
},
location: "West US 2"
};
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(
credential,
subscriptionId
);
const result = await client.clusters.beginCreateAndWait(
resourceGroupName,
clusterPoolName,
clusterName,
hDInsightCluster
);
console.log(result);
}
async function main() {
hdInsightClusterPut();
hdInsightSparkClusterPut();
}
main().catch(console.error);

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

@ -0,0 +1,47 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { HDInsightContainersManagementClient } from "@azure/arm-hdinsightcontainers";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Deletes a cluster.
*
* @summary Deletes a cluster.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/DeleteCluster.json
*/
async function hdInsightClustersDelete() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] ||
"10e32bab-26da-4cc4-a441-52b318f824e6";
const resourceGroupName = process.env["HDINSIGHT_RESOURCE_GROUP"] || "rg1";
const clusterPoolName = "clusterpool1";
const clusterName = "cluster1";
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(
credential,
subscriptionId
);
const result = await client.clusters.beginDeleteAndWait(
resourceGroupName,
clusterPoolName,
clusterName
);
console.log(result);
}
async function main() {
hdInsightClustersDelete();
}
main().catch(console.error);

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

@ -0,0 +1,47 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { HDInsightContainersManagementClient } from "@azure/arm-hdinsightcontainers";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Gets the status of a cluster instance.
*
* @summary Gets the status of a cluster instance.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/GetClusterInstanceView.json
*/
async function hdInsightClusterGetInstanceView() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] ||
"10e32bab-26da-4cc4-a441-52b318f824e6";
const resourceGroupName = process.env["HDINSIGHT_RESOURCE_GROUP"] || "rg1";
const clusterPoolName = "clusterPool1";
const clusterName = "cluster1";
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(
credential,
subscriptionId
);
const result = await client.clusters.getInstanceView(
resourceGroupName,
clusterPoolName,
clusterName
);
console.log(result);
}
async function main() {
hdInsightClusterGetInstanceView();
}
main().catch(console.error);

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

@ -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.
import { HDInsightContainersManagementClient } from "@azure/arm-hdinsightcontainers";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Gets a HDInsight cluster.
*
* @summary Gets a HDInsight cluster.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/GetCluster.json
*/
async function hdInsightClusterGet() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] ||
"10e32bab-26da-4cc4-a441-52b318f824e6";
const resourceGroupName =
process.env["HDINSIGHT_RESOURCE_GROUP"] || "hiloResourcegroup";
const clusterPoolName = "clusterpool1";
const clusterName = "cluster1";
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(
credential,
subscriptionId
);
const result = await client.clusters.get(
resourceGroupName,
clusterPoolName,
clusterName
);
console.log(result);
}
async function main() {
hdInsightClusterGet();
}
main().catch(console.error);

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

@ -0,0 +1,49 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { HDInsightContainersManagementClient } from "@azure/arm-hdinsightcontainers";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Lists the HDInsight cluster pools under a resource group.
*
* @summary Lists the HDInsight cluster pools under a resource group.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ListClustersByClusterPoolName.json
*/
async function hdInsightClustersListByClusterPoolName() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] ||
"10e32bab-26da-4cc4-a441-52b318f824e6";
const resourceGroupName =
process.env["HDINSIGHT_RESOURCE_GROUP"] || "hiloResourcegroup";
const clusterPoolName = "clusterpool1";
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(
credential,
subscriptionId
);
const resArray = new Array();
for await (let item of client.clusters.listByClusterPoolName(
resourceGroupName,
clusterPoolName
)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
hdInsightClustersListByClusterPoolName();
}
main().catch(console.error);

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

@ -0,0 +1,50 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { HDInsightContainersManagementClient } from "@azure/arm-hdinsightcontainers";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Lists the lists of instance views
*
* @summary Lists the lists of instance views
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ListClusterInstanceViews.json
*/
async function hdInsightClusterGetInstanceViews() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] ||
"10e32bab-26da-4cc4-a441-52b318f824e6";
const resourceGroupName = process.env["HDINSIGHT_RESOURCE_GROUP"] || "rg1";
const clusterPoolName = "clusterPool1";
const clusterName = "cluster1";
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(
credential,
subscriptionId
);
const resArray = new Array();
for await (let item of client.clusters.listInstanceViews(
resourceGroupName,
clusterPoolName,
clusterName
)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
hdInsightClusterGetInstanceViews();
}
main().catch(console.error);

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

@ -0,0 +1,50 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { HDInsightContainersManagementClient } from "@azure/arm-hdinsightcontainers";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Lists the config dump of all services running in cluster.
*
* @summary Lists the config dump of all services running in cluster.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ListClusterServiceConfigs.json
*/
async function hdInsightClusterGetServiceConfigs() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] ||
"10e32bab-26da-4cc4-a441-52b318f824e6";
const resourceGroupName = process.env["HDINSIGHT_RESOURCE_GROUP"] || "rg1";
const clusterPoolName = "clusterPool1";
const clusterName = "cluster1";
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(
credential,
subscriptionId
);
const resArray = new Array();
for await (let item of client.clusters.listServiceConfigs(
resourceGroupName,
clusterPoolName,
clusterName
)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
hdInsightClusterGetServiceConfigs();
}
main().catch(console.error);

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

@ -0,0 +1,56 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import {
ClusterResizeData,
HDInsightContainersManagementClient
} from "@azure/arm-hdinsightcontainers";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Resize an existing Cluster.
*
* @summary Resize an existing Cluster.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ResizeCluster.json
*/
async function hdInsightClusterResize() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] ||
"10e32bab-26da-4cc4-a441-52b318f824e6";
const resourceGroupName =
process.env["HDINSIGHT_RESOURCE_GROUP"] || "hiloResourcegroup";
const clusterPoolName = "clusterpool1";
const clusterName = "cluster1";
const clusterResizeRequest: ClusterResizeData = {
location: "West US 2",
targetWorkerNodeCount: 5
};
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(
credential,
subscriptionId
);
const result = await client.clusters.beginResizeAndWait(
resourceGroupName,
clusterPoolName,
clusterName,
clusterResizeRequest
);
console.log(result);
}
async function main() {
hdInsightClusterResize();
}
main().catch(console.error);

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

@ -0,0 +1,125 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import {
ClusterPatch,
HDInsightContainersManagementClient
} from "@azure/arm-hdinsightcontainers";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Updates an existing Cluster.
*
* @summary Updates an existing Cluster.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/PatchCluster.json
*/
async function hdInsightClustersPatchTags() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] ||
"10e32bab-26da-4cc4-a441-52b318f824e6";
const resourceGroupName =
process.env["HDINSIGHT_RESOURCE_GROUP"] || "hiloResourcegroup";
const clusterPoolName = "clusterpool1";
const clusterName = "cluster1";
const clusterPatchRequest: ClusterPatch = {
clusterProfile: {
authorizationProfile: { userIds: ["Testuser1", "Testuser2"] },
autoscaleProfile: {
autoscaleType: "ScheduleBased",
enabled: true,
gracefulDecommissionTimeout: -1,
scheduleBasedConfig: {
defaultCount: 3,
schedules: [
{
count: 3,
days: ["Monday, Tuesday, Wednesday"],
endTime: "12:00",
startTime: "00:00"
},
{ count: 3, days: ["Sunday"], endTime: "12:00", startTime: "00:00" }
],
timeZone: "Cen. Australia Standard Time"
}
},
logAnalyticsProfile: {
applicationLogs: { stdErrorEnabled: true, stdOutEnabled: true },
enabled: true,
metricsEnabled: true
},
serviceConfigsProfiles: [
{
configs: [
{
component: "TestComp1",
files: [
{
fileName: "TestFile1",
values: { testConfig1: "1", testConfig2: "2" }
},
{
fileName: "TestFile2",
values: { testConfig3: "3", testConfig4: "4" }
}
]
},
{
component: "TestComp2",
files: [
{
path: "TestPath",
content: "TestContent",
fileName: "TestFile3"
},
{
fileName: "TestFile4",
values: { testConfig7: "7", testConfig8: "8" }
}
]
}
],
serviceName: "TestService1"
},
{
configs: [
{
component: "TestComp3",
files: [{ fileName: "TestFile5", values: { testConfig9: "9" } }]
}
],
serviceName: "TestService2"
}
],
sshProfile: { count: 2 }
},
location: "West US 2"
};
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(
credential,
subscriptionId
);
const result = await client.clusters.beginUpdateAndWait(
resourceGroupName,
clusterPoolName,
clusterName,
clusterPatchRequest
);
console.log(result);
}
async function main() {
hdInsightClustersPatchTags();
}
main().catch(console.error);

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

@ -0,0 +1,51 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import {
NameAvailabilityParameters,
HDInsightContainersManagementClient
} from "@azure/arm-hdinsightcontainers";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Check the availability of the resource name.
*
* @summary Check the availability of the resource name.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/LocationsNameAvailability.json
*/
async function locationsNameAvailability() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] ||
"10e32bab-26da-4cc4-a441-52b318f824e6";
const location = "southeastasia";
const nameAvailabilityParameters: NameAvailabilityParameters = {
name: "contosemember1",
type: "Microsoft.HDInsight/clusterPools/clusters"
};
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(
credential,
subscriptionId
);
const result = await client.locations.checkNameAvailability(
location,
nameAvailabilityParameters
);
console.log(result);
}
async function main() {
locationsNameAvailability();
}
main().catch(console.error);

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

@ -0,0 +1,43 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { HDInsightContainersManagementClient } from "@azure/arm-hdinsightcontainers";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Returns list of operations.
*
* @summary Returns list of operations.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/GetOperations.json
*/
async function listOperations() {
const subscriptionId =
process.env["HDINSIGHT_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const credential = new DefaultAzureCredential();
const client = new HDInsightContainersManagementClient(
credential,
subscriptionId
);
const resArray = new Array();
for await (let item of client.operations.list()) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
listOperations();
}
main().catch(console.error);

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

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

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

@ -0,0 +1,170 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
import * as coreClient from "@azure/core-client";
import * as coreRestPipeline from "@azure/core-rest-pipeline";
import {
PipelineRequest,
PipelineResponse,
SendRequest
} from "@azure/core-rest-pipeline";
import * as coreAuth from "@azure/core-auth";
import {
ClusterPoolsImpl,
ClustersImpl,
ClusterJobsImpl,
LocationsImpl,
OperationsImpl,
AvailableClusterPoolVersionsImpl,
AvailableClusterVersionsImpl
} from "./operations";
import {
ClusterPools,
Clusters,
ClusterJobs,
Locations,
Operations,
AvailableClusterPoolVersions,
AvailableClusterVersions
} from "./operationsInterfaces";
import { HDInsightContainersManagementClientOptionalParams } from "./models";
export class HDInsightContainersManagementClient extends coreClient.ServiceClient {
$host: string;
subscriptionId: string;
apiVersion: string;
/**
* Initializes a new instance of the HDInsightContainersManagementClient class.
* @param credentials Subscription credentials which uniquely identify client subscription.
* @param subscriptionId The ID of the target subscription. The value must be an UUID.
* @param options The parameter options
*/
constructor(
credentials: coreAuth.TokenCredential,
subscriptionId: string,
options?: HDInsightContainersManagementClientOptionalParams
) {
if (credentials === undefined) {
throw new Error("'credentials' cannot be null");
}
if (subscriptionId === undefined) {
throw new Error("'subscriptionId' cannot be null");
}
// Initializing default values for options
if (!options) {
options = {};
}
const defaults: HDInsightContainersManagementClientOptionalParams = {
requestContentType: "application/json; charset=utf-8",
credential: credentials
};
const packageDetails = `azsdk-js-arm-hdinsightcontainers/1.0.0-beta.1`;
const userAgentPrefix =
options.userAgentOptions && options.userAgentOptions.userAgentPrefix
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
: `${packageDetails}`;
const optionsWithDefaults = {
...defaults,
...options,
userAgentOptions: {
userAgentPrefix
},
endpoint:
options.endpoint ?? options.baseUri ?? "https://management.azure.com"
};
super(optionsWithDefaults);
let bearerTokenAuthenticationPolicyFound: boolean = false;
if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) {
const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies();
bearerTokenAuthenticationPolicyFound = pipelinePolicies.some(
(pipelinePolicy) =>
pipelinePolicy.name ===
coreRestPipeline.bearerTokenAuthenticationPolicyName
);
}
if (
!options ||
!options.pipeline ||
options.pipeline.getOrderedPolicies().length == 0 ||
!bearerTokenAuthenticationPolicyFound
) {
this.pipeline.removePolicy({
name: coreRestPipeline.bearerTokenAuthenticationPolicyName
});
this.pipeline.addPolicy(
coreRestPipeline.bearerTokenAuthenticationPolicy({
credential: credentials,
scopes:
optionsWithDefaults.credentialScopes ??
`${optionsWithDefaults.endpoint}/.default`,
challengeCallbacks: {
authorizeRequestOnChallenge:
coreClient.authorizeRequestOnClaimChallenge
}
})
);
}
// Parameter assignments
this.subscriptionId = subscriptionId;
// Assigning values to Constant parameters
this.$host = options.$host || "https://management.azure.com";
this.apiVersion = options.apiVersion || "2023-06-01-preview";
this.clusterPools = new ClusterPoolsImpl(this);
this.clusters = new ClustersImpl(this);
this.clusterJobs = new ClusterJobsImpl(this);
this.locations = new LocationsImpl(this);
this.operations = new OperationsImpl(this);
this.availableClusterPoolVersions = new AvailableClusterPoolVersionsImpl(
this
);
this.availableClusterVersions = new AvailableClusterVersionsImpl(this);
this.addCustomApiVersionPolicy(options.apiVersion);
}
/** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */
private addCustomApiVersionPolicy(apiVersion?: string) {
if (!apiVersion) {
return;
}
const apiVersionPolicy = {
name: "CustomApiVersionPolicy",
async sendRequest(
request: PipelineRequest,
next: SendRequest
): Promise<PipelineResponse> {
const param = request.url.split("?");
if (param.length > 1) {
const newParams = param[1].split("&").map((item) => {
if (item.indexOf("api-version") > -1) {
return "api-version=" + apiVersion;
} else {
return item;
}
});
request.url = param[0] + "?" + newParams.join("&");
}
return next(request);
}
};
this.pipeline.addPolicy(apiVersionPolicy);
}
clusterPools: ClusterPools;
clusters: Clusters;
clusterJobs: ClusterJobs;
locations: Locations;
operations: Operations;
availableClusterPoolVersions: AvailableClusterPoolVersions;
availableClusterVersions: AvailableClusterVersions;
}

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

@ -0,0 +1,13 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
/// <reference lib="esnext.asynciterable" />
export { getContinuationToken } from "./pagingHelper";
export * from "./models";
export { HDInsightContainersManagementClient } from "./hDInsightContainersManagementClient";
export * from "./operationsInterfaces";

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

@ -0,0 +1,42 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
import { AbortSignalLike } from "@azure/abort-controller";
import { LongRunningOperation, LroResponse } from "@azure/core-lro";
export function createLroSpec<T>(inputs: {
sendOperationFn: (args: any, spec: any) => Promise<LroResponse<T>>;
args: Record<string, unknown>;
spec: {
readonly requestBody?: unknown;
readonly path?: string;
readonly httpMethod: string;
} & Record<string, any>;
}): LongRunningOperation<T> {
const { args, spec, sendOperationFn } = inputs;
return {
requestMethod: spec.httpMethod,
requestPath: spec.path!,
sendInitialRequest: () => sendOperationFn(args, spec),
sendPollRequest: (
path: string,
options?: { abortSignal?: AbortSignalLike }
) => {
const { requestBody, ...restSpec } = spec;
return sendOperationFn(args, {
...restSpec,
httpMethod: "GET",
path,
abortSignal: options?.abortSignal
});
}
};
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -0,0 +1,179 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
import {
OperationParameter,
OperationURLParameter,
OperationQueryParameter
} from "@azure/core-client";
import {
ClusterPool as ClusterPoolMapper,
TagsObject as TagsObjectMapper,
ClusterResizeData as ClusterResizeDataMapper,
Cluster as ClusterMapper,
ClusterPatch as ClusterPatchMapper,
ClusterJob as ClusterJobMapper,
NameAvailabilityParameters as NameAvailabilityParametersMapper
} from "../models/mappers";
export const accept: OperationParameter = {
parameterPath: "accept",
mapper: {
defaultValue: "application/json",
isConstant: true,
serializedName: "Accept",
type: {
name: "String"
}
}
};
export const $host: OperationURLParameter = {
parameterPath: "$host",
mapper: {
serializedName: "$host",
required: true,
type: {
name: "String"
}
},
skipEncoding: true
};
export const subscriptionId: OperationURLParameter = {
parameterPath: "subscriptionId",
mapper: {
serializedName: "subscriptionId",
required: true,
type: {
name: "Uuid"
}
}
};
export const resourceGroupName: OperationURLParameter = {
parameterPath: "resourceGroupName",
mapper: {
constraints: {
MaxLength: 90,
MinLength: 1
},
serializedName: "resourceGroupName",
required: true,
type: {
name: "String"
}
}
};
export const apiVersion: OperationQueryParameter = {
parameterPath: "apiVersion",
mapper: {
defaultValue: "2023-06-01-preview",
isConstant: true,
serializedName: "api-version",
type: {
name: "String"
}
}
};
export const clusterPoolName: OperationURLParameter = {
parameterPath: "clusterPoolName",
mapper: {
serializedName: "clusterPoolName",
required: true,
type: {
name: "String"
}
}
};
export const contentType: OperationParameter = {
parameterPath: ["options", "contentType"],
mapper: {
defaultValue: "application/json",
isConstant: true,
serializedName: "Content-Type",
type: {
name: "String"
}
}
};
export const clusterPool: OperationParameter = {
parameterPath: "clusterPool",
mapper: ClusterPoolMapper
};
export const clusterPoolTags: OperationParameter = {
parameterPath: "clusterPoolTags",
mapper: TagsObjectMapper
};
export const nextLink: OperationURLParameter = {
parameterPath: "nextLink",
mapper: {
serializedName: "nextLink",
required: true,
type: {
name: "String"
}
},
skipEncoding: true
};
export const clusterResizeRequest: OperationParameter = {
parameterPath: "clusterResizeRequest",
mapper: ClusterResizeDataMapper
};
export const clusterName: OperationURLParameter = {
parameterPath: "clusterName",
mapper: {
serializedName: "clusterName",
required: true,
type: {
name: "String"
}
}
};
export const hDInsightCluster: OperationParameter = {
parameterPath: "hDInsightCluster",
mapper: ClusterMapper
};
export const clusterPatchRequest: OperationParameter = {
parameterPath: "clusterPatchRequest",
mapper: ClusterPatchMapper
};
export const clusterJob: OperationParameter = {
parameterPath: "clusterJob",
mapper: ClusterJobMapper
};
export const nameAvailabilityParameters: OperationParameter = {
parameterPath: "nameAvailabilityParameters",
mapper: NameAvailabilityParametersMapper
};
export const location: OperationURLParameter = {
parameterPath: "location",
mapper: {
constraints: {
MinLength: 1
},
serializedName: "location",
required: true,
type: {
name: "String"
}
}
};

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

@ -0,0 +1,175 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging";
import { setContinuationToken } from "../pagingHelper";
import { AvailableClusterPoolVersions } from "../operationsInterfaces";
import * as coreClient from "@azure/core-client";
import * as Mappers from "../models/mappers";
import * as Parameters from "../models/parameters";
import { HDInsightContainersManagementClient } from "../hDInsightContainersManagementClient";
import {
ClusterPoolVersion,
AvailableClusterPoolVersionsListByLocationNextOptionalParams,
AvailableClusterPoolVersionsListByLocationOptionalParams,
AvailableClusterPoolVersionsListByLocationResponse,
AvailableClusterPoolVersionsListByLocationNextResponse
} from "../models";
/// <reference lib="esnext.asynciterable" />
/** Class containing AvailableClusterPoolVersions operations. */
export class AvailableClusterPoolVersionsImpl
implements AvailableClusterPoolVersions {
private readonly client: HDInsightContainersManagementClient;
/**
* Initialize a new instance of the class AvailableClusterPoolVersions class.
* @param client Reference to the service client
*/
constructor(client: HDInsightContainersManagementClient) {
this.client = client;
}
/**
* Returns a list of available cluster pool versions.
* @param location The name of the Azure region.
* @param options The options parameters.
*/
public listByLocation(
location: string,
options?: AvailableClusterPoolVersionsListByLocationOptionalParams
): PagedAsyncIterableIterator<ClusterPoolVersion> {
const iter = this.listByLocationPagingAll(location, options);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: (settings?: PageSettings) => {
if (settings?.maxPageSize) {
throw new Error("maxPageSize is not supported by this operation.");
}
return this.listByLocationPagingPage(location, options, settings);
}
};
}
private async *listByLocationPagingPage(
location: string,
options?: AvailableClusterPoolVersionsListByLocationOptionalParams,
settings?: PageSettings
): AsyncIterableIterator<ClusterPoolVersion[]> {
let result: AvailableClusterPoolVersionsListByLocationResponse;
let continuationToken = settings?.continuationToken;
if (!continuationToken) {
result = await this._listByLocation(location, options);
let page = result.value || [];
continuationToken = result.nextLink;
setContinuationToken(page, continuationToken);
yield page;
}
while (continuationToken) {
result = await this._listByLocationNext(
location,
continuationToken,
options
);
continuationToken = result.nextLink;
let page = result.value || [];
setContinuationToken(page, continuationToken);
yield page;
}
}
private async *listByLocationPagingAll(
location: string,
options?: AvailableClusterPoolVersionsListByLocationOptionalParams
): AsyncIterableIterator<ClusterPoolVersion> {
for await (const page of this.listByLocationPagingPage(location, options)) {
yield* page;
}
}
/**
* Returns a list of available cluster pool versions.
* @param location The name of the Azure region.
* @param options The options parameters.
*/
private _listByLocation(
location: string,
options?: AvailableClusterPoolVersionsListByLocationOptionalParams
): Promise<AvailableClusterPoolVersionsListByLocationResponse> {
return this.client.sendOperationRequest(
{ location, options },
listByLocationOperationSpec
);
}
/**
* ListByLocationNext
* @param location The name of the Azure region.
* @param nextLink The nextLink from the previous successful call to the ListByLocation method.
* @param options The options parameters.
*/
private _listByLocationNext(
location: string,
nextLink: string,
options?: AvailableClusterPoolVersionsListByLocationNextOptionalParams
): Promise<AvailableClusterPoolVersionsListByLocationNextResponse> {
return this.client.sendOperationRequest(
{ location, nextLink, options },
listByLocationNextOperationSpec
);
}
}
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
const listByLocationOperationSpec: coreClient.OperationSpec = {
path:
"/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/availableClusterPoolVersions",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ClusterPoolVersionsListResult
},
default: {
bodyMapper: Mappers.ErrorResponse
}
},
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.location
],
headerParameters: [Parameters.accept],
serializer
};
const listByLocationNextOperationSpec: coreClient.OperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ClusterPoolVersionsListResult
},
default: {
bodyMapper: Mappers.ErrorResponse
}
},
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.nextLink,
Parameters.location
],
headerParameters: [Parameters.accept],
serializer
};

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

@ -0,0 +1,174 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging";
import { setContinuationToken } from "../pagingHelper";
import { AvailableClusterVersions } from "../operationsInterfaces";
import * as coreClient from "@azure/core-client";
import * as Mappers from "../models/mappers";
import * as Parameters from "../models/parameters";
import { HDInsightContainersManagementClient } from "../hDInsightContainersManagementClient";
import {
ClusterVersion,
AvailableClusterVersionsListByLocationNextOptionalParams,
AvailableClusterVersionsListByLocationOptionalParams,
AvailableClusterVersionsListByLocationResponse,
AvailableClusterVersionsListByLocationNextResponse
} from "../models";
/// <reference lib="esnext.asynciterable" />
/** Class containing AvailableClusterVersions operations. */
export class AvailableClusterVersionsImpl implements AvailableClusterVersions {
private readonly client: HDInsightContainersManagementClient;
/**
* Initialize a new instance of the class AvailableClusterVersions class.
* @param client Reference to the service client
*/
constructor(client: HDInsightContainersManagementClient) {
this.client = client;
}
/**
* Returns a list of available cluster versions.
* @param location The name of the Azure region.
* @param options The options parameters.
*/
public listByLocation(
location: string,
options?: AvailableClusterVersionsListByLocationOptionalParams
): PagedAsyncIterableIterator<ClusterVersion> {
const iter = this.listByLocationPagingAll(location, options);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: (settings?: PageSettings) => {
if (settings?.maxPageSize) {
throw new Error("maxPageSize is not supported by this operation.");
}
return this.listByLocationPagingPage(location, options, settings);
}
};
}
private async *listByLocationPagingPage(
location: string,
options?: AvailableClusterVersionsListByLocationOptionalParams,
settings?: PageSettings
): AsyncIterableIterator<ClusterVersion[]> {
let result: AvailableClusterVersionsListByLocationResponse;
let continuationToken = settings?.continuationToken;
if (!continuationToken) {
result = await this._listByLocation(location, options);
let page = result.value || [];
continuationToken = result.nextLink;
setContinuationToken(page, continuationToken);
yield page;
}
while (continuationToken) {
result = await this._listByLocationNext(
location,
continuationToken,
options
);
continuationToken = result.nextLink;
let page = result.value || [];
setContinuationToken(page, continuationToken);
yield page;
}
}
private async *listByLocationPagingAll(
location: string,
options?: AvailableClusterVersionsListByLocationOptionalParams
): AsyncIterableIterator<ClusterVersion> {
for await (const page of this.listByLocationPagingPage(location, options)) {
yield* page;
}
}
/**
* Returns a list of available cluster versions.
* @param location The name of the Azure region.
* @param options The options parameters.
*/
private _listByLocation(
location: string,
options?: AvailableClusterVersionsListByLocationOptionalParams
): Promise<AvailableClusterVersionsListByLocationResponse> {
return this.client.sendOperationRequest(
{ location, options },
listByLocationOperationSpec
);
}
/**
* ListByLocationNext
* @param location The name of the Azure region.
* @param nextLink The nextLink from the previous successful call to the ListByLocation method.
* @param options The options parameters.
*/
private _listByLocationNext(
location: string,
nextLink: string,
options?: AvailableClusterVersionsListByLocationNextOptionalParams
): Promise<AvailableClusterVersionsListByLocationNextResponse> {
return this.client.sendOperationRequest(
{ location, nextLink, options },
listByLocationNextOperationSpec
);
}
}
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
const listByLocationOperationSpec: coreClient.OperationSpec = {
path:
"/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/availableClusterVersions",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ClusterVersionsListResult
},
default: {
bodyMapper: Mappers.ErrorResponse
}
},
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.location
],
headerParameters: [Parameters.accept],
serializer
};
const listByLocationNextOperationSpec: coreClient.OperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ClusterVersionsListResult
},
default: {
bodyMapper: Mappers.ErrorResponse
}
},
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.nextLink,
Parameters.location
],
headerParameters: [Parameters.accept],
serializer
};

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

@ -0,0 +1,366 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging";
import { setContinuationToken } from "../pagingHelper";
import { ClusterJobs } from "../operationsInterfaces";
import * as coreClient from "@azure/core-client";
import * as Mappers from "../models/mappers";
import * as Parameters from "../models/parameters";
import { HDInsightContainersManagementClient } from "../hDInsightContainersManagementClient";
import {
SimplePollerLike,
OperationState,
createHttpPoller
} from "@azure/core-lro";
import { createLroSpec } from "../lroImpl";
import {
ClusterJob,
ClusterJobsListNextOptionalParams,
ClusterJobsListOptionalParams,
ClusterJobsListResponse,
ClusterJobsRunJobOptionalParams,
ClusterJobsRunJobResponse,
ClusterJobsListNextResponse
} from "../models";
/// <reference lib="esnext.asynciterable" />
/** Class containing ClusterJobs operations. */
export class ClusterJobsImpl implements ClusterJobs {
private readonly client: HDInsightContainersManagementClient;
/**
* Initialize a new instance of the class ClusterJobs class.
* @param client Reference to the service client
*/
constructor(client: HDInsightContainersManagementClient) {
this.client = client;
}
/**
* Get jobs of HDInsight on AKS cluster.
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param clusterPoolName The name of the cluster pool.
* @param clusterName The name of the HDInsight cluster.
* @param options The options parameters.
*/
public list(
resourceGroupName: string,
clusterPoolName: string,
clusterName: string,
options?: ClusterJobsListOptionalParams
): PagedAsyncIterableIterator<ClusterJob> {
const iter = this.listPagingAll(
resourceGroupName,
clusterPoolName,
clusterName,
options
);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: (settings?: PageSettings) => {
if (settings?.maxPageSize) {
throw new Error("maxPageSize is not supported by this operation.");
}
return this.listPagingPage(
resourceGroupName,
clusterPoolName,
clusterName,
options,
settings
);
}
};
}
private async *listPagingPage(
resourceGroupName: string,
clusterPoolName: string,
clusterName: string,
options?: ClusterJobsListOptionalParams,
settings?: PageSettings
): AsyncIterableIterator<ClusterJob[]> {
let result: ClusterJobsListResponse;
let continuationToken = settings?.continuationToken;
if (!continuationToken) {
result = await this._list(
resourceGroupName,
clusterPoolName,
clusterName,
options
);
let page = result.value || [];
continuationToken = result.nextLink;
setContinuationToken(page, continuationToken);
yield page;
}
while (continuationToken) {
result = await this._listNext(
resourceGroupName,
clusterPoolName,
clusterName,
continuationToken,
options
);
continuationToken = result.nextLink;
let page = result.value || [];
setContinuationToken(page, continuationToken);
yield page;
}
}
private async *listPagingAll(
resourceGroupName: string,
clusterPoolName: string,
clusterName: string,
options?: ClusterJobsListOptionalParams
): AsyncIterableIterator<ClusterJob> {
for await (const page of this.listPagingPage(
resourceGroupName,
clusterPoolName,
clusterName,
options
)) {
yield* page;
}
}
/**
* Operations on jobs of HDInsight on AKS cluster.
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param clusterPoolName The name of the cluster pool.
* @param clusterName The name of the HDInsight cluster.
* @param clusterJob The Cluster job.
* @param options The options parameters.
*/
async beginRunJob(
resourceGroupName: string,
clusterPoolName: string,
clusterName: string,
clusterJob: ClusterJob,
options?: ClusterJobsRunJobOptionalParams
): Promise<
SimplePollerLike<
OperationState<ClusterJobsRunJobResponse>,
ClusterJobsRunJobResponse
>
> {
const directSendOperation = async (
args: coreClient.OperationArguments,
spec: coreClient.OperationSpec
): Promise<ClusterJobsRunJobResponse> => {
return this.client.sendOperationRequest(args, spec);
};
const sendOperationFn = async (
args: coreClient.OperationArguments,
spec: coreClient.OperationSpec
) => {
let currentRawResponse:
| coreClient.FullOperationResponse
| undefined = undefined;
const providedCallback = args.options?.onResponse;
const callback: coreClient.RawResponseCallback = (
rawResponse: coreClient.FullOperationResponse,
flatResponse: unknown
) => {
currentRawResponse = rawResponse;
providedCallback?.(rawResponse, flatResponse);
};
const updatedArgs = {
...args,
options: {
...args.options,
onResponse: callback
}
};
const flatResponse = await directSendOperation(updatedArgs, spec);
return {
flatResponse,
rawResponse: {
statusCode: currentRawResponse!.status,
body: currentRawResponse!.parsedBody,
headers: currentRawResponse!.headers.toJSON()
}
};
};
const lro = createLroSpec({
sendOperationFn,
args: {
resourceGroupName,
clusterPoolName,
clusterName,
clusterJob,
options
},
spec: runJobOperationSpec
});
const poller = await createHttpPoller<
ClusterJobsRunJobResponse,
OperationState<ClusterJobsRunJobResponse>
>(lro, {
restoreFrom: options?.resumeFrom,
intervalInMs: options?.updateIntervalInMs,
resourceLocationConfig: "location"
});
await poller.poll();
return poller;
}
/**
* Operations on jobs of HDInsight on AKS cluster.
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param clusterPoolName The name of the cluster pool.
* @param clusterName The name of the HDInsight cluster.
* @param clusterJob The Cluster job.
* @param options The options parameters.
*/
async beginRunJobAndWait(
resourceGroupName: string,
clusterPoolName: string,
clusterName: string,
clusterJob: ClusterJob,
options?: ClusterJobsRunJobOptionalParams
): Promise<ClusterJobsRunJobResponse> {
const poller = await this.beginRunJob(
resourceGroupName,
clusterPoolName,
clusterName,
clusterJob,
options
);
return poller.pollUntilDone();
}
/**
* Get jobs of HDInsight on AKS cluster.
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param clusterPoolName The name of the cluster pool.
* @param clusterName The name of the HDInsight cluster.
* @param options The options parameters.
*/
private _list(
resourceGroupName: string,
clusterPoolName: string,
clusterName: string,
options?: ClusterJobsListOptionalParams
): Promise<ClusterJobsListResponse> {
return this.client.sendOperationRequest(
{ resourceGroupName, clusterPoolName, clusterName, options },
listOperationSpec
);
}
/**
* ListNext
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param clusterPoolName The name of the cluster pool.
* @param clusterName The name of the HDInsight cluster.
* @param nextLink The nextLink from the previous successful call to the List method.
* @param options The options parameters.
*/
private _listNext(
resourceGroupName: string,
clusterPoolName: string,
clusterName: string,
nextLink: string,
options?: ClusterJobsListNextOptionalParams
): Promise<ClusterJobsListNextResponse> {
return this.client.sendOperationRequest(
{ resourceGroupName, clusterPoolName, clusterName, nextLink, options },
listNextOperationSpec
);
}
}
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
const runJobOperationSpec: coreClient.OperationSpec = {
path:
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}/clusters/{clusterName}/runJob",
httpMethod: "POST",
responses: {
200: {
bodyMapper: Mappers.ClusterJob
},
201: {
bodyMapper: Mappers.ClusterJob
},
202: {
bodyMapper: Mappers.ClusterJob
},
204: {
bodyMapper: Mappers.ClusterJob
},
default: {
bodyMapper: Mappers.ErrorResponse
}
},
requestBody: Parameters.clusterJob,
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.clusterPoolName,
Parameters.clusterName
],
headerParameters: [Parameters.accept, Parameters.contentType],
mediaType: "json",
serializer
};
const listOperationSpec: coreClient.OperationSpec = {
path:
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}/clusters/{clusterName}/jobs",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ClusterJobList
},
default: {
bodyMapper: Mappers.ErrorResponse
}
},
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.clusterPoolName,
Parameters.clusterName
],
headerParameters: [Parameters.accept],
serializer
};
const listNextOperationSpec: coreClient.OperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ClusterJobList
},
default: {
bodyMapper: Mappers.ErrorResponse
}
},
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.clusterPoolName,
Parameters.nextLink,
Parameters.clusterName
],
headerParameters: [Parameters.accept],
serializer
};

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

@ -0,0 +1,719 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging";
import { setContinuationToken } from "../pagingHelper";
import { ClusterPools } from "../operationsInterfaces";
import * as coreClient from "@azure/core-client";
import * as Mappers from "../models/mappers";
import * as Parameters from "../models/parameters";
import { HDInsightContainersManagementClient } from "../hDInsightContainersManagementClient";
import {
SimplePollerLike,
OperationState,
createHttpPoller
} from "@azure/core-lro";
import { createLroSpec } from "../lroImpl";
import {
ClusterPool,
ClusterPoolsListBySubscriptionNextOptionalParams,
ClusterPoolsListBySubscriptionOptionalParams,
ClusterPoolsListBySubscriptionResponse,
ClusterPoolsListByResourceGroupNextOptionalParams,
ClusterPoolsListByResourceGroupOptionalParams,
ClusterPoolsListByResourceGroupResponse,
ClusterPoolsGetOptionalParams,
ClusterPoolsGetResponse,
ClusterPoolsCreateOrUpdateOptionalParams,
ClusterPoolsCreateOrUpdateResponse,
TagsObject,
ClusterPoolsUpdateTagsOptionalParams,
ClusterPoolsUpdateTagsResponse,
ClusterPoolsDeleteOptionalParams,
ClusterPoolsListBySubscriptionNextResponse,
ClusterPoolsListByResourceGroupNextResponse
} from "../models";
/// <reference lib="esnext.asynciterable" />
/** Class containing ClusterPools operations. */
export class ClusterPoolsImpl implements ClusterPools {
private readonly client: HDInsightContainersManagementClient;
/**
* Initialize a new instance of the class ClusterPools class.
* @param client Reference to the service client
*/
constructor(client: HDInsightContainersManagementClient) {
this.client = client;
}
/**
* Gets the list of Cluster Pools within a Subscription.
* @param options The options parameters.
*/
public listBySubscription(
options?: ClusterPoolsListBySubscriptionOptionalParams
): PagedAsyncIterableIterator<ClusterPool> {
const iter = this.listBySubscriptionPagingAll(options);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: (settings?: PageSettings) => {
if (settings?.maxPageSize) {
throw new Error("maxPageSize is not supported by this operation.");
}
return this.listBySubscriptionPagingPage(options, settings);
}
};
}
private async *listBySubscriptionPagingPage(
options?: ClusterPoolsListBySubscriptionOptionalParams,
settings?: PageSettings
): AsyncIterableIterator<ClusterPool[]> {
let result: ClusterPoolsListBySubscriptionResponse;
let continuationToken = settings?.continuationToken;
if (!continuationToken) {
result = await this._listBySubscription(options);
let page = result.value || [];
continuationToken = result.nextLink;
setContinuationToken(page, continuationToken);
yield page;
}
while (continuationToken) {
result = await this._listBySubscriptionNext(continuationToken, options);
continuationToken = result.nextLink;
let page = result.value || [];
setContinuationToken(page, continuationToken);
yield page;
}
}
private async *listBySubscriptionPagingAll(
options?: ClusterPoolsListBySubscriptionOptionalParams
): AsyncIterableIterator<ClusterPool> {
for await (const page of this.listBySubscriptionPagingPage(options)) {
yield* page;
}
}
/**
* Lists the HDInsight cluster pools under a resource group.
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param options The options parameters.
*/
public listByResourceGroup(
resourceGroupName: string,
options?: ClusterPoolsListByResourceGroupOptionalParams
): PagedAsyncIterableIterator<ClusterPool> {
const iter = this.listByResourceGroupPagingAll(resourceGroupName, options);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: (settings?: PageSettings) => {
if (settings?.maxPageSize) {
throw new Error("maxPageSize is not supported by this operation.");
}
return this.listByResourceGroupPagingPage(
resourceGroupName,
options,
settings
);
}
};
}
private async *listByResourceGroupPagingPage(
resourceGroupName: string,
options?: ClusterPoolsListByResourceGroupOptionalParams,
settings?: PageSettings
): AsyncIterableIterator<ClusterPool[]> {
let result: ClusterPoolsListByResourceGroupResponse;
let continuationToken = settings?.continuationToken;
if (!continuationToken) {
result = await this._listByResourceGroup(resourceGroupName, options);
let page = result.value || [];
continuationToken = result.nextLink;
setContinuationToken(page, continuationToken);
yield page;
}
while (continuationToken) {
result = await this._listByResourceGroupNext(
resourceGroupName,
continuationToken,
options
);
continuationToken = result.nextLink;
let page = result.value || [];
setContinuationToken(page, continuationToken);
yield page;
}
}
private async *listByResourceGroupPagingAll(
resourceGroupName: string,
options?: ClusterPoolsListByResourceGroupOptionalParams
): AsyncIterableIterator<ClusterPool> {
for await (const page of this.listByResourceGroupPagingPage(
resourceGroupName,
options
)) {
yield* page;
}
}
/**
* Gets a cluster pool.
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param clusterPoolName The name of the cluster pool.
* @param options The options parameters.
*/
get(
resourceGroupName: string,
clusterPoolName: string,
options?: ClusterPoolsGetOptionalParams
): Promise<ClusterPoolsGetResponse> {
return this.client.sendOperationRequest(
{ resourceGroupName, clusterPoolName, options },
getOperationSpec
);
}
/**
* Creates or updates a cluster pool.
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param clusterPoolName The name of the cluster pool.
* @param clusterPool The Cluster Pool to create.
* @param options The options parameters.
*/
async beginCreateOrUpdate(
resourceGroupName: string,
clusterPoolName: string,
clusterPool: ClusterPool,
options?: ClusterPoolsCreateOrUpdateOptionalParams
): Promise<
SimplePollerLike<
OperationState<ClusterPoolsCreateOrUpdateResponse>,
ClusterPoolsCreateOrUpdateResponse
>
> {
const directSendOperation = async (
args: coreClient.OperationArguments,
spec: coreClient.OperationSpec
): Promise<ClusterPoolsCreateOrUpdateResponse> => {
return this.client.sendOperationRequest(args, spec);
};
const sendOperationFn = async (
args: coreClient.OperationArguments,
spec: coreClient.OperationSpec
) => {
let currentRawResponse:
| coreClient.FullOperationResponse
| undefined = undefined;
const providedCallback = args.options?.onResponse;
const callback: coreClient.RawResponseCallback = (
rawResponse: coreClient.FullOperationResponse,
flatResponse: unknown
) => {
currentRawResponse = rawResponse;
providedCallback?.(rawResponse, flatResponse);
};
const updatedArgs = {
...args,
options: {
...args.options,
onResponse: callback
}
};
const flatResponse = await directSendOperation(updatedArgs, spec);
return {
flatResponse,
rawResponse: {
statusCode: currentRawResponse!.status,
body: currentRawResponse!.parsedBody,
headers: currentRawResponse!.headers.toJSON()
}
};
};
const lro = createLroSpec({
sendOperationFn,
args: { resourceGroupName, clusterPoolName, clusterPool, options },
spec: createOrUpdateOperationSpec
});
const poller = await createHttpPoller<
ClusterPoolsCreateOrUpdateResponse,
OperationState<ClusterPoolsCreateOrUpdateResponse>
>(lro, {
restoreFrom: options?.resumeFrom,
intervalInMs: options?.updateIntervalInMs,
resourceLocationConfig: "azure-async-operation"
});
await poller.poll();
return poller;
}
/**
* Creates or updates a cluster pool.
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param clusterPoolName The name of the cluster pool.
* @param clusterPool The Cluster Pool to create.
* @param options The options parameters.
*/
async beginCreateOrUpdateAndWait(
resourceGroupName: string,
clusterPoolName: string,
clusterPool: ClusterPool,
options?: ClusterPoolsCreateOrUpdateOptionalParams
): Promise<ClusterPoolsCreateOrUpdateResponse> {
const poller = await this.beginCreateOrUpdate(
resourceGroupName,
clusterPoolName,
clusterPool,
options
);
return poller.pollUntilDone();
}
/**
* Updates an existing Cluster Pool Tags.
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param clusterPoolName The name of the cluster pool.
* @param clusterPoolTags Parameters supplied to update tags.
* @param options The options parameters.
*/
async beginUpdateTags(
resourceGroupName: string,
clusterPoolName: string,
clusterPoolTags: TagsObject,
options?: ClusterPoolsUpdateTagsOptionalParams
): Promise<
SimplePollerLike<
OperationState<ClusterPoolsUpdateTagsResponse>,
ClusterPoolsUpdateTagsResponse
>
> {
const directSendOperation = async (
args: coreClient.OperationArguments,
spec: coreClient.OperationSpec
): Promise<ClusterPoolsUpdateTagsResponse> => {
return this.client.sendOperationRequest(args, spec);
};
const sendOperationFn = async (
args: coreClient.OperationArguments,
spec: coreClient.OperationSpec
) => {
let currentRawResponse:
| coreClient.FullOperationResponse
| undefined = undefined;
const providedCallback = args.options?.onResponse;
const callback: coreClient.RawResponseCallback = (
rawResponse: coreClient.FullOperationResponse,
flatResponse: unknown
) => {
currentRawResponse = rawResponse;
providedCallback?.(rawResponse, flatResponse);
};
const updatedArgs = {
...args,
options: {
...args.options,
onResponse: callback
}
};
const flatResponse = await directSendOperation(updatedArgs, spec);
return {
flatResponse,
rawResponse: {
statusCode: currentRawResponse!.status,
body: currentRawResponse!.parsedBody,
headers: currentRawResponse!.headers.toJSON()
}
};
};
const lro = createLroSpec({
sendOperationFn,
args: { resourceGroupName, clusterPoolName, clusterPoolTags, options },
spec: updateTagsOperationSpec
});
const poller = await createHttpPoller<
ClusterPoolsUpdateTagsResponse,
OperationState<ClusterPoolsUpdateTagsResponse>
>(lro, {
restoreFrom: options?.resumeFrom,
intervalInMs: options?.updateIntervalInMs,
resourceLocationConfig: "azure-async-operation"
});
await poller.poll();
return poller;
}
/**
* Updates an existing Cluster Pool Tags.
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param clusterPoolName The name of the cluster pool.
* @param clusterPoolTags Parameters supplied to update tags.
* @param options The options parameters.
*/
async beginUpdateTagsAndWait(
resourceGroupName: string,
clusterPoolName: string,
clusterPoolTags: TagsObject,
options?: ClusterPoolsUpdateTagsOptionalParams
): Promise<ClusterPoolsUpdateTagsResponse> {
const poller = await this.beginUpdateTags(
resourceGroupName,
clusterPoolName,
clusterPoolTags,
options
);
return poller.pollUntilDone();
}
/**
* Deletes a Cluster Pool.
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param clusterPoolName The name of the cluster pool.
* @param options The options parameters.
*/
async beginDelete(
resourceGroupName: string,
clusterPoolName: string,
options?: ClusterPoolsDeleteOptionalParams
): Promise<SimplePollerLike<OperationState<void>, void>> {
const directSendOperation = async (
args: coreClient.OperationArguments,
spec: coreClient.OperationSpec
): Promise<void> => {
return this.client.sendOperationRequest(args, spec);
};
const sendOperationFn = async (
args: coreClient.OperationArguments,
spec: coreClient.OperationSpec
) => {
let currentRawResponse:
| coreClient.FullOperationResponse
| undefined = undefined;
const providedCallback = args.options?.onResponse;
const callback: coreClient.RawResponseCallback = (
rawResponse: coreClient.FullOperationResponse,
flatResponse: unknown
) => {
currentRawResponse = rawResponse;
providedCallback?.(rawResponse, flatResponse);
};
const updatedArgs = {
...args,
options: {
...args.options,
onResponse: callback
}
};
const flatResponse = await directSendOperation(updatedArgs, spec);
return {
flatResponse,
rawResponse: {
statusCode: currentRawResponse!.status,
body: currentRawResponse!.parsedBody,
headers: currentRawResponse!.headers.toJSON()
}
};
};
const lro = createLroSpec({
sendOperationFn,
args: { resourceGroupName, clusterPoolName, options },
spec: deleteOperationSpec
});
const poller = await createHttpPoller<void, OperationState<void>>(lro, {
restoreFrom: options?.resumeFrom,
intervalInMs: options?.updateIntervalInMs
});
await poller.poll();
return poller;
}
/**
* Deletes a Cluster Pool.
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param clusterPoolName The name of the cluster pool.
* @param options The options parameters.
*/
async beginDeleteAndWait(
resourceGroupName: string,
clusterPoolName: string,
options?: ClusterPoolsDeleteOptionalParams
): Promise<void> {
const poller = await this.beginDelete(
resourceGroupName,
clusterPoolName,
options
);
return poller.pollUntilDone();
}
/**
* Gets the list of Cluster Pools within a Subscription.
* @param options The options parameters.
*/
private _listBySubscription(
options?: ClusterPoolsListBySubscriptionOptionalParams
): Promise<ClusterPoolsListBySubscriptionResponse> {
return this.client.sendOperationRequest(
{ options },
listBySubscriptionOperationSpec
);
}
/**
* Lists the HDInsight cluster pools under a resource group.
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param options The options parameters.
*/
private _listByResourceGroup(
resourceGroupName: string,
options?: ClusterPoolsListByResourceGroupOptionalParams
): Promise<ClusterPoolsListByResourceGroupResponse> {
return this.client.sendOperationRequest(
{ resourceGroupName, options },
listByResourceGroupOperationSpec
);
}
/**
* ListBySubscriptionNext
* @param nextLink The nextLink from the previous successful call to the ListBySubscription method.
* @param options The options parameters.
*/
private _listBySubscriptionNext(
nextLink: string,
options?: ClusterPoolsListBySubscriptionNextOptionalParams
): Promise<ClusterPoolsListBySubscriptionNextResponse> {
return this.client.sendOperationRequest(
{ nextLink, options },
listBySubscriptionNextOperationSpec
);
}
/**
* ListByResourceGroupNext
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param nextLink The nextLink from the previous successful call to the ListByResourceGroup method.
* @param options The options parameters.
*/
private _listByResourceGroupNext(
resourceGroupName: string,
nextLink: string,
options?: ClusterPoolsListByResourceGroupNextOptionalParams
): Promise<ClusterPoolsListByResourceGroupNextResponse> {
return this.client.sendOperationRequest(
{ resourceGroupName, nextLink, options },
listByResourceGroupNextOperationSpec
);
}
}
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
const getOperationSpec: coreClient.OperationSpec = {
path:
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ClusterPool
},
default: {
bodyMapper: Mappers.ErrorResponse
}
},
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.clusterPoolName
],
headerParameters: [Parameters.accept],
serializer
};
const createOrUpdateOperationSpec: coreClient.OperationSpec = {
path:
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}",
httpMethod: "PUT",
responses: {
200: {
bodyMapper: Mappers.ClusterPool
},
201: {
bodyMapper: Mappers.ClusterPool
},
202: {
bodyMapper: Mappers.ClusterPool
},
204: {
bodyMapper: Mappers.ClusterPool
},
default: {
bodyMapper: Mappers.ErrorResponse
}
},
requestBody: Parameters.clusterPool,
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.clusterPoolName
],
headerParameters: [Parameters.accept, Parameters.contentType],
mediaType: "json",
serializer
};
const updateTagsOperationSpec: coreClient.OperationSpec = {
path:
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}",
httpMethod: "PATCH",
responses: {
200: {
bodyMapper: Mappers.ClusterPool
},
201: {
bodyMapper: Mappers.ClusterPool
},
202: {
bodyMapper: Mappers.ClusterPool
},
204: {
bodyMapper: Mappers.ClusterPool
},
default: {
bodyMapper: Mappers.ErrorResponse
}
},
requestBody: Parameters.clusterPoolTags,
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.clusterPoolName
],
headerParameters: [Parameters.accept, Parameters.contentType],
mediaType: "json",
serializer
};
const deleteOperationSpec: coreClient.OperationSpec = {
path:
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}",
httpMethod: "DELETE",
responses: {
200: {},
201: {},
202: {},
204: {},
default: {
bodyMapper: Mappers.ErrorResponse
}
},
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.clusterPoolName
],
headerParameters: [Parameters.accept],
serializer
};
const listBySubscriptionOperationSpec: coreClient.OperationSpec = {
path:
"/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/clusterpools",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ClusterPoolListResult
},
default: {
bodyMapper: Mappers.ErrorResponse
}
},
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host, Parameters.subscriptionId],
headerParameters: [Parameters.accept],
serializer
};
const listByResourceGroupOperationSpec: coreClient.OperationSpec = {
path:
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ClusterPoolListResult
},
default: {
bodyMapper: Mappers.ErrorResponse
}
},
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName
],
headerParameters: [Parameters.accept],
serializer
};
const listBySubscriptionNextOperationSpec: coreClient.OperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ClusterPoolListResult
},
default: {
bodyMapper: Mappers.ErrorResponse
}
},
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.nextLink
],
headerParameters: [Parameters.accept],
serializer
};
const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ClusterPoolListResult
},
default: {
bodyMapper: Mappers.ErrorResponse
}
},
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.nextLink
],
headerParameters: [Parameters.accept],
serializer
};

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -0,0 +1,15 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
export * from "./clusterPools";
export * from "./clusters";
export * from "./clusterJobs";
export * from "./locations";
export * from "./operations";
export * from "./availableClusterPoolVersions";
export * from "./availableClusterVersions";

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

@ -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.
*/
import { Locations } from "../operationsInterfaces";
import * as coreClient from "@azure/core-client";
import * as Mappers from "../models/mappers";
import * as Parameters from "../models/parameters";
import { HDInsightContainersManagementClient } from "../hDInsightContainersManagementClient";
import {
NameAvailabilityParameters,
LocationsCheckNameAvailabilityOptionalParams,
LocationsCheckNameAvailabilityResponse
} from "../models";
/** Class containing Locations operations. */
export class LocationsImpl implements Locations {
private readonly client: HDInsightContainersManagementClient;
/**
* Initialize a new instance of the class Locations class.
* @param client Reference to the service client
*/
constructor(client: HDInsightContainersManagementClient) {
this.client = client;
}
/**
* Check the availability of the resource name.
* @param location The name of the Azure region.
* @param nameAvailabilityParameters The name and type of the resource.
* @param options The options parameters.
*/
checkNameAvailability(
location: string,
nameAvailabilityParameters: NameAvailabilityParameters,
options?: LocationsCheckNameAvailabilityOptionalParams
): Promise<LocationsCheckNameAvailabilityResponse> {
return this.client.sendOperationRequest(
{ location, nameAvailabilityParameters, options },
checkNameAvailabilityOperationSpec
);
}
}
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
const checkNameAvailabilityOperationSpec: coreClient.OperationSpec = {
path:
"/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/checkNameAvailability",
httpMethod: "POST",
responses: {
200: {
bodyMapper: Mappers.NameAvailabilityResult
},
default: {
bodyMapper: Mappers.ErrorResponse
}
},
requestBody: Parameters.nameAvailabilityParameters,
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.location
],
headerParameters: [Parameters.accept, Parameters.contentType],
mediaType: "json",
serializer
};

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

@ -0,0 +1,149 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging";
import { setContinuationToken } from "../pagingHelper";
import { Operations } from "../operationsInterfaces";
import * as coreClient from "@azure/core-client";
import * as Mappers from "../models/mappers";
import * as Parameters from "../models/parameters";
import { HDInsightContainersManagementClient } from "../hDInsightContainersManagementClient";
import {
Operation,
OperationsListNextOptionalParams,
OperationsListOptionalParams,
OperationsListResponse,
OperationsListNextResponse
} from "../models";
/// <reference lib="esnext.asynciterable" />
/** Class containing Operations operations. */
export class OperationsImpl implements Operations {
private readonly client: HDInsightContainersManagementClient;
/**
* Initialize a new instance of the class Operations class.
* @param client Reference to the service client
*/
constructor(client: HDInsightContainersManagementClient) {
this.client = client;
}
/**
* Returns list of operations.
* @param options The options parameters.
*/
public list(
options?: OperationsListOptionalParams
): PagedAsyncIterableIterator<Operation> {
const iter = this.listPagingAll(options);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: (settings?: PageSettings) => {
if (settings?.maxPageSize) {
throw new Error("maxPageSize is not supported by this operation.");
}
return this.listPagingPage(options, settings);
}
};
}
private async *listPagingPage(
options?: OperationsListOptionalParams,
settings?: PageSettings
): AsyncIterableIterator<Operation[]> {
let result: OperationsListResponse;
let continuationToken = settings?.continuationToken;
if (!continuationToken) {
result = await this._list(options);
let page = result.value || [];
continuationToken = result.nextLink;
setContinuationToken(page, continuationToken);
yield page;
}
while (continuationToken) {
result = await this._listNext(continuationToken, options);
continuationToken = result.nextLink;
let page = result.value || [];
setContinuationToken(page, continuationToken);
yield page;
}
}
private async *listPagingAll(
options?: OperationsListOptionalParams
): AsyncIterableIterator<Operation> {
for await (const page of this.listPagingPage(options)) {
yield* page;
}
}
/**
* Returns list of operations.
* @param options The options parameters.
*/
private _list(
options?: OperationsListOptionalParams
): Promise<OperationsListResponse> {
return this.client.sendOperationRequest({ options }, listOperationSpec);
}
/**
* ListNext
* @param nextLink The nextLink from the previous successful call to the List method.
* @param options The options parameters.
*/
private _listNext(
nextLink: string,
options?: OperationsListNextOptionalParams
): Promise<OperationsListNextResponse> {
return this.client.sendOperationRequest(
{ nextLink, options },
listNextOperationSpec
);
}
}
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
const listOperationSpec: coreClient.OperationSpec = {
path: "/providers/Microsoft.HDInsight/operations",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.OperationListResult
},
default: {
bodyMapper: Mappers.ErrorResponse
}
},
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host],
headerParameters: [Parameters.accept],
serializer
};
const listNextOperationSpec: coreClient.OperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.OperationListResult
},
default: {
bodyMapper: Mappers.ErrorResponse
}
},
urlParameters: [Parameters.$host, Parameters.nextLink],
headerParameters: [Parameters.accept],
serializer
};

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

@ -0,0 +1,27 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
import { PagedAsyncIterableIterator } from "@azure/core-paging";
import {
ClusterPoolVersion,
AvailableClusterPoolVersionsListByLocationOptionalParams
} from "../models";
/// <reference lib="esnext.asynciterable" />
/** Interface representing a AvailableClusterPoolVersions. */
export interface AvailableClusterPoolVersions {
/**
* Returns a list of available cluster pool versions.
* @param location The name of the Azure region.
* @param options The options parameters.
*/
listByLocation(
location: string,
options?: AvailableClusterPoolVersionsListByLocationOptionalParams
): PagedAsyncIterableIterator<ClusterPoolVersion>;
}

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

@ -0,0 +1,27 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
import { PagedAsyncIterableIterator } from "@azure/core-paging";
import {
ClusterVersion,
AvailableClusterVersionsListByLocationOptionalParams
} from "../models";
/// <reference lib="esnext.asynciterable" />
/** Interface representing a AvailableClusterVersions. */
export interface AvailableClusterVersions {
/**
* Returns a list of available cluster versions.
* @param location The name of the Azure region.
* @param options The options parameters.
*/
listByLocation(
location: string,
options?: AvailableClusterVersionsListByLocationOptionalParams
): PagedAsyncIterableIterator<ClusterVersion>;
}

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше