mirror of
https://github.com/hanzoai/azure-sdk-for-js.git
synced 2026-10-30 19:51:51 +00:00
Configurations: 'specification/machinelearningservices/MachineLearningServices.Management/tspconfig.yaml', API Version: 2026-03-15-preview, SDK Release Type: beta, and CommitSHA: 'dfef10d031a60f8e2fcf36e99364c144e9661036' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=6492167 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release. --------- Co-authored-by: Jiao Di (MSFT) <[email protected]> Co-authored-by: Jiao Di (MSFT) <[email protected]>
126 lines
4.3 KiB
JavaScript
126 lines
4.3 KiB
JavaScript
// Copyright (c) Microsoft Corporation.
|
|
// Licensed under the MIT License.
|
|
|
|
const { AzureMachineLearningServicesManagementClient } = require("@azure/arm-machinelearning");
|
|
const { DefaultAzureCredential } = require("@azure/identity");
|
|
|
|
/**
|
|
* This sample demonstrates how to create or update Inference Endpoint Deployment (asynchronous).
|
|
*
|
|
* @summary create or update Inference Endpoint Deployment (asynchronous).
|
|
* x-ms-original-file: 2026-03-15-preview/OnlineDeployment/KubernetesOnlineDeployment/createOrUpdate.json
|
|
*/
|
|
async function createOrUpdateKubernetesOnlineDeployment() {
|
|
const credential = new DefaultAzureCredential();
|
|
const subscriptionId = "00000000-1111-2222-3333-444444444444";
|
|
const client = new AzureMachineLearningServicesManagementClient(credential, subscriptionId);
|
|
const result = await client.onlineDeployments.createOrUpdate(
|
|
"test-rg",
|
|
"my-aml-workspace",
|
|
"testEndpointName",
|
|
"testDeploymentName",
|
|
{
|
|
identity: { type: "SystemAssigned", userAssignedIdentities: { string: {} } },
|
|
kind: "string",
|
|
location: "string",
|
|
properties: {
|
|
description: "string",
|
|
appInsightsEnabled: false,
|
|
codeConfiguration: { codeId: "string", scoringScript: "string" },
|
|
containerResourceRequirements: {
|
|
containerResourceLimits: { cpu: '"1"', gpu: '"1"', memory: '"2Gi"' },
|
|
containerResourceRequests: { cpu: '"1"', gpu: '"1"', memory: '"2Gi"' },
|
|
},
|
|
endpointComputeType: "Kubernetes",
|
|
environmentId: "string",
|
|
environmentVariables: { string: "string" },
|
|
instanceType: "string",
|
|
livenessProbe: {
|
|
failureThreshold: 1,
|
|
initialDelay: "PT5M",
|
|
period: "PT5M",
|
|
successThreshold: 1,
|
|
timeout: "PT5M",
|
|
},
|
|
model: "string",
|
|
modelMountPath: "string",
|
|
properties: { string: "string" },
|
|
requestSettings: {
|
|
maxConcurrentRequestsPerInstance: 1,
|
|
maxQueueWait: "PT5M",
|
|
requestTimeout: "PT5M",
|
|
},
|
|
scaleSettings: { scaleType: "Default" },
|
|
},
|
|
sku: { name: "string", capacity: 1, family: "string", size: "string", tier: "Free" },
|
|
tags: {},
|
|
},
|
|
);
|
|
console.log(result);
|
|
}
|
|
|
|
/**
|
|
* This sample demonstrates how to create or update Inference Endpoint Deployment (asynchronous).
|
|
*
|
|
* @summary create or update Inference Endpoint Deployment (asynchronous).
|
|
* x-ms-original-file: 2026-03-15-preview/OnlineDeployment/ManagedOnlineDeployment/createOrUpdate.json
|
|
*/
|
|
async function createOrUpdateManagedOnlineDeployment() {
|
|
const credential = new DefaultAzureCredential();
|
|
const subscriptionId = "00000000-1111-2222-3333-444444444444";
|
|
const client = new AzureMachineLearningServicesManagementClient(credential, subscriptionId);
|
|
const result = await client.onlineDeployments.createOrUpdate(
|
|
"test-rg",
|
|
"my-aml-workspace",
|
|
"testEndpointName",
|
|
"testDeploymentName",
|
|
{
|
|
identity: { type: "SystemAssigned", userAssignedIdentities: { string: {} } },
|
|
kind: "string",
|
|
location: "string",
|
|
properties: {
|
|
description: "string",
|
|
appInsightsEnabled: false,
|
|
codeConfiguration: { codeId: "string", scoringScript: "string" },
|
|
endpointComputeType: "Managed",
|
|
environmentId: "string",
|
|
environmentVariables: { string: "string" },
|
|
instanceType: "string",
|
|
livenessProbe: {
|
|
failureThreshold: 1,
|
|
initialDelay: "PT5M",
|
|
period: "PT5M",
|
|
successThreshold: 1,
|
|
timeout: "PT5M",
|
|
},
|
|
model: "string",
|
|
modelMountPath: "string",
|
|
properties: { string: "string" },
|
|
readinessProbe: {
|
|
failureThreshold: 30,
|
|
initialDelay: "PT1S",
|
|
period: "PT10S",
|
|
successThreshold: 1,
|
|
timeout: "PT2S",
|
|
},
|
|
requestSettings: {
|
|
maxConcurrentRequestsPerInstance: 1,
|
|
maxQueueWait: "PT5M",
|
|
requestTimeout: "PT5M",
|
|
},
|
|
scaleSettings: { scaleType: "Default" },
|
|
},
|
|
sku: { name: "string", capacity: 1, family: "string", size: "string", tier: "Free" },
|
|
tags: {},
|
|
},
|
|
);
|
|
console.log(result);
|
|
}
|
|
|
|
async function main() {
|
|
await createOrUpdateKubernetesOnlineDeployment();
|
|
await createOrUpdateManagedOnlineDeployment();
|
|
}
|
|
|
|
main().catch(console.error);
|