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

azure-arm-mysql

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

azure-arm-mysql

MySQLManagementClient Library with typescript type definitions for node

  • 3.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Microsoft Azure SDK for Node.js - MySQL Management

This project provides a Node.js package that makes it easy to manage Microsoft Azure MySQL Resources. Right now it supports:

  • Node.js version: 6.x.x or higher

How to Install

npm install azure-arm-mysql

How to Use

Listing servers

const msRestAzure = require('ms-rest-azure');
const MySQLManagementClient = require('azure-arm-mysql');

const subscriptionID = '<subscription id>';
const resourceGroup = '<resource group name>';

msRestAzure.interactiveLogin().then((credentials) => {
  let client = new MySQLManagementClient(credentials, subscriptionID);
  return client.servers.listByResourceGroup(resourceGroup);
}).then((servers) => {
  console.log('List of servers:');
  console.dir(servers, {depth: null, colors: true});
}).catch((err) => {
  console.log('An error ocurred');
  console.dir(err, {depth: null, colors: true});
});

Creating a server

const msRestAzure = require('ms-rest-azure');
const MySQLManagementClient = require('azure-arm-mysql');

const subscriptionID = '<subscription id>';
const resourceGroup = '<resource group name>';
const serverName = '<server name>'; // must be globally unique

msRestAzure.interactiveLogin().then((credentials) => {
  let client = new MySQLManagementClient(credentials, subscriptionID);
  return client.servers.createOrUpdate(resourceGroup, serverName, {
    location: 'eastus',
    properties: {
      createMode: 'Default',
      administratorLogin: 'mysql',
      administratorLoginPassword: 'F00Bar!!'
    }
  });
}).then((server) => {
  console.log('Server:');
  console.dir(server, {depth: null, colors: true});
}).catch((err) => {
  console.log('An error ocurred');
  console.dir(err, {depth: null, colors: true});
});

Listing databases

const msRestAzure = require('ms-rest-azure');
const MySQLManagementClient = require('azure-arm-mysql');

const subscriptionID = '<subscription id>';
const resourceGroup = '<resource group name>';
const serverName = '<server name>';

msRestAzure.interactiveLogin().then((credentials) => {
  let client = new MySQLManagementClient(credentials, subscriptionID);
  return client.databases.listByServer(resourceGroup, serverName);
}).then((databases) => {
  console.log('List of databases:');
  console.dir(databases, {depth: null, colors: true});
}).catch((err) => {
  console.log('An error ocurred');
  console.dir(err, {depth: null, colors: true});
});

Creating a database

const msRestAzure = require('ms-rest-azure');
const MySQLManagementClient = require('azure-arm-mysql');

const subscriptionID = '<subscription id>';
const resourceGroup = '<resource group name>';
const serverName = '<server name>';
const databaseName = '<database name>';

msRestAzure.interactiveLogin().then((credentials) => {
  let client = new MySQLManagementClient(credentials, subscriptionID);
  return client.databases.createOrUpdate(resourceGroup, serverName, databaseName, {});
}).then((database) => {
  console.log('Database:');
  console.dir(database, {depth: null, colors: true});
}).catch((err) => {
  console.log('An error ocurred');
  console.dir(err, {depth: null, colors: true});
});

Deleting a database

const msRestAzure = require('ms-rest-azure');
const MySQLManagementClient = require('azure-arm-mysql');

const subscriptionID = '<subscription id>';
const resourceGroup = '<resource group name>';
const serverName = '<server name>';
const databaseName = '<database name>';

msRestAzure.interactiveLogin().then((credentials) => {
  let client = new MySQLManagementClient(credentials, subscriptionID);
  return client.databases.deleteMethod(resourceGroup, serverName, databaseName);
}).then(() => {
  console.log('Database deleted');
}).catch((err) => {
  console.log('An error ocurred');
  console.dir(err, {depth: null, colors: true});
});

Deleting a server

const msRestAzure = require('ms-rest-azure');
const MySQLManagementClient = require('azure-arm-mysql');

const subscriptionID = '<subscription id>';
const resourceGroup = '<resource group name>';
const serverName = '<server name>';

msRestAzure.interactiveLogin().then((credentials) => {
  let client = new MySQLManagementClient(credentials, subscriptionID);
  return client.servers.createOrUpdate(resourceGroup, serverName, {
    location: 'eastus',
    properties: {
      createMode: 'Default',
      administratorLogin: 'mysql',
      administratorLoginPassword: 'F00Bar!!'
    }
  });
}).then((server) => {
  console.log('Server:');
  console.dir(server, {depth: null, colors: true});
}).catch((err) => {
  console.log('An error ocurred');
  console.dir(err, {depth: null, colors: true});
});
  • Microsoft Azure SDK for Node.js

Keywords

FAQs

Package last updated on 07 Nov 2018

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