ZiWei Chen 2024-10-25 14:15:11 +08:00 коммит произвёл GitHub
Родитель 685fb0a4ce
Коммит 64df053b02
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
113 изменённых файлов: 7804 добавлений и 1785 удалений

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

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

@ -1,15 +1,46 @@
# Release History
## 9.1.1 (Unreleased)
## 9.2.0-beta.1 (2024-10-18)
Compared with version 9.1.0
### Features Added
### Breaking Changes
### Bugs Fixed
### Other Changes
- Added operation group ContainerGroupProfileOperations
- Added operation group ContainerGroupProfiles
- Added Interface ConfigMap
- Added Interface ContainerGroupProfile
- Added Interface ContainerGroupProfileGetByRevisionNumberOptionalParams
- Added Interface ContainerGroupProfileListAllRevisionsNextOptionalParams
- Added Interface ContainerGroupProfileListAllRevisionsOptionalParams
- Added Interface ContainerGroupProfileListResult
- Added Interface ContainerGroupProfilePatch
- Added Interface ContainerGroupProfileProperties
- Added Interface ContainerGroupProfileReferenceDefinition
- Added Interface ContainerGroupProfilesCreateOrUpdateOptionalParams
- Added Interface ContainerGroupProfilesDeleteOptionalParams
- Added Interface ContainerGroupProfilesGetOptionalParams
- Added Interface ContainerGroupProfilesListByResourceGroupNextOptionalParams
- Added Interface ContainerGroupProfilesListByResourceGroupOptionalParams
- Added Interface ContainerGroupProfilesListNextOptionalParams
- Added Interface ContainerGroupProfilesListOptionalParams
- Added Interface ContainerGroupProfilesPatchOptionalParams
- Added Interface StandbyPoolProfileDefinition
- Added Type Alias ContainerGroupProfileGetByRevisionNumberResponse
- Added Type Alias ContainerGroupProfileListAllRevisionsNextResponse
- Added Type Alias ContainerGroupProfileListAllRevisionsResponse
- Added Type Alias ContainerGroupProfilesCreateOrUpdateResponse
- Added Type Alias ContainerGroupProfilesGetResponse
- Added Type Alias ContainerGroupProfilesListByResourceGroupNextResponse
- Added Type Alias ContainerGroupProfilesListByResourceGroupResponse
- Added Type Alias ContainerGroupProfilesListNextResponse
- Added Type Alias ContainerGroupProfilesListResponse
- Added Type Alias ContainerGroupProfilesPatchResponse
- Interface Container has a new optional parameter configMap
- Interface ContainerGroupProperties has a new optional parameter containerGroupProfile
- Interface ContainerGroupProperties has a new optional parameter isCreatedFromStandbyPool
- Interface ContainerGroupProperties has a new optional parameter standbyPoolProfile
## 9.1.0 (2023-04-24)
### Features Added
@ -89,4 +120,4 @@ To understand the detail of the change, please refer to [Changelog](https://aka.
To migrate the existing applications to the latest version, please refer to [Migration Guide](https://aka.ms/js-track2-migration-guide).
To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/js/mgmt/quickstart ).
To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/js/mgmt/quickstart).

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

@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) 2023 Microsoft
Copyright (c) 2024 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

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

@ -6,7 +6,7 @@ This package contains an isomorphic SDK (runs both in Node.js and in browsers) f
[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/containerinstance/arm-containerinstance) |
[Package (NPM)](https://www.npmjs.com/package/@azure/arm-containerinstance) |
[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-containerinstance) |
[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-containerinstance?view=azure-node-preview) |
[Samples](https://github.com/Azure-Samples/azure-samples-js-management)
## Getting started

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

@ -1,8 +1,8 @@
{
"commit": "7a65f22cf67826187f75981e914c7e679039257b",
"commit": "abe3209e7c6924a58ab560ebab2349bc8fde6aa7",
"readme": "specification/containerinstance/resource-manager/readme.md",
"autorest_command": "autorest --version=3.9.3 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\Git\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\containerinstance\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-rc.10 --generate-sample=true",
"autorest_command": "autorest --version=3.9.7 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\Git\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\containerinstance\\resource-manager\\readme.md --use=@autorest/typescript@6.0.27 --generate-sample=true",
"repository_url": "https://github.com/Azure/azure-rest-api-specs.git",
"release_tool": "@azure-tools/js-sdk-release-tools@2.6.2",
"use": "@autorest/typescript@6.0.0-rc.10"
"release_tool": "@azure-tools/js-sdk-release-tools@2.7.15",
"use": "@autorest/typescript@6.0.27"
}

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

@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "js",
"TagPrefix": "js/containerinstance/arm-containerinstance",
"Tag": "js/containerinstance/arm-containerinstance_2501c4fdb4"
"Tag": "js/containerinstance/arm-containerinstance_c841ce3241"
}

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

@ -3,17 +3,17 @@
"sdk-type": "mgmt",
"author": "Microsoft Corporation",
"description": "A generated SDK for ContainerInstanceManagementClient.",
"version": "9.1.1",
"version": "9.2.0-beta.1",
"engines": {
"node": ">=18.0.0"
},
"dependencies": {
"@azure/abort-controller": "^1.0.0",
"@azure/core-auth": "^1.3.0",
"@azure/core-client": "^1.7.0",
"@azure/core-lro": "^2.5.0",
"@azure/core-lro": "^2.5.4",
"@azure/abort-controller": "^2.1.2",
"@azure/core-paging": "^1.2.0",
"@azure/core-rest-pipeline": "^1.8.0",
"@azure/core-client": "^1.7.0",
"@azure/core-auth": "^1.6.0",
"@azure/core-rest-pipeline": "^1.14.0",
"tslib": "^2.2.0"
},
"keywords": [
@ -28,20 +28,21 @@
"module": "./dist-esm/src/index.js",
"types": "./types/arm-containerinstance.d.ts",
"devDependencies": {
"@azure-tools/test-credential": "^1.0.0",
"@azure-tools/test-recorder": "^3.0.0",
"typescript": "~5.5.3",
"uglify-js": "^3.4.9",
"dotenv": "^16.0.0",
"@azure/dev-tool": "^1.0.0",
"@azure/identity": "^4.0.1",
"@types/chai": "^4.2.8",
"@azure/identity": "^4.2.1",
"@azure-tools/test-recorder": "^3.0.0",
"@azure-tools/test-credential": "^1.1.0",
"mocha": "^10.0.0",
"@types/mocha": "^10.0.0",
"@types/node": "^18.0.0",
"tsx": "^4.7.1",
"@types/chai": "^4.2.8",
"chai": "^4.2.0",
"cross-env": "^7.0.2",
"dotenv": "^16.0.0",
"mocha": "^10.0.0",
"ts-node": "^10.0.0",
"typescript": "~5.6.2",
"uglify-js": "^3.4.9"
"@types/node": "^18.0.0",
"ts-node": "^10.0.0"
},
"repository": {
"type": "git",
@ -68,31 +69,29 @@
"types/*"
],
"scripts": {
"audit": "echo skipped",
"build": "npm run clean && tsc && dev-tool run bundle && npm run minify && dev-tool run vendored mkdirp ./review && npm run extract-api",
"build:browser": "echo skipped",
"build:node": "echo skipped",
"build:samples": "echo skipped.",
"build:test": "echo skipped",
"check-format": "echo skipped",
"clean": "dev-tool run vendored rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log",
"execute:samples": "echo skipped",
"extract-api": "dev-tool run extract-api",
"format": "echo skipped",
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
"integration-test:browser": "echo skipped",
"integration-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 'test/*.ts'",
"lint": "echo skipped",
"minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js",
"pack": "npm pack 2>&1",
"prepack": "npm run build",
"pack": "npm pack 2>&1",
"extract-api": "dev-tool run extract-api",
"lint": "echo skipped",
"clean": "dev-tool run vendored rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log",
"build:node": "echo skipped",
"build:browser": "echo skipped",
"build:test": "echo skipped",
"build:samples": "echo skipped.",
"check-format": "echo skipped",
"execute:samples": "echo skipped",
"format": "echo skipped",
"test": "npm run integration-test",
"test:browser": "echo skipped",
"test:node": "echo skipped",
"test:browser": "echo skipped",
"unit-test": "npm run unit-test:node && npm run unit-test:browser",
"unit-test:browser": "echo skipped",
"unit-test:node": "cross-env TEST_MODE=playback npm run integration-test:node",
"update-snippets": "echo skipped"
"unit-test:browser": "echo skipped",
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
"integration-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 'test/*.ts'",
"integration-test:browser": "echo skipped"
},
"sideEffects": false,
"//metadata": {

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

@ -71,17 +71,25 @@ export interface ConfidentialComputeProperties {
ccePolicy?: string;
}
// @public
export interface ConfigMap {
keyValuePairs?: {
[propertyName: string]: string;
};
}
// @public
export interface Container {
command?: string[];
configMap?: ConfigMap;
environmentVariables?: EnvironmentVariable[];
image: string;
image?: string;
readonly instanceView?: ContainerPropertiesInstanceView;
livenessProbe?: ContainerProbe;
name: string;
ports?: ContainerPort[];
readinessProbe?: ContainerProbe;
resources: ResourceRequirements;
resources?: ResourceRequirements;
securityContext?: SecurityContextDefinition;
volumeMounts?: VolumeMount[];
}
@ -149,9 +157,141 @@ export type ContainerGroupNetworkProtocol = string;
// @public
export type ContainerGroupPriority = string;
// @public
export interface ContainerGroupProfile extends Resource, ContainerGroupProfileProperties {
}
// @public
export interface ContainerGroupProfileGetByRevisionNumberOptionalParams extends coreClient.OperationOptions {
}
// @public
export type ContainerGroupProfileGetByRevisionNumberResponse = ContainerGroupProfile;
// @public
export interface ContainerGroupProfileListAllRevisionsNextOptionalParams extends coreClient.OperationOptions {
}
// @public
export type ContainerGroupProfileListAllRevisionsNextResponse = ContainerGroupProfileListResult;
// @public
export interface ContainerGroupProfileListAllRevisionsOptionalParams extends coreClient.OperationOptions {
}
// @public
export type ContainerGroupProfileListAllRevisionsResponse = ContainerGroupProfileListResult;
// @public
export interface ContainerGroupProfileListResult {
nextLink?: string;
value?: ContainerGroupProfile[];
}
// @public
export interface ContainerGroupProfileOperations {
getByRevisionNumber(resourceGroupName: string, containerGroupProfileName: string, revisionNumber: string, options?: ContainerGroupProfileGetByRevisionNumberOptionalParams): Promise<ContainerGroupProfileGetByRevisionNumberResponse>;
listAllRevisions(resourceGroupName: string, containerGroupProfileName: string, options?: ContainerGroupProfileListAllRevisionsOptionalParams): PagedAsyncIterableIterator<ContainerGroupProfile>;
}
// @public
export interface ContainerGroupProfilePatch {
tags?: {
[propertyName: string]: string;
};
}
// @public
export interface ContainerGroupProfileProperties {
confidentialComputeProperties?: ConfidentialComputeProperties;
containers: Container[];
diagnostics?: ContainerGroupDiagnostics;
encryptionProperties?: EncryptionProperties;
extensions?: DeploymentExtensionSpec[];
imageRegistryCredentials?: ImageRegistryCredential[];
initContainers?: InitContainerDefinition[];
ipAddress?: IpAddress;
osType: OperatingSystemTypes;
priority?: ContainerGroupPriority;
restartPolicy?: ContainerGroupRestartPolicy;
readonly revision?: number;
sku?: ContainerGroupSku;
volumes?: Volume[];
}
// @public
export interface ContainerGroupProfileReferenceDefinition {
id?: string;
revision?: number;
}
// @public
export interface ContainerGroupProfiles {
createOrUpdate(resourceGroupName: string, containerGroupProfileName: string, containerGroupProfile: ContainerGroupProfile, options?: ContainerGroupProfilesCreateOrUpdateOptionalParams): Promise<ContainerGroupProfilesCreateOrUpdateResponse>;
delete(resourceGroupName: string, containerGroupProfileName: string, options?: ContainerGroupProfilesDeleteOptionalParams): Promise<void>;
get(resourceGroupName: string, containerGroupProfileName: string, options?: ContainerGroupProfilesGetOptionalParams): Promise<ContainerGroupProfilesGetResponse>;
list(options?: ContainerGroupProfilesListOptionalParams): PagedAsyncIterableIterator<ContainerGroupProfile>;
listByResourceGroup(resourceGroupName: string, options?: ContainerGroupProfilesListByResourceGroupOptionalParams): PagedAsyncIterableIterator<ContainerGroupProfile>;
patch(resourceGroupName: string, containerGroupProfileName: string, properties: ContainerGroupProfilePatch, options?: ContainerGroupProfilesPatchOptionalParams): Promise<ContainerGroupProfilesPatchResponse>;
}
// @public
export interface ContainerGroupProfilesCreateOrUpdateOptionalParams extends coreClient.OperationOptions {
}
// @public
export type ContainerGroupProfilesCreateOrUpdateResponse = ContainerGroupProfile;
// @public
export interface ContainerGroupProfilesDeleteOptionalParams extends coreClient.OperationOptions {
}
// @public
export interface ContainerGroupProfilesGetOptionalParams extends coreClient.OperationOptions {
}
// @public
export type ContainerGroupProfilesGetResponse = ContainerGroupProfile;
// @public
export interface ContainerGroupProfilesListByResourceGroupNextOptionalParams extends coreClient.OperationOptions {
}
// @public
export type ContainerGroupProfilesListByResourceGroupNextResponse = ContainerGroupProfileListResult;
// @public
export interface ContainerGroupProfilesListByResourceGroupOptionalParams extends coreClient.OperationOptions {
}
// @public
export type ContainerGroupProfilesListByResourceGroupResponse = ContainerGroupProfileListResult;
// @public
export interface ContainerGroupProfilesListNextOptionalParams extends coreClient.OperationOptions {
}
// @public
export type ContainerGroupProfilesListNextResponse = ContainerGroupProfileListResult;
// @public
export interface ContainerGroupProfilesListOptionalParams extends coreClient.OperationOptions {
}
// @public
export type ContainerGroupProfilesListResponse = ContainerGroupProfileListResult;
// @public
export interface ContainerGroupProfilesPatchOptionalParams extends coreClient.OperationOptions {
}
// @public
export type ContainerGroupProfilesPatchResponse = ContainerGroupProfile;
// @public
export interface ContainerGroupProperties {
confidentialComputeProperties?: ConfidentialComputeProperties;
containerGroupProfile?: ContainerGroupProfileReferenceDefinition;
containers: Container[];
diagnostics?: ContainerGroupDiagnostics;
dnsConfig?: DnsConfiguration;
@ -162,11 +302,13 @@ export interface ContainerGroupProperties {
initContainers?: InitContainerDefinition[];
readonly instanceView?: ContainerGroupPropertiesInstanceView;
ipAddress?: IpAddress;
osType: OperatingSystemTypes;
readonly isCreatedFromStandbyPool?: boolean;
osType?: OperatingSystemTypes;
priority?: ContainerGroupPriority;
readonly provisioningState?: string;
restartPolicy?: ContainerGroupRestartPolicy;
sku?: ContainerGroupSku;
standbyPoolProfile?: StandbyPoolProfileDefinition;
subnetIds?: ContainerGroupSubnetId[];
volumes?: Volume[];
}
@ -308,6 +450,10 @@ export class ContainerInstanceManagementClient extends coreClient.ServiceClient
// (undocumented)
apiVersion: string;
// (undocumented)
containerGroupProfileOperations: ContainerGroupProfileOperations;
// (undocumented)
containerGroupProfiles: ContainerGroupProfiles;
// (undocumented)
containerGroups: ContainerGroups;
// (undocumented)
containers: Containers;
@ -750,6 +896,12 @@ export interface SecurityContextDefinition {
seccompProfile?: string;
}
// @public
export interface StandbyPoolProfileDefinition {
failContainerGroupCreateOnReuseFailure?: boolean;
id?: string;
}
// @public
export interface SubnetServiceAssociationLink {
beginDelete(resourceGroupName: string, virtualNetworkName: string, subnetName: string, options?: SubnetServiceAssociationLinkDeleteOptionalParams): Promise<SimplePollerLike<OperationState<void>, void>>;

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

@ -0,0 +1,49 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { ContainerInstanceManagementClient } from "@azure/arm-containerinstance";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Gets the properties of the specified revision of the container group profile in the given subscription and resource group. The operation returns the properties of container group profile including containers, image registry credentials, restart policy, IP address type, OS type, volumes, current revision number, etc.
*
* @summary Gets the properties of the specified revision of the container group profile in the given subscription and resource group. The operation returns the properties of container group profile including containers, image registry credentials, restart policy, IP address type, OS type, volumes, current revision number, etc.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfileGetByRevisionNumber.json
*/
async function containerGroupProfileGetByRevisionNumber() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupProfileName = "demo1";
const revisionNumber = "1";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId,
);
const result =
await client.containerGroupProfileOperations.getByRevisionNumber(
resourceGroupName,
containerGroupProfileName,
revisionNumber,
);
console.log(result);
}
async function main() {
containerGroupProfileGetByRevisionNumber();
}
main().catch(console.error);

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

@ -0,0 +1,49 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { ContainerInstanceManagementClient } from "@azure/arm-containerinstance";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Get a list of all the revisions of the specified container group profile in the given subscription and resource group. This operation returns properties of each revision of the specified container group profile including containers, image registry credentials, restart policy, IP address type, OS type volumes, revision number, etc.
*
* @summary Get a list of all the revisions of the specified container group profile in the given subscription and resource group. This operation returns properties of each revision of the specified container group profile including containers, image registry credentials, restart policy, IP address type, OS type volumes, revision number, etc.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfileListAllRevisions.json
*/
async function containerGroupProfileListAllRevisions() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupProfileName = "demo1";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId,
);
const resArray = new Array();
for await (let item of client.containerGroupProfileOperations.listAllRevisions(
resourceGroupName,
containerGroupProfileName,
)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
containerGroupProfileListAllRevisions();
}
main().catch(console.error);

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

@ -0,0 +1,306 @@
/*
* 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 {
ContainerGroupProfile,
ContainerInstanceManagementClient,
} from "@azure/arm-containerinstance";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Create or update container group profiles with specified configurations.
*
* @summary Create or update container group profiles with specified configurations.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfileCreateOrUpdate_CreateConfidential.json
*/
async function confidentialContainerGroupProfile() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupProfileName = "demo1";
const containerGroupProfile: ContainerGroupProfile = {
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" }] },
location: "westeurope",
osType: "Linux",
sku: "Confidential",
zones: ["1"],
};
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId,
);
const result = await client.containerGroupProfiles.createOrUpdate(
resourceGroupName,
containerGroupProfileName,
containerGroupProfile,
);
console.log(result);
}
/**
* This sample demonstrates how to Create or update container group profiles with specified configurations.
*
* @summary Create or update container group profiles with specified configurations.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfileCreateOrUpdate_Extensions.json
*/
async function containerGroupProfileCreateWithExtensions() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupProfileName = "demo1";
const containerGroupProfile: ContainerGroupProfile = {
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" }] },
location: "eastus2",
osType: "Linux",
zones: ["1"],
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",
},
],
};
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId,
);
const result = await client.containerGroupProfiles.createOrUpdate(
resourceGroupName,
containerGroupProfileName,
containerGroupProfile,
);
console.log(result);
}
/**
* This sample demonstrates how to Create or update container group profiles with specified configurations.
*
* @summary Create or update container group profiles with specified configurations.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfileCreateOrUpdate_EncryptionProperties.json
*/
async function containerGroupProfileWithEncryptionProperties() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupProfileName = "demo1";
const containerGroupProfile: ContainerGroupProfile = {
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" }] },
location: "eastus2",
osType: "Linux",
zones: ["1"],
};
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId,
);
const result = await client.containerGroupProfiles.createOrUpdate(
resourceGroupName,
containerGroupProfileName,
containerGroupProfile,
);
console.log(result);
}
/**
* This sample demonstrates how to Create or update container group profiles with specified configurations.
*
* @summary Create or update container group profiles with specified configurations.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfilesCreateOrUpdate.json
*/
async function containerGroupProfilesCreateOrUpdate() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupProfileName = "demo1";
const containerGroupProfile: ContainerGroupProfile = {
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: { podUuid: "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" }] },
location: "west us",
osType: "Linux",
volumes: [
{
name: "volume1",
azureFile: {
shareName: "shareName",
storageAccountKey: "accountKey",
storageAccountName: "accountName",
},
},
{ name: "volume2", emptyDir: {} },
{
name: "volume3",
secret: {
secretKey1: "SecretValue1InBase64",
secretKey2: "SecretValue2InBase64",
},
},
],
zones: ["1"],
};
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId,
);
const result = await client.containerGroupProfiles.createOrUpdate(
resourceGroupName,
containerGroupProfileName,
containerGroupProfile,
);
console.log(result);
}
/**
* This sample demonstrates how to Create or update container group profiles with specified configurations.
*
* @summary Create or update container group profiles with specified configurations.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsProfileCreateOrUpdate_CreatePriority.json
*/
async function containerGroupsCreateWithPriority() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupProfileName = "demo1";
const containerGroupProfile: ContainerGroupProfile = {
containers: [
{
name: "test-container-001",
command: ["/bin/sh", "-c", "sleep 10"],
image: "alpine:latest",
resources: { requests: { cpu: 1, memoryInGB: 1 } },
},
],
location: "eastus",
osType: "Linux",
priority: "Spot",
restartPolicy: "Never",
sku: "Standard",
};
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId,
);
const result = await client.containerGroupProfiles.createOrUpdate(
resourceGroupName,
containerGroupProfileName,
containerGroupProfile,
);
console.log(result);
}
async function main() {
confidentialContainerGroupProfile();
containerGroupProfileCreateWithExtensions();
containerGroupProfileWithEncryptionProperties();
containerGroupProfilesCreateOrUpdate();
containerGroupsCreateWithPriority();
}
main().catch(console.error);

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

@ -0,0 +1,46 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { ContainerInstanceManagementClient } from "@azure/arm-containerinstance";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Delete the specified container group profile in the specified subscription and resource group. The operation does not delete other resources provided by the user, such as volumes.
*
* @summary Delete the specified container group profile in the specified subscription and resource group. The operation does not delete other resources provided by the user, such as volumes.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfilesDelete.json
*/
async function containerGroupProfilesDelete() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupProfileName = "demo1";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId,
);
const result = await client.containerGroupProfiles.delete(
resourceGroupName,
containerGroupProfileName,
);
console.log(result);
}
async function main() {
containerGroupProfilesDelete();
}
main().catch(console.error);

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

@ -0,0 +1,72 @@
/*
* 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 { ContainerInstanceManagementClient } from "@azure/arm-containerinstance";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Gets the properties of the specified container group profile in the specified subscription and resource group. The operation returns the properties of container group profile including containers, image registry credentials, restart policy, IP address type, OS type, volumes, current revision number, etc.
*
* @summary Gets the properties of the specified container group profile in the specified subscription and resource group. The operation returns the properties of container group profile including containers, image registry credentials, restart policy, IP address type, OS type, volumes, current revision number, etc.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfilesGetPriority.json
*/
async function containerGroupProfilesGetWithPriority() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupProfileName = "demo1";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId,
);
const result = await client.containerGroupProfiles.get(
resourceGroupName,
containerGroupProfileName,
);
console.log(result);
}
/**
* This sample demonstrates how to Gets the properties of the specified container group profile in the specified subscription and resource group. The operation returns the properties of container group profile including containers, image registry credentials, restart policy, IP address type, OS type, volumes, current revision number, etc.
*
* @summary Gets the properties of the specified container group profile in the specified subscription and resource group. The operation returns the properties of container group profile including containers, image registry credentials, restart policy, IP address type, OS type, volumes, current revision number, etc.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfilesGet.json
*/
async function containerGroupProfilesGetSucceeded() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupProfileName = "demo1";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId,
);
const result = await client.containerGroupProfiles.get(
resourceGroupName,
containerGroupProfileName,
);
console.log(result);
}
async function main() {
containerGroupProfilesGetWithPriority();
containerGroupProfilesGetSucceeded();
}
main().catch(console.error);

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

@ -0,0 +1,47 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { ContainerInstanceManagementClient } from "@azure/arm-containerinstance";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Get a list of container group profiles in a specified subscription and resource group. This operation returns properties of each container group profile including containers, image registry credentials, restart policy, IP address type, OS type volumes, current revision number, etc.
*
* @summary Get a list of container group profiles in a specified subscription and resource group. This operation returns properties of each container group profile including containers, image registry credentials, restart policy, IP address type, OS type volumes, current revision number, etc.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfilesListByResourceGroup.json
*/
async function containerGroupProfilesListByResourceGroup() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId,
);
const resArray = new Array();
for await (let item of client.containerGroupProfiles.listByResourceGroup(
resourceGroupName,
)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
containerGroupProfilesListByResourceGroup();
}
main().catch(console.error);

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

@ -0,0 +1,43 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { ContainerInstanceManagementClient } from "@azure/arm-containerinstance";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Get a list of container group profiles in the specified subscription. This operation returns properties of each container group profile including containers, image registry credentials, restart policy, IP address type, OS type,volumes,current revision number, etc.
*
* @summary Get a list of container group profiles in the specified subscription. This operation returns properties of each container group profile including containers, image registry credentials, restart policy, IP address type, OS type,volumes,current revision number, etc.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfilesList.json
*/
async function containerGroupProfilesList() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId,
);
const resArray = new Array();
for await (let item of client.containerGroupProfiles.list()) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
containerGroupProfilesList();
}
main().catch(console.error);

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

@ -0,0 +1,53 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import {
ContainerGroupProfilePatch,
ContainerInstanceManagementClient,
} from "@azure/arm-containerinstance";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Patches container group profile with specified properties.
*
* @summary Patches container group profile with specified properties.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfilesPatch.json
*/
async function containerGroupProfilesPatch() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demoResource";
const containerGroupProfileName = "demo1";
const properties: ContainerGroupProfilePatch = {
tags: { tag1key: "tag1Value", tag2key: "tag2Value" },
};
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId,
);
const result = await client.containerGroupProfiles.patch(
resourceGroupName,
containerGroupProfileName,
properties,
);
console.log(result);
}
async function main() {
containerGroupProfilesPatch();
}
main().catch(console.error);

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

@ -10,7 +10,7 @@
// Licensed under the MIT License.
import {
ContainerGroup,
ContainerInstanceManagementClient
ContainerInstanceManagementClient,
} from "@azure/arm-containerinstance";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
@ -21,18 +21,19 @@ dotenv.config();
* This sample demonstrates how to Create or update container groups with specified configurations.
*
* @summary Create or update container groups with specified configurations.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/ContainerGroupCreateConfidential.json
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupCreateConfidential.json
*/
async function confidentialContainerGroup() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "subid";
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupName = "demo1";
const containerGroup: ContainerGroup = {
confidentialComputeProperties: {
ccePolicy:
"eyJhbGxvd19hbGwiOiB0cnVlLCAiY29udGFpbmVycyI6IHsibGVuZ3RoIjogMCwgImVsZW1lbnRzIjogbnVsbH19"
"eyJhbGxvd19hbGwiOiB0cnVlLCAiY29udGFpbmVycyI6IHsibGVuZ3RoIjogMCwgImVsZW1lbnRzIjogbnVsbH19",
},
containers: [
{
@ -44,25 +45,25 @@ async function confidentialContainerGroup() {
resources: { requests: { cpu: 1, memoryInGB: 1.5 } },
securityContext: {
capabilities: { add: ["CAP_NET_ADMIN"] },
privileged: false
}
}
privileged: false,
},
},
],
imageRegistryCredentials: [],
ipAddress: { type: "Public", ports: [{ port: 8000, protocol: "TCP" }] },
location: "westeurope",
osType: "Linux",
sku: "Confidential"
sku: "Confidential",
};
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId
subscriptionId,
);
const result = await client.containerGroups.beginCreateOrUpdateAndWait(
resourceGroupName,
containerGroupName,
containerGroup
containerGroup,
);
console.log(result);
}
@ -71,11 +72,51 @@ async function confidentialContainerGroup() {
* This sample demonstrates how to Create or update container groups with specified configurations.
*
* @summary Create or update container groups with specified configurations.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/ContainerGroupExtensions.json
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupCreateOrUpdateStandbyPool.json
*/
async function containerGroupCreateOrUpdateWithStandbyPool() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupName = "demo1";
const containerGroup: ContainerGroup = {
containerGroupProfile: {
id: "/subscriptions/subid/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroupProfiles/democgp",
revision: 1,
},
containers: [
{ name: "demo1", configMap: { keyValuePairs: { newkey: "value" } } },
],
location: "west us",
standbyPoolProfile: {
id: "/subscriptions/subid/resourceGroups/demo/providers/Microsoft.StandbyPool/standbyContainerGroupPools/demopool",
},
};
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId,
);
const result = await client.containerGroups.beginCreateOrUpdateAndWait(
resourceGroupName,
containerGroupName,
containerGroup,
);
console.log(result);
}
/**
* This sample demonstrates how to Create or update container groups with specified configurations.
*
* @summary Create or update container groups with specified configurations.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupExtensions.json
*/
async function containerGroupCreateWithExtensions() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "subid";
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupName = "demo1";
@ -87,8 +128,8 @@ async function containerGroupCreateWithExtensions() {
environmentVariables: [],
image: "nginx",
ports: [{ port: 80 }],
resources: { requests: { cpu: 1, memoryInGB: 1.5 } }
}
resources: { requests: { cpu: 1, memoryInGB: 1.5 } },
},
],
imageRegistryCredentials: [],
ipAddress: { type: "Private", ports: [{ port: 80, protocol: "TCP" }] },
@ -96,9 +137,8 @@ async function containerGroupCreateWithExtensions() {
osType: "Linux",
subnetIds: [
{
id:
"/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-rg-vnet/subnets/test-subnet"
}
id: "/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-rg-vnet/subnets/test-subnet",
},
],
extensions: [
{
@ -106,24 +146,24 @@ async function containerGroupCreateWithExtensions() {
extensionType: "kube-proxy",
protectedSettings: { kubeConfig: "<kubeconfig encoded string>" },
settings: { clusterCidr: "10.240.0.0/16", kubeVersion: "v1.9.10" },
version: "1.0"
version: "1.0",
},
{
name: "vk-realtime-metrics",
extensionType: "realtime-metrics",
version: "1.0"
}
]
version: "1.0",
},
],
};
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId
subscriptionId,
);
const result = await client.containerGroups.beginCreateOrUpdateAndWait(
resourceGroupName,
containerGroupName,
containerGroup
containerGroup,
);
console.log(result);
}
@ -132,11 +172,12 @@ async function containerGroupCreateWithExtensions() {
* This sample demonstrates how to Create or update container groups with specified configurations.
*
* @summary Create or update container groups with specified configurations.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/ContainerGroupEncryptionProperties.json
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupEncryptionProperties.json
*/
async function containerGroupWithEncryptionProperties() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "subid";
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupName = "demo1";
@ -148,36 +189,37 @@ async function containerGroupWithEncryptionProperties() {
environmentVariables: [],
image: "nginx",
ports: [{ port: 80 }],
resources: { requests: { cpu: 1, memoryInGB: 1.5 } }
}
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"
vaultBaseUrl: "https://testkeyvault.vault.azure.net",
},
identity: {
type: "UserAssigned",
userAssignedIdentities: {
"/subscriptions/00000000000000000000000000000000/resourcegroups/testRg/providers/MicrosoftManagedIdentity/userAssignedIdentities/containerGroupIdentity": {}
}
"/subscriptions/00000000000000000000000000000000/resourcegroups/testRg/providers/MicrosoftManagedIdentity/userAssignedIdentities/containerGroupIdentity":
{},
},
},
imageRegistryCredentials: [],
ipAddress: { type: "Public", ports: [{ port: 80, protocol: "TCP" }] },
location: "eastus2",
osType: "Linux"
osType: "Linux",
};
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId
subscriptionId,
);
const result = await client.containerGroups.beginCreateOrUpdateAndWait(
resourceGroupName,
containerGroupName,
containerGroup
containerGroup,
);
console.log(result);
}
@ -186,11 +228,12 @@ async function containerGroupWithEncryptionProperties() {
* This sample demonstrates how to Create or update container groups with specified configurations.
*
* @summary Create or update container groups with specified configurations.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/ContainerGroupsCreateOrUpdate.json
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsCreateOrUpdate.json
*/
async function containerGroupsCreateOrUpdate() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "subid";
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupName = "demo1";
@ -203,14 +246,14 @@ async function containerGroupsCreateOrUpdate() {
image: "nginx",
ports: [{ port: 80 }],
resources: {
requests: { cpu: 1, gpu: { count: 1, sku: "K80" }, memoryInGB: 1.5 }
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 }
]
}
{ name: "volume3", mountPath: "/mnt/volume3", readOnly: true },
],
},
],
diagnostics: {
logAnalytics: {
@ -219,34 +262,34 @@ async function containerGroupsCreateOrUpdate() {
workspaceId: "workspaceid",
workspaceKey: "workspaceKey",
workspaceResourceId:
"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/microsoft.operationalinsights/workspaces/workspace"
}
"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/microsoft.operationalinsights/workspaces/workspace",
},
},
dnsConfig: {
nameServers: ["1.1.1.1"],
options: "ndots:2",
searchDomains: "cluster.local svc.cluster.local"
searchDomains: "cluster.local svc.cluster.local",
},
identity: {
type: "SystemAssigned, UserAssigned",
userAssignedIdentities: {
"/subscriptions/00000000000000000000000000000000/resourceGroups/myResourceGroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/identityName": {}
}
"/subscriptions/00000000000000000000000000000000/resourceGroups/myResourceGroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/identityName":
{},
},
},
imageRegistryCredentials: [],
ipAddress: {
type: "Public",
autoGeneratedDomainNameLabelScope: "Unsecure",
dnsNameLabel: "dnsnamelabel1",
ports: [{ port: 80, protocol: "TCP" }]
ports: [{ port: 80, protocol: "TCP" }],
},
location: "west us",
osType: "Linux",
subnetIds: [
{
id:
"[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('vnetName'), parameters('subnetName'))]"
}
id: "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('vnetName'), parameters('subnetName'))]",
},
],
volumes: [
{
@ -254,28 +297,28 @@ async function containerGroupsCreateOrUpdate() {
azureFile: {
shareName: "shareName",
storageAccountKey: "accountKey",
storageAccountName: "accountName"
}
storageAccountName: "accountName",
},
},
{ name: "volume2", emptyDir: {} },
{
name: "volume3",
secret: {
secretKey1: "SecretValue1InBase64",
secretKey2: "SecretValue2InBase64"
}
}
]
secretKey2: "SecretValue2InBase64",
},
},
],
};
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId
subscriptionId,
);
const result = await client.containerGroups.beginCreateOrUpdateAndWait(
resourceGroupName,
containerGroupName,
containerGroup
containerGroup,
);
console.log(result);
}
@ -284,11 +327,12 @@ async function containerGroupsCreateOrUpdate() {
* This sample demonstrates how to Create or update container groups with specified configurations.
*
* @summary Create or update container groups with specified configurations.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/ContainerGroupsCreatePriority.json
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsCreatePriority.json
*/
async function containerGroupsCreateWithPriority() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "subid";
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupName = "demo1";
@ -298,30 +342,31 @@ async function containerGroupsCreateWithPriority() {
name: "test-container-001",
command: ["/bin/sh", "-c", "sleep 10"],
image: "alpine:latest",
resources: { requests: { cpu: 1, memoryInGB: 1 } }
}
resources: { requests: { cpu: 1, memoryInGB: 1 } },
},
],
location: "eastus",
osType: "Linux",
priority: "Spot",
restartPolicy: "Never",
sku: "Standard"
sku: "Standard",
};
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId
subscriptionId,
);
const result = await client.containerGroups.beginCreateOrUpdateAndWait(
resourceGroupName,
containerGroupName,
containerGroup
containerGroup,
);
console.log(result);
}
async function main() {
confidentialContainerGroup();
containerGroupCreateOrUpdateWithStandbyPool();
containerGroupCreateWithExtensions();
containerGroupWithEncryptionProperties();
containerGroupsCreateOrUpdate();

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

@ -18,22 +18,23 @@ dotenv.config();
* This sample demonstrates how to Delete the specified container group in the specified subscription and resource group. The operation does not delete other resources provided by the user, such as volumes.
*
* @summary Delete the specified container group in the specified subscription and resource group. The operation does not delete other resources provided by the user, such as volumes.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/ContainerGroupsDelete.json
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsDelete.json
*/
async function containerGroupsDelete() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "subid";
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupName = "demo1";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId
subscriptionId,
);
const result = await client.containerGroups.beginDeleteAndWait(
resourceGroupName,
containerGroupName
containerGroupName,
);
console.log(result);
}

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

@ -18,22 +18,23 @@ dotenv.config();
* This sample demonstrates how to Gets the properties of the specified container group in the specified subscription and resource group. The operation returns the properties of each container group including containers, image registry credentials, restart policy, IP address type, OS type, state, and volumes.
*
* @summary Gets the properties of the specified container group in the specified subscription and resource group. The operation returns the properties of each container group including containers, image registry credentials, restart policy, IP address type, OS type, state, and volumes.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/ContainerGroupsGetPriority.json
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsGetPriority.json
*/
async function containerGroupsGetWithPriority() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "subid";
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupName = "demo1";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId
subscriptionId,
);
const result = await client.containerGroups.get(
resourceGroupName,
containerGroupName
containerGroupName,
);
console.log(result);
}
@ -42,22 +43,23 @@ async function containerGroupsGetWithPriority() {
* This sample demonstrates how to Gets the properties of the specified container group in the specified subscription and resource group. The operation returns the properties of each container group including containers, image registry credentials, restart policy, IP address type, OS type, state, and volumes.
*
* @summary Gets the properties of the specified container group in the specified subscription and resource group. The operation returns the properties of each container group including containers, image registry credentials, restart policy, IP address type, OS type, state, and volumes.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/ContainerGroupsGet_Failed.json
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsGet_Failed.json
*/
async function containerGroupsGetFailed() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "subid";
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupName = "demo1";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId
subscriptionId,
);
const result = await client.containerGroups.get(
resourceGroupName,
containerGroupName
containerGroupName,
);
console.log(result);
}
@ -66,22 +68,23 @@ async function containerGroupsGetFailed() {
* This sample demonstrates how to Gets the properties of the specified container group in the specified subscription and resource group. The operation returns the properties of each container group including containers, image registry credentials, restart policy, IP address type, OS type, state, and volumes.
*
* @summary Gets the properties of the specified container group in the specified subscription and resource group. The operation returns the properties of each container group including containers, image registry credentials, restart policy, IP address type, OS type, state, and volumes.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/ContainerGroupsGet_Succeeded.json
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsGet_Succeeded.json
*/
async function containerGroupsGetSucceeded() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "subid";
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupName = "demo1";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId
subscriptionId,
);
const result = await client.containerGroups.get(
resourceGroupName,
containerGroupName
containerGroupName,
);
console.log(result);
}

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

@ -18,21 +18,22 @@ dotenv.config();
* This sample demonstrates how to Get a list of container groups in a specified subscription and resource group. This operation returns properties of each container group including containers, image registry credentials, restart policy, IP address type, OS type, state, and volumes.
*
* @summary Get a list of container groups in a specified subscription and resource group. This operation returns properties of each container group including containers, image registry credentials, restart policy, IP address type, OS type, state, and volumes.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/ContainerGroupsListByResourceGroup.json
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsListByResourceGroup.json
*/
async function containerGroupsListByResourceGroup() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "subid";
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId
subscriptionId,
);
const resArray = new Array();
for await (let item of client.containerGroups.listByResourceGroup(
resourceGroupName
resourceGroupName,
)) {
resArray.push(item);
}

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

@ -18,15 +18,16 @@ dotenv.config();
* This sample demonstrates how to Get a list of container groups in the specified subscription. This operation returns properties of each container group including containers, image registry credentials, restart policy, IP address type, OS type, state, and volumes.
*
* @summary Get a list of container groups in the specified subscription. This operation returns properties of each container group including containers, image registry credentials, restart policy, IP address type, OS type, state, and volumes.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/ContainerGroupsList.json
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsList.json
*/
async function containerGroupsList() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "subid";
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId
subscriptionId,
);
const resArray = new Array();
for await (let item of client.containerGroups.list()) {

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

@ -18,22 +18,23 @@ dotenv.config();
* This sample demonstrates how to Restarts all containers in a container group in place. If container image has updates, new image will be downloaded.
*
* @summary Restarts all containers in a container group in place. If container image has updates, new image will be downloaded.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/ContainerGroupsRestart.json
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsRestart.json
*/
async function containerRestart() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "subid";
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupName = "demo1";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId
subscriptionId,
);
const result = await client.containerGroups.beginRestartAndWait(
resourceGroupName,
containerGroupName
containerGroupName,
);
console.log(result);
}

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

@ -18,22 +18,23 @@ dotenv.config();
* This sample demonstrates how to Starts all containers in a container group. Compute resources will be allocated and billing will start.
*
* @summary Starts all containers in a container group. Compute resources will be allocated and billing will start.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/ContainerGroupsStart.json
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsStart.json
*/
async function containerStart() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "subid";
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupName = "demo1";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId
subscriptionId,
);
const result = await client.containerGroups.beginStartAndWait(
resourceGroupName,
containerGroupName
containerGroupName,
);
console.log(result);
}

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

@ -18,22 +18,23 @@ dotenv.config();
* This sample demonstrates how to Stops all containers in a container group. Compute resources will be deallocated and billing will stop.
*
* @summary Stops all containers in a container group. Compute resources will be deallocated and billing will stop.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/ContainerGroupsStop.json
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsStop.json
*/
async function containerStop() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "subid";
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupName = "demo1";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId
subscriptionId,
);
const result = await client.containerGroups.stop(
resourceGroupName,
containerGroupName
containerGroupName,
);
console.log(result);
}

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

@ -10,7 +10,7 @@
// Licensed under the MIT License.
import {
Resource,
ContainerInstanceManagementClient
ContainerInstanceManagementClient,
} from "@azure/arm-containerinstance";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
@ -21,26 +21,27 @@ dotenv.config();
* This sample demonstrates how to Updates container group tags with specified values.
*
* @summary Updates container group tags with specified values.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/ContainerGroupsUpdate.json
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsUpdate.json
*/
async function containerGroupsUpdate() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "subid";
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demoResource";
const containerGroupName = "demo1";
const resource: Resource = {
tags: { tag1key: "tag1Value", tag2key: "tag2Value" }
tags: { tag1key: "tag1Value", tag2key: "tag2Value" },
};
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId
subscriptionId,
);
const result = await client.containerGroups.update(
resourceGroupName,
containerGroupName,
resource
resource,
);
console.log(result);
}

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

@ -18,11 +18,12 @@ dotenv.config();
* This sample demonstrates how to Attach to the output stream of a specific container instance in a specified resource group and container group.
*
* @summary Attach to the output stream of a specific container instance in a specified resource group and container group.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/ContainerAttach.json
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerAttach.json
*/
async function containerAttach() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "subid";
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupName = "demo1";
@ -30,12 +31,12 @@ async function containerAttach() {
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId
subscriptionId,
);
const result = await client.containers.attach(
resourceGroupName,
containerGroupName,
containerName
containerName,
);
console.log(result);
}

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

@ -10,7 +10,7 @@
// Licensed under the MIT License.
import {
ContainerExecRequest,
ContainerInstanceManagementClient
ContainerInstanceManagementClient,
} from "@azure/arm-containerinstance";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
@ -21,29 +21,30 @@ dotenv.config();
* This sample demonstrates how to Executes a command for a specific container instance in a specified resource group and container group.
*
* @summary Executes a command for a specific container instance in a specified resource group and container group.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/ContainerExec.json
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerExec.json
*/
async function containerExec() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "subid";
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupName = "demo1";
const containerName = "container1";
const containerExecRequest: ContainerExecRequest = {
command: "/bin/bash",
terminalSize: { cols: 12, rows: 12 }
terminalSize: { cols: 12, rows: 12 },
};
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId
subscriptionId,
);
const result = await client.containers.executeCommand(
resourceGroupName,
containerGroupName,
containerName,
containerExecRequest
containerExecRequest,
);
console.log(result);
}

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

@ -10,7 +10,7 @@
// Licensed under the MIT License.
import {
ContainersListLogsOptionalParams,
ContainerInstanceManagementClient
ContainerInstanceManagementClient,
} from "@azure/arm-containerinstance";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
@ -21,11 +21,12 @@ dotenv.config();
* This sample demonstrates how to Get the logs for a specified container instance in a specified resource group and container group.
*
* @summary Get the logs for a specified container instance in a specified resource group and container group.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/ContainerListLogs.json
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerListLogs.json
*/
async function containerListLogs() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "subid";
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupName = "demo1";
@ -35,13 +36,13 @@ async function containerListLogs() {
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId
subscriptionId,
);
const result = await client.containers.listLogs(
resourceGroupName,
containerGroupName,
containerName,
options
options,
);
console.log(result);
}

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

@ -18,16 +18,17 @@ dotenv.config();
* This sample demonstrates how to Get the list of cached images on specific OS type for a subscription in a region.
*
* @summary Get the list of cached images on specific OS type for a subscription in a region.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/CachedImagesList.json
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/CachedImagesList.json
*/
async function cachedImages() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "subid";
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const location = "westcentralus";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId
subscriptionId,
);
const resArray = new Array();
for await (let item of client.location.listCachedImages(location)) {

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

@ -18,16 +18,17 @@ dotenv.config();
* This sample demonstrates how to Get the list of CPU/memory/GPU capabilities of a region.
*
* @summary Get the list of CPU/memory/GPU capabilities of a region.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/CapabilitiesList.json
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/CapabilitiesList.json
*/
async function getCapabilities() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "subid";
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const location = "westus";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId
subscriptionId,
);
const resArray = new Array();
for await (let item of client.location.listCapabilities(location)) {

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

@ -18,16 +18,17 @@ dotenv.config();
* This sample demonstrates how to Get the usage for a subscription
*
* @summary Get the usage for a subscription
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/ContainerGroupUsage.json
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupUsage.json
*/
async function containerUsage() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "subid";
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const location = "westcentralus";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId
subscriptionId,
);
const resArray = new Array();
for await (let item of client.location.listUsage(location)) {

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

@ -18,7 +18,7 @@ dotenv.config();
* This sample demonstrates how to List the operations for Azure Container Instance service.
*
* @summary List the operations for Azure Container Instance service.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/OperationsList.json
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/OperationsList.json
*/
async function operationsList() {
const subscriptionId =
@ -27,7 +27,7 @@ async function operationsList() {
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId
subscriptionId,
);
const resArray = new Array();
for await (let item of client.operations.list()) {

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

@ -18,11 +18,12 @@ dotenv.config();
* This sample demonstrates how to Delete container group virtual network association links. The operation does not delete other resources provided by the user.
*
* @summary Delete container group virtual network association links. The operation does not delete other resources provided by the user.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/SubnetServiceAssociationLinkDelete.json
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/SubnetServiceAssociationLinkDelete.json
*/
async function subnetServiceAssociationLinkDelete() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "subid";
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const virtualNetworkName = "demo2";
@ -30,12 +31,12 @@ async function subnetServiceAssociationLinkDelete() {
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId
subscriptionId,
);
const result = await client.subnetServiceAssociationLink.beginDeleteAndWait(
resourceGroupName,
virtualNetworkName,
subnetName
subnetName,
);
console.log(result);
}

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

@ -0,0 +1,98 @@
# client library samples for JavaScript (Beta)
These sample programs show how to use the JavaScript client libraries for in some common scenarios.
| **File Name** | **Description** |
| ----------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [containerGroupProfileGetByRevisionNumberSample.js][containergroupprofilegetbyrevisionnumbersample] | Gets the properties of the specified revision of the container group profile in the given subscription and resource group. The operation returns the properties of container group profile including containers, image registry credentials, restart policy, IP address type, OS type, volumes, current revision number, etc. x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfileGetByRevisionNumber.json |
| [containerGroupProfileListAllRevisionsSample.js][containergroupprofilelistallrevisionssample] | Get a list of all the revisions of the specified container group profile in the given subscription and resource group. This operation returns properties of each revision of the specified container group profile including containers, image registry credentials, restart policy, IP address type, OS type volumes, revision number, etc. x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfileListAllRevisions.json |
| [containerGroupProfilesCreateOrUpdateSample.js][containergroupprofilescreateorupdatesample] | Create or update container group profiles with specified configurations. x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfileCreateOrUpdate_CreateConfidential.json |
| [containerGroupProfilesDeleteSample.js][containergroupprofilesdeletesample] | Delete the specified container group profile in the specified subscription and resource group. The operation does not delete other resources provided by the user, such as volumes. x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfilesDelete.json |
| [containerGroupProfilesGetSample.js][containergroupprofilesgetsample] | Gets the properties of the specified container group profile in the specified subscription and resource group. The operation returns the properties of container group profile including containers, image registry credentials, restart policy, IP address type, OS type, volumes, current revision number, etc. x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfilesGetPriority.json |
| [containerGroupProfilesListByResourceGroupSample.js][containergroupprofileslistbyresourcegroupsample] | Get a list of container group profiles in a specified subscription and resource group. This operation returns properties of each container group profile including containers, image registry credentials, restart policy, IP address type, OS type volumes, current revision number, etc. x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfilesListByResourceGroup.json |
| [containerGroupProfilesListSample.js][containergroupprofileslistsample] | Get a list of container group profiles in the specified subscription. This operation returns properties of each container group profile including containers, image registry credentials, restart policy, IP address type, OS type,volumes,current revision number, etc. x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfilesList.json |
| [containerGroupProfilesPatchSample.js][containergroupprofilespatchsample] | Patches container group profile with specified properties. x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfilesPatch.json |
| [containerGroupsCreateOrUpdateSample.js][containergroupscreateorupdatesample] | Create or update container groups with specified configurations. x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupCreateConfidential.json |
| [containerGroupsDeleteSample.js][containergroupsdeletesample] | Delete the specified container group in the specified subscription and resource group. The operation does not delete other resources provided by the user, such as volumes. x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsDelete.json |
| [containerGroupsGetSample.js][containergroupsgetsample] | Gets the properties of the specified container group in the specified subscription and resource group. The operation returns the properties of each container group including containers, image registry credentials, restart policy, IP address type, OS type, state, and volumes. x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsGetPriority.json |
| [containerGroupsListByResourceGroupSample.js][containergroupslistbyresourcegroupsample] | Get a list of container groups in a specified subscription and resource group. This operation returns properties of each container group including containers, image registry credentials, restart policy, IP address type, OS type, state, and volumes. x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsListByResourceGroup.json |
| [containerGroupsListSample.js][containergroupslistsample] | Get a list of container groups in the specified subscription. This operation returns properties of each container group including containers, image registry credentials, restart policy, IP address type, OS type, state, and volumes. x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsList.json |
| [containerGroupsRestartSample.js][containergroupsrestartsample] | Restarts all containers in a container group in place. If container image has updates, new image will be downloaded. x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsRestart.json |
| [containerGroupsStartSample.js][containergroupsstartsample] | Starts all containers in a container group. Compute resources will be allocated and billing will start. x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsStart.json |
| [containerGroupsStopSample.js][containergroupsstopsample] | Stops all containers in a container group. Compute resources will be deallocated and billing will stop. x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsStop.json |
| [containerGroupsUpdateSample.js][containergroupsupdatesample] | Updates container group tags with specified values. x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsUpdate.json |
| [containersAttachSample.js][containersattachsample] | Attach to the output stream of a specific container instance in a specified resource group and container group. x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerAttach.json |
| [containersExecuteCommandSample.js][containersexecutecommandsample] | Executes a command for a specific container instance in a specified resource group and container group. x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerExec.json |
| [containersListLogsSample.js][containerslistlogssample] | Get the logs for a specified container instance in a specified resource group and container group. x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerListLogs.json |
| [locationListCachedImagesSample.js][locationlistcachedimagessample] | Get the list of cached images on specific OS type for a subscription in a region. x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/CachedImagesList.json |
| [locationListCapabilitiesSample.js][locationlistcapabilitiessample] | Get the list of CPU/memory/GPU capabilities of a region. x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/CapabilitiesList.json |
| [locationListUsageSample.js][locationlistusagesample] | Get the usage for a subscription x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupUsage.json |
| [operationsListSample.js][operationslistsample] | List the operations for Azure Container Instance service. x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/OperationsList.json |
| [subnetServiceAssociationLinkDeleteSample.js][subnetserviceassociationlinkdeletesample] | Delete container group virtual network association links. The operation does not delete other resources provided by the user. x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/SubnetServiceAssociationLinkDelete.json |
## Prerequisites
The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule).
You need [an Azure subscription][freesub] to run these sample programs.
Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function.
Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package].
## Setup
To run the samples using the published version of the package:
1. Install the dependencies using `npm`:
```bash
npm install
```
2. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically.
3. Run whichever samples you like (note that some samples may require additional setup, see the table above):
```bash
node containerGroupProfileGetByRevisionNumberSample.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 CONTAINERINSTANCE_SUBSCRIPTION_ID="<containerinstance subscription id>" CONTAINERINSTANCE_RESOURCE_GROUP="<containerinstance resource group>" node containerGroupProfileGetByRevisionNumberSample.js
```
## Next Steps
Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients.
[containergroupprofilegetbyrevisionnumbersample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerinstance/arm-containerinstance/samples/v9-beta/javascript/containerGroupProfileGetByRevisionNumberSample.js
[containergroupprofilelistallrevisionssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerinstance/arm-containerinstance/samples/v9-beta/javascript/containerGroupProfileListAllRevisionsSample.js
[containergroupprofilescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerinstance/arm-containerinstance/samples/v9-beta/javascript/containerGroupProfilesCreateOrUpdateSample.js
[containergroupprofilesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerinstance/arm-containerinstance/samples/v9-beta/javascript/containerGroupProfilesDeleteSample.js
[containergroupprofilesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerinstance/arm-containerinstance/samples/v9-beta/javascript/containerGroupProfilesGetSample.js
[containergroupprofileslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerinstance/arm-containerinstance/samples/v9-beta/javascript/containerGroupProfilesListByResourceGroupSample.js
[containergroupprofileslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerinstance/arm-containerinstance/samples/v9-beta/javascript/containerGroupProfilesListSample.js
[containergroupprofilespatchsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerinstance/arm-containerinstance/samples/v9-beta/javascript/containerGroupProfilesPatchSample.js
[containergroupscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerinstance/arm-containerinstance/samples/v9-beta/javascript/containerGroupsCreateOrUpdateSample.js
[containergroupsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerinstance/arm-containerinstance/samples/v9-beta/javascript/containerGroupsDeleteSample.js
[containergroupsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerinstance/arm-containerinstance/samples/v9-beta/javascript/containerGroupsGetSample.js
[containergroupslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerinstance/arm-containerinstance/samples/v9-beta/javascript/containerGroupsListByResourceGroupSample.js
[containergroupslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerinstance/arm-containerinstance/samples/v9-beta/javascript/containerGroupsListSample.js
[containergroupsrestartsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerinstance/arm-containerinstance/samples/v9-beta/javascript/containerGroupsRestartSample.js
[containergroupsstartsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerinstance/arm-containerinstance/samples/v9-beta/javascript/containerGroupsStartSample.js
[containergroupsstopsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerinstance/arm-containerinstance/samples/v9-beta/javascript/containerGroupsStopSample.js
[containergroupsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerinstance/arm-containerinstance/samples/v9-beta/javascript/containerGroupsUpdateSample.js
[containersattachsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerinstance/arm-containerinstance/samples/v9-beta/javascript/containersAttachSample.js
[containersexecutecommandsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerinstance/arm-containerinstance/samples/v9-beta/javascript/containersExecuteCommandSample.js
[containerslistlogssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerinstance/arm-containerinstance/samples/v9-beta/javascript/containersListLogsSample.js
[locationlistcachedimagessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerinstance/arm-containerinstance/samples/v9-beta/javascript/locationListCachedImagesSample.js
[locationlistcapabilitiessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerinstance/arm-containerinstance/samples/v9-beta/javascript/locationListCapabilitiesSample.js
[locationlistusagesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerinstance/arm-containerinstance/samples/v9-beta/javascript/locationListUsageSample.js
[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerinstance/arm-containerinstance/samples/v9-beta/javascript/operationsListSample.js
[subnetserviceassociationlinkdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerinstance/arm-containerinstance/samples/v9-beta/javascript/subnetServiceAssociationLinkDeleteSample.js
[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-containerinstance?view=azure-node-preview
[freesub]: https://azure.microsoft.com/free/
[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/containerinstance/arm-containerinstance/README.md

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

@ -0,0 +1,41 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { ContainerInstanceManagementClient } = require("@azure/arm-containerinstance");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Gets the properties of the specified revision of the container group profile in the given subscription and resource group. The operation returns the properties of container group profile including containers, image registry credentials, restart policy, IP address type, OS type, volumes, current revision number, etc.
*
* @summary Gets the properties of the specified revision of the container group profile in the given subscription and resource group. The operation returns the properties of container group profile including containers, image registry credentials, restart policy, IP address type, OS type, volumes, current revision number, etc.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfileGetByRevisionNumber.json
*/
async function containerGroupProfileGetByRevisionNumber() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupProfileName = "demo1";
const revisionNumber = "1";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(credential, subscriptionId);
const result = await client.containerGroupProfileOperations.getByRevisionNumber(
resourceGroupName,
containerGroupProfileName,
revisionNumber,
);
console.log(result);
}
async function main() {
containerGroupProfileGetByRevisionNumber();
}
main().catch(console.error);

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

@ -0,0 +1,42 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { ContainerInstanceManagementClient } = require("@azure/arm-containerinstance");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Get a list of all the revisions of the specified container group profile in the given subscription and resource group. This operation returns properties of each revision of the specified container group profile including containers, image registry credentials, restart policy, IP address type, OS type volumes, revision number, etc.
*
* @summary Get a list of all the revisions of the specified container group profile in the given subscription and resource group. This operation returns properties of each revision of the specified container group profile including containers, image registry credentials, restart policy, IP address type, OS type volumes, revision number, etc.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfileListAllRevisions.json
*/
async function containerGroupProfileListAllRevisions() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupProfileName = "demo1";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.containerGroupProfileOperations.listAllRevisions(
resourceGroupName,
containerGroupProfileName,
)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
containerGroupProfileListAllRevisions();
}
main().catch(console.error);

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

@ -0,0 +1,276 @@
/*
* 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 { ContainerInstanceManagementClient } = require("@azure/arm-containerinstance");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Create or update container group profiles with specified configurations.
*
* @summary Create or update container group profiles with specified configurations.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfileCreateOrUpdate_CreateConfidential.json
*/
async function confidentialContainerGroupProfile() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupProfileName = "demo1";
const containerGroupProfile = {
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" }] },
location: "westeurope",
osType: "Linux",
sku: "Confidential",
zones: ["1"],
};
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(credential, subscriptionId);
const result = await client.containerGroupProfiles.createOrUpdate(
resourceGroupName,
containerGroupProfileName,
containerGroupProfile,
);
console.log(result);
}
/**
* This sample demonstrates how to Create or update container group profiles with specified configurations.
*
* @summary Create or update container group profiles with specified configurations.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfileCreateOrUpdate_Extensions.json
*/
async function containerGroupProfileCreateWithExtensions() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupProfileName = "demo1";
const containerGroupProfile = {
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" }] },
location: "eastus2",
osType: "Linux",
zones: ["1"],
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",
},
],
};
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(credential, subscriptionId);
const result = await client.containerGroupProfiles.createOrUpdate(
resourceGroupName,
containerGroupProfileName,
containerGroupProfile,
);
console.log(result);
}
/**
* This sample demonstrates how to Create or update container group profiles with specified configurations.
*
* @summary Create or update container group profiles with specified configurations.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfileCreateOrUpdate_EncryptionProperties.json
*/
async function containerGroupProfileWithEncryptionProperties() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupProfileName = "demo1";
const containerGroupProfile = {
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" }] },
location: "eastus2",
osType: "Linux",
zones: ["1"],
};
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(credential, subscriptionId);
const result = await client.containerGroupProfiles.createOrUpdate(
resourceGroupName,
containerGroupProfileName,
containerGroupProfile,
);
console.log(result);
}
/**
* This sample demonstrates how to Create or update container group profiles with specified configurations.
*
* @summary Create or update container group profiles with specified configurations.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfilesCreateOrUpdate.json
*/
async function containerGroupProfilesCreateOrUpdate() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupProfileName = "demo1";
const containerGroupProfile = {
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: { podUuid: "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" }] },
location: "west us",
osType: "Linux",
volumes: [
{
name: "volume1",
azureFile: {
shareName: "shareName",
storageAccountKey: "accountKey",
storageAccountName: "accountName",
},
},
{ name: "volume2", emptyDir: {} },
{
name: "volume3",
secret: {
secretKey1: "SecretValue1InBase64",
secretKey2: "SecretValue2InBase64",
},
},
],
zones: ["1"],
};
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(credential, subscriptionId);
const result = await client.containerGroupProfiles.createOrUpdate(
resourceGroupName,
containerGroupProfileName,
containerGroupProfile,
);
console.log(result);
}
/**
* This sample demonstrates how to Create or update container group profiles with specified configurations.
*
* @summary Create or update container group profiles with specified configurations.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsProfileCreateOrUpdate_CreatePriority.json
*/
async function containerGroupsCreateWithPriority() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupProfileName = "demo1";
const containerGroupProfile = {
containers: [
{
name: "test-container-001",
command: ["/bin/sh", "-c", "sleep 10"],
image: "alpine:latest",
resources: { requests: { cpu: 1, memoryInGB: 1 } },
},
],
location: "eastus",
osType: "Linux",
priority: "Spot",
restartPolicy: "Never",
sku: "Standard",
};
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(credential, subscriptionId);
const result = await client.containerGroupProfiles.createOrUpdate(
resourceGroupName,
containerGroupProfileName,
containerGroupProfile,
);
console.log(result);
}
async function main() {
confidentialContainerGroupProfile();
containerGroupProfileCreateWithExtensions();
containerGroupProfileWithEncryptionProperties();
containerGroupProfilesCreateOrUpdate();
containerGroupsCreateWithPriority();
}
main().catch(console.error);

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

@ -0,0 +1,39 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { ContainerInstanceManagementClient } = require("@azure/arm-containerinstance");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Delete the specified container group profile in the specified subscription and resource group. The operation does not delete other resources provided by the user, such as volumes.
*
* @summary Delete the specified container group profile in the specified subscription and resource group. The operation does not delete other resources provided by the user, such as volumes.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfilesDelete.json
*/
async function containerGroupProfilesDelete() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupProfileName = "demo1";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(credential, subscriptionId);
const result = await client.containerGroupProfiles.delete(
resourceGroupName,
containerGroupProfileName,
);
console.log(result);
}
async function main() {
containerGroupProfilesDelete();
}
main().catch(console.error);

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

@ -0,0 +1,60 @@
/*
* 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 { ContainerInstanceManagementClient } = require("@azure/arm-containerinstance");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Gets the properties of the specified container group profile in the specified subscription and resource group. The operation returns the properties of container group profile including containers, image registry credentials, restart policy, IP address type, OS type, volumes, current revision number, etc.
*
* @summary Gets the properties of the specified container group profile in the specified subscription and resource group. The operation returns the properties of container group profile including containers, image registry credentials, restart policy, IP address type, OS type, volumes, current revision number, etc.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfilesGetPriority.json
*/
async function containerGroupProfilesGetWithPriority() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupProfileName = "demo1";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(credential, subscriptionId);
const result = await client.containerGroupProfiles.get(
resourceGroupName,
containerGroupProfileName,
);
console.log(result);
}
/**
* This sample demonstrates how to Gets the properties of the specified container group profile in the specified subscription and resource group. The operation returns the properties of container group profile including containers, image registry credentials, restart policy, IP address type, OS type, volumes, current revision number, etc.
*
* @summary Gets the properties of the specified container group profile in the specified subscription and resource group. The operation returns the properties of container group profile including containers, image registry credentials, restart policy, IP address type, OS type, volumes, current revision number, etc.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfilesGet.json
*/
async function containerGroupProfilesGetSucceeded() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupProfileName = "demo1";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(credential, subscriptionId);
const result = await client.containerGroupProfiles.get(
resourceGroupName,
containerGroupProfileName,
);
console.log(result);
}
async function main() {
containerGroupProfilesGetWithPriority();
containerGroupProfilesGetSucceeded();
}
main().catch(console.error);

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

@ -0,0 +1,38 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { ContainerInstanceManagementClient } = require("@azure/arm-containerinstance");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Get a list of container group profiles in a specified subscription and resource group. This operation returns properties of each container group profile including containers, image registry credentials, restart policy, IP address type, OS type volumes, current revision number, etc.
*
* @summary Get a list of container group profiles in a specified subscription and resource group. This operation returns properties of each container group profile including containers, image registry credentials, restart policy, IP address type, OS type volumes, current revision number, etc.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfilesListByResourceGroup.json
*/
async function containerGroupProfilesListByResourceGroup() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.containerGroupProfiles.listByResourceGroup(resourceGroupName)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
containerGroupProfilesListByResourceGroup();
}
main().catch(console.error);

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

@ -0,0 +1,37 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { ContainerInstanceManagementClient } = require("@azure/arm-containerinstance");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Get a list of container group profiles in the specified subscription. This operation returns properties of each container group profile including containers, image registry credentials, restart policy, IP address type, OS type,volumes,current revision number, etc.
*
* @summary Get a list of container group profiles in the specified subscription. This operation returns properties of each container group profile including containers, image registry credentials, restart policy, IP address type, OS type,volumes,current revision number, etc.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfilesList.json
*/
async function containerGroupProfilesList() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.containerGroupProfiles.list()) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
containerGroupProfilesList();
}
main().catch(console.error);

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

@ -0,0 +1,43 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { ContainerInstanceManagementClient } = require("@azure/arm-containerinstance");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Patches container group profile with specified properties.
*
* @summary Patches container group profile with specified properties.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfilesPatch.json
*/
async function containerGroupProfilesPatch() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demoResource";
const containerGroupProfileName = "demo1";
const properties = {
tags: { tag1key: "tag1Value", tag2key: "tag2Value" },
};
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(credential, subscriptionId);
const result = await client.containerGroupProfiles.patch(
resourceGroupName,
containerGroupProfileName,
properties,
);
console.log(result);
}
async function main() {
containerGroupProfilesPatch();
}
main().catch(console.error);

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

@ -0,0 +1,339 @@
/*
* 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 { ContainerInstanceManagementClient } = require("@azure/arm-containerinstance");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Create or update container groups with specified configurations.
*
* @summary Create or update container groups with specified configurations.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupCreateConfidential.json
*/
async function confidentialContainerGroup() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupName = "demo1";
const containerGroup = {
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" }] },
location: "westeurope",
osType: "Linux",
sku: "Confidential",
};
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(credential, subscriptionId);
const result = await client.containerGroups.beginCreateOrUpdateAndWait(
resourceGroupName,
containerGroupName,
containerGroup,
);
console.log(result);
}
/**
* This sample demonstrates how to Create or update container groups with specified configurations.
*
* @summary Create or update container groups with specified configurations.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupCreateOrUpdateStandbyPool.json
*/
async function containerGroupCreateOrUpdateWithStandbyPool() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupName = "demo1";
const containerGroup = {
containerGroupProfile: {
id: "/subscriptions/subid/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroupProfiles/democgp",
revision: 1,
},
containers: [{ name: "demo1", configMap: { keyValuePairs: { newkey: "value" } } }],
location: "west us",
standbyPoolProfile: {
id: "/subscriptions/subid/resourceGroups/demo/providers/Microsoft.StandbyPool/standbyContainerGroupPools/demopool",
},
};
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(credential, subscriptionId);
const result = await client.containerGroups.beginCreateOrUpdateAndWait(
resourceGroupName,
containerGroupName,
containerGroup,
);
console.log(result);
}
/**
* This sample demonstrates how to Create or update container groups with specified configurations.
*
* @summary Create or update container groups with specified configurations.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupExtensions.json
*/
async function containerGroupCreateWithExtensions() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupName = "demo1";
const containerGroup = {
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" }] },
location: "eastus2",
osType: "Linux",
subnetIds: [
{
id: "/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-rg-vnet/subnets/test-subnet",
},
],
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",
},
],
};
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(credential, subscriptionId);
const result = await client.containerGroups.beginCreateOrUpdateAndWait(
resourceGroupName,
containerGroupName,
containerGroup,
);
console.log(result);
}
/**
* This sample demonstrates how to Create or update container groups with specified configurations.
*
* @summary Create or update container groups with specified configurations.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupEncryptionProperties.json
*/
async function containerGroupWithEncryptionProperties() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupName = "demo1";
const containerGroup = {
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",
},
identity: {
type: "UserAssigned",
userAssignedIdentities: {
"/subscriptions/00000000000000000000000000000000/resourcegroups/testRg/providers/MicrosoftManagedIdentity/userAssignedIdentities/containerGroupIdentity":
{},
},
},
imageRegistryCredentials: [],
ipAddress: { type: "Public", ports: [{ port: 80, protocol: "TCP" }] },
location: "eastus2",
osType: "Linux",
};
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(credential, subscriptionId);
const result = await client.containerGroups.beginCreateOrUpdateAndWait(
resourceGroupName,
containerGroupName,
containerGroup,
);
console.log(result);
}
/**
* This sample demonstrates how to Create or update container groups with specified configurations.
*
* @summary Create or update container groups with specified configurations.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsCreateOrUpdate.json
*/
async function containerGroupsCreateOrUpdate() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupName = "demo1";
const containerGroup = {
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: { testKey: "test-metadata-value" },
workspaceId: "workspaceid",
workspaceKey: "workspaceKey",
workspaceResourceId:
"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/microsoft.operationalinsights/workspaces/workspace",
},
},
dnsConfig: {
nameServers: ["1.1.1.1"],
options: "ndots:2",
searchDomains: "cluster.local svc.cluster.local",
},
identity: {
type: "SystemAssigned, UserAssigned",
userAssignedIdentities: {
"/subscriptions/00000000000000000000000000000000/resourceGroups/myResourceGroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/identityName":
{},
},
},
imageRegistryCredentials: [],
ipAddress: {
type: "Public",
autoGeneratedDomainNameLabelScope: "Unsecure",
dnsNameLabel: "dnsnamelabel1",
ports: [{ port: 80, protocol: "TCP" }],
},
location: "west us",
osType: "Linux",
subnetIds: [
{
id: "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('vnetName'), parameters('subnetName'))]",
},
],
volumes: [
{
name: "volume1",
azureFile: {
shareName: "shareName",
storageAccountKey: "accountKey",
storageAccountName: "accountName",
},
},
{ name: "volume2", emptyDir: {} },
{
name: "volume3",
secret: {
secretKey1: "SecretValue1InBase64",
secretKey2: "SecretValue2InBase64",
},
},
],
};
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(credential, subscriptionId);
const result = await client.containerGroups.beginCreateOrUpdateAndWait(
resourceGroupName,
containerGroupName,
containerGroup,
);
console.log(result);
}
/**
* This sample demonstrates how to Create or update container groups with specified configurations.
*
* @summary Create or update container groups with specified configurations.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsCreatePriority.json
*/
async function containerGroupsCreateWithPriority() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupName = "demo1";
const containerGroup = {
containers: [
{
name: "test-container-001",
command: ["/bin/sh", "-c", "sleep 10"],
image: "alpine:latest",
resources: { requests: { cpu: 1, memoryInGB: 1 } },
},
],
location: "eastus",
osType: "Linux",
priority: "Spot",
restartPolicy: "Never",
sku: "Standard",
};
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(credential, subscriptionId);
const result = await client.containerGroups.beginCreateOrUpdateAndWait(
resourceGroupName,
containerGroupName,
containerGroup,
);
console.log(result);
}
async function main() {
confidentialContainerGroup();
containerGroupCreateOrUpdateWithStandbyPool();
containerGroupCreateWithExtensions();
containerGroupWithEncryptionProperties();
containerGroupsCreateOrUpdate();
containerGroupsCreateWithPriority();
}
main().catch(console.error);

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

@ -0,0 +1,39 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { ContainerInstanceManagementClient } = require("@azure/arm-containerinstance");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Delete the specified container group in the specified subscription and resource group. The operation does not delete other resources provided by the user, such as volumes.
*
* @summary Delete the specified container group in the specified subscription and resource group. The operation does not delete other resources provided by the user, such as volumes.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsDelete.json
*/
async function containerGroupsDelete() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupName = "demo1";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(credential, subscriptionId);
const result = await client.containerGroups.beginDeleteAndWait(
resourceGroupName,
containerGroupName,
);
console.log(result);
}
async function main() {
containerGroupsDelete();
}
main().catch(console.error);

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

@ -0,0 +1,72 @@
/*
* 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 { ContainerInstanceManagementClient } = require("@azure/arm-containerinstance");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Gets the properties of the specified container group in the specified subscription and resource group. The operation returns the properties of each container group including containers, image registry credentials, restart policy, IP address type, OS type, state, and volumes.
*
* @summary Gets the properties of the specified container group in the specified subscription and resource group. The operation returns the properties of each container group including containers, image registry credentials, restart policy, IP address type, OS type, state, and volumes.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsGetPriority.json
*/
async function containerGroupsGetWithPriority() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupName = "demo1";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(credential, subscriptionId);
const result = await client.containerGroups.get(resourceGroupName, containerGroupName);
console.log(result);
}
/**
* This sample demonstrates how to Gets the properties of the specified container group in the specified subscription and resource group. The operation returns the properties of each container group including containers, image registry credentials, restart policy, IP address type, OS type, state, and volumes.
*
* @summary Gets the properties of the specified container group in the specified subscription and resource group. The operation returns the properties of each container group including containers, image registry credentials, restart policy, IP address type, OS type, state, and volumes.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsGet_Failed.json
*/
async function containerGroupsGetFailed() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupName = "demo1";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(credential, subscriptionId);
const result = await client.containerGroups.get(resourceGroupName, containerGroupName);
console.log(result);
}
/**
* This sample demonstrates how to Gets the properties of the specified container group in the specified subscription and resource group. The operation returns the properties of each container group including containers, image registry credentials, restart policy, IP address type, OS type, state, and volumes.
*
* @summary Gets the properties of the specified container group in the specified subscription and resource group. The operation returns the properties of each container group including containers, image registry credentials, restart policy, IP address type, OS type, state, and volumes.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsGet_Succeeded.json
*/
async function containerGroupsGetSucceeded() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupName = "demo1";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(credential, subscriptionId);
const result = await client.containerGroups.get(resourceGroupName, containerGroupName);
console.log(result);
}
async function main() {
containerGroupsGetWithPriority();
containerGroupsGetFailed();
containerGroupsGetSucceeded();
}
main().catch(console.error);

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

@ -0,0 +1,38 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { ContainerInstanceManagementClient } = require("@azure/arm-containerinstance");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Get a list of container groups in a specified subscription and resource group. This operation returns properties of each container group including containers, image registry credentials, restart policy, IP address type, OS type, state, and volumes.
*
* @summary Get a list of container groups in a specified subscription and resource group. This operation returns properties of each container group including containers, image registry credentials, restart policy, IP address type, OS type, state, and volumes.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsListByResourceGroup.json
*/
async function containerGroupsListByResourceGroup() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.containerGroups.listByResourceGroup(resourceGroupName)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
containerGroupsListByResourceGroup();
}
main().catch(console.error);

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

@ -0,0 +1,37 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { ContainerInstanceManagementClient } = require("@azure/arm-containerinstance");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Get a list of container groups in the specified subscription. This operation returns properties of each container group including containers, image registry credentials, restart policy, IP address type, OS type, state, and volumes.
*
* @summary Get a list of container groups in the specified subscription. This operation returns properties of each container group including containers, image registry credentials, restart policy, IP address type, OS type, state, and volumes.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsList.json
*/
async function containerGroupsList() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.containerGroups.list()) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
containerGroupsList();
}
main().catch(console.error);

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

@ -0,0 +1,39 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { ContainerInstanceManagementClient } = require("@azure/arm-containerinstance");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Restarts all containers in a container group in place. If container image has updates, new image will be downloaded.
*
* @summary Restarts all containers in a container group in place. If container image has updates, new image will be downloaded.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsRestart.json
*/
async function containerRestart() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupName = "demo1";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(credential, subscriptionId);
const result = await client.containerGroups.beginRestartAndWait(
resourceGroupName,
containerGroupName,
);
console.log(result);
}
async function main() {
containerRestart();
}
main().catch(console.error);

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

@ -0,0 +1,39 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { ContainerInstanceManagementClient } = require("@azure/arm-containerinstance");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Starts all containers in a container group. Compute resources will be allocated and billing will start.
*
* @summary Starts all containers in a container group. Compute resources will be allocated and billing will start.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsStart.json
*/
async function containerStart() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupName = "demo1";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(credential, subscriptionId);
const result = await client.containerGroups.beginStartAndWait(
resourceGroupName,
containerGroupName,
);
console.log(result);
}
async function main() {
containerStart();
}
main().catch(console.error);

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

@ -0,0 +1,36 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { ContainerInstanceManagementClient } = require("@azure/arm-containerinstance");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Stops all containers in a container group. Compute resources will be deallocated and billing will stop.
*
* @summary Stops all containers in a container group. Compute resources will be deallocated and billing will stop.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsStop.json
*/
async function containerStop() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupName = "demo1";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(credential, subscriptionId);
const result = await client.containerGroups.stop(resourceGroupName, containerGroupName);
console.log(result);
}
async function main() {
containerStop();
}
main().catch(console.error);

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

@ -0,0 +1,43 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { ContainerInstanceManagementClient } = require("@azure/arm-containerinstance");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Updates container group tags with specified values.
*
* @summary Updates container group tags with specified values.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsUpdate.json
*/
async function containerGroupsUpdate() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demoResource";
const containerGroupName = "demo1";
const resource = {
tags: { tag1key: "tag1Value", tag2key: "tag2Value" },
};
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(credential, subscriptionId);
const result = await client.containerGroups.update(
resourceGroupName,
containerGroupName,
resource,
);
console.log(result);
}
async function main() {
containerGroupsUpdate();
}
main().catch(console.error);

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

@ -0,0 +1,41 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { ContainerInstanceManagementClient } = require("@azure/arm-containerinstance");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Attach to the output stream of a specific container instance in a specified resource group and container group.
*
* @summary Attach to the output stream of a specific container instance in a specified resource group and container group.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerAttach.json
*/
async function containerAttach() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupName = "demo1";
const containerName = "container1";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(credential, subscriptionId);
const result = await client.containers.attach(
resourceGroupName,
containerGroupName,
containerName,
);
console.log(result);
}
async function main() {
containerAttach();
}
main().catch(console.error);

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

@ -0,0 +1,46 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { ContainerInstanceManagementClient } = require("@azure/arm-containerinstance");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Executes a command for a specific container instance in a specified resource group and container group.
*
* @summary Executes a command for a specific container instance in a specified resource group and container group.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerExec.json
*/
async function containerExec() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupName = "demo1";
const containerName = "container1";
const containerExecRequest = {
command: "/bin/bash",
terminalSize: { cols: 12, rows: 12 },
};
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(credential, subscriptionId);
const result = await client.containers.executeCommand(
resourceGroupName,
containerGroupName,
containerName,
containerExecRequest,
);
console.log(result);
}
async function main() {
containerExec();
}
main().catch(console.error);

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

@ -0,0 +1,44 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { ContainerInstanceManagementClient } = require("@azure/arm-containerinstance");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Get the logs for a specified container instance in a specified resource group and container group.
*
* @summary Get the logs for a specified container instance in a specified resource group and container group.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerListLogs.json
*/
async function containerListLogs() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupName = "demo1";
const containerName = "container1";
const tail = 10;
const options = { tail };
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(credential, subscriptionId);
const result = await client.containers.listLogs(
resourceGroupName,
containerGroupName,
containerName,
options,
);
console.log(result);
}
async function main() {
containerListLogs();
}
main().catch(console.error);

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

@ -0,0 +1,38 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { ContainerInstanceManagementClient } = require("@azure/arm-containerinstance");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Get the list of cached images on specific OS type for a subscription in a region.
*
* @summary Get the list of cached images on specific OS type for a subscription in a region.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/CachedImagesList.json
*/
async function cachedImages() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const location = "westcentralus";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.location.listCachedImages(location)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
cachedImages();
}
main().catch(console.error);

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

@ -0,0 +1,38 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { ContainerInstanceManagementClient } = require("@azure/arm-containerinstance");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Get the list of CPU/memory/GPU capabilities of a region.
*
* @summary Get the list of CPU/memory/GPU capabilities of a region.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/CapabilitiesList.json
*/
async function getCapabilities() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const location = "westus";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.location.listCapabilities(location)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
getCapabilities();
}
main().catch(console.error);

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

@ -0,0 +1,38 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { ContainerInstanceManagementClient } = require("@azure/arm-containerinstance");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Get the usage for a subscription
*
* @summary Get the usage for a subscription
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupUsage.json
*/
async function containerUsage() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const location = "westcentralus";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.location.listUsage(location)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
containerUsage();
}
main().catch(console.error);

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

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

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

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

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

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

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

@ -0,0 +1,41 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { ContainerInstanceManagementClient } = require("@azure/arm-containerinstance");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Delete container group virtual network association links. The operation does not delete other resources provided by the user.
*
* @summary Delete container group virtual network association links. The operation does not delete other resources provided by the user.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/SubnetServiceAssociationLinkDelete.json
*/
async function subnetServiceAssociationLinkDelete() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const virtualNetworkName = "demo2";
const subnetName = "demo3";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(credential, subscriptionId);
const result = await client.subnetServiceAssociationLink.beginDeleteAndWait(
resourceGroupName,
virtualNetworkName,
subnetName,
);
console.log(result);
}
async function main() {
subnetServiceAssociationLinkDelete();
}
main().catch(console.error);

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

@ -0,0 +1,111 @@
# client library samples for TypeScript (Beta)
These sample programs show how to use the TypeScript client libraries for in some common scenarios.
| **File Name** | **Description** |
| ----------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [containerGroupProfileGetByRevisionNumberSample.ts][containergroupprofilegetbyrevisionnumbersample] | Gets the properties of the specified revision of the container group profile in the given subscription and resource group. The operation returns the properties of container group profile including containers, image registry credentials, restart policy, IP address type, OS type, volumes, current revision number, etc. x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfileGetByRevisionNumber.json |
| [containerGroupProfileListAllRevisionsSample.ts][containergroupprofilelistallrevisionssample] | Get a list of all the revisions of the specified container group profile in the given subscription and resource group. This operation returns properties of each revision of the specified container group profile including containers, image registry credentials, restart policy, IP address type, OS type volumes, revision number, etc. x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfileListAllRevisions.json |
| [containerGroupProfilesCreateOrUpdateSample.ts][containergroupprofilescreateorupdatesample] | Create or update container group profiles with specified configurations. x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfileCreateOrUpdate_CreateConfidential.json |
| [containerGroupProfilesDeleteSample.ts][containergroupprofilesdeletesample] | Delete the specified container group profile in the specified subscription and resource group. The operation does not delete other resources provided by the user, such as volumes. x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfilesDelete.json |
| [containerGroupProfilesGetSample.ts][containergroupprofilesgetsample] | Gets the properties of the specified container group profile in the specified subscription and resource group. The operation returns the properties of container group profile including containers, image registry credentials, restart policy, IP address type, OS type, volumes, current revision number, etc. x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfilesGetPriority.json |
| [containerGroupProfilesListByResourceGroupSample.ts][containergroupprofileslistbyresourcegroupsample] | Get a list of container group profiles in a specified subscription and resource group. This operation returns properties of each container group profile including containers, image registry credentials, restart policy, IP address type, OS type volumes, current revision number, etc. x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfilesListByResourceGroup.json |
| [containerGroupProfilesListSample.ts][containergroupprofileslistsample] | Get a list of container group profiles in the specified subscription. This operation returns properties of each container group profile including containers, image registry credentials, restart policy, IP address type, OS type,volumes,current revision number, etc. x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfilesList.json |
| [containerGroupProfilesPatchSample.ts][containergroupprofilespatchsample] | Patches container group profile with specified properties. x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfilesPatch.json |
| [containerGroupsCreateOrUpdateSample.ts][containergroupscreateorupdatesample] | Create or update container groups with specified configurations. x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupCreateConfidential.json |
| [containerGroupsDeleteSample.ts][containergroupsdeletesample] | Delete the specified container group in the specified subscription and resource group. The operation does not delete other resources provided by the user, such as volumes. x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsDelete.json |
| [containerGroupsGetSample.ts][containergroupsgetsample] | Gets the properties of the specified container group in the specified subscription and resource group. The operation returns the properties of each container group including containers, image registry credentials, restart policy, IP address type, OS type, state, and volumes. x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsGetPriority.json |
| [containerGroupsListByResourceGroupSample.ts][containergroupslistbyresourcegroupsample] | Get a list of container groups in a specified subscription and resource group. This operation returns properties of each container group including containers, image registry credentials, restart policy, IP address type, OS type, state, and volumes. x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsListByResourceGroup.json |
| [containerGroupsListSample.ts][containergroupslistsample] | Get a list of container groups in the specified subscription. This operation returns properties of each container group including containers, image registry credentials, restart policy, IP address type, OS type, state, and volumes. x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsList.json |
| [containerGroupsRestartSample.ts][containergroupsrestartsample] | Restarts all containers in a container group in place. If container image has updates, new image will be downloaded. x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsRestart.json |
| [containerGroupsStartSample.ts][containergroupsstartsample] | Starts all containers in a container group. Compute resources will be allocated and billing will start. x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsStart.json |
| [containerGroupsStopSample.ts][containergroupsstopsample] | Stops all containers in a container group. Compute resources will be deallocated and billing will stop. x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsStop.json |
| [containerGroupsUpdateSample.ts][containergroupsupdatesample] | Updates container group tags with specified values. x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsUpdate.json |
| [containersAttachSample.ts][containersattachsample] | Attach to the output stream of a specific container instance in a specified resource group and container group. x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerAttach.json |
| [containersExecuteCommandSample.ts][containersexecutecommandsample] | Executes a command for a specific container instance in a specified resource group and container group. x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerExec.json |
| [containersListLogsSample.ts][containerslistlogssample] | Get the logs for a specified container instance in a specified resource group and container group. x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerListLogs.json |
| [locationListCachedImagesSample.ts][locationlistcachedimagessample] | Get the list of cached images on specific OS type for a subscription in a region. x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/CachedImagesList.json |
| [locationListCapabilitiesSample.ts][locationlistcapabilitiessample] | Get the list of CPU/memory/GPU capabilities of a region. x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/CapabilitiesList.json |
| [locationListUsageSample.ts][locationlistusagesample] | Get the usage for a subscription x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupUsage.json |
| [operationsListSample.ts][operationslistsample] | List the operations for Azure Container Instance service. x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/OperationsList.json |
| [subnetServiceAssociationLinkDeleteSample.ts][subnetserviceassociationlinkdeletesample] | Delete container group virtual network association links. The operation does not delete other resources provided by the user. x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/SubnetServiceAssociationLinkDelete.json |
## Prerequisites
The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule).
Before running the samples in Node, they must be compiled to JavaScript using the TypeScript compiler. For more information on TypeScript, see the [TypeScript documentation][typescript]. Install the TypeScript compiler using:
```bash
npm install -g typescript
```
You need [an Azure subscription][freesub] to run these sample programs.
Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function.
Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package].
## Setup
To run the samples using the published version of the package:
1. Install the dependencies using `npm`:
```bash
npm install
```
2. Compile the samples:
```bash
npm run build
```
3. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically.
4. Run whichever samples you like (note that some samples may require additional setup, see the table above):
```bash
node dist/containerGroupProfileGetByRevisionNumberSample.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 CONTAINERINSTANCE_SUBSCRIPTION_ID="<containerinstance subscription id>" CONTAINERINSTANCE_RESOURCE_GROUP="<containerinstance resource group>" node dist/containerGroupProfileGetByRevisionNumberSample.js
```
## Next Steps
Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients.
[containergroupprofilegetbyrevisionnumbersample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerinstance/arm-containerinstance/samples/v9-beta/typescript/src/containerGroupProfileGetByRevisionNumberSample.ts
[containergroupprofilelistallrevisionssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerinstance/arm-containerinstance/samples/v9-beta/typescript/src/containerGroupProfileListAllRevisionsSample.ts
[containergroupprofilescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerinstance/arm-containerinstance/samples/v9-beta/typescript/src/containerGroupProfilesCreateOrUpdateSample.ts
[containergroupprofilesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerinstance/arm-containerinstance/samples/v9-beta/typescript/src/containerGroupProfilesDeleteSample.ts
[containergroupprofilesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerinstance/arm-containerinstance/samples/v9-beta/typescript/src/containerGroupProfilesGetSample.ts
[containergroupprofileslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerinstance/arm-containerinstance/samples/v9-beta/typescript/src/containerGroupProfilesListByResourceGroupSample.ts
[containergroupprofileslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerinstance/arm-containerinstance/samples/v9-beta/typescript/src/containerGroupProfilesListSample.ts
[containergroupprofilespatchsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerinstance/arm-containerinstance/samples/v9-beta/typescript/src/containerGroupProfilesPatchSample.ts
[containergroupscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerinstance/arm-containerinstance/samples/v9-beta/typescript/src/containerGroupsCreateOrUpdateSample.ts
[containergroupsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerinstance/arm-containerinstance/samples/v9-beta/typescript/src/containerGroupsDeleteSample.ts
[containergroupsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerinstance/arm-containerinstance/samples/v9-beta/typescript/src/containerGroupsGetSample.ts
[containergroupslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerinstance/arm-containerinstance/samples/v9-beta/typescript/src/containerGroupsListByResourceGroupSample.ts
[containergroupslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerinstance/arm-containerinstance/samples/v9-beta/typescript/src/containerGroupsListSample.ts
[containergroupsrestartsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerinstance/arm-containerinstance/samples/v9-beta/typescript/src/containerGroupsRestartSample.ts
[containergroupsstartsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerinstance/arm-containerinstance/samples/v9-beta/typescript/src/containerGroupsStartSample.ts
[containergroupsstopsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerinstance/arm-containerinstance/samples/v9-beta/typescript/src/containerGroupsStopSample.ts
[containergroupsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerinstance/arm-containerinstance/samples/v9-beta/typescript/src/containerGroupsUpdateSample.ts
[containersattachsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerinstance/arm-containerinstance/samples/v9-beta/typescript/src/containersAttachSample.ts
[containersexecutecommandsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerinstance/arm-containerinstance/samples/v9-beta/typescript/src/containersExecuteCommandSample.ts
[containerslistlogssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerinstance/arm-containerinstance/samples/v9-beta/typescript/src/containersListLogsSample.ts
[locationlistcachedimagessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerinstance/arm-containerinstance/samples/v9-beta/typescript/src/locationListCachedImagesSample.ts
[locationlistcapabilitiessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerinstance/arm-containerinstance/samples/v9-beta/typescript/src/locationListCapabilitiesSample.ts
[locationlistusagesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerinstance/arm-containerinstance/samples/v9-beta/typescript/src/locationListUsageSample.ts
[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerinstance/arm-containerinstance/samples/v9-beta/typescript/src/operationsListSample.ts
[subnetserviceassociationlinkdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/containerinstance/arm-containerinstance/samples/v9-beta/typescript/src/subnetServiceAssociationLinkDeleteSample.ts
[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-containerinstance?view=azure-node-preview
[freesub]: https://azure.microsoft.com/free/
[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/containerinstance/arm-containerinstance/README.md
[typescript]: https://www.typescriptlang.org/docs/home.html

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

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

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

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

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

@ -0,0 +1,49 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { ContainerInstanceManagementClient } from "@azure/arm-containerinstance";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Gets the properties of the specified revision of the container group profile in the given subscription and resource group. The operation returns the properties of container group profile including containers, image registry credentials, restart policy, IP address type, OS type, volumes, current revision number, etc.
*
* @summary Gets the properties of the specified revision of the container group profile in the given subscription and resource group. The operation returns the properties of container group profile including containers, image registry credentials, restart policy, IP address type, OS type, volumes, current revision number, etc.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfileGetByRevisionNumber.json
*/
async function containerGroupProfileGetByRevisionNumber() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupProfileName = "demo1";
const revisionNumber = "1";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId,
);
const result =
await client.containerGroupProfileOperations.getByRevisionNumber(
resourceGroupName,
containerGroupProfileName,
revisionNumber,
);
console.log(result);
}
async function main() {
containerGroupProfileGetByRevisionNumber();
}
main().catch(console.error);

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

@ -0,0 +1,49 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { ContainerInstanceManagementClient } from "@azure/arm-containerinstance";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Get a list of all the revisions of the specified container group profile in the given subscription and resource group. This operation returns properties of each revision of the specified container group profile including containers, image registry credentials, restart policy, IP address type, OS type volumes, revision number, etc.
*
* @summary Get a list of all the revisions of the specified container group profile in the given subscription and resource group. This operation returns properties of each revision of the specified container group profile including containers, image registry credentials, restart policy, IP address type, OS type volumes, revision number, etc.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfileListAllRevisions.json
*/
async function containerGroupProfileListAllRevisions() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupProfileName = "demo1";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId,
);
const resArray = new Array();
for await (let item of client.containerGroupProfileOperations.listAllRevisions(
resourceGroupName,
containerGroupProfileName,
)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
containerGroupProfileListAllRevisions();
}
main().catch(console.error);

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

@ -0,0 +1,306 @@
/*
* 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 {
ContainerGroupProfile,
ContainerInstanceManagementClient,
} from "@azure/arm-containerinstance";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Create or update container group profiles with specified configurations.
*
* @summary Create or update container group profiles with specified configurations.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfileCreateOrUpdate_CreateConfidential.json
*/
async function confidentialContainerGroupProfile() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupProfileName = "demo1";
const containerGroupProfile: ContainerGroupProfile = {
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" }] },
location: "westeurope",
osType: "Linux",
sku: "Confidential",
zones: ["1"],
};
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId,
);
const result = await client.containerGroupProfiles.createOrUpdate(
resourceGroupName,
containerGroupProfileName,
containerGroupProfile,
);
console.log(result);
}
/**
* This sample demonstrates how to Create or update container group profiles with specified configurations.
*
* @summary Create or update container group profiles with specified configurations.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfileCreateOrUpdate_Extensions.json
*/
async function containerGroupProfileCreateWithExtensions() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupProfileName = "demo1";
const containerGroupProfile: ContainerGroupProfile = {
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" }] },
location: "eastus2",
osType: "Linux",
zones: ["1"],
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",
},
],
};
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId,
);
const result = await client.containerGroupProfiles.createOrUpdate(
resourceGroupName,
containerGroupProfileName,
containerGroupProfile,
);
console.log(result);
}
/**
* This sample demonstrates how to Create or update container group profiles with specified configurations.
*
* @summary Create or update container group profiles with specified configurations.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfileCreateOrUpdate_EncryptionProperties.json
*/
async function containerGroupProfileWithEncryptionProperties() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupProfileName = "demo1";
const containerGroupProfile: ContainerGroupProfile = {
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" }] },
location: "eastus2",
osType: "Linux",
zones: ["1"],
};
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId,
);
const result = await client.containerGroupProfiles.createOrUpdate(
resourceGroupName,
containerGroupProfileName,
containerGroupProfile,
);
console.log(result);
}
/**
* This sample demonstrates how to Create or update container group profiles with specified configurations.
*
* @summary Create or update container group profiles with specified configurations.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfilesCreateOrUpdate.json
*/
async function containerGroupProfilesCreateOrUpdate() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupProfileName = "demo1";
const containerGroupProfile: ContainerGroupProfile = {
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: { podUuid: "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" }] },
location: "west us",
osType: "Linux",
volumes: [
{
name: "volume1",
azureFile: {
shareName: "shareName",
storageAccountKey: "accountKey",
storageAccountName: "accountName",
},
},
{ name: "volume2", emptyDir: {} },
{
name: "volume3",
secret: {
secretKey1: "SecretValue1InBase64",
secretKey2: "SecretValue2InBase64",
},
},
],
zones: ["1"],
};
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId,
);
const result = await client.containerGroupProfiles.createOrUpdate(
resourceGroupName,
containerGroupProfileName,
containerGroupProfile,
);
console.log(result);
}
/**
* This sample demonstrates how to Create or update container group profiles with specified configurations.
*
* @summary Create or update container group profiles with specified configurations.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsProfileCreateOrUpdate_CreatePriority.json
*/
async function containerGroupsCreateWithPriority() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupProfileName = "demo1";
const containerGroupProfile: ContainerGroupProfile = {
containers: [
{
name: "test-container-001",
command: ["/bin/sh", "-c", "sleep 10"],
image: "alpine:latest",
resources: { requests: { cpu: 1, memoryInGB: 1 } },
},
],
location: "eastus",
osType: "Linux",
priority: "Spot",
restartPolicy: "Never",
sku: "Standard",
};
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId,
);
const result = await client.containerGroupProfiles.createOrUpdate(
resourceGroupName,
containerGroupProfileName,
containerGroupProfile,
);
console.log(result);
}
async function main() {
confidentialContainerGroupProfile();
containerGroupProfileCreateWithExtensions();
containerGroupProfileWithEncryptionProperties();
containerGroupProfilesCreateOrUpdate();
containerGroupsCreateWithPriority();
}
main().catch(console.error);

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

@ -0,0 +1,46 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { ContainerInstanceManagementClient } from "@azure/arm-containerinstance";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Delete the specified container group profile in the specified subscription and resource group. The operation does not delete other resources provided by the user, such as volumes.
*
* @summary Delete the specified container group profile in the specified subscription and resource group. The operation does not delete other resources provided by the user, such as volumes.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfilesDelete.json
*/
async function containerGroupProfilesDelete() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupProfileName = "demo1";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId,
);
const result = await client.containerGroupProfiles.delete(
resourceGroupName,
containerGroupProfileName,
);
console.log(result);
}
async function main() {
containerGroupProfilesDelete();
}
main().catch(console.error);

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

@ -0,0 +1,72 @@
/*
* 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 { ContainerInstanceManagementClient } from "@azure/arm-containerinstance";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Gets the properties of the specified container group profile in the specified subscription and resource group. The operation returns the properties of container group profile including containers, image registry credentials, restart policy, IP address type, OS type, volumes, current revision number, etc.
*
* @summary Gets the properties of the specified container group profile in the specified subscription and resource group. The operation returns the properties of container group profile including containers, image registry credentials, restart policy, IP address type, OS type, volumes, current revision number, etc.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfilesGetPriority.json
*/
async function containerGroupProfilesGetWithPriority() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupProfileName = "demo1";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId,
);
const result = await client.containerGroupProfiles.get(
resourceGroupName,
containerGroupProfileName,
);
console.log(result);
}
/**
* This sample demonstrates how to Gets the properties of the specified container group profile in the specified subscription and resource group. The operation returns the properties of container group profile including containers, image registry credentials, restart policy, IP address type, OS type, volumes, current revision number, etc.
*
* @summary Gets the properties of the specified container group profile in the specified subscription and resource group. The operation returns the properties of container group profile including containers, image registry credentials, restart policy, IP address type, OS type, volumes, current revision number, etc.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfilesGet.json
*/
async function containerGroupProfilesGetSucceeded() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupProfileName = "demo1";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId,
);
const result = await client.containerGroupProfiles.get(
resourceGroupName,
containerGroupProfileName,
);
console.log(result);
}
async function main() {
containerGroupProfilesGetWithPriority();
containerGroupProfilesGetSucceeded();
}
main().catch(console.error);

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

@ -0,0 +1,47 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { ContainerInstanceManagementClient } from "@azure/arm-containerinstance";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Get a list of container group profiles in a specified subscription and resource group. This operation returns properties of each container group profile including containers, image registry credentials, restart policy, IP address type, OS type volumes, current revision number, etc.
*
* @summary Get a list of container group profiles in a specified subscription and resource group. This operation returns properties of each container group profile including containers, image registry credentials, restart policy, IP address type, OS type volumes, current revision number, etc.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfilesListByResourceGroup.json
*/
async function containerGroupProfilesListByResourceGroup() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId,
);
const resArray = new Array();
for await (let item of client.containerGroupProfiles.listByResourceGroup(
resourceGroupName,
)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
containerGroupProfilesListByResourceGroup();
}
main().catch(console.error);

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

@ -0,0 +1,43 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { ContainerInstanceManagementClient } from "@azure/arm-containerinstance";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Get a list of container group profiles in the specified subscription. This operation returns properties of each container group profile including containers, image registry credentials, restart policy, IP address type, OS type,volumes,current revision number, etc.
*
* @summary Get a list of container group profiles in the specified subscription. This operation returns properties of each container group profile including containers, image registry credentials, restart policy, IP address type, OS type,volumes,current revision number, etc.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfilesList.json
*/
async function containerGroupProfilesList() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId,
);
const resArray = new Array();
for await (let item of client.containerGroupProfiles.list()) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
containerGroupProfilesList();
}
main().catch(console.error);

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

@ -0,0 +1,53 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import {
ContainerGroupProfilePatch,
ContainerInstanceManagementClient,
} from "@azure/arm-containerinstance";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Patches container group profile with specified properties.
*
* @summary Patches container group profile with specified properties.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfilesPatch.json
*/
async function containerGroupProfilesPatch() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demoResource";
const containerGroupProfileName = "demo1";
const properties: ContainerGroupProfilePatch = {
tags: { tag1key: "tag1Value", tag2key: "tag2Value" },
};
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId,
);
const result = await client.containerGroupProfiles.patch(
resourceGroupName,
containerGroupProfileName,
properties,
);
console.log(result);
}
async function main() {
containerGroupProfilesPatch();
}
main().catch(console.error);

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

@ -0,0 +1,376 @@
/*
* 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 {
ContainerGroup,
ContainerInstanceManagementClient,
} from "@azure/arm-containerinstance";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Create or update container groups with specified configurations.
*
* @summary Create or update container groups with specified configurations.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupCreateConfidential.json
*/
async function confidentialContainerGroup() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupName = "demo1";
const containerGroup: ContainerGroup = {
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" }] },
location: "westeurope",
osType: "Linux",
sku: "Confidential",
};
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId,
);
const result = await client.containerGroups.beginCreateOrUpdateAndWait(
resourceGroupName,
containerGroupName,
containerGroup,
);
console.log(result);
}
/**
* This sample demonstrates how to Create or update container groups with specified configurations.
*
* @summary Create or update container groups with specified configurations.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupCreateOrUpdateStandbyPool.json
*/
async function containerGroupCreateOrUpdateWithStandbyPool() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupName = "demo1";
const containerGroup: ContainerGroup = {
containerGroupProfile: {
id: "/subscriptions/subid/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroupProfiles/democgp",
revision: 1,
},
containers: [
{ name: "demo1", configMap: { keyValuePairs: { newkey: "value" } } },
],
location: "west us",
standbyPoolProfile: {
id: "/subscriptions/subid/resourceGroups/demo/providers/Microsoft.StandbyPool/standbyContainerGroupPools/demopool",
},
};
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId,
);
const result = await client.containerGroups.beginCreateOrUpdateAndWait(
resourceGroupName,
containerGroupName,
containerGroup,
);
console.log(result);
}
/**
* This sample demonstrates how to Create or update container groups with specified configurations.
*
* @summary Create or update container groups with specified configurations.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupExtensions.json
*/
async function containerGroupCreateWithExtensions() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupName = "demo1";
const containerGroup: ContainerGroup = {
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" }] },
location: "eastus2",
osType: "Linux",
subnetIds: [
{
id: "/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-rg-vnet/subnets/test-subnet",
},
],
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",
},
],
};
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId,
);
const result = await client.containerGroups.beginCreateOrUpdateAndWait(
resourceGroupName,
containerGroupName,
containerGroup,
);
console.log(result);
}
/**
* This sample demonstrates how to Create or update container groups with specified configurations.
*
* @summary Create or update container groups with specified configurations.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupEncryptionProperties.json
*/
async function containerGroupWithEncryptionProperties() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupName = "demo1";
const containerGroup: ContainerGroup = {
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",
},
identity: {
type: "UserAssigned",
userAssignedIdentities: {
"/subscriptions/00000000000000000000000000000000/resourcegroups/testRg/providers/MicrosoftManagedIdentity/userAssignedIdentities/containerGroupIdentity":
{},
},
},
imageRegistryCredentials: [],
ipAddress: { type: "Public", ports: [{ port: 80, protocol: "TCP" }] },
location: "eastus2",
osType: "Linux",
};
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId,
);
const result = await client.containerGroups.beginCreateOrUpdateAndWait(
resourceGroupName,
containerGroupName,
containerGroup,
);
console.log(result);
}
/**
* This sample demonstrates how to Create or update container groups with specified configurations.
*
* @summary Create or update container groups with specified configurations.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsCreateOrUpdate.json
*/
async function containerGroupsCreateOrUpdate() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupName = "demo1";
const containerGroup: ContainerGroup = {
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: { testKey: "test-metadata-value" },
workspaceId: "workspaceid",
workspaceKey: "workspaceKey",
workspaceResourceId:
"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/microsoft.operationalinsights/workspaces/workspace",
},
},
dnsConfig: {
nameServers: ["1.1.1.1"],
options: "ndots:2",
searchDomains: "cluster.local svc.cluster.local",
},
identity: {
type: "SystemAssigned, UserAssigned",
userAssignedIdentities: {
"/subscriptions/00000000000000000000000000000000/resourceGroups/myResourceGroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/identityName":
{},
},
},
imageRegistryCredentials: [],
ipAddress: {
type: "Public",
autoGeneratedDomainNameLabelScope: "Unsecure",
dnsNameLabel: "dnsnamelabel1",
ports: [{ port: 80, protocol: "TCP" }],
},
location: "west us",
osType: "Linux",
subnetIds: [
{
id: "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('vnetName'), parameters('subnetName'))]",
},
],
volumes: [
{
name: "volume1",
azureFile: {
shareName: "shareName",
storageAccountKey: "accountKey",
storageAccountName: "accountName",
},
},
{ name: "volume2", emptyDir: {} },
{
name: "volume3",
secret: {
secretKey1: "SecretValue1InBase64",
secretKey2: "SecretValue2InBase64",
},
},
],
};
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId,
);
const result = await client.containerGroups.beginCreateOrUpdateAndWait(
resourceGroupName,
containerGroupName,
containerGroup,
);
console.log(result);
}
/**
* This sample demonstrates how to Create or update container groups with specified configurations.
*
* @summary Create or update container groups with specified configurations.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsCreatePriority.json
*/
async function containerGroupsCreateWithPriority() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupName = "demo1";
const containerGroup: ContainerGroup = {
containers: [
{
name: "test-container-001",
command: ["/bin/sh", "-c", "sleep 10"],
image: "alpine:latest",
resources: { requests: { cpu: 1, memoryInGB: 1 } },
},
],
location: "eastus",
osType: "Linux",
priority: "Spot",
restartPolicy: "Never",
sku: "Standard",
};
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId,
);
const result = await client.containerGroups.beginCreateOrUpdateAndWait(
resourceGroupName,
containerGroupName,
containerGroup,
);
console.log(result);
}
async function main() {
confidentialContainerGroup();
containerGroupCreateOrUpdateWithStandbyPool();
containerGroupCreateWithExtensions();
containerGroupWithEncryptionProperties();
containerGroupsCreateOrUpdate();
containerGroupsCreateWithPriority();
}
main().catch(console.error);

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

@ -0,0 +1,46 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { ContainerInstanceManagementClient } from "@azure/arm-containerinstance";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Delete the specified container group in the specified subscription and resource group. The operation does not delete other resources provided by the user, such as volumes.
*
* @summary Delete the specified container group in the specified subscription and resource group. The operation does not delete other resources provided by the user, such as volumes.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsDelete.json
*/
async function containerGroupsDelete() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupName = "demo1";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId,
);
const result = await client.containerGroups.beginDeleteAndWait(
resourceGroupName,
containerGroupName,
);
console.log(result);
}
async function main() {
containerGroupsDelete();
}
main().catch(console.error);

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

@ -0,0 +1,98 @@
/*
* 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 { ContainerInstanceManagementClient } from "@azure/arm-containerinstance";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Gets the properties of the specified container group in the specified subscription and resource group. The operation returns the properties of each container group including containers, image registry credentials, restart policy, IP address type, OS type, state, and volumes.
*
* @summary Gets the properties of the specified container group in the specified subscription and resource group. The operation returns the properties of each container group including containers, image registry credentials, restart policy, IP address type, OS type, state, and volumes.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsGetPriority.json
*/
async function containerGroupsGetWithPriority() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupName = "demo1";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId,
);
const result = await client.containerGroups.get(
resourceGroupName,
containerGroupName,
);
console.log(result);
}
/**
* This sample demonstrates how to Gets the properties of the specified container group in the specified subscription and resource group. The operation returns the properties of each container group including containers, image registry credentials, restart policy, IP address type, OS type, state, and volumes.
*
* @summary Gets the properties of the specified container group in the specified subscription and resource group. The operation returns the properties of each container group including containers, image registry credentials, restart policy, IP address type, OS type, state, and volumes.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsGet_Failed.json
*/
async function containerGroupsGetFailed() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupName = "demo1";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId,
);
const result = await client.containerGroups.get(
resourceGroupName,
containerGroupName,
);
console.log(result);
}
/**
* This sample demonstrates how to Gets the properties of the specified container group in the specified subscription and resource group. The operation returns the properties of each container group including containers, image registry credentials, restart policy, IP address type, OS type, state, and volumes.
*
* @summary Gets the properties of the specified container group in the specified subscription and resource group. The operation returns the properties of each container group including containers, image registry credentials, restart policy, IP address type, OS type, state, and volumes.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsGet_Succeeded.json
*/
async function containerGroupsGetSucceeded() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupName = "demo1";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId,
);
const result = await client.containerGroups.get(
resourceGroupName,
containerGroupName,
);
console.log(result);
}
async function main() {
containerGroupsGetWithPriority();
containerGroupsGetFailed();
containerGroupsGetSucceeded();
}
main().catch(console.error);

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

@ -0,0 +1,47 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { ContainerInstanceManagementClient } from "@azure/arm-containerinstance";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Get a list of container groups in a specified subscription and resource group. This operation returns properties of each container group including containers, image registry credentials, restart policy, IP address type, OS type, state, and volumes.
*
* @summary Get a list of container groups in a specified subscription and resource group. This operation returns properties of each container group including containers, image registry credentials, restart policy, IP address type, OS type, state, and volumes.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsListByResourceGroup.json
*/
async function containerGroupsListByResourceGroup() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId,
);
const resArray = new Array();
for await (let item of client.containerGroups.listByResourceGroup(
resourceGroupName,
)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
containerGroupsListByResourceGroup();
}
main().catch(console.error);

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

@ -0,0 +1,43 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { ContainerInstanceManagementClient } from "@azure/arm-containerinstance";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Get a list of container groups in the specified subscription. This operation returns properties of each container group including containers, image registry credentials, restart policy, IP address type, OS type, state, and volumes.
*
* @summary Get a list of container groups in the specified subscription. This operation returns properties of each container group including containers, image registry credentials, restart policy, IP address type, OS type, state, and volumes.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsList.json
*/
async function containerGroupsList() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId,
);
const resArray = new Array();
for await (let item of client.containerGroups.list()) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
containerGroupsList();
}
main().catch(console.error);

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

@ -0,0 +1,46 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { ContainerInstanceManagementClient } from "@azure/arm-containerinstance";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Restarts all containers in a container group in place. If container image has updates, new image will be downloaded.
*
* @summary Restarts all containers in a container group in place. If container image has updates, new image will be downloaded.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsRestart.json
*/
async function containerRestart() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupName = "demo1";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId,
);
const result = await client.containerGroups.beginRestartAndWait(
resourceGroupName,
containerGroupName,
);
console.log(result);
}
async function main() {
containerRestart();
}
main().catch(console.error);

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

@ -0,0 +1,46 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { ContainerInstanceManagementClient } from "@azure/arm-containerinstance";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Starts all containers in a container group. Compute resources will be allocated and billing will start.
*
* @summary Starts all containers in a container group. Compute resources will be allocated and billing will start.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsStart.json
*/
async function containerStart() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupName = "demo1";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId,
);
const result = await client.containerGroups.beginStartAndWait(
resourceGroupName,
containerGroupName,
);
console.log(result);
}
async function main() {
containerStart();
}
main().catch(console.error);

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

@ -0,0 +1,46 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { ContainerInstanceManagementClient } from "@azure/arm-containerinstance";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Stops all containers in a container group. Compute resources will be deallocated and billing will stop.
*
* @summary Stops all containers in a container group. Compute resources will be deallocated and billing will stop.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsStop.json
*/
async function containerStop() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupName = "demo1";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId,
);
const result = await client.containerGroups.stop(
resourceGroupName,
containerGroupName,
);
console.log(result);
}
async function main() {
containerStop();
}
main().catch(console.error);

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

@ -0,0 +1,53 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import {
Resource,
ContainerInstanceManagementClient,
} from "@azure/arm-containerinstance";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Updates container group tags with specified values.
*
* @summary Updates container group tags with specified values.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsUpdate.json
*/
async function containerGroupsUpdate() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demoResource";
const containerGroupName = "demo1";
const resource: Resource = {
tags: { tag1key: "tag1Value", tag2key: "tag2Value" },
};
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId,
);
const result = await client.containerGroups.update(
resourceGroupName,
containerGroupName,
resource,
);
console.log(result);
}
async function main() {
containerGroupsUpdate();
}
main().catch(console.error);

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

@ -0,0 +1,48 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { ContainerInstanceManagementClient } from "@azure/arm-containerinstance";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Attach to the output stream of a specific container instance in a specified resource group and container group.
*
* @summary Attach to the output stream of a specific container instance in a specified resource group and container group.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerAttach.json
*/
async function containerAttach() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupName = "demo1";
const containerName = "container1";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId,
);
const result = await client.containers.attach(
resourceGroupName,
containerGroupName,
containerName,
);
console.log(result);
}
async function main() {
containerAttach();
}
main().catch(console.error);

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

@ -0,0 +1,56 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import {
ContainerExecRequest,
ContainerInstanceManagementClient,
} from "@azure/arm-containerinstance";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Executes a command for a specific container instance in a specified resource group and container group.
*
* @summary Executes a command for a specific container instance in a specified resource group and container group.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerExec.json
*/
async function containerExec() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupName = "demo1";
const containerName = "container1";
const containerExecRequest: ContainerExecRequest = {
command: "/bin/bash",
terminalSize: { cols: 12, rows: 12 },
};
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId,
);
const result = await client.containers.executeCommand(
resourceGroupName,
containerGroupName,
containerName,
containerExecRequest,
);
console.log(result);
}
async function main() {
containerExec();
}
main().catch(console.error);

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

@ -0,0 +1,54 @@
/*
* 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 {
ContainersListLogsOptionalParams,
ContainerInstanceManagementClient,
} from "@azure/arm-containerinstance";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Get the logs for a specified container instance in a specified resource group and container group.
*
* @summary Get the logs for a specified container instance in a specified resource group and container group.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerListLogs.json
*/
async function containerListLogs() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupName = "demo1";
const containerName = "container1";
const tail = 10;
const options: ContainersListLogsOptionalParams = { tail };
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId,
);
const result = await client.containers.listLogs(
resourceGroupName,
containerGroupName,
containerName,
options,
);
console.log(result);
}
async function main() {
containerListLogs();
}
main().catch(console.error);

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

@ -0,0 +1,44 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { ContainerInstanceManagementClient } from "@azure/arm-containerinstance";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Get the list of cached images on specific OS type for a subscription in a region.
*
* @summary Get the list of cached images on specific OS type for a subscription in a region.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/CachedImagesList.json
*/
async function cachedImages() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const location = "westcentralus";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId,
);
const resArray = new Array();
for await (let item of client.location.listCachedImages(location)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
cachedImages();
}
main().catch(console.error);

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

@ -0,0 +1,44 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { ContainerInstanceManagementClient } from "@azure/arm-containerinstance";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Get the list of CPU/memory/GPU capabilities of a region.
*
* @summary Get the list of CPU/memory/GPU capabilities of a region.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/CapabilitiesList.json
*/
async function getCapabilities() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const location = "westus";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId,
);
const resArray = new Array();
for await (let item of client.location.listCapabilities(location)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
getCapabilities();
}
main().catch(console.error);

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

@ -0,0 +1,44 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { ContainerInstanceManagementClient } from "@azure/arm-containerinstance";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Get the usage for a subscription
*
* @summary Get the usage for a subscription
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupUsage.json
*/
async function containerUsage() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const location = "westcentralus";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId,
);
const resArray = new Array();
for await (let item of client.location.listUsage(location)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
containerUsage();
}
main().catch(console.error);

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

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

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

@ -0,0 +1,48 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { ContainerInstanceManagementClient } from "@azure/arm-containerinstance";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Delete container group virtual network association links. The operation does not delete other resources provided by the user.
*
* @summary Delete container group virtual network association links. The operation does not delete other resources provided by the user.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/SubnetServiceAssociationLinkDelete.json
*/
async function subnetServiceAssociationLinkDelete() {
const subscriptionId =
process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const virtualNetworkName = "demo2";
const subnetName = "demo3";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(
credential,
subscriptionId,
);
const result = await client.subnetServiceAssociationLink.beginDeleteAndWait(
resourceGroupName,
virtualNetworkName,
subnetName,
);
console.log(result);
}
async function main() {
subnetServiceAssociationLinkDelete();
}
main().catch(console.error);

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

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

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

@ -11,7 +11,7 @@ import * as coreRestPipeline from "@azure/core-rest-pipeline";
import {
PipelineRequest,
PipelineResponse,
SendRequest
SendRequest,
} from "@azure/core-rest-pipeline";
import * as coreAuth from "@azure/core-auth";
import {
@ -19,14 +19,18 @@ import {
OperationsImpl,
LocationImpl,
ContainersImpl,
SubnetServiceAssociationLinkImpl
SubnetServiceAssociationLinkImpl,
ContainerGroupProfilesImpl,
ContainerGroupProfileOperationsImpl,
} from "./operations";
import {
ContainerGroups,
Operations,
Location,
Containers,
SubnetServiceAssociationLink
SubnetServiceAssociationLink,
ContainerGroupProfiles,
ContainerGroupProfileOperations,
} from "./operationsInterfaces";
import { ContainerInstanceManagementClientOptionalParams } from "./models";
@ -38,14 +42,13 @@ export class ContainerInstanceManagementClient extends coreClient.ServiceClient
/**
* Initializes a new instance of the ContainerInstanceManagementClient class.
* @param credentials Subscription credentials which uniquely identify client subscription.
* @param subscriptionId Subscription credentials which uniquely identify Microsoft Azure subscription.
* The subscription ID forms part of the URI for every service call.
* @param subscriptionId The ID of the target subscription. The value must be an UUID.
* @param options The parameter options
*/
constructor(
credentials: coreAuth.TokenCredential,
subscriptionId: string,
options?: ContainerInstanceManagementClientOptionalParams
options?: ContainerInstanceManagementClientOptionalParams,
) {
if (credentials === undefined) {
throw new Error("'credentials' cannot be null");
@ -60,10 +63,10 @@ export class ContainerInstanceManagementClient extends coreClient.ServiceClient
}
const defaults: ContainerInstanceManagementClientOptionalParams = {
requestContentType: "application/json; charset=utf-8",
credential: credentials
credential: credentials,
};
const packageDetails = `azsdk-js-arm-containerinstance/9.1.1`;
const packageDetails = `azsdk-js-arm-containerinstance/9.2.0-beta.1`;
const userAgentPrefix =
options.userAgentOptions && options.userAgentOptions.userAgentPrefix
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
@ -73,20 +76,21 @@ export class ContainerInstanceManagementClient extends coreClient.ServiceClient
...defaults,
...options,
userAgentOptions: {
userAgentPrefix
userAgentPrefix,
},
endpoint:
options.endpoint ?? options.baseUri ?? "https://management.azure.com"
options.endpoint ?? options.baseUri ?? "https://management.azure.com",
};
super(optionsWithDefaults);
let bearerTokenAuthenticationPolicyFound: boolean = false;
if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) {
const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies();
const pipelinePolicies: coreRestPipeline.PipelinePolicy[] =
options.pipeline.getOrderedPolicies();
bearerTokenAuthenticationPolicyFound = pipelinePolicies.some(
(pipelinePolicy) =>
pipelinePolicy.name ===
coreRestPipeline.bearerTokenAuthenticationPolicyName
coreRestPipeline.bearerTokenAuthenticationPolicyName,
);
}
if (
@ -96,7 +100,7 @@ export class ContainerInstanceManagementClient extends coreClient.ServiceClient
!bearerTokenAuthenticationPolicyFound
) {
this.pipeline.removePolicy({
name: coreRestPipeline.bearerTokenAuthenticationPolicyName
name: coreRestPipeline.bearerTokenAuthenticationPolicyName,
});
this.pipeline.addPolicy(
coreRestPipeline.bearerTokenAuthenticationPolicy({
@ -106,9 +110,9 @@ export class ContainerInstanceManagementClient extends coreClient.ServiceClient
`${optionsWithDefaults.endpoint}/.default`,
challengeCallbacks: {
authorizeRequestOnChallenge:
coreClient.authorizeRequestOnClaimChallenge
}
})
coreClient.authorizeRequestOnClaimChallenge,
},
}),
);
}
// Parameter assignments
@ -116,14 +120,17 @@ export class ContainerInstanceManagementClient extends coreClient.ServiceClient
// Assigning values to Constant parameters
this.$host = options.$host || "https://management.azure.com";
this.apiVersion = options.apiVersion || "2023-05-01";
this.apiVersion = options.apiVersion || "2024-05-01-preview";
this.containerGroups = new ContainerGroupsImpl(this);
this.operations = new OperationsImpl(this);
this.location = new LocationImpl(this);
this.containers = new ContainersImpl(this);
this.subnetServiceAssociationLink = new SubnetServiceAssociationLinkImpl(
this
this,
);
this.containerGroupProfiles = new ContainerGroupProfilesImpl(this);
this.containerGroupProfileOperations =
new ContainerGroupProfileOperationsImpl(this);
this.addCustomApiVersionPolicy(options.apiVersion);
}
@ -136,7 +143,7 @@ export class ContainerInstanceManagementClient extends coreClient.ServiceClient
name: "CustomApiVersionPolicy",
async sendRequest(
request: PipelineRequest,
next: SendRequest
next: SendRequest,
): Promise<PipelineResponse> {
const param = request.url.split("?");
if (param.length > 1) {
@ -150,7 +157,7 @@ export class ContainerInstanceManagementClient extends coreClient.ServiceClient
request.url = param[0] + "?" + newParams.join("&");
}
return next(request);
}
},
};
this.pipeline.addPolicy(apiVersionPolicy);
}
@ -160,4 +167,6 @@ export class ContainerInstanceManagementClient extends coreClient.ServiceClient
location: Location;
containers: Containers;
subnetServiceAssociationLink: SubnetServiceAssociationLink;
containerGroupProfiles: ContainerGroupProfiles;
containerGroupProfileOperations: ContainerGroupProfileOperations;
}

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

@ -28,15 +28,15 @@ export function createLroSpec<T>(inputs: {
sendInitialRequest: () => sendOperationFn(args, spec),
sendPollRequest: (
path: string,
options?: { abortSignal?: AbortSignalLike }
options?: { abortSignal?: AbortSignalLike },
) => {
const { requestBody, ...restSpec } = spec;
return sendOperationFn(args, {
...restSpec,
httpMethod: "GET",
path,
abortSignal: options?.abortSignal
abortSignal: options?.abortSignal,
});
}
},
};
}

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

@ -65,7 +65,7 @@ export interface ContainerGroupProperties {
/** The IP address type of the container group. */
ipAddress?: IpAddress;
/** The operating system type required by the containers in the container group. */
osType: OperatingSystemTypes;
osType?: OperatingSystemTypes;
/** The list of volumes that can be mounted by containers in this container group. */
volumes?: Volume[];
/**
@ -91,6 +91,15 @@ export interface ContainerGroupProperties {
confidentialComputeProperties?: ConfidentialComputeProperties;
/** The priority of the container group. */
priority?: ContainerGroupPriority;
/** The reference container group profile properties. */
containerGroupProfile?: ContainerGroupProfileReferenceDefinition;
/** The reference standby pool profile properties. */
standbyPoolProfile?: StandbyPoolProfileDefinition;
/**
* The flag indicating whether the container group is created by standby pool.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly isCreatedFromStandbyPool?: boolean;
}
/** Identity for the container group. */
@ -130,7 +139,7 @@ export interface Container {
/** The user-provided name of the container instance. */
name: string;
/** The name of the image used to create the container instance. */
image: string;
image?: string;
/** The commands to execute within the container instance in exec form. */
command?: string[];
/** The exposed ports on the container instance. */
@ -143,7 +152,7 @@ export interface Container {
*/
readonly instanceView?: ContainerPropertiesInstanceView;
/** The resource requirements of the container instance. */
resources: ResourceRequirements;
resources?: ResourceRequirements;
/** The volume mounts available to the container instance. */
volumeMounts?: VolumeMount[];
/** The liveness probe. */
@ -152,6 +161,8 @@ export interface Container {
readinessProbe?: ContainerProbe;
/** The container security properties. */
securityContext?: SecurityContextDefinition;
/** The config map. */
configMap?: ConfigMap;
}
/** The port exposed on the container instance. */
@ -373,6 +384,12 @@ export interface SecurityContextCapabilitiesDefinition {
drop?: string[];
}
/** The container config map. */
export interface ConfigMap {
/** The key value pairs dictionary in the config map. */
keyValuePairs?: { [propertyName: string]: string };
}
/** Image registry credential. */
export interface ImageRegistryCredential {
/** The Docker image registry server without a protocol such as "http" and "https". */
@ -579,6 +596,22 @@ export interface ConfidentialComputeProperties {
ccePolicy?: string;
}
/** The container group profile reference. */
export interface ContainerGroupProfileReferenceDefinition {
/** The container group profile reference id.This will be an ARM resource id in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroupProfiles/{containerGroupProfileName}'. */
id?: string;
/** The container group profile reference revision. */
revision?: number;
}
/** The standby pool profile reference. */
export interface StandbyPoolProfileDefinition {
/** The standby pool profile reference id.This will be an ARM resource id in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyPoolName}'. */
id?: string;
/** The flag to determine whether ACI should fail the create request if the container group can not be obtained from standby pool. */
failContainerGroupCreateOnReuseFailure?: boolean;
}
/** An error response from the Container Instance service. */
export interface CloudError {
/** An error response from the Container Instance service. */
@ -796,15 +829,75 @@ export interface CapabilitiesCapabilities {
readonly maxGpuCount?: number;
}
/** The container group profile list response that contains the container group profile properties. */
export interface ContainerGroupProfileListResult {
/** The list of container group profiles. */
value?: ContainerGroupProfile[];
/** The URI to fetch the next page of container group profiles. */
nextLink?: string;
}
/** The container group profile properties */
export interface ContainerGroupProfileProperties {
/** The containers within the container group. */
containers: Container[];
/** The image registry credentials by which the container group is created from. */
imageRegistryCredentials?: ImageRegistryCredential[];
/**
* Restart policy for all containers within the container group.
* - `Always` Always restart
* - `OnFailure` Restart on failure
* - `Never` Never restart
*
*/
restartPolicy?: ContainerGroupRestartPolicy;
/** The IP address type of the container group. */
ipAddress?: IpAddress;
/** The operating system type required by the containers in the container group. */
osType: OperatingSystemTypes;
/** The list of volumes that can be mounted by containers in this container group. */
volumes?: Volume[];
/** The diagnostic information for a container group. */
diagnostics?: ContainerGroupDiagnostics;
/** The SKU for a container group. */
sku?: ContainerGroupSku;
/** The encryption properties for a container group. */
encryptionProperties?: EncryptionProperties;
/** The init containers for a container group. */
initContainers?: InitContainerDefinition[];
/** extensions used by virtual kubelet */
extensions?: DeploymentExtensionSpec[];
/** The properties for confidential container group */
confidentialComputeProperties?: ConfidentialComputeProperties;
/** The priority of the container group. */
priority?: ContainerGroupPriority;
/**
* The container group profile current revision number. This only appears in the response.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly revision?: number;
}
/** Properties of container group profile that need to be patched */
export interface ContainerGroupProfilePatch {
/** Resource tags. */
tags?: { [propertyName: string]: string };
}
/** A container group. */
export interface ContainerGroup extends Resource, ContainerGroupProperties {}
/** A container group profile. */
export interface ContainerGroupProfile
extends Resource,
ContainerGroupProfileProperties {}
/** Known values of {@link ContainerNetworkProtocol} that the service accepts. */
export enum KnownContainerNetworkProtocol {
/** TCP */
TCP = "TCP",
/** UDP */
UDP = "UDP"
UDP = "UDP",
}
/**
@ -824,7 +917,7 @@ export enum KnownGpuSku {
/** P100 */
P100 = "P100",
/** V100 */
V100 = "V100"
V100 = "V100",
}
/**
@ -843,7 +936,7 @@ export enum KnownScheme {
/** Http */
Http = "http",
/** Https */
Https = "https"
Https = "https",
}
/**
@ -863,7 +956,7 @@ export enum KnownContainerGroupRestartPolicy {
/** OnFailure */
OnFailure = "OnFailure",
/** Never */
Never = "Never"
Never = "Never",
}
/**
@ -882,7 +975,7 @@ export enum KnownContainerGroupNetworkProtocol {
/** TCP */
TCP = "TCP",
/** UDP */
UDP = "UDP"
UDP = "UDP",
}
/**
@ -900,7 +993,7 @@ export enum KnownContainerGroupIpAddressType {
/** Public */
Public = "Public",
/** Private */
Private = "Private"
Private = "Private",
}
/**
@ -924,7 +1017,7 @@ export enum KnownDnsNameLabelReusePolicy {
/** ResourceGroupReuse */
ResourceGroupReuse = "ResourceGroupReuse",
/** Noreuse */
Noreuse = "Noreuse"
Noreuse = "Noreuse",
}
/**
@ -945,7 +1038,7 @@ export enum KnownOperatingSystemTypes {
/** Windows */
Windows = "Windows",
/** Linux */
Linux = "Linux"
Linux = "Linux",
}
/**
@ -963,7 +1056,7 @@ export enum KnownLogAnalyticsLogType {
/** ContainerInsights */
ContainerInsights = "ContainerInsights",
/** ContainerInstanceLogs */
ContainerInstanceLogs = "ContainerInstanceLogs"
ContainerInstanceLogs = "ContainerInstanceLogs",
}
/**
@ -983,7 +1076,7 @@ export enum KnownContainerGroupSku {
/** Dedicated */
Dedicated = "Dedicated",
/** Confidential */
Confidential = "Confidential"
Confidential = "Confidential",
}
/**
@ -1002,7 +1095,7 @@ export enum KnownContainerGroupPriority {
/** Regular */
Regular = "Regular",
/** Spot */
Spot = "Spot"
Spot = "Spot",
}
/**
@ -1020,7 +1113,7 @@ export enum KnownContainerInstanceOperationsOrigin {
/** User */
User = "User",
/** System */
System = "System"
System = "System",
}
/**
@ -1051,7 +1144,8 @@ export interface ContainerGroupsListByResourceGroupOptionalParams
extends coreClient.OperationOptions {}
/** Contains response data for the listByResourceGroup operation. */
export type ContainerGroupsListByResourceGroupResponse = ContainerGroupListResult;
export type ContainerGroupsListByResourceGroupResponse =
ContainerGroupListResult;
/** Optional parameters. */
export interface ContainerGroupsGetOptionalParams
@ -1135,7 +1229,8 @@ export interface ContainerGroupsListByResourceGroupNextOptionalParams
extends coreClient.OperationOptions {}
/** Contains response data for the listByResourceGroupNext operation. */
export type ContainerGroupsListByResourceGroupNextResponse = ContainerGroupListResult;
export type ContainerGroupsListByResourceGroupNextResponse =
ContainerGroupListResult;
/** Optional parameters. */
export interface OperationsListOptionalParams
@ -1221,6 +1316,88 @@ export interface SubnetServiceAssociationLinkDeleteOptionalParams
resumeFrom?: string;
}
/** Optional parameters. */
export interface ContainerGroupProfilesListOptionalParams
extends coreClient.OperationOptions {}
/** Contains response data for the list operation. */
export type ContainerGroupProfilesListResponse =
ContainerGroupProfileListResult;
/** Optional parameters. */
export interface ContainerGroupProfilesListByResourceGroupOptionalParams
extends coreClient.OperationOptions {}
/** Contains response data for the listByResourceGroup operation. */
export type ContainerGroupProfilesListByResourceGroupResponse =
ContainerGroupProfileListResult;
/** Optional parameters. */
export interface ContainerGroupProfilesGetOptionalParams
extends coreClient.OperationOptions {}
/** Contains response data for the get operation. */
export type ContainerGroupProfilesGetResponse = ContainerGroupProfile;
/** Optional parameters. */
export interface ContainerGroupProfilesCreateOrUpdateOptionalParams
extends coreClient.OperationOptions {}
/** Contains response data for the createOrUpdate operation. */
export type ContainerGroupProfilesCreateOrUpdateResponse =
ContainerGroupProfile;
/** Optional parameters. */
export interface ContainerGroupProfilesPatchOptionalParams
extends coreClient.OperationOptions {}
/** Contains response data for the patch operation. */
export type ContainerGroupProfilesPatchResponse = ContainerGroupProfile;
/** Optional parameters. */
export interface ContainerGroupProfilesDeleteOptionalParams
extends coreClient.OperationOptions {}
/** Optional parameters. */
export interface ContainerGroupProfilesListNextOptionalParams
extends coreClient.OperationOptions {}
/** Contains response data for the listNext operation. */
export type ContainerGroupProfilesListNextResponse =
ContainerGroupProfileListResult;
/** Optional parameters. */
export interface ContainerGroupProfilesListByResourceGroupNextOptionalParams
extends coreClient.OperationOptions {}
/** Contains response data for the listByResourceGroupNext operation. */
export type ContainerGroupProfilesListByResourceGroupNextResponse =
ContainerGroupProfileListResult;
/** Optional parameters. */
export interface ContainerGroupProfileListAllRevisionsOptionalParams
extends coreClient.OperationOptions {}
/** Contains response data for the listAllRevisions operation. */
export type ContainerGroupProfileListAllRevisionsResponse =
ContainerGroupProfileListResult;
/** Optional parameters. */
export interface ContainerGroupProfileGetByRevisionNumberOptionalParams
extends coreClient.OperationOptions {}
/** Contains response data for the getByRevisionNumber operation. */
export type ContainerGroupProfileGetByRevisionNumberResponse =
ContainerGroupProfile;
/** Optional parameters. */
export interface ContainerGroupProfileListAllRevisionsNextOptionalParams
extends coreClient.OperationOptions {}
/** Contains response data for the listAllRevisionsNext operation. */
export type ContainerGroupProfileListAllRevisionsNextResponse =
ContainerGroupProfileListResult;
/** Optional parameters. */
export interface ContainerInstanceManagementClientOptionalParams
extends coreClient.ServiceClientOptions {

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

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

@ -9,12 +9,14 @@
import {
OperationParameter,
OperationURLParameter,
OperationQueryParameter
OperationQueryParameter,
} from "@azure/core-client";
import {
ContainerGroup as ContainerGroupMapper,
Resource as ResourceMapper,
ContainerExecRequest as ContainerExecRequestMapper
ContainerExecRequest as ContainerExecRequestMapper,
ContainerGroupProfile as ContainerGroupProfileMapper,
ContainerGroupProfilePatch as ContainerGroupProfilePatchMapper,
} from "../models/mappers";
export const accept: OperationParameter = {
@ -24,9 +26,9 @@ export const accept: OperationParameter = {
isConstant: true,
serializedName: "Accept",
type: {
name: "String"
}
}
name: "String",
},
},
};
export const $host: OperationURLParameter = {
@ -35,10 +37,10 @@ export const $host: OperationURLParameter = {
serializedName: "$host",
required: true,
type: {
name: "String"
}
name: "String",
},
},
skipEncoding: true
skipEncoding: true,
};
export const subscriptionId: OperationURLParameter = {
@ -47,32 +49,36 @@ export const subscriptionId: OperationURLParameter = {
serializedName: "subscriptionId",
required: true,
type: {
name: "String"
}
}
name: "Uuid",
},
},
};
export const apiVersion: OperationQueryParameter = {
parameterPath: "apiVersion",
mapper: {
defaultValue: "2023-05-01",
defaultValue: "2024-05-01-preview",
isConstant: true,
serializedName: "api-version",
type: {
name: "String"
}
}
name: "String",
},
},
};
export const resourceGroupName: OperationURLParameter = {
parameterPath: "resourceGroupName",
mapper: {
constraints: {
MaxLength: 90,
MinLength: 1,
},
serializedName: "resourceGroupName",
required: true,
type: {
name: "String"
}
}
name: "String",
},
},
};
export const containerGroupName: OperationURLParameter = {
@ -81,9 +87,9 @@ export const containerGroupName: OperationURLParameter = {
serializedName: "containerGroupName",
required: true,
type: {
name: "String"
}
}
name: "String",
},
},
};
export const contentType: OperationParameter = {
@ -93,19 +99,19 @@ export const contentType: OperationParameter = {
isConstant: true,
serializedName: "Content-Type",
type: {
name: "String"
}
}
name: "String",
},
},
};
export const containerGroup: OperationParameter = {
parameterPath: "containerGroup",
mapper: ContainerGroupMapper
mapper: ContainerGroupMapper,
};
export const resource: OperationParameter = {
parameterPath: "resource",
mapper: ResourceMapper
mapper: ResourceMapper,
};
export const nextLink: OperationURLParameter = {
@ -114,21 +120,24 @@ export const nextLink: OperationURLParameter = {
serializedName: "nextLink",
required: true,
type: {
name: "String"
}
name: "String",
},
},
skipEncoding: true
skipEncoding: true,
};
export const location: OperationURLParameter = {
parameterPath: "location",
mapper: {
constraints: {
MinLength: 1,
},
serializedName: "location",
required: true,
type: {
name: "String"
}
}
name: "String",
},
},
};
export const containerName: OperationURLParameter = {
@ -137,9 +146,9 @@ export const containerName: OperationURLParameter = {
serializedName: "containerName",
required: true,
type: {
name: "String"
}
}
name: "String",
},
},
};
export const tail: OperationQueryParameter = {
@ -147,9 +156,9 @@ export const tail: OperationQueryParameter = {
mapper: {
serializedName: "tail",
type: {
name: "Number"
}
}
name: "Number",
},
},
};
export const timestamps: OperationQueryParameter = {
@ -157,14 +166,14 @@ export const timestamps: OperationQueryParameter = {
mapper: {
serializedName: "timestamps",
type: {
name: "Boolean"
}
}
name: "Boolean",
},
},
};
export const containerExecRequest: OperationParameter = {
parameterPath: "containerExecRequest",
mapper: ContainerExecRequestMapper
mapper: ContainerExecRequestMapper,
};
export const virtualNetworkName: OperationURLParameter = {
@ -173,9 +182,9 @@ export const virtualNetworkName: OperationURLParameter = {
serializedName: "virtualNetworkName",
required: true,
type: {
name: "String"
}
}
name: "String",
},
},
};
export const subnetName: OperationURLParameter = {
@ -184,7 +193,44 @@ export const subnetName: OperationURLParameter = {
serializedName: "subnetName",
required: true,
type: {
name: "String"
}
}
name: "String",
},
},
};
export const containerGroupProfileName: OperationURLParameter = {
parameterPath: "containerGroupProfileName",
mapper: {
constraints: {
Pattern: new RegExp("^(?!.*--)[a-z0-9]([-a-z0-9]*[a-z0-9])?$"),
MaxLength: 63,
MinLength: 1,
},
serializedName: "containerGroupProfileName",
required: true,
type: {
name: "String",
},
},
};
export const containerGroupProfile: OperationParameter = {
parameterPath: "containerGroupProfile",
mapper: ContainerGroupProfileMapper,
};
export const properties: OperationParameter = {
parameterPath: "properties",
mapper: ContainerGroupProfilePatchMapper,
};
export const revisionNumber: OperationURLParameter = {
parameterPath: "revisionNumber",
mapper: {
serializedName: "revisionNumber",
required: true,
type: {
name: "String",
},
},
};

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

@ -0,0 +1,255 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging";
import { setContinuationToken } from "../pagingHelper";
import { ContainerGroupProfileOperations } from "../operationsInterfaces";
import * as coreClient from "@azure/core-client";
import * as Mappers from "../models/mappers";
import * as Parameters from "../models/parameters";
import { ContainerInstanceManagementClient } from "../containerInstanceManagementClient";
import {
ContainerGroupProfile,
ContainerGroupProfileListAllRevisionsNextOptionalParams,
ContainerGroupProfileListAllRevisionsOptionalParams,
ContainerGroupProfileListAllRevisionsResponse,
ContainerGroupProfileGetByRevisionNumberOptionalParams,
ContainerGroupProfileGetByRevisionNumberResponse,
ContainerGroupProfileListAllRevisionsNextResponse,
} from "../models";
/// <reference lib="esnext.asynciterable" />
/** Class containing ContainerGroupProfileOperations operations. */
export class ContainerGroupProfileOperationsImpl
implements ContainerGroupProfileOperations
{
private readonly client: ContainerInstanceManagementClient;
/**
* Initialize a new instance of the class ContainerGroupProfileOperations class.
* @param client Reference to the service client
*/
constructor(client: ContainerInstanceManagementClient) {
this.client = client;
}
/**
* Get a list of all the revisions of the specified container group profile in the given subscription
* and resource group. This operation returns properties of each revision of the specified container
* group profile including containers, image registry credentials, restart policy, IP address type, OS
* type volumes, revision number, etc.
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param containerGroupProfileName The name of the container group profile.
* @param options The options parameters.
*/
public listAllRevisions(
resourceGroupName: string,
containerGroupProfileName: string,
options?: ContainerGroupProfileListAllRevisionsOptionalParams,
): PagedAsyncIterableIterator<ContainerGroupProfile> {
const iter = this.listAllRevisionsPagingAll(
resourceGroupName,
containerGroupProfileName,
options,
);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: (settings?: PageSettings) => {
if (settings?.maxPageSize) {
throw new Error("maxPageSize is not supported by this operation.");
}
return this.listAllRevisionsPagingPage(
resourceGroupName,
containerGroupProfileName,
options,
settings,
);
},
};
}
private async *listAllRevisionsPagingPage(
resourceGroupName: string,
containerGroupProfileName: string,
options?: ContainerGroupProfileListAllRevisionsOptionalParams,
settings?: PageSettings,
): AsyncIterableIterator<ContainerGroupProfile[]> {
let result: ContainerGroupProfileListAllRevisionsResponse;
let continuationToken = settings?.continuationToken;
if (!continuationToken) {
result = await this._listAllRevisions(
resourceGroupName,
containerGroupProfileName,
options,
);
let page = result.value || [];
continuationToken = result.nextLink;
setContinuationToken(page, continuationToken);
yield page;
}
while (continuationToken) {
result = await this._listAllRevisionsNext(
resourceGroupName,
containerGroupProfileName,
continuationToken,
options,
);
continuationToken = result.nextLink;
let page = result.value || [];
setContinuationToken(page, continuationToken);
yield page;
}
}
private async *listAllRevisionsPagingAll(
resourceGroupName: string,
containerGroupProfileName: string,
options?: ContainerGroupProfileListAllRevisionsOptionalParams,
): AsyncIterableIterator<ContainerGroupProfile> {
for await (const page of this.listAllRevisionsPagingPage(
resourceGroupName,
containerGroupProfileName,
options,
)) {
yield* page;
}
}
/**
* Get a list of all the revisions of the specified container group profile in the given subscription
* and resource group. This operation returns properties of each revision of the specified container
* group profile including containers, image registry credentials, restart policy, IP address type, OS
* type volumes, revision number, etc.
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param containerGroupProfileName The name of the container group profile.
* @param options The options parameters.
*/
private _listAllRevisions(
resourceGroupName: string,
containerGroupProfileName: string,
options?: ContainerGroupProfileListAllRevisionsOptionalParams,
): Promise<ContainerGroupProfileListAllRevisionsResponse> {
return this.client.sendOperationRequest(
{ resourceGroupName, containerGroupProfileName, options },
listAllRevisionsOperationSpec,
);
}
/**
* Gets the properties of the specified revision of the container group profile in the given
* subscription and resource group. The operation returns the properties of container group profile
* including containers, image registry credentials, restart policy, IP address type, OS type, volumes,
* current revision number, etc.
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param containerGroupProfileName The name of the container group profile.
* @param revisionNumber The revision number of the container group profile.
* @param options The options parameters.
*/
getByRevisionNumber(
resourceGroupName: string,
containerGroupProfileName: string,
revisionNumber: string,
options?: ContainerGroupProfileGetByRevisionNumberOptionalParams,
): Promise<ContainerGroupProfileGetByRevisionNumberResponse> {
return this.client.sendOperationRequest(
{ resourceGroupName, containerGroupProfileName, revisionNumber, options },
getByRevisionNumberOperationSpec,
);
}
/**
* ListAllRevisionsNext
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param containerGroupProfileName The name of the container group profile.
* @param nextLink The nextLink from the previous successful call to the ListAllRevisions method.
* @param options The options parameters.
*/
private _listAllRevisionsNext(
resourceGroupName: string,
containerGroupProfileName: string,
nextLink: string,
options?: ContainerGroupProfileListAllRevisionsNextOptionalParams,
): Promise<ContainerGroupProfileListAllRevisionsNextResponse> {
return this.client.sendOperationRequest(
{ resourceGroupName, containerGroupProfileName, nextLink, options },
listAllRevisionsNextOperationSpec,
);
}
}
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
const listAllRevisionsOperationSpec: coreClient.OperationSpec = {
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroupProfiles/{containerGroupProfileName}/revisions",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ContainerGroupProfileListResult,
},
default: {
bodyMapper: Mappers.CloudError,
},
},
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.containerGroupProfileName,
],
headerParameters: [Parameters.accept],
serializer,
};
const getByRevisionNumberOperationSpec: coreClient.OperationSpec = {
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroupProfiles/{containerGroupProfileName}/revisions/{revisionNumber}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ContainerGroupProfile,
},
default: {
bodyMapper: Mappers.CloudError,
},
},
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.containerGroupProfileName,
Parameters.revisionNumber,
],
headerParameters: [Parameters.accept],
serializer,
};
const listAllRevisionsNextOperationSpec: coreClient.OperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ContainerGroupProfileListResult,
},
default: {
bodyMapper: Mappers.CloudError,
},
},
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.nextLink,
Parameters.containerGroupProfileName,
],
headerParameters: [Parameters.accept],
serializer,
};

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

@ -0,0 +1,485 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging";
import { setContinuationToken } from "../pagingHelper";
import { ContainerGroupProfiles } from "../operationsInterfaces";
import * as coreClient from "@azure/core-client";
import * as Mappers from "../models/mappers";
import * as Parameters from "../models/parameters";
import { ContainerInstanceManagementClient } from "../containerInstanceManagementClient";
import {
ContainerGroupProfile,
ContainerGroupProfilesListNextOptionalParams,
ContainerGroupProfilesListOptionalParams,
ContainerGroupProfilesListResponse,
ContainerGroupProfilesListByResourceGroupNextOptionalParams,
ContainerGroupProfilesListByResourceGroupOptionalParams,
ContainerGroupProfilesListByResourceGroupResponse,
ContainerGroupProfilesGetOptionalParams,
ContainerGroupProfilesGetResponse,
ContainerGroupProfilesCreateOrUpdateOptionalParams,
ContainerGroupProfilesCreateOrUpdateResponse,
ContainerGroupProfilePatch,
ContainerGroupProfilesPatchOptionalParams,
ContainerGroupProfilesPatchResponse,
ContainerGroupProfilesDeleteOptionalParams,
ContainerGroupProfilesListNextResponse,
ContainerGroupProfilesListByResourceGroupNextResponse,
} from "../models";
/// <reference lib="esnext.asynciterable" />
/** Class containing ContainerGroupProfiles operations. */
export class ContainerGroupProfilesImpl implements ContainerGroupProfiles {
private readonly client: ContainerInstanceManagementClient;
/**
* Initialize a new instance of the class ContainerGroupProfiles class.
* @param client Reference to the service client
*/
constructor(client: ContainerInstanceManagementClient) {
this.client = client;
}
/**
* Get a list of container group profiles in the specified subscription. This operation returns
* properties of each container group profile including containers, image registry credentials, restart
* policy, IP address type, OS type,volumes,current revision number, etc.
* @param options The options parameters.
*/
public list(
options?: ContainerGroupProfilesListOptionalParams,
): PagedAsyncIterableIterator<ContainerGroupProfile> {
const iter = this.listPagingAll(options);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: (settings?: PageSettings) => {
if (settings?.maxPageSize) {
throw new Error("maxPageSize is not supported by this operation.");
}
return this.listPagingPage(options, settings);
},
};
}
private async *listPagingPage(
options?: ContainerGroupProfilesListOptionalParams,
settings?: PageSettings,
): AsyncIterableIterator<ContainerGroupProfile[]> {
let result: ContainerGroupProfilesListResponse;
let continuationToken = settings?.continuationToken;
if (!continuationToken) {
result = await this._list(options);
let page = result.value || [];
continuationToken = result.nextLink;
setContinuationToken(page, continuationToken);
yield page;
}
while (continuationToken) {
result = await this._listNext(continuationToken, options);
continuationToken = result.nextLink;
let page = result.value || [];
setContinuationToken(page, continuationToken);
yield page;
}
}
private async *listPagingAll(
options?: ContainerGroupProfilesListOptionalParams,
): AsyncIterableIterator<ContainerGroupProfile> {
for await (const page of this.listPagingPage(options)) {
yield* page;
}
}
/**
* Get a list of container group profiles in a specified subscription and resource group. This
* operation returns properties of each container group profile including containers, image registry
* credentials, restart policy, IP address type, OS type volumes, current revision number, etc.
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param options The options parameters.
*/
public listByResourceGroup(
resourceGroupName: string,
options?: ContainerGroupProfilesListByResourceGroupOptionalParams,
): PagedAsyncIterableIterator<ContainerGroupProfile> {
const iter = this.listByResourceGroupPagingAll(resourceGroupName, options);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: (settings?: PageSettings) => {
if (settings?.maxPageSize) {
throw new Error("maxPageSize is not supported by this operation.");
}
return this.listByResourceGroupPagingPage(
resourceGroupName,
options,
settings,
);
},
};
}
private async *listByResourceGroupPagingPage(
resourceGroupName: string,
options?: ContainerGroupProfilesListByResourceGroupOptionalParams,
settings?: PageSettings,
): AsyncIterableIterator<ContainerGroupProfile[]> {
let result: ContainerGroupProfilesListByResourceGroupResponse;
let continuationToken = settings?.continuationToken;
if (!continuationToken) {
result = await this._listByResourceGroup(resourceGroupName, options);
let page = result.value || [];
continuationToken = result.nextLink;
setContinuationToken(page, continuationToken);
yield page;
}
while (continuationToken) {
result = await this._listByResourceGroupNext(
resourceGroupName,
continuationToken,
options,
);
continuationToken = result.nextLink;
let page = result.value || [];
setContinuationToken(page, continuationToken);
yield page;
}
}
private async *listByResourceGroupPagingAll(
resourceGroupName: string,
options?: ContainerGroupProfilesListByResourceGroupOptionalParams,
): AsyncIterableIterator<ContainerGroupProfile> {
for await (const page of this.listByResourceGroupPagingPage(
resourceGroupName,
options,
)) {
yield* page;
}
}
/**
* Get a list of container group profiles in the specified subscription. This operation returns
* properties of each container group profile including containers, image registry credentials, restart
* policy, IP address type, OS type,volumes,current revision number, etc.
* @param options The options parameters.
*/
private _list(
options?: ContainerGroupProfilesListOptionalParams,
): Promise<ContainerGroupProfilesListResponse> {
return this.client.sendOperationRequest({ options }, listOperationSpec);
}
/**
* Get a list of container group profiles in a specified subscription and resource group. This
* operation returns properties of each container group profile including containers, image registry
* credentials, restart policy, IP address type, OS type volumes, current revision number, etc.
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param options The options parameters.
*/
private _listByResourceGroup(
resourceGroupName: string,
options?: ContainerGroupProfilesListByResourceGroupOptionalParams,
): Promise<ContainerGroupProfilesListByResourceGroupResponse> {
return this.client.sendOperationRequest(
{ resourceGroupName, options },
listByResourceGroupOperationSpec,
);
}
/**
* Gets the properties of the specified container group profile in the specified subscription and
* resource group. The operation returns the properties of container group profile including
* containers, image registry credentials, restart policy, IP address type, OS type, volumes, current
* revision number, etc.
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param containerGroupProfileName The name of the container group profile.
* @param options The options parameters.
*/
get(
resourceGroupName: string,
containerGroupProfileName: string,
options?: ContainerGroupProfilesGetOptionalParams,
): Promise<ContainerGroupProfilesGetResponse> {
return this.client.sendOperationRequest(
{ resourceGroupName, containerGroupProfileName, options },
getOperationSpec,
);
}
/**
* Create or update container group profiles with specified configurations.
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param containerGroupProfileName The name of the container group profile.
* @param containerGroupProfile The properties of the container group profile to be created or updated.
* @param options The options parameters.
*/
createOrUpdate(
resourceGroupName: string,
containerGroupProfileName: string,
containerGroupProfile: ContainerGroupProfile,
options?: ContainerGroupProfilesCreateOrUpdateOptionalParams,
): Promise<ContainerGroupProfilesCreateOrUpdateResponse> {
return this.client.sendOperationRequest(
{
resourceGroupName,
containerGroupProfileName,
containerGroupProfile,
options,
},
createOrUpdateOperationSpec,
);
}
/**
* Patches container group profile with specified properties.
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param containerGroupProfileName The name of the container group profile.
* @param properties The container group profile properties that need to be updated.
* @param options The options parameters.
*/
patch(
resourceGroupName: string,
containerGroupProfileName: string,
properties: ContainerGroupProfilePatch,
options?: ContainerGroupProfilesPatchOptionalParams,
): Promise<ContainerGroupProfilesPatchResponse> {
return this.client.sendOperationRequest(
{ resourceGroupName, containerGroupProfileName, properties, options },
patchOperationSpec,
);
}
/**
* Delete the specified container group profile in the specified subscription and resource group. The
* operation does not delete other resources provided by the user, such as volumes.
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param containerGroupProfileName The name of the container group profile.
* @param options The options parameters.
*/
delete(
resourceGroupName: string,
containerGroupProfileName: string,
options?: ContainerGroupProfilesDeleteOptionalParams,
): Promise<void> {
return this.client.sendOperationRequest(
{ resourceGroupName, containerGroupProfileName, options },
deleteOperationSpec,
);
}
/**
* ListNext
* @param nextLink The nextLink from the previous successful call to the List method.
* @param options The options parameters.
*/
private _listNext(
nextLink: string,
options?: ContainerGroupProfilesListNextOptionalParams,
): Promise<ContainerGroupProfilesListNextResponse> {
return this.client.sendOperationRequest(
{ nextLink, options },
listNextOperationSpec,
);
}
/**
* ListByResourceGroupNext
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param nextLink The nextLink from the previous successful call to the ListByResourceGroup method.
* @param options The options parameters.
*/
private _listByResourceGroupNext(
resourceGroupName: string,
nextLink: string,
options?: ContainerGroupProfilesListByResourceGroupNextOptionalParams,
): Promise<ContainerGroupProfilesListByResourceGroupNextResponse> {
return this.client.sendOperationRequest(
{ resourceGroupName, nextLink, options },
listByResourceGroupNextOperationSpec,
);
}
}
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
const listOperationSpec: coreClient.OperationSpec = {
path: "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/containerGroupProfiles",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ContainerGroupProfileListResult,
},
default: {
bodyMapper: Mappers.CloudError,
},
},
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host, Parameters.subscriptionId],
headerParameters: [Parameters.accept],
serializer,
};
const listByResourceGroupOperationSpec: coreClient.OperationSpec = {
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroupProfiles",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ContainerGroupProfileListResult,
},
default: {
bodyMapper: Mappers.CloudError,
},
},
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
],
headerParameters: [Parameters.accept],
serializer,
};
const getOperationSpec: coreClient.OperationSpec = {
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroupProfiles/{containerGroupProfileName}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ContainerGroupProfile,
},
default: {
bodyMapper: Mappers.CloudError,
},
},
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.containerGroupProfileName,
],
headerParameters: [Parameters.accept],
serializer,
};
const createOrUpdateOperationSpec: coreClient.OperationSpec = {
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroupProfiles/{containerGroupProfileName}",
httpMethod: "PUT",
responses: {
200: {
bodyMapper: Mappers.ContainerGroupProfile,
},
201: {
bodyMapper: Mappers.ContainerGroupProfile,
},
default: {
bodyMapper: Mappers.CloudError,
},
},
requestBody: Parameters.containerGroupProfile,
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.containerGroupProfileName,
],
headerParameters: [Parameters.accept, Parameters.contentType],
mediaType: "json",
serializer,
};
const patchOperationSpec: coreClient.OperationSpec = {
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroupProfiles/{containerGroupProfileName}",
httpMethod: "PATCH",
responses: {
200: {
bodyMapper: Mappers.ContainerGroupProfile,
},
default: {
bodyMapper: Mappers.CloudError,
},
},
requestBody: Parameters.properties,
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.containerGroupProfileName,
],
headerParameters: [Parameters.accept, Parameters.contentType],
mediaType: "json",
serializer,
};
const deleteOperationSpec: coreClient.OperationSpec = {
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroupProfiles/{containerGroupProfileName}",
httpMethod: "DELETE",
responses: {
200: {},
204: {},
default: {
bodyMapper: Mappers.CloudError,
},
},
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.containerGroupProfileName,
],
headerParameters: [Parameters.accept],
serializer,
};
const listNextOperationSpec: coreClient.OperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ContainerGroupProfileListResult,
},
default: {
bodyMapper: Mappers.CloudError,
},
},
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.nextLink,
],
headerParameters: [Parameters.accept],
serializer,
};
const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ContainerGroupProfileListResult,
},
default: {
bodyMapper: Mappers.CloudError,
},
},
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.nextLink,
],
headerParameters: [Parameters.accept],
serializer,
};

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

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

@ -18,7 +18,7 @@ import {
ContainersExecuteCommandOptionalParams,
ContainersExecuteCommandResponse,
ContainersAttachOptionalParams,
ContainersAttachResponse
ContainersAttachResponse,
} from "../models";
/** Class containing Containers operations. */
@ -35,7 +35,7 @@ export class ContainersImpl implements Containers {
/**
* Get the logs for a specified container instance in a specified resource group and container group.
* @param resourceGroupName The name of the resource group.
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param containerGroupName The name of the container group.
* @param containerName The name of the container instance.
* @param options The options parameters.
@ -44,18 +44,18 @@ export class ContainersImpl implements Containers {
resourceGroupName: string,
containerGroupName: string,
containerName: string,
options?: ContainersListLogsOptionalParams
options?: ContainersListLogsOptionalParams,
): Promise<ContainersListLogsResponse> {
return this.client.sendOperationRequest(
{ resourceGroupName, containerGroupName, containerName, options },
listLogsOperationSpec
listLogsOperationSpec,
);
}
/**
* Executes a command for a specific container instance in a specified resource group and container
* group.
* @param resourceGroupName The name of the resource group.
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param containerGroupName The name of the container group.
* @param containerName The name of the container instance.
* @param containerExecRequest The request for the exec command.
@ -66,7 +66,7 @@ export class ContainersImpl implements Containers {
containerGroupName: string,
containerName: string,
containerExecRequest: ContainerExecRequest,
options?: ContainersExecuteCommandOptionalParams
options?: ContainersExecuteCommandOptionalParams,
): Promise<ContainersExecuteCommandResponse> {
return this.client.sendOperationRequest(
{
@ -74,16 +74,16 @@ export class ContainersImpl implements Containers {
containerGroupName,
containerName,
containerExecRequest,
options
options,
},
executeCommandOperationSpec
executeCommandOperationSpec,
);
}
/**
* Attach to the output stream of a specific container instance in a specified resource group and
* container group.
* @param resourceGroupName The name of the resource group.
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param containerGroupName The name of the container group.
* @param containerName The name of the container instance.
* @param options The options parameters.
@ -92,11 +92,11 @@ export class ContainersImpl implements Containers {
resourceGroupName: string,
containerGroupName: string,
containerName: string,
options?: ContainersAttachOptionalParams
options?: ContainersAttachOptionalParams,
): Promise<ContainersAttachResponse> {
return this.client.sendOperationRequest(
{ resourceGroupName, containerGroupName, containerName, options },
attachOperationSpec
attachOperationSpec,
);
}
}
@ -104,43 +104,41 @@ export class ContainersImpl implements Containers {
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
const listLogsOperationSpec: coreClient.OperationSpec = {
path:
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/containers/{containerName}/logs",
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/containers/{containerName}/logs",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.Logs
bodyMapper: Mappers.Logs,
},
default: {
bodyMapper: Mappers.CloudError
}
bodyMapper: Mappers.CloudError,
},
},
queryParameters: [
Parameters.apiVersion,
Parameters.tail,
Parameters.timestamps
Parameters.timestamps,
],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.containerGroupName,
Parameters.containerName
Parameters.containerName,
],
headerParameters: [Parameters.accept],
serializer
serializer,
};
const executeCommandOperationSpec: coreClient.OperationSpec = {
path:
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/containers/{containerName}/exec",
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/containers/{containerName}/exec",
httpMethod: "POST",
responses: {
200: {
bodyMapper: Mappers.ContainerExecResponse
bodyMapper: Mappers.ContainerExecResponse,
},
default: {
bodyMapper: Mappers.CloudError
}
bodyMapper: Mappers.CloudError,
},
},
requestBody: Parameters.containerExecRequest,
queryParameters: [Parameters.apiVersion],
@ -149,23 +147,22 @@ const executeCommandOperationSpec: coreClient.OperationSpec = {
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.containerGroupName,
Parameters.containerName
Parameters.containerName,
],
headerParameters: [Parameters.accept, Parameters.contentType],
mediaType: "json",
serializer
serializer,
};
const attachOperationSpec: coreClient.OperationSpec = {
path:
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/containers/{containerName}/attach",
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/containers/{containerName}/attach",
httpMethod: "POST",
responses: {
200: {
bodyMapper: Mappers.ContainerAttachResponse
bodyMapper: Mappers.ContainerAttachResponse,
},
default: {
bodyMapper: Mappers.CloudError
}
bodyMapper: Mappers.CloudError,
},
},
queryParameters: [Parameters.apiVersion],
urlParameters: [
@ -173,8 +170,8 @@ const attachOperationSpec: coreClient.OperationSpec = {
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.containerGroupName,
Parameters.containerName
Parameters.containerName,
],
headerParameters: [Parameters.accept],
serializer
serializer,
};

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

@ -11,3 +11,5 @@ export * from "./operations";
export * from "./location";
export * from "./containers";
export * from "./subnetServiceAssociationLink";
export * from "./containerGroupProfiles";
export * from "./containerGroupProfileOperations";

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