Socket
Book a DemoInstallSign in
Socket

@azure/arm-containerinstance

Package Overview
Dependencies
Maintainers
4
Versions
352
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@azure/arm-containerinstance

A generated SDK for ContainerInstanceManagementClient.

latest
Source
npmnpm
Version
9.1.0
Version published
Weekly downloads
205K
-3.02%
Maintainers
4
Weekly downloads
 
Created

What is @azure/arm-containerinstance?

The @azure/arm-containerinstance package is a client library for managing Azure Container Instances. It allows developers to create, update, delete, and manage container groups and their configurations in Azure.

What are @azure/arm-containerinstance's main functionalities?

Create a Container Group

This feature allows you to create a new container group in Azure. The code sample demonstrates how to use the @azure/arm-containerinstance package to create a container group with a single container running the Nginx image.

const { ContainerInstanceManagementClient } = require('@azure/arm-containerinstance');
const { DefaultAzureCredential } = require('@azure/identity');

async function createContainerGroup() {
  const credential = new DefaultAzureCredential();
  const client = new ContainerInstanceManagementClient(credential, '<subscription-id>');
  const resourceGroupName = '<resource-group-name>';
  const containerGroupName = '<container-group-name>';
  const containerGroup = {
    location: 'eastus',
    containers: [
      {
        name: 'mycontainer',
        image: 'nginx',
        resources: {
          requests: {
            cpu: 1,
            memoryInGB: 1.5
          }
        }
      }
    ],
    osType: 'Linux'
  };
  const result = await client.containerGroups.createOrUpdate(resourceGroupName, containerGroupName, containerGroup);
  console.log(result);
}

createContainerGroup();

List Container Groups

This feature allows you to list all container groups within a specific resource group. The code sample shows how to retrieve and print the list of container groups using the @azure/arm-containerinstance package.

const { ContainerInstanceManagementClient } = require('@azure/arm-containerinstance');
const { DefaultAzureCredential } = require('@azure/identity');

async function listContainerGroups() {
  const credential = new DefaultAzureCredential();
  const client = new ContainerInstanceManagementClient(credential, '<subscription-id>');
  const resourceGroupName = '<resource-group-name>';
  const containerGroups = await client.containerGroups.listByResourceGroup(resourceGroupName);
  console.log(containerGroups);
}

listContainerGroups();

Delete a Container Group

This feature allows you to delete a specified container group. The code sample demonstrates how to use the @azure/arm-containerinstance package to delete a container group by its name.

const { ContainerInstanceManagementClient } = require('@azure/arm-containerinstance');
const { DefaultAzureCredential } = require('@azure/identity');

async function deleteContainerGroup() {
  const credential = new DefaultAzureCredential();
  const client = new ContainerInstanceManagementClient(credential, '<subscription-id>');
  const resourceGroupName = '<resource-group-name>';
  const containerGroupName = '<container-group-name>';
  await client.containerGroups.deleteMethod(resourceGroupName, containerGroupName);
  console.log(`Container group ${containerGroupName} deleted.`);
}

deleteContainerGroup();

Other packages similar to @azure/arm-containerinstance

Keywords

node

FAQs

Package last updated on 24 Apr 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts