cognitiverservices-track2-release (#21221)
This commit is contained in:
Родитель
2053ab3cc5
Коммит
8f0fe90c1b
|
@ -9608,7 +9608,7 @@ packages:
|
|||
dev: false
|
||||
|
||||
file:projects/arm-cognitiveservices.tgz:
|
||||
resolution: {integrity: sha512-TVvxQMYtcXgUfUms4MqQHE5zcUpCzg4eZK2VJmqQ14/paJG2amXdO2+wo96DbIzy1ay8xA5UYZH5zaMtEWY6tQ==, tarball: file:projects/arm-cognitiveservices.tgz}
|
||||
resolution: {integrity: sha512-5ft5zJVV/bD87pD20Gk+GbCy0EVtHJwVIptjnVlrK5Z/iAlNCK0uCvqYjr0DKhQHI8wp3biKOOZbfCE8xrG/Fw==, tarball: file:projects/arm-cognitiveservices.tgz}
|
||||
name: '@rush-temp/arm-cognitiveservices'
|
||||
version: 0.0.0
|
||||
dependencies:
|
||||
|
@ -9617,18 +9617,19 @@ packages:
|
|||
'@microsoft/api-extractor': 7.20.0
|
||||
'@rollup/plugin-commonjs': 21.0.3_rollup@2.70.1
|
||||
'@rollup/plugin-json': 4.1.0_rollup@2.70.1
|
||||
'@rollup/plugin-multi-entry': 3.0.1_rollup@2.70.1
|
||||
'@rollup/plugin-node-resolve': 8.4.0_rollup@2.70.1
|
||||
'@rollup/plugin-multi-entry': 4.1.0_rollup@2.70.1
|
||||
'@rollup/plugin-node-resolve': 13.1.3_rollup@2.70.1
|
||||
cross-env: 7.0.3
|
||||
mkdirp: 1.0.4
|
||||
mocha: 7.2.0
|
||||
rimraf: 3.0.2
|
||||
rollup: 2.70.1
|
||||
rollup-plugin-sourcemaps: 0.4.2_rollup@2.70.1
|
||||
rollup-plugin-sourcemaps: 0.6.3_rollup@2.70.1
|
||||
tslib: 2.3.1
|
||||
typescript: 4.2.4
|
||||
uglify-js: 3.15.3
|
||||
transitivePeerDependencies:
|
||||
- '@types/node'
|
||||
- debug
|
||||
- encoding
|
||||
- supports-color
|
||||
|
|
|
@ -1,15 +1,23 @@
|
|||
# Release History
|
||||
|
||||
## 7.1.0 (2022-04-06)
|
||||
|
||||
**Features**
|
||||
|
||||
## 7.0.1 (Unreleased)
|
||||
|
||||
### Features Added
|
||||
|
||||
### Breaking Changes
|
||||
|
||||
### Bugs Fixed
|
||||
|
||||
### Other Changes
|
||||
|
||||
- Added operation Accounts.listModels
|
||||
- Added Interface AccountModelListResult
|
||||
- Added Interface AccountsListModelsNextOptionalParams
|
||||
- Added Interface AccountsListModelsOptionalParams
|
||||
- Added Interface ModelDeprecationInfo
|
||||
- Added Type Alias AccountModel
|
||||
- Added Type Alias AccountsListModelsNextResponse
|
||||
- Added Type Alias AccountsListModelsResponse
|
||||
- Interface AccountProperties has a new optional parameter deletionDate
|
||||
- Interface AccountProperties has a new optional parameter dynamicThrottlingEnabled
|
||||
- Interface AccountProperties has a new optional parameter scheduledPurgeDate
|
||||
- Interface DeploymentScaleSettings has a new optional parameter activeCapacity
|
||||
|
||||
|
||||
## 7.0.0 (2021-12-20)
|
||||
|
||||
The package of @azure/arm-cognitiveservices is using our next generation design principles since version 7.0.0, which contains breaking changes.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2021 Microsoft
|
||||
Copyright (c) 2022 Microsoft
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
|
@ -16,6 +16,8 @@ Cognitive Services Management Client
|
|||
- [LTS versions of Node.js](https://nodejs.org/about/releases/)
|
||||
- Latest versions of Safari, Chrome, Edge and Firefox.
|
||||
|
||||
See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details.
|
||||
|
||||
### Prerequisites
|
||||
|
||||
- An [Azure subscription][azure_sub].
|
||||
|
@ -49,8 +51,17 @@ For more information about how to create an Azure AD Application check out [this
|
|||
```javascript
|
||||
const { CognitiveServicesManagementClient } = require("@azure/arm-cognitiveservices");
|
||||
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 CognitiveServicesManagementClient(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 CognitiveServicesManagementClient(credential, subscriptionId);
|
||||
```
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
{
|
||||
"commit": "d967edeee8fd6af6d40bffe53cceed1bd053d7ad",
|
||||
"commit": "515a036fd42e59b65e94c8480b3a850d0b192bfc",
|
||||
"readme": "specification/cognitiveservices/resource-manager/readme.md",
|
||||
"autorest_command": "autorest --version=3.1.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\mydev\\azure-sdk-for-js ../azure-rest-api-specs/specification/cognitiveservices/resource-manager/readme.md --use=@autorest/typescript@6.0.0-alpha.16.20211217.1",
|
||||
"autorest_command": "autorest --version=3.7.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\work\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\cognitiveservices\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-alpha.18.20220329.1 --generate-sample=true",
|
||||
"repository_url": "https://github.com/Azure/azure-rest-api-specs.git",
|
||||
"use": "@autorest/typescript@6.0.0-alpha.16.20211217.1"
|
||||
"release_tool": "@azure-tools/js-sdk-release-tools@2.2.1",
|
||||
"use": "@autorest/typescript@6.0.0-alpha.18.20220329.1"
|
||||
}
|
|
@ -1,18 +1,31 @@
|
|||
{
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
||||
"mainEntryPointFilePath": "./dist-esm/src/index.d.ts",
|
||||
"docModel": { "enabled": true },
|
||||
"apiReport": { "enabled": true, "reportFolder": "./review" },
|
||||
"docModel": {
|
||||
"enabled": true
|
||||
},
|
||||
"apiReport": {
|
||||
"enabled": true,
|
||||
"reportFolder": "./review"
|
||||
},
|
||||
"dtsRollup": {
|
||||
"enabled": true,
|
||||
"untrimmedFilePath": "",
|
||||
"publicTrimmedFilePath": "./types/arm-cognitiveservices.d.ts"
|
||||
},
|
||||
"messages": {
|
||||
"tsdocMessageReporting": { "default": { "logLevel": "none" } },
|
||||
"tsdocMessageReporting": {
|
||||
"default": {
|
||||
"logLevel": "none"
|
||||
}
|
||||
},
|
||||
"extractorMessageReporting": {
|
||||
"ae-missing-release-tag": { "logLevel": "none" },
|
||||
"ae-unresolved-link": { "logLevel": "none" }
|
||||
"ae-missing-release-tag": {
|
||||
"logLevel": "none"
|
||||
},
|
||||
"ae-unresolved-link": {
|
||||
"logLevel": "none"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -3,7 +3,7 @@
|
|||
"sdk-type": "mgmt",
|
||||
"author": "Microsoft Corporation",
|
||||
"description": "A generated SDK for CognitiveServicesManagementClient.",
|
||||
"version": "7.0.1",
|
||||
"version": "7.1.0",
|
||||
"engines": {
|
||||
"node": ">=12.0.0"
|
||||
},
|
||||
|
@ -30,12 +30,12 @@
|
|||
"devDependencies": {
|
||||
"@microsoft/api-extractor": "^7.18.11",
|
||||
"@rollup/plugin-commonjs": "^21.0.1",
|
||||
"@rollup/plugin-json": "^4.0.0",
|
||||
"@rollup/plugin-multi-entry": "^3.0.0",
|
||||
"@rollup/plugin-node-resolve": "^8.0.0",
|
||||
"@rollup/plugin-json": "^4.1.0",
|
||||
"@rollup/plugin-multi-entry": "^4.1.0",
|
||||
"@rollup/plugin-node-resolve": "^13.1.3",
|
||||
"mkdirp": "^1.0.4",
|
||||
"rollup": "^2.0.0",
|
||||
"rollup-plugin-sourcemaps": "^0.4.2",
|
||||
"rollup": "^2.66.1",
|
||||
"rollup-plugin-sourcemaps": "^0.6.3",
|
||||
"typescript": "~4.2.0",
|
||||
"uglify-js": "^3.4.9",
|
||||
"rimraf": "^3.0.0",
|
||||
|
@ -98,5 +98,21 @@
|
|||
"docs": "echo skipped"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"autoPublish": true
|
||||
}
|
||||
"//metadata": {
|
||||
"constantPaths": [
|
||||
{
|
||||
"path": "src/cognitiveServicesManagementClient.ts",
|
||||
"prefix": "packageDetails"
|
||||
}
|
||||
]
|
||||
},
|
||||
"autoPublish": true,
|
||||
"//sampleConfiguration": {
|
||||
"productName": "",
|
||||
"productSlugs": [
|
||||
"azure"
|
||||
],
|
||||
"disableDocsMs": true,
|
||||
"apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-cognitiveservices?view=azure-node-preview"
|
||||
}
|
||||
}
|
|
@ -29,6 +29,23 @@ export interface AccountListResult {
|
|||
readonly value?: Account[];
|
||||
}
|
||||
|
||||
// @public
|
||||
export type AccountModel = DeploymentModel & {
|
||||
baseModel?: DeploymentModel;
|
||||
maxCapacity?: number;
|
||||
capabilities?: {
|
||||
[propertyName: string]: string;
|
||||
};
|
||||
deprecation?: ModelDeprecationInfo;
|
||||
readonly systemData?: SystemData;
|
||||
};
|
||||
|
||||
// @public
|
||||
export interface AccountModelListResult {
|
||||
nextLink?: string;
|
||||
value?: AccountModel[];
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface AccountProperties {
|
||||
// (undocumented)
|
||||
|
@ -38,8 +55,10 @@ export interface AccountProperties {
|
|||
readonly capabilities?: SkuCapability[];
|
||||
customSubDomainName?: string;
|
||||
readonly dateCreated?: string;
|
||||
readonly deletionDate?: string;
|
||||
// (undocumented)
|
||||
disableLocalAuth?: boolean;
|
||||
dynamicThrottlingEnabled?: boolean;
|
||||
encryption?: Encryption;
|
||||
readonly endpoint?: string;
|
||||
readonly endpoints?: {
|
||||
|
@ -57,6 +76,7 @@ export interface AccountProperties {
|
|||
restore?: boolean;
|
||||
// (undocumented)
|
||||
restrictOutboundNetworkAccess?: boolean;
|
||||
readonly scheduledPurgeDate?: string;
|
||||
readonly skuChangeInfo?: SkuChangeInfo;
|
||||
userOwnedStorage?: UserOwnedStorage[];
|
||||
}
|
||||
|
@ -73,6 +93,7 @@ export interface Accounts {
|
|||
list(options?: AccountsListOptionalParams): PagedAsyncIterableIterator<Account>;
|
||||
listByResourceGroup(resourceGroupName: string, options?: AccountsListByResourceGroupOptionalParams): PagedAsyncIterableIterator<Account>;
|
||||
listKeys(resourceGroupName: string, accountName: string, options?: AccountsListKeysOptionalParams): Promise<AccountsListKeysResponse>;
|
||||
listModels(resourceGroupName: string, accountName: string, options?: AccountsListModelsOptionalParams): PagedAsyncIterableIterator<AccountModel>;
|
||||
listSkus(resourceGroupName: string, accountName: string, options?: AccountsListSkusOptionalParams): Promise<AccountsListSkusResponse>;
|
||||
listUsages(resourceGroupName: string, accountName: string, options?: AccountsListUsagesOptionalParams): Promise<AccountsListUsagesResponse>;
|
||||
regenerateKey(resourceGroupName: string, accountName: string, keyName: KeyName, options?: AccountsRegenerateKeyOptionalParams): Promise<AccountsRegenerateKeyResponse>;
|
||||
|
@ -132,6 +153,20 @@ export interface AccountsListKeysOptionalParams extends coreClient.OperationOpti
|
|||
// @public
|
||||
export type AccountsListKeysResponse = ApiKeys;
|
||||
|
||||
// @public
|
||||
export interface AccountsListModelsNextOptionalParams extends coreClient.OperationOptions {
|
||||
}
|
||||
|
||||
// @public
|
||||
export type AccountsListModelsNextResponse = AccountModelListResult;
|
||||
|
||||
// @public
|
||||
export interface AccountsListModelsOptionalParams extends coreClient.OperationOptions {
|
||||
}
|
||||
|
||||
// @public
|
||||
export type AccountsListModelsResponse = AccountModelListResult;
|
||||
|
||||
// @public
|
||||
export interface AccountsListNextOptionalParams extends coreClient.OperationOptions {
|
||||
}
|
||||
|
@ -485,6 +520,7 @@ export interface Deployments {
|
|||
|
||||
// @public
|
||||
export interface DeploymentScaleSettings {
|
||||
readonly activeCapacity?: number;
|
||||
capacity?: number;
|
||||
scaleType?: DeploymentScaleType;
|
||||
}
|
||||
|
@ -778,6 +814,12 @@ export interface MetricName {
|
|||
value?: string;
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface ModelDeprecationInfo {
|
||||
fineTune?: string;
|
||||
inference?: string;
|
||||
}
|
||||
|
||||
// @public
|
||||
export type NetworkRuleAction = string;
|
||||
|
||||
|
|
|
@ -14,62 +14,14 @@ import json from "@rollup/plugin-json";
|
|||
|
||||
import nodeBuiltins from "builtin-modules";
|
||||
|
||||
/**
|
||||
* Gets the proper configuration needed for rollup's commonJS plugin for @opentelemetry/api.
|
||||
*
|
||||
* NOTE: this manual configuration is only needed because OpenTelemetry uses an
|
||||
* __exportStar downleveled helper function to declare its exports which confuses
|
||||
* rollup's automatic discovery mechanism.
|
||||
*
|
||||
* @returns an object reference that can be `...`'d into your cjs() configuration.
|
||||
*/
|
||||
export function openTelemetryCommonJs() {
|
||||
const namedExports = {};
|
||||
|
||||
for (const key of [
|
||||
"@opentelemetry/api",
|
||||
"@azure/core-tracing/node_modules/@opentelemetry/api"
|
||||
]) {
|
||||
namedExports[key] = [
|
||||
"SpanKind",
|
||||
"TraceFlags",
|
||||
"getSpan",
|
||||
"setSpan",
|
||||
"SpanStatusCode",
|
||||
"getSpanContext",
|
||||
"setSpanContext"
|
||||
];
|
||||
}
|
||||
|
||||
const releasedOpenTelemetryVersions = ["0.10.2", "1.0.0-rc.0"];
|
||||
|
||||
for (const version of releasedOpenTelemetryVersions) {
|
||||
namedExports[
|
||||
// working around a limitation in the rollup common.js plugin - it's not able to resolve these modules so the named exports listed above will not get applied. We have to drill down to the actual path.
|
||||
`../../../common/temp/node_modules/.pnpm/@opentelemetry/api@${version}/node_modules/@opentelemetry/api/build/src/index.js`
|
||||
] = [
|
||||
"SpanKind",
|
||||
"TraceFlags",
|
||||
"getSpan",
|
||||
"setSpan",
|
||||
"StatusCode",
|
||||
"CanonicalCode",
|
||||
"getSpanContext",
|
||||
"setSpanContext"
|
||||
];
|
||||
}
|
||||
|
||||
return namedExports;
|
||||
}
|
||||
|
||||
// #region Warning Handler
|
||||
|
||||
/**
|
||||
* A function that can determine whether a rollupwarning should be ignored. If
|
||||
* A function that can determine whether a rollup warning should be ignored. If
|
||||
* the function returns `true`, then the warning will not be displayed.
|
||||
*/
|
||||
|
||||
function ignoreNiseSinonEvalWarnings(warning) {
|
||||
function ignoreNiseSinonEval(warning) {
|
||||
return (
|
||||
warning.code === "EVAL" &&
|
||||
warning.id &&
|
||||
|
@ -78,17 +30,14 @@ function ignoreNiseSinonEvalWarnings(warning) {
|
|||
);
|
||||
}
|
||||
|
||||
function ignoreChaiCircularDependencyWarnings(warning) {
|
||||
function ignoreChaiCircularDependency(warning) {
|
||||
return (
|
||||
warning.code === "CIRCULAR_DEPENDENCY" &&
|
||||
warning.importer && warning.importer.includes("node_modules/chai") === true
|
||||
);
|
||||
}
|
||||
|
||||
const warningInhibitors = [
|
||||
ignoreChaiCircularDependencyWarnings,
|
||||
ignoreNiseSinonEvalWarnings
|
||||
];
|
||||
const warningInhibitors = [ignoreChaiCircularDependency, ignoreNiseSinonEval];
|
||||
|
||||
/**
|
||||
* Construct a warning handler for the shared rollup configuration
|
||||
|
@ -122,22 +71,7 @@ function makeBrowserTestConfig() {
|
|||
nodeResolve({
|
||||
mainFields: ["module", "browser"]
|
||||
}),
|
||||
cjs({
|
||||
namedExports: {
|
||||
// Chai's strange internal architecture makes it impossible to statically
|
||||
// analyze its exports.
|
||||
chai: [
|
||||
"version",
|
||||
"use",
|
||||
"util",
|
||||
"config",
|
||||
"expect",
|
||||
"should",
|
||||
"assert"
|
||||
],
|
||||
...openTelemetryCommonJs()
|
||||
}
|
||||
}),
|
||||
cjs(),
|
||||
json(),
|
||||
sourcemaps()
|
||||
//viz({ filename: "dist-test/browser-stats.html", sourcemap: true })
|
||||
|
@ -173,7 +107,7 @@ export function makeConfig(pkg, options) {
|
|||
],
|
||||
output: { file: "dist/index.js", format: "cjs", sourcemap: true },
|
||||
preserveSymlinks: false,
|
||||
plugins: [sourcemaps(), nodeResolve(), cjs()]
|
||||
plugins: [sourcemaps(), nodeResolve()]
|
||||
};
|
||||
|
||||
const config = [baseConfig];
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
# App registration secret for AAD authentication
|
||||
AZURE_CLIENT_SECRET=
|
||||
AZURE_CLIENT_ID=
|
||||
AZURE_TENANT_ID=
|
|
@ -0,0 +1,94 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code 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 {
|
||||
Account,
|
||||
CognitiveServicesManagementClient
|
||||
} from "@azure/arm-cognitiveservices";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Create Cognitive Services Account. Accounts is a resource group wide resource type. It holds the keys for developer to access intelligent APIs. It's also the resource type for billing.
|
||||
*
|
||||
* @summary Create Cognitive Services Account. Accounts is a resource group wide resource type. It holds the keys for developer to access intelligent APIs. It's also the resource type for billing.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/CreateAccount.json
|
||||
*/
|
||||
async function createAccount() {
|
||||
const subscriptionId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
|
||||
const resourceGroupName = "myResourceGroup";
|
||||
const accountName = "testCreate1";
|
||||
const account: Account = {
|
||||
identity: { type: "SystemAssigned" },
|
||||
kind: "Emotion",
|
||||
location: "West US",
|
||||
properties: {
|
||||
encryption: {
|
||||
keySource: "Microsoft.KeyVault",
|
||||
keyVaultProperties: {
|
||||
keyName: "KeyName",
|
||||
keyVaultUri: "https://pltfrmscrts-use-pc-dev.vault.azure.net/",
|
||||
keyVersion: "891CF236-D241-4738-9462-D506AF493DFA"
|
||||
}
|
||||
},
|
||||
userOwnedStorage: [
|
||||
{
|
||||
resourceId:
|
||||
"/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount"
|
||||
}
|
||||
]
|
||||
},
|
||||
sku: { name: "S0" }
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(
|
||||
credential,
|
||||
subscriptionId
|
||||
);
|
||||
const result = await client.accounts.beginCreateAndWait(
|
||||
resourceGroupName,
|
||||
accountName,
|
||||
account
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
createAccount().catch(console.error);
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Create Cognitive Services Account. Accounts is a resource group wide resource type. It holds the keys for developer to access intelligent APIs. It's also the resource type for billing.
|
||||
*
|
||||
* @summary Create Cognitive Services Account. Accounts is a resource group wide resource type. It holds the keys for developer to access intelligent APIs. It's also the resource type for billing.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/CreateAccountMin.json
|
||||
*/
|
||||
async function createAccountMin() {
|
||||
const subscriptionId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
|
||||
const resourceGroupName = "myResourceGroup";
|
||||
const accountName = "testCreate1";
|
||||
const account: Account = {
|
||||
identity: { type: "SystemAssigned" },
|
||||
kind: "CognitiveServices",
|
||||
location: "West US",
|
||||
properties: {},
|
||||
sku: { name: "S0" }
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(
|
||||
credential,
|
||||
subscriptionId
|
||||
);
|
||||
const result = await client.accounts.beginCreateAndWait(
|
||||
resourceGroupName,
|
||||
accountName,
|
||||
account
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
createAccountMin().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.
|
||||
import { CognitiveServicesManagementClient } from "@azure/arm-cognitiveservices";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Deletes a Cognitive Services account from the resource group.
|
||||
*
|
||||
* @summary Deletes a Cognitive Services account from the resource group.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/DeleteAccount.json
|
||||
*/
|
||||
async function deleteAccount() {
|
||||
const subscriptionId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
|
||||
const resourceGroupName = "myResourceGroup";
|
||||
const accountName = "PropTest01";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(
|
||||
credential,
|
||||
subscriptionId
|
||||
);
|
||||
const result = await client.accounts.beginDeleteAndWait(
|
||||
resourceGroupName,
|
||||
accountName
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
deleteAccount().catch(console.error);
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { CognitiveServicesManagementClient } from "@azure/arm-cognitiveservices";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Returns a Cognitive Services account specified by the parameters.
|
||||
*
|
||||
* @summary Returns a Cognitive Services account specified by the parameters.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/GetAccount.json
|
||||
*/
|
||||
async function getAccount() {
|
||||
const subscriptionId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
|
||||
const resourceGroupName = "myResourceGroup";
|
||||
const accountName = "myAccount";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(
|
||||
credential,
|
||||
subscriptionId
|
||||
);
|
||||
const result = await client.accounts.get(resourceGroupName, accountName);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
getAccount().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.
|
||||
import { CognitiveServicesManagementClient } from "@azure/arm-cognitiveservices";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Returns all the resources of a particular type belonging to a resource group
|
||||
*
|
||||
* @summary Returns all the resources of a particular type belonging to a resource group
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/ListAccountsByResourceGroup.json
|
||||
*/
|
||||
async function listAccountsByResourceGroup() {
|
||||
const subscriptionId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
|
||||
const resourceGroupName = "myResourceGroup";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(
|
||||
credential,
|
||||
subscriptionId
|
||||
);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.accounts.listByResourceGroup(
|
||||
resourceGroupName
|
||||
)) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
listAccountsByResourceGroup().catch(console.error);
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { CognitiveServicesManagementClient } from "@azure/arm-cognitiveservices";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Lists the account keys for the specified Cognitive Services account.
|
||||
*
|
||||
* @summary Lists the account keys for the specified Cognitive Services account.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/ListKeys.json
|
||||
*/
|
||||
async function listKeys() {
|
||||
const subscriptionId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
|
||||
const resourceGroupName = "myResourceGroup";
|
||||
const accountName = "myAccount";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(
|
||||
credential,
|
||||
subscriptionId
|
||||
);
|
||||
const result = await client.accounts.listKeys(resourceGroupName, accountName);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
listKeys().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.
|
||||
import { CognitiveServicesManagementClient } from "@azure/arm-cognitiveservices";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to List available Models for the requested Cognitive Services account
|
||||
*
|
||||
* @summary List available Models for the requested Cognitive Services account
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/ListAccountModels.json
|
||||
*/
|
||||
async function listAccountModels() {
|
||||
const subscriptionId = "subscriptionId";
|
||||
const resourceGroupName = "resourceGroupName";
|
||||
const accountName = "accountName";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(
|
||||
credential,
|
||||
subscriptionId
|
||||
);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.accounts.listModels(
|
||||
resourceGroupName,
|
||||
accountName
|
||||
)) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
listAccountModels().catch(console.error);
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { CognitiveServicesManagementClient } from "@azure/arm-cognitiveservices";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Returns all the resources of a particular type belonging to a subscription.
|
||||
*
|
||||
* @summary Returns all the resources of a particular type belonging to a subscription.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/ListAccountsBySubscription.json
|
||||
*/
|
||||
async function listAccountsBySubscription() {
|
||||
const subscriptionId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(
|
||||
credential,
|
||||
subscriptionId
|
||||
);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.accounts.list()) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
listAccountsBySubscription().catch(console.error);
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { CognitiveServicesManagementClient } from "@azure/arm-cognitiveservices";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to List available SKUs for the requested Cognitive Services account
|
||||
*
|
||||
* @summary List available SKUs for the requested Cognitive Services account
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/ListSkus.json
|
||||
*/
|
||||
async function listSkUs() {
|
||||
const subscriptionId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
|
||||
const resourceGroupName = "myResourceGroup";
|
||||
const accountName = "myAccount";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(
|
||||
credential,
|
||||
subscriptionId
|
||||
);
|
||||
const result = await client.accounts.listSkus(resourceGroupName, accountName);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
listSkUs().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.
|
||||
import { CognitiveServicesManagementClient } from "@azure/arm-cognitiveservices";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Get usages for the requested Cognitive Services account
|
||||
*
|
||||
* @summary Get usages for the requested Cognitive Services account
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/GetUsages.json
|
||||
*/
|
||||
async function getUsages() {
|
||||
const subscriptionId = "5a4f5c2e-6983-4ccb-bd34-2196d5b5bbd3";
|
||||
const resourceGroupName = "myResourceGroup";
|
||||
const accountName = "TestUsage02";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(
|
||||
credential,
|
||||
subscriptionId
|
||||
);
|
||||
const result = await client.accounts.listUsages(
|
||||
resourceGroupName,
|
||||
accountName
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
getUsages().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.
|
||||
import { CognitiveServicesManagementClient } from "@azure/arm-cognitiveservices";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Regenerates the specified account key for the specified Cognitive Services account.
|
||||
*
|
||||
* @summary Regenerates the specified account key for the specified Cognitive Services account.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/RegenerateKey.json
|
||||
*/
|
||||
async function regenerateKeys() {
|
||||
const subscriptionId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
|
||||
const resourceGroupName = "myResourceGroup";
|
||||
const accountName = "myAccount";
|
||||
const keyName = "Key2";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(
|
||||
credential,
|
||||
subscriptionId
|
||||
);
|
||||
const result = await client.accounts.regenerateKey(
|
||||
resourceGroupName,
|
||||
accountName,
|
||||
keyName
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
regenerateKeys().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.
|
||||
import {
|
||||
Account,
|
||||
CognitiveServicesManagementClient
|
||||
} from "@azure/arm-cognitiveservices";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Updates a Cognitive Services account
|
||||
*
|
||||
* @summary Updates a Cognitive Services account
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/UpdateAccount.json
|
||||
*/
|
||||
async function updateAccount() {
|
||||
const subscriptionId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
|
||||
const resourceGroupName = "bvttest";
|
||||
const accountName = "bingSearch";
|
||||
const account: Account = { location: "global", sku: { name: "S2" } };
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(
|
||||
credential,
|
||||
subscriptionId
|
||||
);
|
||||
const result = await client.accounts.beginUpdateAndWait(
|
||||
resourceGroupName,
|
||||
accountName,
|
||||
account
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
updateAccount().catch(console.error);
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { CognitiveServicesManagementClient } from "@azure/arm-cognitiveservices";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Check whether a domain is available.
|
||||
*
|
||||
* @summary Check whether a domain is available.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/CheckDomainAvailability.json
|
||||
*/
|
||||
async function checkSkuAvailability() {
|
||||
const subscriptionId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
|
||||
const subdomainName = "contosodemoapp1";
|
||||
const typeParam = "Microsoft.CognitiveServices/accounts";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(
|
||||
credential,
|
||||
subscriptionId
|
||||
);
|
||||
const result = await client.checkDomainAvailability(subdomainName, typeParam);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
checkSkuAvailability().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.
|
||||
import { CognitiveServicesManagementClient } from "@azure/arm-cognitiveservices";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Check available SKUs.
|
||||
*
|
||||
* @summary Check available SKUs.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/CheckSkuAvailability.json
|
||||
*/
|
||||
async function checkSkuAvailability() {
|
||||
const subscriptionId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
|
||||
const location = "westus";
|
||||
const skus = ["S0"];
|
||||
const kind = "Face";
|
||||
const typeParam = "Microsoft.CognitiveServices/accounts";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(
|
||||
credential,
|
||||
subscriptionId
|
||||
);
|
||||
const result = await client.checkSkuAvailability(
|
||||
location,
|
||||
skus,
|
||||
kind,
|
||||
typeParam
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
checkSkuAvailability().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 {
|
||||
CommitmentPlan,
|
||||
CognitiveServicesManagementClient
|
||||
} from "@azure/arm-cognitiveservices";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Update the state of specified commitmentPlans associated with the Cognitive Services account.
|
||||
*
|
||||
* @summary Update the state of specified commitmentPlans associated with the Cognitive Services account.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/PutCommitmentPlan.json
|
||||
*/
|
||||
async function putCommitmentPlan() {
|
||||
const subscriptionId = "subscriptionId";
|
||||
const resourceGroupName = "resourceGroupName";
|
||||
const accountName = "accountName";
|
||||
const commitmentPlanName = "commitmentPlanName";
|
||||
const commitmentPlan: CommitmentPlan = {
|
||||
properties: {
|
||||
autoRenew: true,
|
||||
current: { tier: "T1" },
|
||||
hostingModel: "Web",
|
||||
planType: "Speech2Text"
|
||||
}
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(
|
||||
credential,
|
||||
subscriptionId
|
||||
);
|
||||
const result = await client.commitmentPlans.createOrUpdate(
|
||||
resourceGroupName,
|
||||
accountName,
|
||||
commitmentPlanName,
|
||||
commitmentPlan
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
putCommitmentPlan().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.
|
||||
import { CognitiveServicesManagementClient } from "@azure/arm-cognitiveservices";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Deletes the specified commitmentPlan associated with the Cognitive Services account.
|
||||
*
|
||||
* @summary Deletes the specified commitmentPlan associated with the Cognitive Services account.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/DeleteCommitmentPlan.json
|
||||
*/
|
||||
async function deleteCommitmentPlan() {
|
||||
const subscriptionId = "subscriptionId";
|
||||
const resourceGroupName = "resourceGroupName";
|
||||
const accountName = "accountName";
|
||||
const commitmentPlanName = "commitmentPlanName";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(
|
||||
credential,
|
||||
subscriptionId
|
||||
);
|
||||
const result = await client.commitmentPlans.beginDeleteAndWait(
|
||||
resourceGroupName,
|
||||
accountName,
|
||||
commitmentPlanName
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
deleteCommitmentPlan().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.
|
||||
import { CognitiveServicesManagementClient } from "@azure/arm-cognitiveservices";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Gets the specified commitmentPlans associated with the Cognitive Services account.
|
||||
*
|
||||
* @summary Gets the specified commitmentPlans associated with the Cognitive Services account.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/GetCommitmentPlan.json
|
||||
*/
|
||||
async function getCommitmentPlan() {
|
||||
const subscriptionId = "subscriptionId";
|
||||
const resourceGroupName = "resourceGroupName";
|
||||
const accountName = "accountName";
|
||||
const commitmentPlanName = "commitmentPlanName";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(
|
||||
credential,
|
||||
subscriptionId
|
||||
);
|
||||
const result = await client.commitmentPlans.get(
|
||||
resourceGroupName,
|
||||
accountName,
|
||||
commitmentPlanName
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
getCommitmentPlan().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.
|
||||
import { CognitiveServicesManagementClient } from "@azure/arm-cognitiveservices";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Gets the commitmentPlans associated with the Cognitive Services account.
|
||||
*
|
||||
* @summary Gets the commitmentPlans associated with the Cognitive Services account.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/ListCommitmentPlans.json
|
||||
*/
|
||||
async function listCommitmentPlans() {
|
||||
const subscriptionId = "subscriptionId";
|
||||
const resourceGroupName = "resourceGroupName";
|
||||
const accountName = "accountName";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(
|
||||
credential,
|
||||
subscriptionId
|
||||
);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.commitmentPlans.list(
|
||||
resourceGroupName,
|
||||
accountName
|
||||
)) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
listCommitmentPlans().catch(console.error);
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { CognitiveServicesManagementClient } from "@azure/arm-cognitiveservices";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to List Commitment Tiers.
|
||||
*
|
||||
* @summary List Commitment Tiers.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/ListCommitmentTiers.json
|
||||
*/
|
||||
async function listCommitmentTiers() {
|
||||
const subscriptionId = "subscriptionId";
|
||||
const location = "location";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(
|
||||
credential,
|
||||
subscriptionId
|
||||
);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.commitmentTiers.list(location)) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
listCommitmentTiers().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.
|
||||
import { CognitiveServicesManagementClient } from "@azure/arm-cognitiveservices";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Returns a Cognitive Services account specified by the parameters.
|
||||
*
|
||||
* @summary Returns a Cognitive Services account specified by the parameters.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/GetDeletedAccount.json
|
||||
*/
|
||||
async function getAccount() {
|
||||
const subscriptionId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
|
||||
const location = "westus";
|
||||
const resourceGroupName = "myResourceGroup";
|
||||
const accountName = "myAccount";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(
|
||||
credential,
|
||||
subscriptionId
|
||||
);
|
||||
const result = await client.deletedAccounts.get(
|
||||
location,
|
||||
resourceGroupName,
|
||||
accountName
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
getAccount().catch(console.error);
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { CognitiveServicesManagementClient } from "@azure/arm-cognitiveservices";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Returns all the resources of a particular type belonging to a subscription.
|
||||
*
|
||||
* @summary Returns all the resources of a particular type belonging to a subscription.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/ListAccountsBySubscription.json
|
||||
*/
|
||||
async function listDeletedAccountsBySubscription() {
|
||||
const subscriptionId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(
|
||||
credential,
|
||||
subscriptionId
|
||||
);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.deletedAccounts.list()) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
listDeletedAccountsBySubscription().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.
|
||||
import { CognitiveServicesManagementClient } from "@azure/arm-cognitiveservices";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Deletes a Cognitive Services account from the resource group.
|
||||
*
|
||||
* @summary Deletes a Cognitive Services account from the resource group.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/PurgeDeletedAccount.json
|
||||
*/
|
||||
async function deleteAccount() {
|
||||
const subscriptionId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
|
||||
const location = "westus";
|
||||
const resourceGroupName = "myResourceGroup";
|
||||
const accountName = "PropTest01";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(
|
||||
credential,
|
||||
subscriptionId
|
||||
);
|
||||
const result = await client.deletedAccounts.beginPurgeAndWait(
|
||||
location,
|
||||
resourceGroupName,
|
||||
accountName
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
deleteAccount().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 {
|
||||
Deployment,
|
||||
CognitiveServicesManagementClient
|
||||
} from "@azure/arm-cognitiveservices";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Update the state of specified deployments associated with the Cognitive Services account.
|
||||
*
|
||||
* @summary Update the state of specified deployments associated with the Cognitive Services account.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/PutDeployment.json
|
||||
*/
|
||||
async function putDeployment() {
|
||||
const subscriptionId = "subscriptionId";
|
||||
const resourceGroupName = "resourceGroupName";
|
||||
const accountName = "accountName";
|
||||
const deploymentName = "deploymentName";
|
||||
const deployment: Deployment = {
|
||||
properties: {
|
||||
model: { name: "ada", format: "OpenAI", version: "1" },
|
||||
scaleSettings: { capacity: 1, scaleType: "Manual" }
|
||||
}
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(
|
||||
credential,
|
||||
subscriptionId
|
||||
);
|
||||
const result = await client.deployments.beginCreateOrUpdateAndWait(
|
||||
resourceGroupName,
|
||||
accountName,
|
||||
deploymentName,
|
||||
deployment
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
putDeployment().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.
|
||||
import { CognitiveServicesManagementClient } from "@azure/arm-cognitiveservices";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Deletes the specified deployment associated with the Cognitive Services account.
|
||||
*
|
||||
* @summary Deletes the specified deployment associated with the Cognitive Services account.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/DeleteDeployment.json
|
||||
*/
|
||||
async function deleteDeployment() {
|
||||
const subscriptionId = "subscriptionId";
|
||||
const resourceGroupName = "resourceGroupName";
|
||||
const accountName = "accountName";
|
||||
const deploymentName = "deploymentName";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(
|
||||
credential,
|
||||
subscriptionId
|
||||
);
|
||||
const result = await client.deployments.beginDeleteAndWait(
|
||||
resourceGroupName,
|
||||
accountName,
|
||||
deploymentName
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
deleteDeployment().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.
|
||||
import { CognitiveServicesManagementClient } from "@azure/arm-cognitiveservices";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Gets the specified deployments associated with the Cognitive Services account.
|
||||
*
|
||||
* @summary Gets the specified deployments associated with the Cognitive Services account.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/GetDeployment.json
|
||||
*/
|
||||
async function getDeployment() {
|
||||
const subscriptionId = "subscriptionId";
|
||||
const resourceGroupName = "resourceGroupName";
|
||||
const accountName = "accountName";
|
||||
const deploymentName = "deploymentName";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(
|
||||
credential,
|
||||
subscriptionId
|
||||
);
|
||||
const result = await client.deployments.get(
|
||||
resourceGroupName,
|
||||
accountName,
|
||||
deploymentName
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
getDeployment().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.
|
||||
import { CognitiveServicesManagementClient } from "@azure/arm-cognitiveservices";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Gets the deployments associated with the Cognitive Services account.
|
||||
*
|
||||
* @summary Gets the deployments associated with the Cognitive Services account.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/ListDeployments.json
|
||||
*/
|
||||
async function listDeployments() {
|
||||
const subscriptionId = "subscriptionId";
|
||||
const resourceGroupName = "resourceGroupName";
|
||||
const accountName = "accountName";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(
|
||||
credential,
|
||||
subscriptionId
|
||||
);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.deployments.list(
|
||||
resourceGroupName,
|
||||
accountName
|
||||
)) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
listDeployments().catch(console.error);
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { CognitiveServicesManagementClient } from "@azure/arm-cognitiveservices";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Lists all the available Cognitive Services account operations.
|
||||
*
|
||||
* @summary Lists all the available Cognitive Services account operations.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/GetOperations.json
|
||||
*/
|
||||
async function getOperations() {
|
||||
const subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(
|
||||
credential,
|
||||
subscriptionId
|
||||
);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.operations.list()) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
getOperations().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 {
|
||||
PrivateEndpointConnection,
|
||||
CognitiveServicesManagementClient
|
||||
} from "@azure/arm-cognitiveservices";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Update the state of specified private endpoint connection associated with the Cognitive Services account.
|
||||
*
|
||||
* @summary Update the state of specified private endpoint connection associated with the Cognitive Services account.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/PutPrivateEndpointConnection.json
|
||||
*/
|
||||
async function putPrivateEndpointConnection() {
|
||||
const subscriptionId = "{subscription-id}";
|
||||
const resourceGroupName = "res7687";
|
||||
const accountName = "sto9699";
|
||||
const privateEndpointConnectionName = "{privateEndpointConnectionName}";
|
||||
const properties: PrivateEndpointConnection = {
|
||||
properties: {
|
||||
privateLinkServiceConnectionState: {
|
||||
description: "Auto-Approved",
|
||||
status: "Approved"
|
||||
}
|
||||
}
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(
|
||||
credential,
|
||||
subscriptionId
|
||||
);
|
||||
const result = await client.privateEndpointConnections.beginCreateOrUpdateAndWait(
|
||||
resourceGroupName,
|
||||
accountName,
|
||||
privateEndpointConnectionName,
|
||||
properties
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
putPrivateEndpointConnection().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.
|
||||
import { CognitiveServicesManagementClient } from "@azure/arm-cognitiveservices";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Deletes the specified private endpoint connection associated with the Cognitive Services account.
|
||||
*
|
||||
* @summary Deletes the specified private endpoint connection associated with the Cognitive Services account.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/DeletePrivateEndpointConnection.json
|
||||
*/
|
||||
async function deletePrivateEndpointConnection() {
|
||||
const subscriptionId = "{subscription-id}";
|
||||
const resourceGroupName = "res6977";
|
||||
const accountName = "sto2527";
|
||||
const privateEndpointConnectionName = "{privateEndpointConnectionName}";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(
|
||||
credential,
|
||||
subscriptionId
|
||||
);
|
||||
const result = await client.privateEndpointConnections.beginDeleteAndWait(
|
||||
resourceGroupName,
|
||||
accountName,
|
||||
privateEndpointConnectionName
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
deletePrivateEndpointConnection().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.
|
||||
import { CognitiveServicesManagementClient } from "@azure/arm-cognitiveservices";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Gets the specified private endpoint connection associated with the Cognitive Services account.
|
||||
*
|
||||
* @summary Gets the specified private endpoint connection associated with the Cognitive Services account.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/GetPrivateEndpointConnection.json
|
||||
*/
|
||||
async function getPrivateEndpointConnection() {
|
||||
const subscriptionId = "{subscription-id}";
|
||||
const resourceGroupName = "res6977";
|
||||
const accountName = "sto2527";
|
||||
const privateEndpointConnectionName = "{privateEndpointConnectionName}";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(
|
||||
credential,
|
||||
subscriptionId
|
||||
);
|
||||
const result = await client.privateEndpointConnections.get(
|
||||
resourceGroupName,
|
||||
accountName,
|
||||
privateEndpointConnectionName
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
getPrivateEndpointConnection().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.
|
||||
import { CognitiveServicesManagementClient } from "@azure/arm-cognitiveservices";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Gets the private endpoint connections associated with the Cognitive Services account.
|
||||
*
|
||||
* @summary Gets the private endpoint connections associated with the Cognitive Services account.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/ListPrivateEndpointConnections.json
|
||||
*/
|
||||
async function getPrivateEndpointConnection() {
|
||||
const subscriptionId = "{subscription-id}";
|
||||
const resourceGroupName = "res6977";
|
||||
const accountName = "sto2527";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(
|
||||
credential,
|
||||
subscriptionId
|
||||
);
|
||||
const result = await client.privateEndpointConnections.list(
|
||||
resourceGroupName,
|
||||
accountName
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
getPrivateEndpointConnection().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.
|
||||
import { CognitiveServicesManagementClient } from "@azure/arm-cognitiveservices";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Gets the private link resources that need to be created for a Cognitive Services account.
|
||||
*
|
||||
* @summary Gets the private link resources that need to be created for a Cognitive Services account.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/ListPrivateLinkResources.json
|
||||
*/
|
||||
async function listPrivateLinkResources() {
|
||||
const subscriptionId = "{subscription-id}";
|
||||
const resourceGroupName = "res6977";
|
||||
const accountName = "sto2527";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(
|
||||
credential,
|
||||
subscriptionId
|
||||
);
|
||||
const result = await client.privateLinkResources.list(
|
||||
resourceGroupName,
|
||||
accountName
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
listPrivateLinkResources().catch(console.error);
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { CognitiveServicesManagementClient } from "@azure/arm-cognitiveservices";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Gets the list of Microsoft.CognitiveServices SKUs available for your Subscription.
|
||||
*
|
||||
* @summary Gets the list of Microsoft.CognitiveServices SKUs available for your Subscription.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/GetSkus.json
|
||||
*/
|
||||
async function regenerateKeys() {
|
||||
const subscriptionId = "f1c637e4-72ec-4f89-8d2b-0f933c036002";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(
|
||||
credential,
|
||||
subscriptionId
|
||||
);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.resourceSkus.list()) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
regenerateKeys().catch(console.error);
|
|
@ -0,0 +1,112 @@
|
|||
# client library samples for JavaScript
|
||||
|
||||
These sample programs show how to use the JavaScript client libraries for in some common scenarios.
|
||||
|
||||
| **File Name** | **Description** |
|
||||
| --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [accountsCreateSample.js][accountscreatesample] | Create Cognitive Services Account. Accounts is a resource group wide resource type. It holds the keys for developer to access intelligent APIs. It's also the resource type for billing. x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/CreateAccount.json |
|
||||
| [accountsDeleteSample.js][accountsdeletesample] | Deletes a Cognitive Services account from the resource group. x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/DeleteAccount.json |
|
||||
| [accountsGetSample.js][accountsgetsample] | Returns a Cognitive Services account specified by the parameters. x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/GetAccount.json |
|
||||
| [accountsListByResourceGroupSample.js][accountslistbyresourcegroupsample] | Returns all the resources of a particular type belonging to a resource group x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/ListAccountsByResourceGroup.json |
|
||||
| [accountsListKeysSample.js][accountslistkeyssample] | Lists the account keys for the specified Cognitive Services account. x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/ListKeys.json |
|
||||
| [accountsListModelsSample.js][accountslistmodelssample] | List available Models for the requested Cognitive Services account x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/ListAccountModels.json |
|
||||
| [accountsListSample.js][accountslistsample] | Returns all the resources of a particular type belonging to a subscription. x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/ListAccountsBySubscription.json |
|
||||
| [accountsListSkusSample.js][accountslistskussample] | List available SKUs for the requested Cognitive Services account x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/ListSkus.json |
|
||||
| [accountsListUsagesSample.js][accountslistusagessample] | Get usages for the requested Cognitive Services account x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/GetUsages.json |
|
||||
| [accountsRegenerateKeySample.js][accountsregeneratekeysample] | Regenerates the specified account key for the specified Cognitive Services account. x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/RegenerateKey.json |
|
||||
| [accountsUpdateSample.js][accountsupdatesample] | Updates a Cognitive Services account x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/UpdateAccount.json |
|
||||
| [checkDomainAvailabilitySample.js][checkdomainavailabilitysample] | Check whether a domain is available. x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/CheckDomainAvailability.json |
|
||||
| [checkSkuAvailabilitySample.js][checkskuavailabilitysample] | Check available SKUs. x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/CheckSkuAvailability.json |
|
||||
| [commitmentPlansCreateOrUpdateSample.js][commitmentplanscreateorupdatesample] | Update the state of specified commitmentPlans associated with the Cognitive Services account. x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/PutCommitmentPlan.json |
|
||||
| [commitmentPlansDeleteSample.js][commitmentplansdeletesample] | Deletes the specified commitmentPlan associated with the Cognitive Services account. x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/DeleteCommitmentPlan.json |
|
||||
| [commitmentPlansGetSample.js][commitmentplansgetsample] | Gets the specified commitmentPlans associated with the Cognitive Services account. x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/GetCommitmentPlan.json |
|
||||
| [commitmentPlansListSample.js][commitmentplanslistsample] | Gets the commitmentPlans associated with the Cognitive Services account. x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/ListCommitmentPlans.json |
|
||||
| [commitmentTiersListSample.js][commitmenttierslistsample] | List Commitment Tiers. x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/ListCommitmentTiers.json |
|
||||
| [deletedAccountsGetSample.js][deletedaccountsgetsample] | Returns a Cognitive Services account specified by the parameters. x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/GetDeletedAccount.json |
|
||||
| [deletedAccountsListSample.js][deletedaccountslistsample] | Returns all the resources of a particular type belonging to a subscription. x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/ListAccountsBySubscription.json |
|
||||
| [deletedAccountsPurgeSample.js][deletedaccountspurgesample] | Deletes a Cognitive Services account from the resource group. x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/PurgeDeletedAccount.json |
|
||||
| [deploymentsCreateOrUpdateSample.js][deploymentscreateorupdatesample] | Update the state of specified deployments associated with the Cognitive Services account. x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/PutDeployment.json |
|
||||
| [deploymentsDeleteSample.js][deploymentsdeletesample] | Deletes the specified deployment associated with the Cognitive Services account. x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/DeleteDeployment.json |
|
||||
| [deploymentsGetSample.js][deploymentsgetsample] | Gets the specified deployments associated with the Cognitive Services account. x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/GetDeployment.json |
|
||||
| [deploymentsListSample.js][deploymentslistsample] | Gets the deployments associated with the Cognitive Services account. x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/ListDeployments.json |
|
||||
| [operationsListSample.js][operationslistsample] | Lists all the available Cognitive Services account operations. x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/GetOperations.json |
|
||||
| [privateEndpointConnectionsCreateOrUpdateSample.js][privateendpointconnectionscreateorupdatesample] | Update the state of specified private endpoint connection associated with the Cognitive Services account. x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/PutPrivateEndpointConnection.json |
|
||||
| [privateEndpointConnectionsDeleteSample.js][privateendpointconnectionsdeletesample] | Deletes the specified private endpoint connection associated with the Cognitive Services account. x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/DeletePrivateEndpointConnection.json |
|
||||
| [privateEndpointConnectionsGetSample.js][privateendpointconnectionsgetsample] | Gets the specified private endpoint connection associated with the Cognitive Services account. x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/GetPrivateEndpointConnection.json |
|
||||
| [privateEndpointConnectionsListSample.js][privateendpointconnectionslistsample] | Gets the private endpoint connections associated with the Cognitive Services account. x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/ListPrivateEndpointConnections.json |
|
||||
| [privateLinkResourcesListSample.js][privatelinkresourceslistsample] | Gets the private link resources that need to be created for a Cognitive Services account. x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/ListPrivateLinkResources.json |
|
||||
| [resourceSkusListSample.js][resourceskuslistsample] | Gets the list of Microsoft.CognitiveServices SKUs available for your Subscription. x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/GetSkus.json |
|
||||
|
||||
## Prerequisites
|
||||
|
||||
The sample programs are compatible with [LTS versions of Node.js](https://nodejs.org/about/releases/).
|
||||
|
||||
You need [an Azure subscription][freesub] to run these sample programs.
|
||||
|
||||
Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function.
|
||||
|
||||
Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package].
|
||||
|
||||
## Setup
|
||||
|
||||
To run the samples using the published version of the package:
|
||||
|
||||
1. Install the dependencies using `npm`:
|
||||
|
||||
```bash
|
||||
npm install
|
||||
```
|
||||
|
||||
2. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically.
|
||||
|
||||
3. Run whichever samples you like (note that some samples may require additional setup, see the table above):
|
||||
|
||||
```bash
|
||||
node accountsCreateSample.js
|
||||
```
|
||||
|
||||
Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform):
|
||||
|
||||
```bash
|
||||
npx cross-env node accountsCreateSample.js
|
||||
```
|
||||
|
||||
## Next Steps
|
||||
|
||||
Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients.
|
||||
|
||||
[accountscreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/javascript/accountsCreateSample.js
|
||||
[accountsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/javascript/accountsDeleteSample.js
|
||||
[accountsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/javascript/accountsGetSample.js
|
||||
[accountslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/javascript/accountsListByResourceGroupSample.js
|
||||
[accountslistkeyssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/javascript/accountsListKeysSample.js
|
||||
[accountslistmodelssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/javascript/accountsListModelsSample.js
|
||||
[accountslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/javascript/accountsListSample.js
|
||||
[accountslistskussample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/javascript/accountsListSkusSample.js
|
||||
[accountslistusagessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/javascript/accountsListUsagesSample.js
|
||||
[accountsregeneratekeysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/javascript/accountsRegenerateKeySample.js
|
||||
[accountsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/javascript/accountsUpdateSample.js
|
||||
[checkdomainavailabilitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/javascript/checkDomainAvailabilitySample.js
|
||||
[checkskuavailabilitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/javascript/checkSkuAvailabilitySample.js
|
||||
[commitmentplanscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/javascript/commitmentPlansCreateOrUpdateSample.js
|
||||
[commitmentplansdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/javascript/commitmentPlansDeleteSample.js
|
||||
[commitmentplansgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/javascript/commitmentPlansGetSample.js
|
||||
[commitmentplanslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/javascript/commitmentPlansListSample.js
|
||||
[commitmenttierslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/javascript/commitmentTiersListSample.js
|
||||
[deletedaccountsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/javascript/deletedAccountsGetSample.js
|
||||
[deletedaccountslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/javascript/deletedAccountsListSample.js
|
||||
[deletedaccountspurgesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/javascript/deletedAccountsPurgeSample.js
|
||||
[deploymentscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/javascript/deploymentsCreateOrUpdateSample.js
|
||||
[deploymentsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/javascript/deploymentsDeleteSample.js
|
||||
[deploymentsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/javascript/deploymentsGetSample.js
|
||||
[deploymentslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/javascript/deploymentsListSample.js
|
||||
[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/javascript/operationsListSample.js
|
||||
[privateendpointconnectionscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/javascript/privateEndpointConnectionsCreateOrUpdateSample.js
|
||||
[privateendpointconnectionsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/javascript/privateEndpointConnectionsDeleteSample.js
|
||||
[privateendpointconnectionsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/javascript/privateEndpointConnectionsGetSample.js
|
||||
[privateendpointconnectionslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/javascript/privateEndpointConnectionsListSample.js
|
||||
[privatelinkresourceslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/javascript/privateLinkResourcesListSample.js
|
||||
[resourceskuslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/javascript/resourceSkusListSample.js
|
||||
[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-cognitiveservices?view=azure-node-preview
|
||||
[freesub]: https://azure.microsoft.com/free/
|
||||
[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/cognitiveservices/arm-cognitiveservices/README.md
|
|
@ -0,0 +1,77 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
const { CognitiveServicesManagementClient } = require("@azure/arm-cognitiveservices");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Create Cognitive Services Account. Accounts is a resource group wide resource type. It holds the keys for developer to access intelligent APIs. It's also the resource type for billing.
|
||||
*
|
||||
* @summary Create Cognitive Services Account. Accounts is a resource group wide resource type. It holds the keys for developer to access intelligent APIs. It's also the resource type for billing.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/CreateAccount.json
|
||||
*/
|
||||
async function createAccount() {
|
||||
const subscriptionId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
|
||||
const resourceGroupName = "myResourceGroup";
|
||||
const accountName = "testCreate1";
|
||||
const account = {
|
||||
identity: { type: "SystemAssigned" },
|
||||
kind: "Emotion",
|
||||
location: "West US",
|
||||
properties: {
|
||||
encryption: {
|
||||
keySource: "Microsoft.KeyVault",
|
||||
keyVaultProperties: {
|
||||
keyName: "KeyName",
|
||||
keyVaultUri: "https://pltfrmscrts-use-pc-dev.vault.azure.net/",
|
||||
keyVersion: "891CF236-D241-4738-9462-D506AF493DFA",
|
||||
},
|
||||
},
|
||||
userOwnedStorage: [
|
||||
{
|
||||
resourceId:
|
||||
"/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount",
|
||||
},
|
||||
],
|
||||
},
|
||||
sku: { name: "S0" },
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(credential, subscriptionId);
|
||||
const result = await client.accounts.beginCreateAndWait(resourceGroupName, accountName, account);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
createAccount().catch(console.error);
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Create Cognitive Services Account. Accounts is a resource group wide resource type. It holds the keys for developer to access intelligent APIs. It's also the resource type for billing.
|
||||
*
|
||||
* @summary Create Cognitive Services Account. Accounts is a resource group wide resource type. It holds the keys for developer to access intelligent APIs. It's also the resource type for billing.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/CreateAccountMin.json
|
||||
*/
|
||||
async function createAccountMin() {
|
||||
const subscriptionId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
|
||||
const resourceGroupName = "myResourceGroup";
|
||||
const accountName = "testCreate1";
|
||||
const account = {
|
||||
identity: { type: "SystemAssigned" },
|
||||
kind: "CognitiveServices",
|
||||
location: "West US",
|
||||
properties: {},
|
||||
sku: { name: "S0" },
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(credential, subscriptionId);
|
||||
const result = await client.accounts.beginCreateAndWait(resourceGroupName, accountName, account);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
createAccountMin().catch(console.error);
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
const { CognitiveServicesManagementClient } = require("@azure/arm-cognitiveservices");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Deletes a Cognitive Services account from the resource group.
|
||||
*
|
||||
* @summary Deletes a Cognitive Services account from the resource group.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/DeleteAccount.json
|
||||
*/
|
||||
async function deleteAccount() {
|
||||
const subscriptionId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
|
||||
const resourceGroupName = "myResourceGroup";
|
||||
const accountName = "PropTest01";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(credential, subscriptionId);
|
||||
const result = await client.accounts.beginDeleteAndWait(resourceGroupName, accountName);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
deleteAccount().catch(console.error);
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
const { CognitiveServicesManagementClient } = require("@azure/arm-cognitiveservices");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Returns a Cognitive Services account specified by the parameters.
|
||||
*
|
||||
* @summary Returns a Cognitive Services account specified by the parameters.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/GetAccount.json
|
||||
*/
|
||||
async function getAccount() {
|
||||
const subscriptionId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
|
||||
const resourceGroupName = "myResourceGroup";
|
||||
const accountName = "myAccount";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(credential, subscriptionId);
|
||||
const result = await client.accounts.get(resourceGroupName, accountName);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
getAccount().catch(console.error);
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
const { CognitiveServicesManagementClient } = require("@azure/arm-cognitiveservices");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Returns all the resources of a particular type belonging to a resource group
|
||||
*
|
||||
* @summary Returns all the resources of a particular type belonging to a resource group
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/ListAccountsByResourceGroup.json
|
||||
*/
|
||||
async function listAccountsByResourceGroup() {
|
||||
const subscriptionId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
|
||||
const resourceGroupName = "myResourceGroup";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(credential, subscriptionId);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.accounts.listByResourceGroup(resourceGroupName)) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
listAccountsByResourceGroup().catch(console.error);
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
const { CognitiveServicesManagementClient } = require("@azure/arm-cognitiveservices");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Lists the account keys for the specified Cognitive Services account.
|
||||
*
|
||||
* @summary Lists the account keys for the specified Cognitive Services account.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/ListKeys.json
|
||||
*/
|
||||
async function listKeys() {
|
||||
const subscriptionId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
|
||||
const resourceGroupName = "myResourceGroup";
|
||||
const accountName = "myAccount";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(credential, subscriptionId);
|
||||
const result = await client.accounts.listKeys(resourceGroupName, accountName);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
listKeys().catch(console.error);
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
const { CognitiveServicesManagementClient } = require("@azure/arm-cognitiveservices");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to List available Models for the requested Cognitive Services account
|
||||
*
|
||||
* @summary List available Models for the requested Cognitive Services account
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/ListAccountModels.json
|
||||
*/
|
||||
async function listAccountModels() {
|
||||
const subscriptionId = "subscriptionId";
|
||||
const resourceGroupName = "resourceGroupName";
|
||||
const accountName = "accountName";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(credential, subscriptionId);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.accounts.listModels(resourceGroupName, accountName)) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
listAccountModels().catch(console.error);
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
const { CognitiveServicesManagementClient } = require("@azure/arm-cognitiveservices");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Returns all the resources of a particular type belonging to a subscription.
|
||||
*
|
||||
* @summary Returns all the resources of a particular type belonging to a subscription.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/ListAccountsBySubscription.json
|
||||
*/
|
||||
async function listAccountsBySubscription() {
|
||||
const subscriptionId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(credential, subscriptionId);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.accounts.list()) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
listAccountsBySubscription().catch(console.error);
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
const { CognitiveServicesManagementClient } = require("@azure/arm-cognitiveservices");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to List available SKUs for the requested Cognitive Services account
|
||||
*
|
||||
* @summary List available SKUs for the requested Cognitive Services account
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/ListSkus.json
|
||||
*/
|
||||
async function listSkUs() {
|
||||
const subscriptionId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
|
||||
const resourceGroupName = "myResourceGroup";
|
||||
const accountName = "myAccount";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(credential, subscriptionId);
|
||||
const result = await client.accounts.listSkus(resourceGroupName, accountName);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
listSkUs().catch(console.error);
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
const { CognitiveServicesManagementClient } = require("@azure/arm-cognitiveservices");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Get usages for the requested Cognitive Services account
|
||||
*
|
||||
* @summary Get usages for the requested Cognitive Services account
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/GetUsages.json
|
||||
*/
|
||||
async function getUsages() {
|
||||
const subscriptionId = "5a4f5c2e-6983-4ccb-bd34-2196d5b5bbd3";
|
||||
const resourceGroupName = "myResourceGroup";
|
||||
const accountName = "TestUsage02";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(credential, subscriptionId);
|
||||
const result = await client.accounts.listUsages(resourceGroupName, accountName);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
getUsages().catch(console.error);
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
const { CognitiveServicesManagementClient } = require("@azure/arm-cognitiveservices");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Regenerates the specified account key for the specified Cognitive Services account.
|
||||
*
|
||||
* @summary Regenerates the specified account key for the specified Cognitive Services account.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/RegenerateKey.json
|
||||
*/
|
||||
async function regenerateKeys() {
|
||||
const subscriptionId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
|
||||
const resourceGroupName = "myResourceGroup";
|
||||
const accountName = "myAccount";
|
||||
const keyName = "Key2";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(credential, subscriptionId);
|
||||
const result = await client.accounts.regenerateKey(resourceGroupName, accountName, keyName);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
regenerateKeys().catch(console.error);
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
const { CognitiveServicesManagementClient } = require("@azure/arm-cognitiveservices");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Updates a Cognitive Services account
|
||||
*
|
||||
* @summary Updates a Cognitive Services account
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/UpdateAccount.json
|
||||
*/
|
||||
async function updateAccount() {
|
||||
const subscriptionId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
|
||||
const resourceGroupName = "bvttest";
|
||||
const accountName = "bingSearch";
|
||||
const account = { location: "global", sku: { name: "S2" } };
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(credential, subscriptionId);
|
||||
const result = await client.accounts.beginUpdateAndWait(resourceGroupName, accountName, account);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
updateAccount().catch(console.error);
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
const { CognitiveServicesManagementClient } = require("@azure/arm-cognitiveservices");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Check whether a domain is available.
|
||||
*
|
||||
* @summary Check whether a domain is available.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/CheckDomainAvailability.json
|
||||
*/
|
||||
async function checkSkuAvailability() {
|
||||
const subscriptionId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
|
||||
const subdomainName = "contosodemoapp1";
|
||||
const typeParam = "Microsoft.CognitiveServices/accounts";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(credential, subscriptionId);
|
||||
const result = await client.checkDomainAvailability(subdomainName, typeParam);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
checkSkuAvailability().catch(console.error);
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
const { CognitiveServicesManagementClient } = require("@azure/arm-cognitiveservices");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Check available SKUs.
|
||||
*
|
||||
* @summary Check available SKUs.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/CheckSkuAvailability.json
|
||||
*/
|
||||
async function checkSkuAvailability() {
|
||||
const subscriptionId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
|
||||
const location = "westus";
|
||||
const skus = ["S0"];
|
||||
const kind = "Face";
|
||||
const typeParam = "Microsoft.CognitiveServices/accounts";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(credential, subscriptionId);
|
||||
const result = await client.checkSkuAvailability(location, skus, kind, typeParam);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
checkSkuAvailability().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 { CognitiveServicesManagementClient } = require("@azure/arm-cognitiveservices");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Update the state of specified commitmentPlans associated with the Cognitive Services account.
|
||||
*
|
||||
* @summary Update the state of specified commitmentPlans associated with the Cognitive Services account.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/PutCommitmentPlan.json
|
||||
*/
|
||||
async function putCommitmentPlan() {
|
||||
const subscriptionId = "subscriptionId";
|
||||
const resourceGroupName = "resourceGroupName";
|
||||
const accountName = "accountName";
|
||||
const commitmentPlanName = "commitmentPlanName";
|
||||
const commitmentPlan = {
|
||||
properties: {
|
||||
autoRenew: true,
|
||||
current: { tier: "T1" },
|
||||
hostingModel: "Web",
|
||||
planType: "Speech2Text",
|
||||
},
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(credential, subscriptionId);
|
||||
const result = await client.commitmentPlans.createOrUpdate(
|
||||
resourceGroupName,
|
||||
accountName,
|
||||
commitmentPlanName,
|
||||
commitmentPlan
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
putCommitmentPlan().catch(console.error);
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
const { CognitiveServicesManagementClient } = require("@azure/arm-cognitiveservices");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Deletes the specified commitmentPlan associated with the Cognitive Services account.
|
||||
*
|
||||
* @summary Deletes the specified commitmentPlan associated with the Cognitive Services account.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/DeleteCommitmentPlan.json
|
||||
*/
|
||||
async function deleteCommitmentPlan() {
|
||||
const subscriptionId = "subscriptionId";
|
||||
const resourceGroupName = "resourceGroupName";
|
||||
const accountName = "accountName";
|
||||
const commitmentPlanName = "commitmentPlanName";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(credential, subscriptionId);
|
||||
const result = await client.commitmentPlans.beginDeleteAndWait(
|
||||
resourceGroupName,
|
||||
accountName,
|
||||
commitmentPlanName
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
deleteCommitmentPlan().catch(console.error);
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
const { CognitiveServicesManagementClient } = require("@azure/arm-cognitiveservices");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Gets the specified commitmentPlans associated with the Cognitive Services account.
|
||||
*
|
||||
* @summary Gets the specified commitmentPlans associated with the Cognitive Services account.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/GetCommitmentPlan.json
|
||||
*/
|
||||
async function getCommitmentPlan() {
|
||||
const subscriptionId = "subscriptionId";
|
||||
const resourceGroupName = "resourceGroupName";
|
||||
const accountName = "accountName";
|
||||
const commitmentPlanName = "commitmentPlanName";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(credential, subscriptionId);
|
||||
const result = await client.commitmentPlans.get(
|
||||
resourceGroupName,
|
||||
accountName,
|
||||
commitmentPlanName
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
getCommitmentPlan().catch(console.error);
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
const { CognitiveServicesManagementClient } = require("@azure/arm-cognitiveservices");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Gets the commitmentPlans associated with the Cognitive Services account.
|
||||
*
|
||||
* @summary Gets the commitmentPlans associated with the Cognitive Services account.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/ListCommitmentPlans.json
|
||||
*/
|
||||
async function listCommitmentPlans() {
|
||||
const subscriptionId = "subscriptionId";
|
||||
const resourceGroupName = "resourceGroupName";
|
||||
const accountName = "accountName";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(credential, subscriptionId);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.commitmentPlans.list(resourceGroupName, accountName)) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
listCommitmentPlans().catch(console.error);
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
const { CognitiveServicesManagementClient } = require("@azure/arm-cognitiveservices");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to List Commitment Tiers.
|
||||
*
|
||||
* @summary List Commitment Tiers.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/ListCommitmentTiers.json
|
||||
*/
|
||||
async function listCommitmentTiers() {
|
||||
const subscriptionId = "subscriptionId";
|
||||
const location = "location";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(credential, subscriptionId);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.commitmentTiers.list(location)) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
listCommitmentTiers().catch(console.error);
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
const { CognitiveServicesManagementClient } = require("@azure/arm-cognitiveservices");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Returns a Cognitive Services account specified by the parameters.
|
||||
*
|
||||
* @summary Returns a Cognitive Services account specified by the parameters.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/GetDeletedAccount.json
|
||||
*/
|
||||
async function getAccount() {
|
||||
const subscriptionId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
|
||||
const location = "westus";
|
||||
const resourceGroupName = "myResourceGroup";
|
||||
const accountName = "myAccount";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(credential, subscriptionId);
|
||||
const result = await client.deletedAccounts.get(location, resourceGroupName, accountName);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
getAccount().catch(console.error);
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
const { CognitiveServicesManagementClient } = require("@azure/arm-cognitiveservices");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Returns all the resources of a particular type belonging to a subscription.
|
||||
*
|
||||
* @summary Returns all the resources of a particular type belonging to a subscription.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/ListAccountsBySubscription.json
|
||||
*/
|
||||
async function listDeletedAccountsBySubscription() {
|
||||
const subscriptionId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(credential, subscriptionId);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.deletedAccounts.list()) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
listDeletedAccountsBySubscription().catch(console.error);
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
const { CognitiveServicesManagementClient } = require("@azure/arm-cognitiveservices");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Deletes a Cognitive Services account from the resource group.
|
||||
*
|
||||
* @summary Deletes a Cognitive Services account from the resource group.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/PurgeDeletedAccount.json
|
||||
*/
|
||||
async function deleteAccount() {
|
||||
const subscriptionId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
|
||||
const location = "westus";
|
||||
const resourceGroupName = "myResourceGroup";
|
||||
const accountName = "PropTest01";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(credential, subscriptionId);
|
||||
const result = await client.deletedAccounts.beginPurgeAndWait(
|
||||
location,
|
||||
resourceGroupName,
|
||||
accountName
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
deleteAccount().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 { CognitiveServicesManagementClient } = require("@azure/arm-cognitiveservices");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Update the state of specified deployments associated with the Cognitive Services account.
|
||||
*
|
||||
* @summary Update the state of specified deployments associated with the Cognitive Services account.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/PutDeployment.json
|
||||
*/
|
||||
async function putDeployment() {
|
||||
const subscriptionId = "subscriptionId";
|
||||
const resourceGroupName = "resourceGroupName";
|
||||
const accountName = "accountName";
|
||||
const deploymentName = "deploymentName";
|
||||
const deployment = {
|
||||
properties: {
|
||||
model: { name: "ada", format: "OpenAI", version: "1" },
|
||||
scaleSettings: { capacity: 1, scaleType: "Manual" },
|
||||
},
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(credential, subscriptionId);
|
||||
const result = await client.deployments.beginCreateOrUpdateAndWait(
|
||||
resourceGroupName,
|
||||
accountName,
|
||||
deploymentName,
|
||||
deployment
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
putDeployment().catch(console.error);
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
const { CognitiveServicesManagementClient } = require("@azure/arm-cognitiveservices");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Deletes the specified deployment associated with the Cognitive Services account.
|
||||
*
|
||||
* @summary Deletes the specified deployment associated with the Cognitive Services account.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/DeleteDeployment.json
|
||||
*/
|
||||
async function deleteDeployment() {
|
||||
const subscriptionId = "subscriptionId";
|
||||
const resourceGroupName = "resourceGroupName";
|
||||
const accountName = "accountName";
|
||||
const deploymentName = "deploymentName";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(credential, subscriptionId);
|
||||
const result = await client.deployments.beginDeleteAndWait(
|
||||
resourceGroupName,
|
||||
accountName,
|
||||
deploymentName
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
deleteDeployment().catch(console.error);
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
const { CognitiveServicesManagementClient } = require("@azure/arm-cognitiveservices");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Gets the specified deployments associated with the Cognitive Services account.
|
||||
*
|
||||
* @summary Gets the specified deployments associated with the Cognitive Services account.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/GetDeployment.json
|
||||
*/
|
||||
async function getDeployment() {
|
||||
const subscriptionId = "subscriptionId";
|
||||
const resourceGroupName = "resourceGroupName";
|
||||
const accountName = "accountName";
|
||||
const deploymentName = "deploymentName";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(credential, subscriptionId);
|
||||
const result = await client.deployments.get(resourceGroupName, accountName, deploymentName);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
getDeployment().catch(console.error);
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
const { CognitiveServicesManagementClient } = require("@azure/arm-cognitiveservices");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Gets the deployments associated with the Cognitive Services account.
|
||||
*
|
||||
* @summary Gets the deployments associated with the Cognitive Services account.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/ListDeployments.json
|
||||
*/
|
||||
async function listDeployments() {
|
||||
const subscriptionId = "subscriptionId";
|
||||
const resourceGroupName = "resourceGroupName";
|
||||
const accountName = "accountName";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(credential, subscriptionId);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.deployments.list(resourceGroupName, accountName)) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
listDeployments().catch(console.error);
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
const { CognitiveServicesManagementClient } = require("@azure/arm-cognitiveservices");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Lists all the available Cognitive Services account operations.
|
||||
*
|
||||
* @summary Lists all the available Cognitive Services account operations.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/GetOperations.json
|
||||
*/
|
||||
async function getOperations() {
|
||||
const subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(credential, subscriptionId);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.operations.list()) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
getOperations().catch(console.error);
|
|
@ -0,0 +1,32 @@
|
|||
{
|
||||
"name": "@azure-samples/arm-cognitiveservices-js",
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"description": " client library samples for JavaScript",
|
||||
"engines": {
|
||||
"node": ">=12.0.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/Azure/azure-sdk-for-js.git",
|
||||
"directory": "sdk/cognitiveservices/arm-cognitiveservices"
|
||||
},
|
||||
"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/cognitiveservices/arm-cognitiveservices",
|
||||
"dependencies": {
|
||||
"@azure/arm-cognitiveservices": "latest",
|
||||
"dotenv": "latest",
|
||||
"@azure/identity": "^2.0.1"
|
||||
}
|
||||
}
|
|
@ -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 { CognitiveServicesManagementClient } = require("@azure/arm-cognitiveservices");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Update the state of specified private endpoint connection associated with the Cognitive Services account.
|
||||
*
|
||||
* @summary Update the state of specified private endpoint connection associated with the Cognitive Services account.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/PutPrivateEndpointConnection.json
|
||||
*/
|
||||
async function putPrivateEndpointConnection() {
|
||||
const subscriptionId = "{subscription-id}";
|
||||
const resourceGroupName = "res7687";
|
||||
const accountName = "sto9699";
|
||||
const privateEndpointConnectionName = "{privateEndpointConnectionName}";
|
||||
const properties = {
|
||||
properties: {
|
||||
privateLinkServiceConnectionState: {
|
||||
description: "Auto-Approved",
|
||||
status: "Approved",
|
||||
},
|
||||
},
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(credential, subscriptionId);
|
||||
const result = await client.privateEndpointConnections.beginCreateOrUpdateAndWait(
|
||||
resourceGroupName,
|
||||
accountName,
|
||||
privateEndpointConnectionName,
|
||||
properties
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
putPrivateEndpointConnection().catch(console.error);
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
const { CognitiveServicesManagementClient } = require("@azure/arm-cognitiveservices");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Deletes the specified private endpoint connection associated with the Cognitive Services account.
|
||||
*
|
||||
* @summary Deletes the specified private endpoint connection associated with the Cognitive Services account.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/DeletePrivateEndpointConnection.json
|
||||
*/
|
||||
async function deletePrivateEndpointConnection() {
|
||||
const subscriptionId = "{subscription-id}";
|
||||
const resourceGroupName = "res6977";
|
||||
const accountName = "sto2527";
|
||||
const privateEndpointConnectionName = "{privateEndpointConnectionName}";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(credential, subscriptionId);
|
||||
const result = await client.privateEndpointConnections.beginDeleteAndWait(
|
||||
resourceGroupName,
|
||||
accountName,
|
||||
privateEndpointConnectionName
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
deletePrivateEndpointConnection().catch(console.error);
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
const { CognitiveServicesManagementClient } = require("@azure/arm-cognitiveservices");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Gets the specified private endpoint connection associated with the Cognitive Services account.
|
||||
*
|
||||
* @summary Gets the specified private endpoint connection associated with the Cognitive Services account.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/GetPrivateEndpointConnection.json
|
||||
*/
|
||||
async function getPrivateEndpointConnection() {
|
||||
const subscriptionId = "{subscription-id}";
|
||||
const resourceGroupName = "res6977";
|
||||
const accountName = "sto2527";
|
||||
const privateEndpointConnectionName = "{privateEndpointConnectionName}";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(credential, subscriptionId);
|
||||
const result = await client.privateEndpointConnections.get(
|
||||
resourceGroupName,
|
||||
accountName,
|
||||
privateEndpointConnectionName
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
getPrivateEndpointConnection().catch(console.error);
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
const { CognitiveServicesManagementClient } = require("@azure/arm-cognitiveservices");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Gets the private endpoint connections associated with the Cognitive Services account.
|
||||
*
|
||||
* @summary Gets the private endpoint connections associated with the Cognitive Services account.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/ListPrivateEndpointConnections.json
|
||||
*/
|
||||
async function getPrivateEndpointConnection() {
|
||||
const subscriptionId = "{subscription-id}";
|
||||
const resourceGroupName = "res6977";
|
||||
const accountName = "sto2527";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(credential, subscriptionId);
|
||||
const result = await client.privateEndpointConnections.list(resourceGroupName, accountName);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
getPrivateEndpointConnection().catch(console.error);
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
const { CognitiveServicesManagementClient } = require("@azure/arm-cognitiveservices");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Gets the private link resources that need to be created for a Cognitive Services account.
|
||||
*
|
||||
* @summary Gets the private link resources that need to be created for a Cognitive Services account.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/ListPrivateLinkResources.json
|
||||
*/
|
||||
async function listPrivateLinkResources() {
|
||||
const subscriptionId = "{subscription-id}";
|
||||
const resourceGroupName = "res6977";
|
||||
const accountName = "sto2527";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(credential, subscriptionId);
|
||||
const result = await client.privateLinkResources.list(resourceGroupName, accountName);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
listPrivateLinkResources().catch(console.error);
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
const { CognitiveServicesManagementClient } = require("@azure/arm-cognitiveservices");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Gets the list of Microsoft.CognitiveServices SKUs available for your Subscription.
|
||||
*
|
||||
* @summary Gets the list of Microsoft.CognitiveServices SKUs available for your Subscription.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/GetSkus.json
|
||||
*/
|
||||
async function regenerateKeys() {
|
||||
const subscriptionId = "f1c637e4-72ec-4f89-8d2b-0f933c036002";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(credential, subscriptionId);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.resourceSkus.list()) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
regenerateKeys().catch(console.error);
|
|
@ -0,0 +1,4 @@
|
|||
# App registration secret for AAD authentication
|
||||
AZURE_CLIENT_SECRET=
|
||||
AZURE_CLIENT_ID=
|
||||
AZURE_TENANT_ID=
|
|
@ -0,0 +1,125 @@
|
|||
# client library samples for TypeScript
|
||||
|
||||
These sample programs show how to use the TypeScript client libraries for in some common scenarios.
|
||||
|
||||
| **File Name** | **Description** |
|
||||
| --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [accountsCreateSample.ts][accountscreatesample] | Create Cognitive Services Account. Accounts is a resource group wide resource type. It holds the keys for developer to access intelligent APIs. It's also the resource type for billing. x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/CreateAccount.json |
|
||||
| [accountsDeleteSample.ts][accountsdeletesample] | Deletes a Cognitive Services account from the resource group. x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/DeleteAccount.json |
|
||||
| [accountsGetSample.ts][accountsgetsample] | Returns a Cognitive Services account specified by the parameters. x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/GetAccount.json |
|
||||
| [accountsListByResourceGroupSample.ts][accountslistbyresourcegroupsample] | Returns all the resources of a particular type belonging to a resource group x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/ListAccountsByResourceGroup.json |
|
||||
| [accountsListKeysSample.ts][accountslistkeyssample] | Lists the account keys for the specified Cognitive Services account. x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/ListKeys.json |
|
||||
| [accountsListModelsSample.ts][accountslistmodelssample] | List available Models for the requested Cognitive Services account x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/ListAccountModels.json |
|
||||
| [accountsListSample.ts][accountslistsample] | Returns all the resources of a particular type belonging to a subscription. x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/ListAccountsBySubscription.json |
|
||||
| [accountsListSkusSample.ts][accountslistskussample] | List available SKUs for the requested Cognitive Services account x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/ListSkus.json |
|
||||
| [accountsListUsagesSample.ts][accountslistusagessample] | Get usages for the requested Cognitive Services account x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/GetUsages.json |
|
||||
| [accountsRegenerateKeySample.ts][accountsregeneratekeysample] | Regenerates the specified account key for the specified Cognitive Services account. x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/RegenerateKey.json |
|
||||
| [accountsUpdateSample.ts][accountsupdatesample] | Updates a Cognitive Services account x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/UpdateAccount.json |
|
||||
| [checkDomainAvailabilitySample.ts][checkdomainavailabilitysample] | Check whether a domain is available. x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/CheckDomainAvailability.json |
|
||||
| [checkSkuAvailabilitySample.ts][checkskuavailabilitysample] | Check available SKUs. x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/CheckSkuAvailability.json |
|
||||
| [commitmentPlansCreateOrUpdateSample.ts][commitmentplanscreateorupdatesample] | Update the state of specified commitmentPlans associated with the Cognitive Services account. x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/PutCommitmentPlan.json |
|
||||
| [commitmentPlansDeleteSample.ts][commitmentplansdeletesample] | Deletes the specified commitmentPlan associated with the Cognitive Services account. x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/DeleteCommitmentPlan.json |
|
||||
| [commitmentPlansGetSample.ts][commitmentplansgetsample] | Gets the specified commitmentPlans associated with the Cognitive Services account. x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/GetCommitmentPlan.json |
|
||||
| [commitmentPlansListSample.ts][commitmentplanslistsample] | Gets the commitmentPlans associated with the Cognitive Services account. x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/ListCommitmentPlans.json |
|
||||
| [commitmentTiersListSample.ts][commitmenttierslistsample] | List Commitment Tiers. x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/ListCommitmentTiers.json |
|
||||
| [deletedAccountsGetSample.ts][deletedaccountsgetsample] | Returns a Cognitive Services account specified by the parameters. x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/GetDeletedAccount.json |
|
||||
| [deletedAccountsListSample.ts][deletedaccountslistsample] | Returns all the resources of a particular type belonging to a subscription. x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/ListAccountsBySubscription.json |
|
||||
| [deletedAccountsPurgeSample.ts][deletedaccountspurgesample] | Deletes a Cognitive Services account from the resource group. x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/PurgeDeletedAccount.json |
|
||||
| [deploymentsCreateOrUpdateSample.ts][deploymentscreateorupdatesample] | Update the state of specified deployments associated with the Cognitive Services account. x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/PutDeployment.json |
|
||||
| [deploymentsDeleteSample.ts][deploymentsdeletesample] | Deletes the specified deployment associated with the Cognitive Services account. x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/DeleteDeployment.json |
|
||||
| [deploymentsGetSample.ts][deploymentsgetsample] | Gets the specified deployments associated with the Cognitive Services account. x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/GetDeployment.json |
|
||||
| [deploymentsListSample.ts][deploymentslistsample] | Gets the deployments associated with the Cognitive Services account. x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/ListDeployments.json |
|
||||
| [operationsListSample.ts][operationslistsample] | Lists all the available Cognitive Services account operations. x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/GetOperations.json |
|
||||
| [privateEndpointConnectionsCreateOrUpdateSample.ts][privateendpointconnectionscreateorupdatesample] | Update the state of specified private endpoint connection associated with the Cognitive Services account. x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/PutPrivateEndpointConnection.json |
|
||||
| [privateEndpointConnectionsDeleteSample.ts][privateendpointconnectionsdeletesample] | Deletes the specified private endpoint connection associated with the Cognitive Services account. x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/DeletePrivateEndpointConnection.json |
|
||||
| [privateEndpointConnectionsGetSample.ts][privateendpointconnectionsgetsample] | Gets the specified private endpoint connection associated with the Cognitive Services account. x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/GetPrivateEndpointConnection.json |
|
||||
| [privateEndpointConnectionsListSample.ts][privateendpointconnectionslistsample] | Gets the private endpoint connections associated with the Cognitive Services account. x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/ListPrivateEndpointConnections.json |
|
||||
| [privateLinkResourcesListSample.ts][privatelinkresourceslistsample] | Gets the private link resources that need to be created for a Cognitive Services account. x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/ListPrivateLinkResources.json |
|
||||
| [resourceSkusListSample.ts][resourceskuslistsample] | Gets the list of Microsoft.CognitiveServices SKUs available for your Subscription. x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/GetSkus.json |
|
||||
|
||||
## Prerequisites
|
||||
|
||||
The sample programs are compatible with [LTS versions of Node.js](https://nodejs.org/about/releases/).
|
||||
|
||||
Before running the samples in Node, they must be compiled to JavaScript using the TypeScript compiler. For more information on TypeScript, see the [TypeScript documentation][typescript]. Install the TypeScript compiler using:
|
||||
|
||||
```bash
|
||||
npm install -g typescript
|
||||
```
|
||||
|
||||
You need [an Azure subscription][freesub] to run these sample programs.
|
||||
|
||||
Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function.
|
||||
|
||||
Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package].
|
||||
|
||||
## Setup
|
||||
|
||||
To run the samples using the published version of the package:
|
||||
|
||||
1. Install the dependencies using `npm`:
|
||||
|
||||
```bash
|
||||
npm install
|
||||
```
|
||||
|
||||
2. Compile the samples:
|
||||
|
||||
```bash
|
||||
npm run build
|
||||
```
|
||||
|
||||
3. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically.
|
||||
|
||||
4. Run whichever samples you like (note that some samples may require additional setup, see the table above):
|
||||
|
||||
```bash
|
||||
node dist/accountsCreateSample.js
|
||||
```
|
||||
|
||||
Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform):
|
||||
|
||||
```bash
|
||||
npx cross-env node dist/accountsCreateSample.js
|
||||
```
|
||||
|
||||
## Next Steps
|
||||
|
||||
Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients.
|
||||
|
||||
[accountscreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/typescript/src/accountsCreateSample.ts
|
||||
[accountsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/typescript/src/accountsDeleteSample.ts
|
||||
[accountsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/typescript/src/accountsGetSample.ts
|
||||
[accountslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/typescript/src/accountsListByResourceGroupSample.ts
|
||||
[accountslistkeyssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/typescript/src/accountsListKeysSample.ts
|
||||
[accountslistmodelssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/typescript/src/accountsListModelsSample.ts
|
||||
[accountslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/typescript/src/accountsListSample.ts
|
||||
[accountslistskussample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/typescript/src/accountsListSkusSample.ts
|
||||
[accountslistusagessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/typescript/src/accountsListUsagesSample.ts
|
||||
[accountsregeneratekeysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/typescript/src/accountsRegenerateKeySample.ts
|
||||
[accountsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/typescript/src/accountsUpdateSample.ts
|
||||
[checkdomainavailabilitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/typescript/src/checkDomainAvailabilitySample.ts
|
||||
[checkskuavailabilitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/typescript/src/checkSkuAvailabilitySample.ts
|
||||
[commitmentplanscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/typescript/src/commitmentPlansCreateOrUpdateSample.ts
|
||||
[commitmentplansdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/typescript/src/commitmentPlansDeleteSample.ts
|
||||
[commitmentplansgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/typescript/src/commitmentPlansGetSample.ts
|
||||
[commitmentplanslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/typescript/src/commitmentPlansListSample.ts
|
||||
[commitmenttierslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/typescript/src/commitmentTiersListSample.ts
|
||||
[deletedaccountsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/typescript/src/deletedAccountsGetSample.ts
|
||||
[deletedaccountslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/typescript/src/deletedAccountsListSample.ts
|
||||
[deletedaccountspurgesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/typescript/src/deletedAccountsPurgeSample.ts
|
||||
[deploymentscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/typescript/src/deploymentsCreateOrUpdateSample.ts
|
||||
[deploymentsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/typescript/src/deploymentsDeleteSample.ts
|
||||
[deploymentsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/typescript/src/deploymentsGetSample.ts
|
||||
[deploymentslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/typescript/src/deploymentsListSample.ts
|
||||
[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/typescript/src/operationsListSample.ts
|
||||
[privateendpointconnectionscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/typescript/src/privateEndpointConnectionsCreateOrUpdateSample.ts
|
||||
[privateendpointconnectionsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/typescript/src/privateEndpointConnectionsDeleteSample.ts
|
||||
[privateendpointconnectionsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/typescript/src/privateEndpointConnectionsGetSample.ts
|
||||
[privateendpointconnectionslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/typescript/src/privateEndpointConnectionsListSample.ts
|
||||
[privatelinkresourceslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/typescript/src/privateLinkResourcesListSample.ts
|
||||
[resourceskuslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitiveservices/arm-cognitiveservices/samples/v7/typescript/src/resourceSkusListSample.ts
|
||||
[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-cognitiveservices?view=azure-node-preview
|
||||
[freesub]: https://azure.microsoft.com/free/
|
||||
[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/cognitiveservices/arm-cognitiveservices/README.md
|
||||
[typescript]: https://www.typescriptlang.org/docs/home.html
|
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
"name": "@azure-samples/arm-cognitiveservices-ts",
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"description": " client library samples for TypeScript",
|
||||
"engines": {
|
||||
"node": ">=12.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"prebuild": "rimraf dist/"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/Azure/azure-sdk-for-js.git",
|
||||
"directory": "sdk/cognitiveservices/arm-cognitiveservices"
|
||||
},
|
||||
"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/cognitiveservices/arm-cognitiveservices",
|
||||
"dependencies": {
|
||||
"@azure/arm-cognitiveservices": "latest",
|
||||
"dotenv": "latest",
|
||||
"@azure/identity": "^2.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^12.0.0",
|
||||
"typescript": "~4.4.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,94 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code 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 {
|
||||
Account,
|
||||
CognitiveServicesManagementClient
|
||||
} from "@azure/arm-cognitiveservices";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Create Cognitive Services Account. Accounts is a resource group wide resource type. It holds the keys for developer to access intelligent APIs. It's also the resource type for billing.
|
||||
*
|
||||
* @summary Create Cognitive Services Account. Accounts is a resource group wide resource type. It holds the keys for developer to access intelligent APIs. It's also the resource type for billing.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/CreateAccount.json
|
||||
*/
|
||||
async function createAccount() {
|
||||
const subscriptionId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
|
||||
const resourceGroupName = "myResourceGroup";
|
||||
const accountName = "testCreate1";
|
||||
const account: Account = {
|
||||
identity: { type: "SystemAssigned" },
|
||||
kind: "Emotion",
|
||||
location: "West US",
|
||||
properties: {
|
||||
encryption: {
|
||||
keySource: "Microsoft.KeyVault",
|
||||
keyVaultProperties: {
|
||||
keyName: "KeyName",
|
||||
keyVaultUri: "https://pltfrmscrts-use-pc-dev.vault.azure.net/",
|
||||
keyVersion: "891CF236-D241-4738-9462-D506AF493DFA"
|
||||
}
|
||||
},
|
||||
userOwnedStorage: [
|
||||
{
|
||||
resourceId:
|
||||
"/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount"
|
||||
}
|
||||
]
|
||||
},
|
||||
sku: { name: "S0" }
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(
|
||||
credential,
|
||||
subscriptionId
|
||||
);
|
||||
const result = await client.accounts.beginCreateAndWait(
|
||||
resourceGroupName,
|
||||
accountName,
|
||||
account
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
createAccount().catch(console.error);
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Create Cognitive Services Account. Accounts is a resource group wide resource type. It holds the keys for developer to access intelligent APIs. It's also the resource type for billing.
|
||||
*
|
||||
* @summary Create Cognitive Services Account. Accounts is a resource group wide resource type. It holds the keys for developer to access intelligent APIs. It's also the resource type for billing.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/CreateAccountMin.json
|
||||
*/
|
||||
async function createAccountMin() {
|
||||
const subscriptionId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
|
||||
const resourceGroupName = "myResourceGroup";
|
||||
const accountName = "testCreate1";
|
||||
const account: Account = {
|
||||
identity: { type: "SystemAssigned" },
|
||||
kind: "CognitiveServices",
|
||||
location: "West US",
|
||||
properties: {},
|
||||
sku: { name: "S0" }
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(
|
||||
credential,
|
||||
subscriptionId
|
||||
);
|
||||
const result = await client.accounts.beginCreateAndWait(
|
||||
resourceGroupName,
|
||||
accountName,
|
||||
account
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
createAccountMin().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.
|
||||
import { CognitiveServicesManagementClient } from "@azure/arm-cognitiveservices";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Deletes a Cognitive Services account from the resource group.
|
||||
*
|
||||
* @summary Deletes a Cognitive Services account from the resource group.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/DeleteAccount.json
|
||||
*/
|
||||
async function deleteAccount() {
|
||||
const subscriptionId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
|
||||
const resourceGroupName = "myResourceGroup";
|
||||
const accountName = "PropTest01";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(
|
||||
credential,
|
||||
subscriptionId
|
||||
);
|
||||
const result = await client.accounts.beginDeleteAndWait(
|
||||
resourceGroupName,
|
||||
accountName
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
deleteAccount().catch(console.error);
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { CognitiveServicesManagementClient } from "@azure/arm-cognitiveservices";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Returns a Cognitive Services account specified by the parameters.
|
||||
*
|
||||
* @summary Returns a Cognitive Services account specified by the parameters.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/GetAccount.json
|
||||
*/
|
||||
async function getAccount() {
|
||||
const subscriptionId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
|
||||
const resourceGroupName = "myResourceGroup";
|
||||
const accountName = "myAccount";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(
|
||||
credential,
|
||||
subscriptionId
|
||||
);
|
||||
const result = await client.accounts.get(resourceGroupName, accountName);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
getAccount().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.
|
||||
import { CognitiveServicesManagementClient } from "@azure/arm-cognitiveservices";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Returns all the resources of a particular type belonging to a resource group
|
||||
*
|
||||
* @summary Returns all the resources of a particular type belonging to a resource group
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/ListAccountsByResourceGroup.json
|
||||
*/
|
||||
async function listAccountsByResourceGroup() {
|
||||
const subscriptionId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
|
||||
const resourceGroupName = "myResourceGroup";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(
|
||||
credential,
|
||||
subscriptionId
|
||||
);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.accounts.listByResourceGroup(
|
||||
resourceGroupName
|
||||
)) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
listAccountsByResourceGroup().catch(console.error);
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { CognitiveServicesManagementClient } from "@azure/arm-cognitiveservices";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Lists the account keys for the specified Cognitive Services account.
|
||||
*
|
||||
* @summary Lists the account keys for the specified Cognitive Services account.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/ListKeys.json
|
||||
*/
|
||||
async function listKeys() {
|
||||
const subscriptionId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
|
||||
const resourceGroupName = "myResourceGroup";
|
||||
const accountName = "myAccount";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(
|
||||
credential,
|
||||
subscriptionId
|
||||
);
|
||||
const result = await client.accounts.listKeys(resourceGroupName, accountName);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
listKeys().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.
|
||||
import { CognitiveServicesManagementClient } from "@azure/arm-cognitiveservices";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to List available Models for the requested Cognitive Services account
|
||||
*
|
||||
* @summary List available Models for the requested Cognitive Services account
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/ListAccountModels.json
|
||||
*/
|
||||
async function listAccountModels() {
|
||||
const subscriptionId = "subscriptionId";
|
||||
const resourceGroupName = "resourceGroupName";
|
||||
const accountName = "accountName";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(
|
||||
credential,
|
||||
subscriptionId
|
||||
);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.accounts.listModels(
|
||||
resourceGroupName,
|
||||
accountName
|
||||
)) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
listAccountModels().catch(console.error);
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { CognitiveServicesManagementClient } from "@azure/arm-cognitiveservices";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Returns all the resources of a particular type belonging to a subscription.
|
||||
*
|
||||
* @summary Returns all the resources of a particular type belonging to a subscription.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/ListAccountsBySubscription.json
|
||||
*/
|
||||
async function listAccountsBySubscription() {
|
||||
const subscriptionId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(
|
||||
credential,
|
||||
subscriptionId
|
||||
);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.accounts.list()) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
listAccountsBySubscription().catch(console.error);
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { CognitiveServicesManagementClient } from "@azure/arm-cognitiveservices";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to List available SKUs for the requested Cognitive Services account
|
||||
*
|
||||
* @summary List available SKUs for the requested Cognitive Services account
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/ListSkus.json
|
||||
*/
|
||||
async function listSkUs() {
|
||||
const subscriptionId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
|
||||
const resourceGroupName = "myResourceGroup";
|
||||
const accountName = "myAccount";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(
|
||||
credential,
|
||||
subscriptionId
|
||||
);
|
||||
const result = await client.accounts.listSkus(resourceGroupName, accountName);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
listSkUs().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.
|
||||
import { CognitiveServicesManagementClient } from "@azure/arm-cognitiveservices";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Get usages for the requested Cognitive Services account
|
||||
*
|
||||
* @summary Get usages for the requested Cognitive Services account
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/GetUsages.json
|
||||
*/
|
||||
async function getUsages() {
|
||||
const subscriptionId = "5a4f5c2e-6983-4ccb-bd34-2196d5b5bbd3";
|
||||
const resourceGroupName = "myResourceGroup";
|
||||
const accountName = "TestUsage02";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(
|
||||
credential,
|
||||
subscriptionId
|
||||
);
|
||||
const result = await client.accounts.listUsages(
|
||||
resourceGroupName,
|
||||
accountName
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
getUsages().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.
|
||||
import { CognitiveServicesManagementClient } from "@azure/arm-cognitiveservices";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Regenerates the specified account key for the specified Cognitive Services account.
|
||||
*
|
||||
* @summary Regenerates the specified account key for the specified Cognitive Services account.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/RegenerateKey.json
|
||||
*/
|
||||
async function regenerateKeys() {
|
||||
const subscriptionId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
|
||||
const resourceGroupName = "myResourceGroup";
|
||||
const accountName = "myAccount";
|
||||
const keyName = "Key2";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(
|
||||
credential,
|
||||
subscriptionId
|
||||
);
|
||||
const result = await client.accounts.regenerateKey(
|
||||
resourceGroupName,
|
||||
accountName,
|
||||
keyName
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
regenerateKeys().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.
|
||||
import {
|
||||
Account,
|
||||
CognitiveServicesManagementClient
|
||||
} from "@azure/arm-cognitiveservices";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Updates a Cognitive Services account
|
||||
*
|
||||
* @summary Updates a Cognitive Services account
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/UpdateAccount.json
|
||||
*/
|
||||
async function updateAccount() {
|
||||
const subscriptionId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
|
||||
const resourceGroupName = "bvttest";
|
||||
const accountName = "bingSearch";
|
||||
const account: Account = { location: "global", sku: { name: "S2" } };
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(
|
||||
credential,
|
||||
subscriptionId
|
||||
);
|
||||
const result = await client.accounts.beginUpdateAndWait(
|
||||
resourceGroupName,
|
||||
accountName,
|
||||
account
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
updateAccount().catch(console.error);
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { CognitiveServicesManagementClient } from "@azure/arm-cognitiveservices";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Check whether a domain is available.
|
||||
*
|
||||
* @summary Check whether a domain is available.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/CheckDomainAvailability.json
|
||||
*/
|
||||
async function checkSkuAvailability() {
|
||||
const subscriptionId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
|
||||
const subdomainName = "contosodemoapp1";
|
||||
const typeParam = "Microsoft.CognitiveServices/accounts";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(
|
||||
credential,
|
||||
subscriptionId
|
||||
);
|
||||
const result = await client.checkDomainAvailability(subdomainName, typeParam);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
checkSkuAvailability().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.
|
||||
import { CognitiveServicesManagementClient } from "@azure/arm-cognitiveservices";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Check available SKUs.
|
||||
*
|
||||
* @summary Check available SKUs.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/CheckSkuAvailability.json
|
||||
*/
|
||||
async function checkSkuAvailability() {
|
||||
const subscriptionId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
|
||||
const location = "westus";
|
||||
const skus = ["S0"];
|
||||
const kind = "Face";
|
||||
const typeParam = "Microsoft.CognitiveServices/accounts";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(
|
||||
credential,
|
||||
subscriptionId
|
||||
);
|
||||
const result = await client.checkSkuAvailability(
|
||||
location,
|
||||
skus,
|
||||
kind,
|
||||
typeParam
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
checkSkuAvailability().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 {
|
||||
CommitmentPlan,
|
||||
CognitiveServicesManagementClient
|
||||
} from "@azure/arm-cognitiveservices";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Update the state of specified commitmentPlans associated with the Cognitive Services account.
|
||||
*
|
||||
* @summary Update the state of specified commitmentPlans associated with the Cognitive Services account.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/PutCommitmentPlan.json
|
||||
*/
|
||||
async function putCommitmentPlan() {
|
||||
const subscriptionId = "subscriptionId";
|
||||
const resourceGroupName = "resourceGroupName";
|
||||
const accountName = "accountName";
|
||||
const commitmentPlanName = "commitmentPlanName";
|
||||
const commitmentPlan: CommitmentPlan = {
|
||||
properties: {
|
||||
autoRenew: true,
|
||||
current: { tier: "T1" },
|
||||
hostingModel: "Web",
|
||||
planType: "Speech2Text"
|
||||
}
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(
|
||||
credential,
|
||||
subscriptionId
|
||||
);
|
||||
const result = await client.commitmentPlans.createOrUpdate(
|
||||
resourceGroupName,
|
||||
accountName,
|
||||
commitmentPlanName,
|
||||
commitmentPlan
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
putCommitmentPlan().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.
|
||||
import { CognitiveServicesManagementClient } from "@azure/arm-cognitiveservices";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Deletes the specified commitmentPlan associated with the Cognitive Services account.
|
||||
*
|
||||
* @summary Deletes the specified commitmentPlan associated with the Cognitive Services account.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/DeleteCommitmentPlan.json
|
||||
*/
|
||||
async function deleteCommitmentPlan() {
|
||||
const subscriptionId = "subscriptionId";
|
||||
const resourceGroupName = "resourceGroupName";
|
||||
const accountName = "accountName";
|
||||
const commitmentPlanName = "commitmentPlanName";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(
|
||||
credential,
|
||||
subscriptionId
|
||||
);
|
||||
const result = await client.commitmentPlans.beginDeleteAndWait(
|
||||
resourceGroupName,
|
||||
accountName,
|
||||
commitmentPlanName
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
deleteCommitmentPlan().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.
|
||||
import { CognitiveServicesManagementClient } from "@azure/arm-cognitiveservices";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Gets the specified commitmentPlans associated with the Cognitive Services account.
|
||||
*
|
||||
* @summary Gets the specified commitmentPlans associated with the Cognitive Services account.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/GetCommitmentPlan.json
|
||||
*/
|
||||
async function getCommitmentPlan() {
|
||||
const subscriptionId = "subscriptionId";
|
||||
const resourceGroupName = "resourceGroupName";
|
||||
const accountName = "accountName";
|
||||
const commitmentPlanName = "commitmentPlanName";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(
|
||||
credential,
|
||||
subscriptionId
|
||||
);
|
||||
const result = await client.commitmentPlans.get(
|
||||
resourceGroupName,
|
||||
accountName,
|
||||
commitmentPlanName
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
getCommitmentPlan().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.
|
||||
import { CognitiveServicesManagementClient } from "@azure/arm-cognitiveservices";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Gets the commitmentPlans associated with the Cognitive Services account.
|
||||
*
|
||||
* @summary Gets the commitmentPlans associated with the Cognitive Services account.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/ListCommitmentPlans.json
|
||||
*/
|
||||
async function listCommitmentPlans() {
|
||||
const subscriptionId = "subscriptionId";
|
||||
const resourceGroupName = "resourceGroupName";
|
||||
const accountName = "accountName";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(
|
||||
credential,
|
||||
subscriptionId
|
||||
);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.commitmentPlans.list(
|
||||
resourceGroupName,
|
||||
accountName
|
||||
)) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
listCommitmentPlans().catch(console.error);
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { CognitiveServicesManagementClient } from "@azure/arm-cognitiveservices";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to List Commitment Tiers.
|
||||
*
|
||||
* @summary List Commitment Tiers.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/ListCommitmentTiers.json
|
||||
*/
|
||||
async function listCommitmentTiers() {
|
||||
const subscriptionId = "subscriptionId";
|
||||
const location = "location";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(
|
||||
credential,
|
||||
subscriptionId
|
||||
);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.commitmentTiers.list(location)) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
listCommitmentTiers().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.
|
||||
import { CognitiveServicesManagementClient } from "@azure/arm-cognitiveservices";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Returns a Cognitive Services account specified by the parameters.
|
||||
*
|
||||
* @summary Returns a Cognitive Services account specified by the parameters.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/GetDeletedAccount.json
|
||||
*/
|
||||
async function getAccount() {
|
||||
const subscriptionId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
|
||||
const location = "westus";
|
||||
const resourceGroupName = "myResourceGroup";
|
||||
const accountName = "myAccount";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(
|
||||
credential,
|
||||
subscriptionId
|
||||
);
|
||||
const result = await client.deletedAccounts.get(
|
||||
location,
|
||||
resourceGroupName,
|
||||
accountName
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
getAccount().catch(console.error);
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { CognitiveServicesManagementClient } from "@azure/arm-cognitiveservices";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Returns all the resources of a particular type belonging to a subscription.
|
||||
*
|
||||
* @summary Returns all the resources of a particular type belonging to a subscription.
|
||||
* x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-03-01/examples/ListAccountsBySubscription.json
|
||||
*/
|
||||
async function listDeletedAccountsBySubscription() {
|
||||
const subscriptionId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new CognitiveServicesManagementClient(
|
||||
credential,
|
||||
subscriptionId
|
||||
);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.deletedAccounts.list()) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
listDeletedAccountsBySubscription().catch(console.error);
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче