forked from Azure/azure-sdk-for-js
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Dan Schulte
committed
Oct 23, 2018
1 parent
93db5a4
commit 87fd0a2
Showing
3 changed files
with
45 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"package": "sample", | ||
"version": "1.0.0", | ||
"dependencies": { | ||
"azure-arm-storage": "^6.0.0", | ||
"ms-rest": "^2.3.7", | ||
"ms-rest-js": "^1.0.455", | ||
"ms-rest-nodeauth": "^0.7.0" | ||
}, | ||
"devDependencies": { | ||
"ts-node": "^7.0.1" | ||
}, | ||
"scripts": { | ||
"test": "ts-node ./sample.ts" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import * as msRestAzure from "ms-rest-azure"; | ||
import * as msRestJs from "ms-rest-js"; | ||
import * as msRestNodeAuth from "ms-rest-nodeauth"; | ||
import { StorageManagementClient as StorageManagementClientNode, StorageManagementModels as StorageManagementModelsNode } from "azure-arm-storage"; | ||
import { StorageManagementClient as StorageManagementClientJS, StorageManagementModels as StorageManagementModelsJS } from "../packages/@azure/arm-storage"; | ||
|
||
const subscriptionId: string = "4cf32f9e-069a-4492-967c-d9fdd3cc3e07"; | ||
|
||
console.log("Node.js SDK:"); | ||
msRestAzure.interactiveLogin() | ||
.then((credentials: msRestAzure.DeviceTokenCredentials) => { | ||
const clientNode = new StorageManagementClientNode() | ||
}) | ||
.then(() => { | ||
msRestNodeAuth.interactiveLogin().then((credentials: msRestJs.ServiceClientCredentials) => { | ||
console.log("TypeScript SDK:"); | ||
const clientJS = new StorageManagementClientJS(credentials, subscriptionId); | ||
clientJS.storageAccounts.list().then((storageAccounts: StorageManagementModelsJS.StorageAccountListResult) => { | ||
console.log(`Found ${storageAccounts.length} storage account${(storageAccounts.length === 1 ? "" : "s")}${(storageAccounts.length === 0 ? "." : ":")}`); | ||
for (const storageAccount of storageAccounts) { | ||
console.log(` ${storageAccount.id}`); | ||
} | ||
}); | ||
}); | ||
}); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters