Socket
Book a DemoInstallSign in
Socket

@googleapis/sqladmin

Package Overview
Dependencies
Maintainers
3
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@googleapis/sqladmin

sqladmin

7.1.0
Source
npmnpm
Version published
Maintainers
3
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

google

FAQs

Package last updated on 14 Mar 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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.