Files
4201b08be2 [AutoPR @azure-arm-containerinstance]-generated-from-SDK Generation - JS-6410514 (#38853)
Configurations:
'specification/containerinstance/resource-manager/Microsoft.ContainerInstance/ContainerInstance/tspconfig.yaml',
API Version: 2026-06-01-preview, SDK Release Type: beta, and CommitSHA:
'1b4778de3e8c7709823e0f95bbd8c29bedeb5bdb' in SpecRepo:
'https://github.com/Azure/azure-rest-api-specs' Pipeline run:
https://dev.azure.com/azure-sdk/internal/_build/results?buildId=6410514
Refer to
https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites
to prepare for SDK release.

### Packages impacted by this PR

`@azure/arm-containerinstance`

### Issues associated with this PR


### Describe the problem that is addressed by this PR

Auto-generated SDK update for `@azure/arm-containerinstance` from
TypeSpec/emitter, targeting API version `2026-06-01-preview` (beta
release). The branch has been updated with the latest changes from the
`main` branch.

### What are the possible designs available to address the problem? If
there are more than one possible design, why was the one in this PR
chosen?

Auto-generated via SDK generation pipeline (build ID: 6410514).

### Are there test cases added in this PR? _(If not, why?)_

No. This is an auto-generated SDK PR.

### Provide a list of related PRs _(if any)_


### Command used to generate this PR:**_(Applicable only to SDK release
request PRs)_

Pipeline run:
https://dev.azure.com/azure-sdk/internal/_build/results?buildId=6410514

### Checklists
- [ ] Added impacted package name to the issue description
- [ ] Does this PR needs any fixes in the SDK Generator?** _(If so,
create an Issue in the
[Autorest/typescript](https://github.com/Azure/autorest.typescript)
repository and link it here)_
- [ ] Added a changelog (if necessary)

---------

Co-authored-by: Jiao Di (MSFT) <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: jeremymeng <[email protected]>
Co-authored-by: Jeremy Meng <[email protected]>
2026-06-24 13:55:12 +08:00

188 lines
6.7 KiB
JavaScript

// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { ContainerInstanceManagementClient } = require("@azure/arm-containerinstance");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to create a CGProfile if it doesn't exist or update an existing CGProfile.
*
* @summary create a CGProfile if it doesn't exist or update an existing CGProfile.
* x-ms-original-file: 2026-06-01-preview/ContainerGroupProfileCreateOrUpdate_CreateConfidential.json
*/
async function confidentialContainerGroupProfile() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const client = new ContainerInstanceManagementClient(credential, subscriptionId);
const result = await client.cgProfile.createOrUpdate("demo", "demo1", {
location: "westeurope",
confidentialComputeProperties: {
ccePolicy:
"eyJhbGxvd19hbGwiOiB0cnVlLCAiY29udGFpbmVycyI6IHsibGVuZ3RoIjogMCwgImVsZW1lbnRzIjogbnVsbH19",
},
containers: [
{
name: "accdemo",
command: [],
environmentVariables: [],
image: "confiimage",
ports: [{ port: 8000 }],
resources: { requests: { cpu: 1, memoryInGB: 1.5 } },
securityContext: { capabilities: { add: ["CAP_NET_ADMIN"] }, privileged: false },
},
],
imageRegistryCredentials: [],
ipAddress: { type: "Public", ports: [{ port: 8000, protocol: "TCP" }] },
osType: "Linux",
sku: "Confidential",
zones: ["1"],
});
console.log(result);
}
/**
* This sample demonstrates how to create a CGProfile if it doesn't exist or update an existing CGProfile.
*
* @summary create a CGProfile if it doesn't exist or update an existing CGProfile.
* x-ms-original-file: 2026-06-01-preview/ContainerGroupProfileCreateOrUpdate_EncryptionProperties.json
*/
async function containerGroupProfileWithEncryptionProperties() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const client = new ContainerInstanceManagementClient(credential, subscriptionId);
const result = await client.cgProfile.createOrUpdate("demo", "demo1", {
location: "eastus2",
containers: [
{
name: "demo1",
command: [],
environmentVariables: [],
image: "nginx",
ports: [{ port: 80 }],
resources: { requests: { cpu: 1, memoryInGB: 1.5 } },
},
],
encryptionProperties: {
identity:
"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/container-group-identity",
keyName: "test-key",
keyVersion: "<key version>",
vaultBaseUrl: "https://testkeyvault.vault.azure.net",
},
imageRegistryCredentials: [],
ipAddress: { type: "Public", ports: [{ port: 80, protocol: "TCP" }] },
osType: "Linux",
zones: ["1"],
});
console.log(result);
}
/**
* This sample demonstrates how to create a CGProfile if it doesn't exist or update an existing CGProfile.
*
* @summary create a CGProfile if it doesn't exist or update an existing CGProfile.
* x-ms-original-file: 2026-06-01-preview/ContainerGroupProfileCreateOrUpdate_Extensions.json
*/
async function containerGroupProfileCreateWithExtensions() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const client = new ContainerInstanceManagementClient(credential, subscriptionId);
const result = await client.cgProfile.createOrUpdate("demo", "demo1", {
location: "eastus2",
containers: [
{
name: "demo1",
command: [],
environmentVariables: [],
image: "nginx",
ports: [{ port: 80 }],
resources: { requests: { cpu: 1, memoryInGB: 1.5 } },
},
],
imageRegistryCredentials: [],
ipAddress: { type: "Private", ports: [{ port: 80, protocol: "TCP" }] },
osType: "Linux",
extensions: [
{
name: "kube-proxy",
extensionType: "kube-proxy",
protectedSettings: { kubeConfig: "<kubeconfig encoded string>" },
settings: { clusterCidr: "10.240.0.0/16", kubeVersion: "v1.9.10" },
version: "1.0",
},
{ name: "vk-realtime-metrics", extensionType: "realtime-metrics", version: "1.0" },
],
zones: ["1"],
});
console.log(result);
}
/**
* This sample demonstrates how to create a CGProfile if it doesn't exist or update an existing CGProfile.
*
* @summary create a CGProfile if it doesn't exist or update an existing CGProfile.
* x-ms-original-file: 2026-06-01-preview/ContainerGroupProfilesCreateOrUpdate.json
*/
async function containerGroupProfilesCreateOrUpdate() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const client = new ContainerInstanceManagementClient(credential, subscriptionId);
const result = await client.cgProfile.createOrUpdate("demo", "demo1", {
location: "west us",
containers: [
{
name: "demo1",
command: [],
environmentVariables: [],
image: "nginx",
ports: [{ port: 80 }],
resources: { requests: { cpu: 1, gpu: { count: 1, sku: "K80" }, memoryInGB: 1.5 } },
volumeMounts: [
{ name: "volume1", mountPath: "/mnt/volume1", readOnly: false },
{ name: "volume2", mountPath: "/mnt/volume2", readOnly: false },
{ name: "volume3", mountPath: "/mnt/volume3", readOnly: true },
],
},
],
diagnostics: {
logAnalytics: {
logType: "ContainerInsights",
metadata: { "pod-uuid": "test-metadata-value" },
workspaceId: "workspaceid",
workspaceKey: "workspaceKey",
workspaceResourceId:
"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/microsoft.operationalinsights/workspaces/workspace",
},
},
imageRegistryCredentials: [],
ipAddress: { type: "Public", ports: [{ port: 80, protocol: "TCP" }] },
osType: "Linux",
volumes: [
{
name: "volume1",
azureFile: {
shareName: "shareName",
storageAccountKey: "accountKey",
storageAccountName: "accountName",
},
},
{ name: "volume2", emptyDir: {} },
{
name: "volume3",
secret: { secretKey1: "SecretValue1InBase64", secretKey2: "SecretValue2InBase64" },
},
],
zones: ["1"],
});
console.log(result);
}
async function main() {
await confidentialContainerGroupProfile();
await containerGroupProfileWithEncryptionProperties();
await containerGroupProfileCreateWithExtensions();
await containerGroupProfilesCreateOrUpdate();
}
main().catch(console.error);