mirror of
https://github.com/hanzoai/azure-sdk-for-js.git
synced 2026-10-30 19:51:51 +00:00
Configurations: 'specification/devcenter/DevCenter.Management/tspconfig.yaml', SDK Release Type: beta, and CommitSHA: '473a3bcb1ab8ce3a94e032b59f26b0bf1609064f' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=6539157 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release. --------- Co-authored-by: azure-sdk <[email protected]> Co-authored-by: ZiWei Chen <[email protected]>
85 lines
3.2 KiB
TypeScript
85 lines
3.2 KiB
TypeScript
// Copyright (c) Microsoft Corporation.
|
|
// Licensed under the MIT License.
|
|
|
|
import { DevCenterClient } from "@azure/arm-devcenter";
|
|
import { DefaultAzureCredential } from "@azure/identity";
|
|
|
|
/**
|
|
* This sample demonstrates how to creates or updates an project policy.
|
|
*
|
|
* @summary creates or updates an project policy.
|
|
* x-ms-original-file: 2026-01-01-preview/ProjectPolicies_Put.json
|
|
*/
|
|
async function projectPoliciesCreateOrUpdate(): Promise<void> {
|
|
const credential = new DefaultAzureCredential();
|
|
const subscriptionId = "0ac520ee-14c0-480f-b6c9-0a90c58ffff1";
|
|
const client = new DevCenterClient(credential, subscriptionId);
|
|
const result = await client.projectPolicies.createOrUpdate("rg1", "Contoso", "DevOnlyResources", {
|
|
properties: {
|
|
resourcePolicies: [
|
|
{
|
|
resources:
|
|
"/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff1/resourceGroups/rg1/providers/Microsoft.DevCenter/devcenters/Contoso/attachednetworks/network-westus3",
|
|
},
|
|
{ resourceType: "Images", action: "Deny" },
|
|
{ resourceType: "Skus", action: "Allow" },
|
|
],
|
|
scopes: [
|
|
"/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff1/resourceGroups/rg1/providers/Microsoft.DevCenter/projects/DevProject",
|
|
],
|
|
configurationPolicies: {
|
|
azureAiServicesFeatureStatus: {
|
|
statusModifiable: "Modifiable",
|
|
defaultStatus: "AutoDeploy",
|
|
},
|
|
devBoxScheduleDeleteFeatureStatus: {
|
|
statusModifiable: "NotModifiable",
|
|
valuesModifiable: "Modifiable",
|
|
defaultStatus: "Enabled",
|
|
defaultValues: [
|
|
{ name: "inactiveThreshold", value: "P30D" },
|
|
{ name: "gracePeriod", value: "P3D" },
|
|
{ name: "cancelOnConnectEnableStatus", value: "false" },
|
|
],
|
|
},
|
|
devBoxLimitsFeatureStatus: {
|
|
statusModifiable: "Modifiable",
|
|
valuesModifiable: "Modifiable",
|
|
defaultStatus: "Enabled",
|
|
defaultValues: [{ name: "maxDevBoxesPerUser", value: "10" }],
|
|
},
|
|
displayNameFeatureStatus: { statusModifiable: "NotModifiable", defaultStatus: "Disabled" },
|
|
devBoxTunnelFeatureStatus: { statusModifiable: "Modifiable", defaultStatus: "Disabled" },
|
|
projectCatalogFeatureStatus: {
|
|
valuesModifiable: "Modifiable",
|
|
defaultValues: [
|
|
{ name: "environmentDefinitionCatalogItemSync", value: "Enabled" },
|
|
{ name: "imageDefinitionCatalogItemSync", value: "Enabled" },
|
|
],
|
|
},
|
|
serverlessGpuSessionsFeatureStatus: {
|
|
statusModifiable: "Modifiable",
|
|
valuesModifiable: "NotModifiable",
|
|
defaultStatus: "AutoDeploy",
|
|
defaultValues: [{ name: "maxConcurrentSessionsPerProject", value: "3" }],
|
|
},
|
|
userCustomizationsFeatureStatus: {
|
|
statusModifiable: "Modifiable",
|
|
defaultStatus: "Enabled",
|
|
},
|
|
workspaceStorageFeatureStatus: {
|
|
statusModifiable: "NotModifiable",
|
|
defaultStatus: "AutoDeploy",
|
|
},
|
|
},
|
|
},
|
|
});
|
|
console.log(result);
|
|
}
|
|
|
|
async function main(): Promise<void> {
|
|
await projectPoliciesCreateOrUpdate();
|
|
}
|
|
|
|
main().catch(console.error);
|