Comparing version 0.9.16 to 0.10.0
@@ -0,1 +1,5 @@ | ||
2014.10.02 Version 0.10.0 | ||
* Switch to use "azure-storage" from "azure-storage-legacy" | ||
* Fix retry logic on http status code 408 | ||
2014.09.10 Version 0.9.16 | ||
@@ -2,0 +6,0 @@ * Release new azure authorization clients |
@@ -24,3 +24,3 @@ // | ||
var storage = require('azure-storage-legacy'); | ||
var storage = require('azure-storage'); | ||
@@ -27,0 +27,0 @@ var TableService = storage.TableService; |
@@ -605,3 +605,3 @@ // | ||
var setting; | ||
for (setting in currentConfig) { | ||
Object.keys(currentConfig).forEach(function(settings) { | ||
if (!newConfig[setting] || | ||
@@ -611,9 +611,9 @@ newConfig[setting] !== currentConfig[setting]) { | ||
} | ||
} | ||
}); | ||
for (setting in newConfig) { | ||
Object.keys(newConfig).forEach(function(settings) { | ||
if (!currentConfig[setting]) { | ||
changes.push({ type: 'ConfigurationSettingChange', name: setting }); | ||
} | ||
} | ||
}); | ||
@@ -632,3 +632,3 @@ var changedRoleSet = []; | ||
for (role in currentRoles) { | ||
if (newRoles[role]) { | ||
if (currentRoles.hasOwnProperty(role) && newRoles[role]) { | ||
currentRole = currentRoles[role]; | ||
@@ -638,3 +638,3 @@ newRole = newRoles[role]; | ||
for (instance in currentRole.instances) { | ||
if (newRole.instances[instance]) { | ||
if (currentRole.instances.hasOwnProperty(instance) && newRole.instances[instance]) { | ||
currentInstance = currentRole.instances[instance]; | ||
@@ -647,3 +647,3 @@ newInstance = newRole.instances[instance]; | ||
for (endpoint in currentInstance.endpoints) { | ||
if (newInstance.endpoints[endpoint]) { | ||
if (currentInstance.endpoints.hasOwnProperty(endpoint) && newInstance.endpoints[endpoint]) { | ||
currentEndpoint = currentInstance.endpoints[endpoint]; | ||
@@ -674,3 +674,3 @@ newEndpoint = newInstance.endpoints[endpoint]; | ||
for (role in newRoles) { | ||
if (currentRoles[role]) { | ||
if (newRoles.hasOwnProperty(role) && currentRoles[role]) { | ||
currentRole = currentRoles[role]; | ||
@@ -680,3 +680,3 @@ newRole = newRoles[role]; | ||
for (instance in newRole.instances) { | ||
if (currentRole.instances[instance]) { | ||
if (newRole.instances.hasOwnProperty(instance) && currentRole.instances[instance]) { | ||
currentInstance = currentRole.instances[instance]; | ||
@@ -689,3 +689,3 @@ newInstance = newRole.instances[instance]; | ||
for (endpoint in newInstance.endpoints) { | ||
if (currentInstance.endpoints[endpoint]) { | ||
if (newInstance.endpoints.hasOwnProperty(endpoint) && currentInstance.endpoints[endpoint]) { | ||
currentEndpoint = currentInstance.endpoints[endpoint]; | ||
@@ -692,0 +692,0 @@ newEndpoint = newInstance.endpoints[endpoint]; |
@@ -10,3 +10,3 @@ { | ||
], | ||
"version": "0.9.0-pre.1", | ||
"version": "0.9.0-pre.2", | ||
"description": "Microsoft Azure Authorization Management Client Library for node", | ||
@@ -32,3 +32,3 @@ "tags": [ | ||
"dependencies": { | ||
"azure-common": "0.9.8", | ||
"azure-common": "0.9.9", | ||
"underscore": "1.4.x" | ||
@@ -35,0 +35,0 @@ }, |
@@ -13,3 +13,3 @@ { | ||
], | ||
"version": "2.0.0-pre.10", | ||
"version": "2.0.0-pre.11", | ||
"description": "Microsoft Azure Gallery Client Library for node", | ||
@@ -35,3 +35,3 @@ "tags": [ | ||
"dependencies": { | ||
"azure-common": "0.9.8", | ||
"azure-common": "0.9.9", | ||
"underscore": "1.4.x" | ||
@@ -38,0 +38,0 @@ }, |
@@ -13,3 +13,3 @@ { | ||
], | ||
"version": "2.0.0-pre.11", | ||
"version": "2.0.0-pre.12", | ||
"description": "Microsoft Azure Resource Management Client Library for node", | ||
@@ -35,3 +35,3 @@ "tags": [ | ||
"dependencies": { | ||
"azure-common": "0.9.8", | ||
"azure-common": "0.9.9", | ||
"underscore": "1.4.x" | ||
@@ -38,0 +38,0 @@ }, |
@@ -17,3 +17,3 @@ { | ||
], | ||
"version": "0.9.16", | ||
"version": "0.10.0", | ||
"description": "Microsoft Azure Client Library for node", | ||
@@ -39,25 +39,25 @@ "tags": [ | ||
"dependencies": { | ||
"azure-common": "0.9.8", | ||
"azure-storage-legacy": "0.9.11", | ||
"azure-mgmt-compute": "0.9.11", | ||
"azure-mgmt": "0.9.11", | ||
"azure-mgmt-vnet": "0.9.11", | ||
"azure-mgmt-sb": "0.9.11", | ||
"azure-mgmt-sql": "0.9.11", | ||
"azure-mgmt-storage": "0.9.11", | ||
"azure-mgmt-website": "0.9.11", | ||
"azure-rm-website": "0.9.0-pre.5", | ||
"azure-mgmt-subscription": "0.9.11", | ||
"azure-monitoring": "0.9.1-pre.11", | ||
"azure-scheduler": "0.9.1-pre.11", | ||
"azure-mgmt-scheduler": "0.9.1-pre.11", | ||
"azure-mgmt-resource": "2.0.0-pre.11", | ||
"azure-gallery": "2.0.0-pre.10", | ||
"azure-mgmt-hdinsight": "0.9.11", | ||
"azure-mgmt-authorization": "0.9.0-pre.1", | ||
"azure-sb": "0.9.12", | ||
"azure-common": "0.9.9", | ||
"azure-mgmt-compute": "0.9.12", | ||
"azure-mgmt": "0.9.12", | ||
"azure-mgmt-vnet": "0.9.12", | ||
"azure-mgmt-sb": "0.9.12", | ||
"azure-mgmt-sql": "0.9.12", | ||
"azure-mgmt-storage": "0.9.12", | ||
"azure-mgmt-website": "0.9.12", | ||
"azure-rm-website": "0.9.0-pre.6", | ||
"azure-mgmt-subscription": "0.9.12", | ||
"azure-monitoring": "0.9.1-pre.12", | ||
"azure-scheduler": "0.9.1-pre.12", | ||
"azure-mgmt-scheduler": "0.9.1-pre.12", | ||
"azure-mgmt-resource": "2.0.0-pre.12", | ||
"azure-gallery": "2.0.0-pre.11", | ||
"azure-mgmt-hdinsight": "0.9.12", | ||
"azure-mgmt-authorization": "0.9.0-pre.2", | ||
"azure-sb": "0.9.13", | ||
"mime": "~1.2.4", | ||
"underscore": "1.4.x", | ||
"request": "2.27.0", | ||
"node-uuid": "~1.2.0" | ||
"node-uuid": "~1.2.0", | ||
"azure-storage": "0.3.3" | ||
}, | ||
@@ -64,0 +64,0 @@ "devDependencies": { |
136
README.md
@@ -9,6 +9,3 @@ # Microsoft Azure SDK for Node.js | ||
* Storage | ||
* Blob | ||
* Table | ||
* Storage Queue | ||
* [Storage](https://github.com/Azure/azure-storage-node/blob/master/README.md) | ||
* Service Bus | ||
@@ -46,2 +43,3 @@ * Queue | ||
* Storage: ``npm install azure-storage`` | ||
* Core management: ``npm install azure-mgmt`` | ||
@@ -55,132 +53,8 @@ * Compute management: ``npm install azure-mgmt-compute`` | ||
## Usage | ||
### Usage | ||
### Table Storage | ||
## Storage | ||
To ensure a table exists, call **createTableIfNotExists**: | ||
For using Storage Blobs, Tables, Files, and Queues visit the Microsoft Azure Storage SDK for Node.js [ReadMe](https://github.com/Azure/azure-storage-node/blob/master/README.md) file. | ||
```Javascript | ||
var tableService = azure.createTableService(); | ||
tableService.createTableIfNotExists('tasktable', function(error){ | ||
if(!error){ | ||
// Table exists | ||
} | ||
}); | ||
``` | ||
A new entity can be added by calling **insertEntity**: | ||
```Javascript | ||
var tableService = azure.createTableService(), | ||
task1 = { | ||
PartitionKey : 'tasksSeattle', | ||
RowKey: '1', | ||
Description: 'Take out the trash', | ||
DueDate: new Date(2011, 12, 14, 12) | ||
}; | ||
tableService.insertEntity('tasktable', task1, function(error){ | ||
if(!error){ | ||
// Entity inserted | ||
} | ||
}); | ||
``` | ||
The method **queryEntity** can then be used to fetch the entity that was just inserted: | ||
```Javascript | ||
var tableService = azure.createTableService(); | ||
tableService.queryEntity('tasktable', 'tasksSeattle', '1', function(error, serverEntity){ | ||
if(!error){ | ||
// Entity available in serverEntity variable | ||
} | ||
}); | ||
``` | ||
## Blob Storage | ||
The **createContainerIfNotExists** method can be used to create a | ||
container in which to store a blob: | ||
```Javascript | ||
var blobService = azure.createBlobService(); | ||
blobService.createContainerIfNotExists('taskcontainer', {publicAccessLevel : 'blob'}, function(error){ | ||
if(!error){ | ||
// Container exists and is public | ||
} | ||
}); | ||
``` | ||
To upload a file (assuming it is called task1-upload.txt and it is placed in the same folder as the script below), the method **createBlob** can be used. This method will return a writable stream which can be writen to, for instance, through piping: | ||
```Javascript | ||
var blobService = azure.createBlobService(); | ||
fs.createReadStream('task1-upload.txt').pipe(blobService.createBlob('taskcontainer', 'task1', azure.Constants.BlobConstants.BlobTypes.BLOCK)); | ||
``` | ||
To download the blob and write it to the file system, a similar **getBlob** method can be used: | ||
```Javascript | ||
var blobService = azure.createBlobService(); | ||
blobService.getBlob('taskcontainer', 'task1').pipe(fs.createWriteStream('task1-download.txt')); | ||
``` | ||
To create a SAS URL you can use the **getBlobUrl** method. Additionally you can use the **date** helper functions to easily create a SAS that expires at some point relative to the current time. | ||
```Javascript | ||
var blobService = azure.createBlobService(); | ||
//create a SAS that expires in an hour | ||
var sharedAccessPolicy = { | ||
AccessPolicy: { | ||
Expiry: azure.date.minutesFromNow(60); | ||
} | ||
}; | ||
var sasUrl = blobService.getBlobUrl(containerName, blobName, sharedAccessPolicy); | ||
``` | ||
## Storage Queues | ||
The **createQueueIfNotExists** method can be used to ensure a queue exists: | ||
```Javascript | ||
var queueService = azure.createQueueService(); | ||
queueService.createQueueIfNotExists('taskqueue', function(error){ | ||
if(!error){ | ||
// Queue exists | ||
} | ||
}); | ||
``` | ||
The **createMessage** method can then be called to insert the message into the queue: | ||
```Javascript | ||
var queueService = azure.createQueueService(); | ||
queueService.createMessage('taskqueue', 'Hello world!', function(error){ | ||
if(!error){ | ||
// Message inserted | ||
} | ||
}); | ||
``` | ||
It is then possible to call the **getMessage** method, process the message and then call **deleteMessage** inside the callback. This two-step process ensures messages don't get lost when they are removed from the queue. | ||
```Javascript | ||
var queueService = azure.createQueueService(), | ||
queueName = 'taskqueue'; | ||
queueService.getMessages(queueName, function(error, serverMessages){ | ||
if(!error){ | ||
// Process the message in less than 30 seconds, the message | ||
// text is available in serverMessages[0].messagetext | ||
queueService.deleteMessage(queueName, serverMessages[0].messageid, serverMessages[0].popreceipt, function(error){ | ||
if(!error){ | ||
// Message deleted | ||
} | ||
}); | ||
} | ||
}); | ||
``` | ||
## Service Bus Queues | ||
@@ -187,0 +61,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
651703
13477
308
+ Addedazure-storage@0.3.3
+ Addedazure-common@0.9.9(transitive)
+ Addedazure-gallery@2.0.0-pre.11(transitive)
+ Addedazure-mgmt@0.9.12(transitive)
+ Addedazure-mgmt-authorization@0.9.0-pre.2(transitive)
+ Addedazure-mgmt-compute@0.9.12(transitive)
+ Addedazure-mgmt-hdinsight@0.9.12(transitive)
+ Addedazure-mgmt-resource@2.0.0-pre.12(transitive)
+ Addedazure-mgmt-sb@0.9.12(transitive)
+ Addedazure-mgmt-scheduler@0.9.1-pre.12(transitive)
+ Addedazure-mgmt-sql@0.9.12(transitive)
+ Addedazure-mgmt-storage@0.9.12(transitive)
+ Addedazure-mgmt-subscription@0.9.12(transitive)
+ Addedazure-mgmt-vnet@0.9.12(transitive)
+ Addedazure-mgmt-website@0.9.12(transitive)
+ Addedazure-monitoring@0.9.1-pre.12(transitive)
+ Addedazure-rm-website@0.9.0-pre.6(transitive)
+ Addedazure-sb@0.9.13(transitive)
+ Addedazure-scheduler@0.9.1-pre.12(transitive)
+ Addedazure-storage@0.3.3(transitive)
+ Addedextend@1.2.1(transitive)
- Removedazure-storage-legacy@0.9.11
- Removedazure-common@0.9.8(transitive)
- Removedazure-gallery@2.0.0-pre.10(transitive)
- Removedazure-mgmt@0.9.11(transitive)
- Removedazure-mgmt-authorization@0.9.0-pre.1(transitive)
- Removedazure-mgmt-compute@0.9.11(transitive)
- Removedazure-mgmt-hdinsight@0.9.11(transitive)
- Removedazure-mgmt-resource@2.0.0-pre.11(transitive)
- Removedazure-mgmt-sb@0.9.11(transitive)
- Removedazure-mgmt-scheduler@0.9.1-pre.11(transitive)
- Removedazure-mgmt-sql@0.9.11(transitive)
- Removedazure-mgmt-storage@0.9.11(transitive)
- Removedazure-mgmt-subscription@0.9.11(transitive)
- Removedazure-mgmt-vnet@0.9.11(transitive)
- Removedazure-mgmt-website@0.9.11(transitive)
- Removedazure-monitoring@0.9.1-pre.11(transitive)
- Removedazure-rm-website@0.9.0-pre.5(transitive)
- Removedazure-sb@0.9.12(transitive)
- Removedazure-scheduler@0.9.1-pre.11(transitive)
- Removedazure-storage-legacy@0.9.11(transitive)
Updatedazure-common@0.9.9
Updatedazure-gallery@2.0.0-pre.11
Updatedazure-mgmt@0.9.12
Updatedazure-mgmt-compute@0.9.12
Updatedazure-mgmt-hdinsight@0.9.12
Updatedazure-mgmt-sb@0.9.12
Updatedazure-mgmt-sql@0.9.12
Updatedazure-mgmt-storage@0.9.12
Updatedazure-mgmt-vnet@0.9.12
Updatedazure-mgmt-website@0.9.12
Updatedazure-rm-website@0.9.0-pre.6
Updatedazure-sb@0.9.13
Updatedazure-scheduler@0.9.1-pre.12