Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@google-cloud/container

Package Overview
Dependencies
Maintainers
0
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@google-cloud/container

Google Container Engine API client for Node.js

  • 5.19.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created

What is @google-cloud/container?

@google-cloud/container is a Node.js client library for Google Kubernetes Engine (GKE). It allows developers to interact with GKE clusters programmatically, enabling operations such as creating, managing, and deleting clusters, as well as retrieving information about clusters and their nodes.

What are @google-cloud/container's main functionalities?

Create a Cluster

This feature allows you to create a new Kubernetes cluster in GKE. The code sample demonstrates how to use the @google-cloud/container package to create a cluster with a specified name, initial node count, and node configuration.

const {ClusterManagerClient} = require('@google-cloud/container');
const client = new ClusterManagerClient();

async function createCluster() {
  const request = {
    parent: 'projects/YOUR_PROJECT_ID/locations/YOUR_LOCATION',
    cluster: {
      name: 'my-cluster',
      initialNodeCount: 3,
      nodeConfig: {
        machineType: 'n1-standard-1'
      }
    }
  };
  const [operation] = await client.createCluster(request);
  console.log('Cluster creation operation:', operation);
}

createCluster().catch(console.error);

List Clusters

This feature allows you to list all the Kubernetes clusters in a specified project and location. The code sample demonstrates how to use the @google-cloud/container package to retrieve and print the list of clusters.

const {ClusterManagerClient} = require('@google-cloud/container');
const client = new ClusterManagerClient();

async function listClusters() {
  const request = {
    parent: 'projects/YOUR_PROJECT_ID/locations/YOUR_LOCATION'
  };
  const [response] = await client.listClusters(request);
  console.log('Clusters:', response.clusters);
}

listClusters().catch(console.error);

Delete a Cluster

This feature allows you to delete an existing Kubernetes cluster in GKE. The code sample demonstrates how to use the @google-cloud/container package to delete a cluster by specifying its name.

const {ClusterManagerClient} = require('@google-cloud/container');
const client = new ClusterManagerClient();

async function deleteCluster() {
  const request = {
    name: 'projects/YOUR_PROJECT_ID/locations/YOUR_LOCATION/clusters/YOUR_CLUSTER_NAME'
  };
  const [operation] = await client.deleteCluster(request);
  console.log('Cluster deletion operation:', operation);
}

deleteCluster().catch(console.error);

Other packages similar to @google-cloud/container

Keywords

FAQs

Package last updated on 14 Nov 2024

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc