-
Notifications
You must be signed in to change notification settings - Fork 41
/
index.js
70 lines (58 loc) · 1.55 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
const msRestAzure = require("ms-rest-azure");
const virtualmachine = require("./compute/virtual-machine");
const blobStorage = require("./storage/blob-storage");
const queueStorage = require("./storage/queue-storage");
const tableStorage = require("./storage/table-storage");
const virtualNetwork = require("./network/azure-virtual-network");
const webSite = require("./webapps/app-service");
const database = require("./database/azure-database");
const api = require("./utilities/azure-api");
class Azure {
constructor() {
this._azureRestSdk = msRestAzure;
if (
!process.env.AZURE_TENANT_ID ||
!process.env.AZURE_CLIENT_ID ||
!process.env.AZURE_SUBSCRIPTION_ID ||
!process.env.AZURE_CLIENT_SECRET
) {
throw new Error("Provide credentials");
}
return {
getSDK: () => this._azureRestSdk,
compute: this.virtualmachine,
blob: this.blobstorage,
queue: this.queuestorage,
table: this.tablestorage,
network: this.virtualnetwork,
website: this.website,
sql: this.sql,
api: this.api
};
}
virtualmachine() {
return new virtualmachine(this.getSDK());
}
blobstorage() {
return new blobStorage();
}
queuestorage() {
return new queueStorage();
}
tablestorage() {
return new tableStorage();
}
virtualnetwork() {
return new virtualNetwork(this.getSDK());
}
website() {
return new webSite(this.getSDK());
}
sql() {
return new database(this.getSDK());
}
api() {
return new api(this.getSDK());
}
}
module.exports = Azure;