Skip to content

Commit

Permalink
Storage Client Library - 0.4.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Zack Yang committed Jun 8, 2015
1 parent 261f1f6 commit 97b0429
Show file tree
Hide file tree
Showing 5 changed files with 151 additions and 30 deletions.
6 changes: 6 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Note: This is an Azure Storage only package. The all up Azure node sdk still has the old storage bits in there. In a future release, those storage bits will be removed and an npm dependency to this storage node sdk will
be taken. This is a CTP v1 release and the changes described below indicate the changes from the Azure node SDK 0.9.8 available here - https://github.com/Azure/azure-sdk-for-node.

2015.06 Version 0.4.5

ALL
* Updated the dependency of the 'request' module to avoid the security vulnerability reported by the 'nsp' tool: (https://nodesecurity.io/advisories/qs_dos_extended_event_loop_blocking) and (https://nodesecurity.io/advisories/qs_dos_memory_exhaustion).
* Included package validation in grunt tasks.

2015.05 Version 0.4.4

ALL
Expand Down
108 changes: 107 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

This project provides a Node.js package that makes it easy to consume and manage Microsoft Azure Storage Services.

> If you are looking for documentation for the Azure SDK for Node.js, see [http://dl.windowsazure.com/nodedocs/index.html](http://dl.windowsazure.com/nodedocs/index.html) or visit [https://github.com/Azure/azure-sdk-for-node](https://github.com/Azure/azure-sdk-for-node). While the Azure SDK for Node.js provides support for working with Azure Storage, you should consider using the Azure Storage SDK as it supports features not available in the Azure SDK for Node.js
> If you are looking for the Node.js SDK for other Azure services, visit [https://github.com/Azure/azure-sdk-for-node](https://github.com/Azure/azure-sdk-for-node).
# Features

Expand All @@ -22,6 +22,9 @@ This project provides a Node.js package that makes it easy to consume and manage
- Create/Delete Queues
- Insert/Peek Queue Messages
- Advanced Queue Operations
- Service Properties
- Get Service Properties
- Set Service Properties

Please check details on [API reference documents](http://azure.github.io/azure-storage-node).

Expand Down Expand Up @@ -292,6 +295,109 @@ fileService.getFileToStream('taskshare', 'taskdirectory', 'taskfile', fs.createW
});
```

### Service Properties

The **getServiceProperties** method can be used to fetch the logging, metrics and CORS settings on your storage account:

```Javascript
var azure = require('azure-storage');
var blobService = azure.createBlobService();

blobService.getServiceProperties(function(error, result, response) {
if (!error) {
var serviceProperties = result;
// properties are fetched
}
});
```

The **setServiceProperties** method can be used to modify the logging, metrics and CORS settings on your storage account:

```Javascript
var azure = require('azure-storage');
var blobService = azure.createBlobService();

var serviceProperties = generateServiceProperties();

blobService.setServiceProperties(serviceProperties, function(error, result, response) {
if (!error) {
// properties are set
}
});

function generateServiceProperties() {
return serviceProperties = {
Logging: {
Version: '1.0',
Delete: true,
Read: true,
Write: true,
RetentionPolicy: {
Enabled: true,
Days: 10,
},
},
HourMetrics: {
Version: '1.0',
Enabled: true,
IncludeAPIs: true,
RetentionPolicy: {
Enabled: true,
Days: 10,
},
},
MinuteMetrics: {
Version: '1.0',
Enabled: true,
IncludeAPIs: true,
RetentionPolicy: {
Enabled: true,
Days: 10,
},
},
Cors: {
CorsRule: [
{
AllowedOrigins: ['www.azure.com', 'www.microsoft.com'],
AllowedMethods: ['GET', 'PUT'],
AllowedHeaders: ['x-ms-meta-data*', 'x-ms-meta-target*', 'x-ms-meta-xyz', 'x-ms-meta-foo'],
ExposedHeaders: ['x-ms-meta-data*', 'x-ms-meta-source*', 'x-ms-meta-abc', 'x-ms-meta-bcd'],
MaxAgeInSeconds: 500,
},
{
AllowedOrigins: ['www.msdn.com', 'www.asp.com'],
AllowedMethods: ['GET', 'PUT'],
AllowedHeaders: ['x-ms-meta-data*', 'x-ms-meta-target*', 'x-ms-meta-xyz', 'x-ms-meta-foo'],
ExposedHeaders: ['x-ms-meta-data*', 'x-ms-meta-source*', 'x-ms-meta-abc', 'x-ms-meta-bcd'],
MaxAgeInSeconds: 500,
},
],
},
};
}
```

When modifying the service properties, you can fetch the properties and then modify the them to prevent overwriting the existing settings.

```Javascript
var azure = require('azure-storage');
var blobService = azure.createBlobService();

blobService.getServiceProperties(function(error, result, response) {
if (!error) {
var serviceProperties = result;

// modify the properties

blobService.setServiceProperties(serviceProperties, function(error, result, response) {
if (!error) {
// properties are set
}
});
}
});
```

## Code Samples

How-Tos focused around accomplishing specific tasks are available on the [Microsoft Azure Node.js Developer Center](http://azure.microsoft.com/en-us/develop/nodejs/).
Expand Down
51 changes: 31 additions & 20 deletions gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ module.exports = function(grunt) {
options: {
reporter: 'spec',
quiet: false,
clearRequireCache: false
clearRequireCache: false,
timeout: 100000
},
src: ['test/**/*.js']
}
Expand All @@ -34,27 +35,27 @@ module.exports = function(grunt) {
jsdoc: {
dist: {
src: [
"README.md",
"lib/azure-storage.js",
"lib/common/filters/retrypolicyfilter.js",
"lib/common/filters/linearretrypolicyfilter.js",
"lib/common/filters/exponentialretrypolicyfilter.js",
"lib/common/services/storageutilities.js",
"lib/services/blob/blobservice.js",
"lib/services/blob/blobutilities.js",
"lib/services/queue/queueservice.js",
"lib/services/queue/queueutilities.js",
"lib/services/table/tableservice.js",
"lib/services/table/tablebatch.js",
"lib/services/table/tablequery.js",
"lib/services/table/tableutilities.js",
"lib/services/file/fileservice.js",
"lib/services/file/fileutilities.js",
'README.md',
'lib/azure-storage.js',
'lib/common/filters/retrypolicyfilter.js',
'lib/common/filters/linearretrypolicyfilter.js',
'lib/common/filters/exponentialretrypolicyfilter.js',
'lib/common/services/storageutilities.js',
'lib/services/blob/blobservice.js',
'lib/services/blob/blobutilities.js',
'lib/services/queue/queueservice.js',
'lib/services/queue/queueutilities.js',
'lib/services/table/tableservice.js',
'lib/services/table/tablebatch.js',
'lib/services/table/tablequery.js',
'lib/services/table/tableutilities.js',
'lib/services/file/fileservice.js',
'lib/services/file/fileutilities.js',
],
options: {
destination: 'docs',
template: "node_modules/grunt-jsdoc/node_modules/ink-docstrap/template",
configure: "jsdoc/jsdoc.json"
template: 'node_modules/grunt-jsdoc/node_modules/ink-docstrap/template',
configure: 'jsdoc/jsdoc.json'
}
}
},
Expand All @@ -65,13 +66,23 @@ module.exports = function(grunt) {
options: {
'base': 'docs'
}
},

jshint: {
all: ['Gruntfile.js', 'lib/**/*.js'],
options: {
jshintrc: true
}
}
});

grunt.loadNpmTasks('grunt-jsdoc');
grunt.loadNpmTasks('grunt-mocha-test');
grunt.loadNpmTasks('grunt-devserver');
grunt.loadNpmTasks('grunt-nsp-package');
grunt.loadNpmTasks('grunt-contrib-jshint');

grunt.registerTask('default', ['mochaTest']);
grunt.registerTask('doc', ['jsdoc', 'devserver']);
grunt.registerTask('validate', ['jshint', 'validate-package']);
grunt.registerTask('default', ['validate', 'mochaTest']);
};
2 changes: 1 addition & 1 deletion lib/common/util/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var Constants = {
/*
* Specifies the value to use for UserAgent header.
*/
USER_AGENT_PRODUCT_VERSION: '0.4.4',
USER_AGENT_PRODUCT_VERSION: '0.4.5',

/**
* The number of default concurrent requests for parallel operation.
Expand Down
14 changes: 6 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "azure-storage",
"author": "Microsoft Corporation",
"version": "0.4.4",
"version": "0.4.5",
"description": "Microsoft Azure Storage Client Library for Node.js",
"tags": [
"azure",
Expand All @@ -17,32 +17,30 @@
"engines": {
"node": ">= 0.8.26"
},
"licenses": [
{
"type": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0"
}
],
"license": "Apache-2.0",
"dependencies": {
"extend": "~1.2.1",
"mime": "~1.2.4",
"node-uuid": "~1.4.0",
"readable-stream": "~1.0.0",
"request": "~2.27.0",
"request": "~2.57.0",
"underscore": "~1.4.4",
"validator": "~3.22.2",
"xml2js": "0.2.7",
"xmlbuilder": "0.4.3"
},
"devDependencies": {
"grunt": "~0.4.2",
"grunt-contrib-jshint": "~0.11.0",
"grunt-devserver": "^0.6.0",
"grunt-jsdoc": "~0.5.1",
"grunt-mocha": "^0.4.12",
"grunt-mocha-test": "^0.12.7",
"grunt-nsp-package": "0.0.5",
"jshint": ">= 2.1.4",
"mocha": ">= 1.18.0",
"nock": "0.16",
"nsp": "^1.0.1",
"should": "1.2.x"
},
"homepage": "http://github.com/Azure/azure-storage-node",
Expand Down

0 comments on commit 97b0429

Please sign in to comment.