Skip to content
This repository has been archived by the owner on May 5, 2023. It is now read-only.

Commit

Permalink
Merge pull request #1848 from smithab/master
Browse files Browse the repository at this point in the history
NH : Updated api-version and new SAS api
  • Loading branch information
amarzavery committed Aug 17, 2016
2 parents 6d3b8d8 + 811400c commit f101f34
Show file tree
Hide file tree
Showing 39 changed files with 4,196 additions and 2,369 deletions.
4 changes: 2 additions & 2 deletions gulpfile.js
Expand Up @@ -83,7 +83,7 @@ var mappings = {
},
'notificationHubs':{
'dir': 'notificationHubsManagement/lib',
'source': 'arm-notificationhubs/2014-09-01/swagger/notificationhubs.json'
'source': 'arm-notificationhubs/2016-03-01/swagger/notificationhubs.json'
},
'powerbiembedded': {
'dir': 'powerbiembedded/lib',
Expand Down Expand Up @@ -140,7 +140,7 @@ var mappings = {
}
};

var defaultAutoRestVersion = '0.17.0-Nightly20160630';
var defaultAutoRestVersion = '0.17.0-Nightly20160811';
var usingAutoRestVersion;
var specRoot = args['spec-root'] || "https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master";
var project = args['project'];
Expand Down
124 changes: 124 additions & 0 deletions lib/services/notificationHubsManagement/README.md
Expand Up @@ -28,6 +28,130 @@ npm install azure-arm-notificationhubs
});
```


#### Managing a Namespace

var groupName = 'myResourceGroup';
var namespaceName = 'myNamespace';
var namespaceLocation = "South Central US"
//Create a Namespace

var createNamespaceParameters = {
location: namespaceLocation,
tags: {
tag1: 'value1',
tag2: 'value2'
}
};

console.info('Creating Namespace...');
client.namespaces.createOrUpdate(groupName, namespaceName, createNamespaceParameters, function (err, result, request, response) {
if (err) throw err;
console.info('Namespace created: ' + JSON.stringify(result, null, ' '));
});


//Get properties of an active Namespace

console.info('Get namespace...');
client.namespaces.get(groupName, namespaceName, function (err, result, request, response) {
if (err) throw err;
console.info('Namespace properties: ' + JSON.stringify(result, null, ' '));
});


//list all Namespaces within a resource group

console.info('Getting Namespaces within a resource group...');
client.namespaces.list(groupName, function (err, result, request, response) {
if (err) throw err;
console.info('Namespaces: ' + JSON.stringify(result, null, ' '));
});

//list all Namespaces within your subscription

console.info('Getting Namespaces within a subscription...');
client.namespaces.listAll(function (err, result, request, response) {
if (err) throw err;
console.info('Namespaces: ' + JSON.stringify(result, null, ' '));
});

//Create Namespace authorization rule

var authRuleParameter = {
location: namespaceLocation,
name: authorizationRuleName,
rights : ['Listen', 'Send']
};

client.namespaces.createOrUpdateAuthorizationRule(groupName, namespaceName, authorizationRuleName, authRuleParameter, function (err, result, request, response) {
if (err) throw err;
console.info('Namespace Authorization Rule: ' + JSON.stringify(result, null, ' '));
});

//show primary and secondary keys of the Namespace

console.info('Getting Namespace keys...');
client.namespaces.listKeys(groupName, namespaceName, authorizationRuleName, function (err, result, request, response) {
if (err) throw err;
console.info('Namespace Authorization Rule keys: ' + JSON.stringify(result, null, ' '));
});


//regenerate keys of the cache

regenerateKeyParameter =
{
policyKey : 'primary KEY'
};

console.info('Regenerating Namespace keys...');
client.namespaces.regenerateKeys(groupName, namespaceName, authorizationRuleName, regenerateKeyParameter, function (err, result, request, response) {
if (err) throw err;
console.info('Namespace primary key regenerated');
console.info('Regenerated Namespace keys: ' + JSON.stringify(result, null, ' '));
});


#### Managing a Namespace and NotificationHubs

var createNotificationHubParameters = {
location: namespaceLocation,
wnsCredential : {
packageSid : 'ms-app://s-1-15-2-1817505189-427745171-3213743798-2985869298-800724128-1004923984-4143860699',
secretKey : 'w7TBprR-THIS-IS-DUMMY-KEYAzSYFhp',
windowsLiveEndpoint : 'http://pushtestservice.cloudapp.net/LiveID/accesstoken.srf'
}
};

//Create a NotificationHub

console.info('Creating NotificationHub...');

client.notificationHubs.createOrUpdate(groupName, namespaceName, notificationHubName, createNotificationHubParameters, function (err, result, request, response) {

if (err) throw err;
console.info('NotificationHub created: ' + JSON.stringify(result, null, ' '));
});

//Get all NotificationHubs
console.info("Get all Notification Hubs");
client.notificationHubs.list(groupName, namespaceName, function (err, result, request, response) {
if (err) throw err;
console.info('Get all NotificationHub created: ' + JSON.stringify(result, null, ' '));
});

//Get NotificationHub PNS credentials
console.info("Get the PNS credentials");
client.notificationHubs.getPnsCredentials(groupName, namespaceName, notificationHubName, function (err, result, request, response) {
if (err) throw err;
console.info('NotificationHub PNS credentials: ' + JSON.stringify(result, null, ' '));
});

```
## Related projects
- [Microsoft Azure SDK for Node.js - All-up](https://github.com/WindowsAzure/azure-sdk-for-node)
- [AutoRest](https://github.com/Azure/autorest)
35 changes: 21 additions & 14 deletions lib/services/notificationHubsManagement/lib/models/admCredential.js
Expand Up @@ -10,23 +10,17 @@

'use strict';

var models = require('./index');

/**
* @class
* Initializes a new instance of the AdmCredential class.
* @constructor
* Description of a NotificationHub AdmCredential.
* @member {object} [properties] Gets or sets properties of NotificationHub
* AdmCredential.
*
* @member {string} [properties.clientId] Gets or sets the client identifier.
*
* @member {string} [clientId] The client identifier.
*
* @member {string} [properties.clientSecret] Gets or sets the credential
* secret access key.
* @member {string} [clientSecret] The credential secret access key.
*
* @member {string} [properties.authTokenUrl] Gets or sets the URL of the
* authorization token.
* @member {string} [authTokenUrl] The URL of the authorization token.
*
*/
function AdmCredential() {
Expand All @@ -46,12 +40,25 @@ AdmCredential.prototype.mapper = function () {
name: 'Composite',
className: 'AdmCredential',
modelProperties: {
properties: {
clientId: {
required: false,
serializedName: 'properties.clientId',
type: {
name: 'String'
}
},
clientSecret: {
required: false,
serializedName: 'properties.clientSecret',
type: {
name: 'String'
}
},
authTokenUrl: {
required: false,
serializedName: 'properties',
serializedName: 'properties.authTokenUrl',
type: {
name: 'Composite',
className: 'AdmCredentialProperties'
name: 'String'
}
}
}
Expand Down
Expand Up @@ -10,27 +10,19 @@

'use strict';

var models = require('./index');

/**
* @class
* Initializes a new instance of the ApnsCredential class.
* @constructor
* Description of a NotificationHub ApnsCredential.
* @member {object} [properties] Gets or sets properties of NotificationHub
* ApnsCredential.
*
* @member {string} [properties.apnsCertificate] Gets or sets the APNS
* certificate.
*
* @member {string} [apnsCertificate] The APNS certificate.
*
* @member {string} [properties.certificateKey] Gets or sets the certificate
* key.
* @member {string} [certificateKey] The certificate key.
*
* @member {string} [properties.endpoint] Gets or sets the endpoint of this
* credential.
* @member {string} [endpoint] The endpoint of this credential.
*
* @member {string} [properties.thumbprint] Gets or sets the Apns certificate
* Thumbprint
* @member {string} [thumbprint] The Apns certificate Thumbprint
*
*/
function ApnsCredential() {
Expand All @@ -50,12 +42,32 @@ ApnsCredential.prototype.mapper = function () {
name: 'Composite',
className: 'ApnsCredential',
modelProperties: {
properties: {
apnsCertificate: {
required: false,
serializedName: 'properties.apnsCertificate',
type: {
name: 'String'
}
},
certificateKey: {
required: false,
serializedName: 'properties.certificateKey',
type: {
name: 'String'
}
},
endpoint: {
required: false,
serializedName: 'properties.endpoint',
type: {
name: 'String'
}
},
thumbprint: {
required: false,
serializedName: 'properties',
serializedName: 'properties.thumbprint',
type: {
name: 'Composite',
className: 'ApnsCredentialProperties'
name: 'String'
}
}
}
Expand Down
Expand Up @@ -10,21 +10,17 @@

'use strict';

var models = require('./index');

/**
* @class
* Initializes a new instance of the BaiduCredential class.
* @constructor
* Description of a NotificationHub BaiduCredential.
* @member {object} [properties] Gets or sets properties of NotificationHub
* BaiduCredential.
*
* @member {string} [properties.baiduApiKey] Get or Set Baidu Api Key.
*
* @member {string} [baiduApiKey] Baidu Api Key.
*
* @member {string} [properties.baiduEndPoint] Get or Set Baidu Endpoint.
* @member {string} [baiduEndPoint] Baidu Endpoint.
*
* @member {string} [properties.baiduSecretKey] Get or Set Baidu Secret Key
* @member {string} [baiduSecretKey] Baidu Secret Key
*
*/
function BaiduCredential() {
Expand All @@ -44,12 +40,25 @@ BaiduCredential.prototype.mapper = function () {
name: 'Composite',
className: 'BaiduCredential',
modelProperties: {
properties: {
baiduApiKey: {
required: false,
serializedName: 'properties.baiduApiKey',
type: {
name: 'String'
}
},
baiduEndPoint: {
required: false,
serializedName: 'properties.baiduEndPoint',
type: {
name: 'String'
}
},
baiduSecretKey: {
required: false,
serializedName: 'properties',
serializedName: 'properties.baiduSecretKey',
type: {
name: 'Composite',
className: 'BaiduCredentialProperties'
name: 'String'
}
}
}
Expand Down

0 comments on commit f101f34

Please sign in to comment.