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

@googleapis/sqladmin

Package Overview
Dependencies
Maintainers
2
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@googleapis/sqladmin

sqladmin

  • 24.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
356K
increased by4.07%
Maintainers
2
Weekly downloads
 
Created

What is @googleapis/sqladmin?

@googleapis/sqladmin is an npm package that provides access to the Google Cloud SQL Admin API. This API allows you to manage Cloud SQL instances, including creating, configuring, and deleting instances, as well as managing databases, users, and other resources within those instances.

What are @googleapis/sqladmin's main functionalities?

Create a Cloud SQL Instance

This feature allows you to create a new Cloud SQL instance with specified settings such as tier, disk size, disk type, and region.

const {google} = require('@googleapis/sqladmin');
const sqladmin = google.sqladmin('v1beta4');

async function createInstance(auth) {
  const request = {
    project: 'your-project-id',
    resource: {
      name: 'instance-name',
      settings: {
        tier: 'db-f1-micro',
        dataDiskSizeGb: '10',
        dataDiskType: 'PD_SSD',
        region: 'us-central1'
      }
    },
    auth: auth
  };

  try {
    const response = await sqladmin.instances.insert(request);
    console.log(response.data);
  } catch (err) {
    console.error(err);
  }
}

List Cloud SQL Instances

This feature allows you to list all Cloud SQL instances within a specified project.

const {google} = require('@googleapis/sqladmin');
const sqladmin = google.sqladmin('v1beta4');

async function listInstances(auth) {
  const request = {
    project: 'your-project-id',
    auth: auth
  };

  try {
    const response = await sqladmin.instances.list(request);
    console.log(response.data.items);
  } catch (err) {
    console.error(err);
  }
}

Delete a Cloud SQL Instance

This feature allows you to delete a specified Cloud SQL instance.

const {google} = require('@googleapis/sqladmin');
const sqladmin = google.sqladmin('v1beta4');

async function deleteInstance(auth) {
  const request = {
    project: 'your-project-id',
    instance: 'instance-name',
    auth: auth
  };

  try {
    const response = await sqladmin.instances.delete(request);
    console.log(response.data);
  } catch (err) {
    console.error(err);
  }
}

Create a Database in a Cloud SQL Instance

This feature allows you to create a new database within a specified Cloud SQL instance.

const {google} = require('@googleapis/sqladmin');
const sqladmin = google.sqladmin('v1beta4');

async function createDatabase(auth) {
  const request = {
    project: 'your-project-id',
    instance: 'instance-name',
    resource: {
      name: 'database-name'
    },
    auth: auth
  };

  try {
    const response = await sqladmin.databases.insert(request);
    console.log(response.data);
  } catch (err) {
    console.error(err);
  }
}

List Databases in a Cloud SQL Instance

This feature allows you to list all databases within a specified Cloud SQL instance.

const {google} = require('@googleapis/sqladmin');
const sqladmin = google.sqladmin('v1beta4');

async function listDatabases(auth) {
  const request = {
    project: 'your-project-id',
    instance: 'instance-name',
    auth: auth
  };

  try {
    const response = await sqladmin.databases.list(request);
    console.log(response.data.items);
  } catch (err) {
    console.error(err);
  }
}

Other packages similar to @googleapis/sqladmin

Keywords

FAQs

Package last updated on 29 Aug 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