Merge pull request #129 from Microsoft-Interop/management

Add ServiceManagement API
This commit is contained in:
André Rodrigues 2012-03-02 15:21:32 -08:00
Родитель 59848c822a c0a1c2e8c4
Коммит edf842588a
35 изменённых файлов: 3206 добавлений и 110 удалений

Просмотреть файл

@ -0,0 +1,48 @@
var azure = require('../../lib/azure');
var testCommon = require('./testcommon');
var auth = {
keyfile: './certs/priv.pem',
certfile: './certs/pub.pem'
}
var inputNames = {
subscriptionId: '167a0c69-cb6f-4522-ba3e-d3bdc9c504e1',
serviceName: 'testjsService',
deploymentName: 'testjsDeployment',
roleName: 'testjsRole'
}
// data disk
// One of DiskName, SourceMediaLink, or LogicalDiskSize must be specified for createDeployment
// DiskName - ref to Data Disk in User Image Repository
// SourceMediaLink may be used in Create to specifiy location of BLOB in XSTORE
// MediaLink location of BLOB - not required in create
// DiskLabel - friendly name - optional
// HostCaching - “None”, ”ReadOnly”, “ReadWrite”. optional. Default ReadOnly
var dataDisk = {
LUN : 4,
SourceMediaLink: 'http://auxpreview181imagestore.blob.core.azure-preview.com/platformimages/b1e4d11d-f2be-4edb-93c4-77962e644fc8.vhd',
DiskLabel: 'disklabel'
};
var svcmgmt = azure.createServiceManagementService(inputNames.subscriptionId, auth);
svcmgmt.addDataDisk(inputNames.serviceName,
inputNames.deploymentName,
inputNames.roleName,
dataDisk, function(rspobj) {
if (rspobj.response && rspobj.response.isSuccessful) {
if (rspobj.response.statusCode == 200) {
console.log('OK');
} else {
console.log('Pending');
console.log('RequestID: ' + rspobj.response.headers['x-ms-request-id']);
}
} else {
testCommon.showErrorResponse(rspobj);
}
});

Просмотреть файл

@ -0,0 +1,49 @@
var azure = require('../../lib/azure');
var testCommon = require('./testcommon');
var auth = {
keyfile : './certs/priv.pem',
certfile : './certs/pub.pem'
}
var inputNames = {
subscriptionId: '167a0c69-cb6f-4522-ba3e-d3bdc9c504e1',
serviceName: 'testjsService',
deploymentName: 'testjsDeployment',
roleName: 'testjsRole'
}
// data disk
// One of DiskName, SourceMediaLink, or LogicalDiskSize must be specified for createDeployment
// DiskName - ref to Data Disk in User Image Repository
// SourceMediaLink may be used in Create to specifiy location of BLOB in XSTORE
// MediaLink location of BLOB - not required in create
// DiskLabel - friendly name - optional
// HostCaching - “None”, ”ReadOnly”, “ReadWrite”. optional. Default ReadOnly
var dataDisk = {
LUN : 3,
DiskName: 'testjsDeployment-testjsRole--2012216225449',
DiskLabel: 'disklabel'
};
var svcmgmt = azure.createServiceManagementService(inputNames.subscriptionId, auth);
svcmgmt.addDataDisk(inputNames.serviceName,
inputNames.deploymentName,
inputNames.roleName,
dataDisk, function(rspobj) {
if (rspobj.response && rspobj.response.isSuccessful) {
if (rspobj.response.statusCode == 200) {
console.log('OK');
} else {
console.log('Pending');
console.log('RequestID: ' + rspobj.response.headers['x-ms-request-id']);
}
} else {
testCommon.showErrorResponse(rspobj);
}
});

Просмотреть файл

@ -0,0 +1,48 @@
var azure = require('../../lib/azure');
var testCommon = require('./testcommon');
var auth = {
keyfile: './certs/priv.pem',
certfile: './certs/pub.pem'
}
var inputNames = {
subscriptionId: '167a0c69-cb6f-4522-ba3e-d3bdc9c504e1',
serviceName: 'testjsService',
deploymentName: 'testjsDeployment',
roleName: 'testjsRole'
}
// data disk
// One of DiskId, SourceMediaLink, or LogicalDiskSize must be specified for createDeployment
// DiskId - ref to Data Disk in User Image Repository
// SourceMediaLink may be used in Create to specifiy location of BLOB in XSTORE
// MediaLink location of BLOB - not required in create
// DiskName - friendly name - optional
// HostCaching - “None”, ”ReadOnly”, “ReadWrite”. optional. Default ReadOnly
var dataDisk = {
DiskLabel : 'testjsDiskLabel1',
LogicalDiskSizeInGB : 10,
LUN : 2,
MediaLink: 'testmedia'
};
var svcmgmt = azure.createServiceManagementService(inputNames.subscriptionId, auth);
svcmgmt.addDataDisk(inputNames.serviceName,
inputNames.deploymentName,
inputNames.roleName,
dataDisk, function(rspobj) {
if (rspobj.response && rspobj.response.isSuccessful) {
if (rspobj.response.statusCode == 200) {
console.log('OK');
} else {
console.log('Pending');
console.log('RequestID: ' + rspobj.response.headers['x-ms-request-id']);
}
} else {
testCommon.showErrorResponse(rspobj);
}
});

Просмотреть файл

@ -0,0 +1,97 @@
var azure = require('../../lib/azure');
var testCommon = require('./testcommon');
var auth = {
keyfile : './certs/priv.pem',
certfile : './certs/pub.pem'
}
var inputNames = {
subscriptionId: '167a0c69-cb6f-4522-ba3e-d3bdc9c504e1',
serviceName: 'testjsService',
deploymentName: 'testjsDeployment'
}
// data for VM Role
// OS Disk for VM role
// One of DiskId, SourceImageID, or MediaLink must be specified for createDeployment
// DiskId - guid reference to User Image Repository
// SourceImageId - reference to PlatformStockImage or UserImage Repository
// MediaLink - location of physical BLOB backing OS disk. Blob in customer storage account
// DiskLabel - friendly name - optional
// HostCaching - ”ReadOnly”, “ReadWrite”. optional. Default ReadWrite
var osDisk = {
SourceImageName : 'Win2K8SP1.110809-2000.201108-01.en.us.30GB.vhd',
};
// data disk
// One of DiskId, SourceMediaLink, or LogicalDiskSize must be specified for createDeployment
// DiskId - ref to Data Disk in User Image Repository
// SourceMediaLink may be used in Create to specifiy location of BLOB in XSTORE
// MediaLink location of BLOB - not required in create
// DiskName - friendly name - optional
// HostCaching - “None”, ”ReadOnly”, “ReadWrite”. optional. Default ReadOnly
var dataDisk1 = {
LogicalDiskSizeInGB : 10,
LUN : 0
};
// ConfigurationSetType must be 'ProvisioningConfiguration'
// AdminPassword must be base64 encoded
// MachineName is required
// ResetPasswordOnFirstLogon optional
// StoredCertificateSettings optional
var provisioningConfigurationSet = {
ConfigurationSetType: 'ProvisioningConfiguration',
AdminPassword: 'nodejsIaas',
MachineName: 'NodejsMa',
ResetPasswordOnFirstLogon: false
};
// Defines network endpoint
var externalEndpoint1 = {
Name: 'endpname1',
Protocol: 'tcp',
Port: '59917',
LocalPort: '3395'
};
// network configuration set
// Type maybe 'VirtualnetworkConfiguration' - doc ambiguous
var networkConfigurationSet = {
ConfigurationSetType: 'NetworkConfiguration',
InputEndpoints: [externalEndpoint1]
};
// VMRole is required
// may also have AvailabilitySetName
// RoleSize is optional
// RoleType must be 'PersistentVMRole'. Filled in automatically
var VMRole = {
RoleName: 'testjsRole',
RoleSize: 'Small',
OSDisk: osDisk,
DataDisks: [dataDisk1],
ConfigurationSets: [provisioningConfigurationSet, networkConfigurationSet]
}
var svcmgmt = azure.createServiceManagementService(inputNames.subscriptionId, auth);
svcmgmt.addRole(inputNames.serviceName,
inputNames.deploymentName,
VMRole, function(rspobj) {
if (rspobj.response && rspobj.response.isSuccessful) {
if (rspobj.response.statusCode == 200) {
console.log('OK');
} else {
console.log('Pending');
console.log('RequestID: ' + rspobj.response.headers['x-ms-request-id']);
}
} else {
testCommon.showErrorResponse(rspobj);
}
});

Просмотреть файл

@ -0,0 +1,50 @@
var azure = require('../../lib/azure');
var testCommon = require('./testcommon');
var auth = {
keyfile : './certs/priv.pem',
certfile : './certs/pub.pem'
}
var inputNames = {
subscriptionId: '167a0c69-cb6f-4522-ba3e-d3bdc9c504e1',
serviceName: 'testjsService',
deploymentName: 'testjsDeployment',
roleInstance: 'testjsRole_IN_0',
}
var provisioningConfigurationSet = {
ConfigurationSetType: 'ProvisioningConfiguration',
AdminPassword: 'nodejsIaas',
MachineName: 'NodejsMa',
ResetPasswordOnFirstLogon: false
}
var captureOptions = {
PostCaptureAction: 'Reprovision',
TargetImageLabel: 'targetimagelabel',
TargetImageName: 'Win2K8SP1.110809-2000.201108-01.en.us.30GB.vhd',
ProvisioningConfiguration: provisioningConfigurationSet
}
var svcmgmt = azure.createServiceManagementService(inputNames.subscriptionId, auth);
svcmgmt.captureRoleInstance(inputNames.serviceName,
inputNames.deploymentName,
inputNames.roleInstance,
captureOptions,
function(rspobj) {
if (rspobj.response && rspobj.response.isSuccessful) {
if (rspobj.response.statusCode == 200) {
console.log('OK');
} else {
console.log('Pending');
console.log('RequestID: ' + rspobj.response.headers['x-ms-request-id']);
}
} else {
testCommon.showErrorResponse(rspobj);
}
});

Просмотреть файл

@ -0,0 +1,163 @@
exports.showErrorResponse = showErrorResponse;
exports.showDeployment = showDeployment;
exports.showRole = showRole;
exports.showDataDisk = showDataDisk;
exports.showNetworkConfigEndpoints = showNetworkConfigEndpoints;
exports.showExternalEndpoint = showExternalEndpoint;
exports.showInputEndpoint = showInputEndpoint;
exports.showOSImage = showOSImage;
exports.showDisk = showDisk;
function showErrorResponse(rsp) {
console.log('There was an error response from the service');
console.log('status code=' + rsp.response.statusCode);
console.log('Error Code=' + rsp.error.code);
console.log('Error Message=' + rsp.error.message);
}
function showDeployment(rsp) {
console.log('Name: ' + rsp.Name);
console.log('DeploymentSlot:' + rsp.DeploymentSlot);
console.log('Status: ' + rsp.Status);
console.log('PrivateID: ' + rsp.PrivateID);
console.log('Label: ' + rsp.Label);
console.log('UpgradeDomainCount: ' + rsp.UpgradeDomainCount);
console.log('SdkVersion: ' + rsp.SdkVersion);
console.log('URL: ' + rsp.Url);
console.log('Configuration: ' + rsp.Configuration);
console.log('Locked: ' + rsp.Locked);
console.log('RollbackAllowed: ' + rsp.RollbackAllowed);
var roleinst = rsp.RoleInstanceList.RoleInstance;
console.log('RoleInstance: ');
console.log(' RoleName: ' + roleinst.RoleName);
console.log(' InstanceName: ' + roleinst.InstanceName);
console.log(' InstanceStatus: ' + roleinst.InstanceStatus);
console.log(' InstanceUpgradeDomain: ' + roleinst.InstanceUpgradeDomain);
console.log(' InstanceFaultDomain: ' + roleinst.InstanceFaultDomain);
console.log(' InstanceSize: ' + roleinst.InstanceSize);
console.log(' IpAddress: ' + roleinst.IpAddress);
var role = rsp.RoleList.Role;
console.log('Role: ');
showRole(role);
if (rsp.InputEndpointList) {
console.log(' InputEndpointList: ');
var endpoints = rsp.InputEndpointList
if (endpoints.InputEndpoint instanceof Array) {
var len = endpoints.InputEndpoint.length;
for (var i = 0; i < len; i++) {
showInputEndpoint(endpoints.InputEndpoint[i]);
}
} else if (endpoints) {
showInputEndpoint(endpoints.InputEndpoint);
}
}
}
function showRole(role) {
console.log(' RoleName: ' + role.RoleName);
console.log(' RoleType: ' + role.RoleType);
console.log(' RoleSize: ' + role.RoleSize);
console.log(' OsVersion: ' + role.OsVersion);
if (role.SubnetNames instanceof Array) {
console.log(' SubnetNames: ');
var len = role.SubnetNames.length;
for (var i = 0; i < len; i++) {
console.log(' SubnetName: ' + role.SubnetNames[i]);
}
}
console.log(' ConfigurationSets:');
if (role.ConfigurationSets.ConfigurationSet instanceof Array) {
var len = role.ConfigurationSets.length;
for (var i = 0; i < len; i++) {
console.log(' ConfigurationSetType: ' + role.ConfigurationSets.ConfigurationSet[i].ConfigurationSetType);
showNetworkConfigEndpoints(role.ConfigurationSets.ConfigurationSet[i]);
}
} else if (role.ConfigurationSets) {
console.log(' ConfigurationSetType: ' + role.ConfigurationSets.ConfigurationSet.ConfigurationSetType);
showNetworkConfigEndpoints(role.ConfigurationSets.ConfigurationSet);
}
if (role.DataDisks) {
console.log(' DataDisks:');
if (role.DataDisks.DataDisk instanceof Array) {
var len = role.DataDisks.DataDisk.length;
for (var i = 0; i < len; i++) {
showDataDisk(role.DataDisks.DataDisk[i]);
}
} else if (role.DataDisks.DataDisk) {
showDataDisk(role.DataDisks.DataDisk);
}
}
console.log(' OSDisk: ');
console.log(' DisableWriteCache: ' + role.OSDisk.DisableWriteCache);
console.log(' DiskName: ' + role.OSDisk.DiskName);
console.log(' MediaLink: ' + role.OSDisk.MediaLink);
console.log(' SourceImageName: ' + role.OSDisk.SourceImageName);
}
function showDataDisk(datadisk) {
console.log(' DataDisk:');
console.log(' DisableReadCache: ' + datadisk.DisableReadCache);
console.log(' DiskName: ' + datadisk.DiskName);
console.log(' EnableWriteCache: ' + datadisk.EnableWriteCache);
console.log(' LogicalDiskSizeInGB: ' + datadisk.LogicalDiskSizeInGB);
console.log(' LUN: ' + datadisk.LUN);
console.log(' MediaLink: ' + datadisk.MediaLink);
}
function showNetworkConfigEndpoints(configset) {
if (configset.ConfigurationSetType == 'NetworkConfiguration') {
var endpoints = configset.InputEndpoints;
if (endpoints) {
console.log(' InputEndpoints: ');
if (endpoints.ExternalEndpoint instanceof Array) {
var elen = endpoints.ExternalEndpoint.length;
for (var e = 0; e < elen; e++) {
showExternalEndpoint(endpoints.ExternalEndpoint[e]);
}
} else if (endpoints.ExternalEndpoint) {
showExternalEndpoint(endpoints.ExternalEndpoint);
}
}
}
}
function showExternalEndpoint(endpoint) {
console.log(' ExternalEndpoint: ');
console.log(' LocalPort: ' + endpoint.LocalPort);
console.log(' Name: ' + endpoint.Name);
console.log(' Port: ' + endpoint.Port);
console.log(' Protocol: ' + endpoint.Protocol);
}
function showInputEndpoint(endpoint) {
console.log(' InputEndpoint: ');
console.log(' RoleName: ' + endpoint.RoleName);
console.log(' Vip: ' + endpoint.Vip);
console.log(' Port: ' + endpoint.Port);
}
function showOSImage(image) {
console.log(' category = ' + image.Category);
console.log(' label = ' + image.Label);
console.log(' location = ' + image.Location);
console.log(' mediaLink = ' + image.MediaLink);
console.log(' name = ' + image.Name);
console.log(' role size = ' + image.RoleSize);
console.log(' SupportsStatelessDeployment = ' + image.SupportsStatelessDeployment);
}
function showDisk(disk) {
if (disk.AttachedTo) {
console.log(' AttachedTo');
console.log(' DeploymentName = ' + disk.AttachedTo.DeploymentName);
console.log(' HostedServiceName = ' + disk.AttachedTo.HostedServiceName);
console.log(' RoleName = ' + disk.AttachedTo.RoleName);
}
console.log(' HasOperatingSystem = ' + disk.HasOperatingSystem);
console.log(' Location = ' + disk.Location);
console.log(' MediaLink = ' + disk.MediaLink);
console.log(' Name = ' + disk.Name);
console.log(' SourceImageName = ' + disk.SourceImageName);
}

Просмотреть файл

@ -0,0 +1,105 @@
var azure = require('../../lib/azure');
var testCommon = require('./testcommon');
var auth = {
keyfile : './certs/priv.pem',
certfile : './certs/pub.pem'
}
var inputNames = {
subscriptionId: '167a0c69-cb6f-4522-ba3e-d3bdc9c504e1',
serviceName: 'testjsService',
deploymentName: 'testjsDeployment'
}
// deploymentOptions is optional
// may also have UpgradeDomainCount
var deploymentOptions = {
DeploymentSlot: 'Staging',
Label: 'testjsDeployLabel'
}
// data for VM Role
// OS Disk for VM role
// One of DiskId, SourceImageID, or MediaLink must be specified for createDeployment
// DiskId - guid reference to User Image Repository
// SourceImageId - reference to PlatformStockImage or UserImage Repository
// MediaLink - location of physical BLOB backing OS disk. Blob in customer storage account
// DiskLabel - friendly name - optional
// HostCaching - ”ReadOnly”, “ReadWrite”. optional. Default ReadWrite
var osDisk = {
SourceImageName : 'CentOs-CS.vhd',
};
// data disk
// One of DiskId, SourceMediaLink, or LogicalDiskSize must be specified for createDeployment
// DiskId - ref to Data Disk in User Image Repository
// SourceMediaLink may be used in Create to specifiy location of BLOB in XSTORE
// MediaLink location of BLOB - not required in create
// DiskName - friendly name - optional
// HostCaching - “None”, ”ReadOnly”, “ReadWrite”. optional. Default ReadOnly
var dataDisk1 = {
LogicalDiskSizeInGB : 10,
LUN : 0
};
// ConfigurationSetType must be 'ProvisioningConfiguration'
// AdminPassword must be base64 encoded
// MachineName is required
// ResetPasswordOnFirstLogon optional
// StoredCertificateSettings optional
var provisioningConfigurationSet = {
ConfigurationSetType: 'ProvisioningConfiguration',
AdminPassword: 'nodejsIaas',
MachineName: 'NodejsMa',
ResetPasswordOnFirstLogon: false
};
// Defines network endpoint
var externalEndpoint1 = {
Name: 'endpname1',
Protocol: 'tcp',
Port: '59917',
LocalPort: '3395'
};
// network configuration set
// Type maybe 'VirtualnetworkConfiguration' - doc ambiguous
var networkConfigurationSet = {
ConfigurationSetType: 'NetworkConfiguration',
InputEndpoints: [externalEndpoint1]
};
// VMRole is required
// may also have AvailabilitySetName
// RoleSize is optional
// RoleType must be 'PersistentVMRole'. Filled in automatically
var VMRole = {
RoleName: 'testjsRole',
RoleSize: 'Small',
OSDisk: osDisk,
DataDisks: [dataDisk1],
ConfigurationSets: [provisioningConfigurationSet, networkConfigurationSet]
}
var svcmgmt = azure.createServiceManagementService(inputNames.subscriptionId, auth);
svcmgmt.createDeployment(inputNames.serviceName,
inputNames.deploymentName,
VMRole, deploymentOptions,
function(rspobj) {
if (rspobj.response && rspobj.response.isSuccessful) {
if (rspobj.response.statusCode == 200) {
console.log('OK');
} else {
console.log('Pending');
console.log('RequestID: ' + rspobj.response.headers['x-ms-request-id']);
}
} else {
testCommon.showErrorResponse(rspobj);
}
});

Просмотреть файл

@ -0,0 +1,30 @@
var azure = require('../../lib/azure');
var testCommon = require('./testcommon');
var auth = {
keyfile: './certs/priv.pem',
certfile: './certs/pub.pem'
}
var inputNames = {
subscriptionId: '167a0c69-cb6f-4522-ba3e-d3bdc9c504e1',
serviceName: 'testjsService'
};
var svcmgmt = azure.createServiceManagementService(inputNames.subscriptionId, auth);
svcmgmt.createHostedService(inputNames.serviceName, function(rspobj) {
if (rspobj.response && rspobj.response.isSuccessful) {
if (rspobj.response.statusCode == 200) {
console.log('OK');
} else {
console.log('Pending');
console.log('RequestID: ' + rspobj.response.headers['x-ms-request-id']);
}
} else {
testCommon.showErrorResponse(rspobj);
}
});

Просмотреть файл

@ -0,0 +1,30 @@
var azure = require('../../lib/azure');
var testCommon = require('./testcommon');
var auth = {
keyfile: './certs/priv.pem',
certfile: './certs/pub.pem'
}
var inputNames = {
subscriptionId: '167a0c69-cb6f-4522-ba3e-d3bdc9c504e1',
imageName: 'testjsImage',
mediaLink: 'http://sergei.blob.core.azure-preview.com/vhdstore/a5ca38048c2440b59e3166590f22b5aaXX.vhd'
};
var svcmgmt = azure.createServiceManagementService(inputNames.subscriptionId, auth);
svcmgmt.createOSImage(inputNames.imageName, inputNames.mediaLink, function(rspobj) {
if (rspobj.response && rspobj.response.isSuccessful) {
if (rspobj.response.statusCode == 200) {
console.log('OK');
} else {
console.log('Pending');
console.log('RequestID: ' + rspobj.response.headers['x-ms-request-id']);
}
} else {
testCommon.showErrorResponse(rspobj);
}
});

Просмотреть файл

@ -0,0 +1,32 @@
var azure = require('../../lib/azure');
var testCommon = require('./testcommon');
var auth = {
keyfile: './certs/priv.pem',
certfile: './certs/pub.pem'
}
var inputNames = {
subscriptionId: '167a0c69-cb6f-4522-ba3e-d3bdc9c504e1',
serviceName: 'testjsService',
deploymentName: 'testjsDeployment',
deploymentSlot: 'Staging'
};
var svcmgmt = azure.createServiceManagementService(inputNames.subscriptionId, auth);
svcmgmt.deleteDeployment(inputNames.serviceName, inputNames.deploymentName, function(rspobj) {
if (rspobj.response && rspobj.response.isSuccessful) {
if (rspobj.response.statusCode == 200) {
console.log('OK');
} else {
console.log('Pending');
console.log('RequestID: ' + rspobj.response.headers['x-ms-request-id']);
}
} else {
testCommon.showErrorResponse(rspobj);
}
});

Просмотреть файл

@ -0,0 +1,29 @@
var azure = require('../../lib/azure');
var testCommon = require('./testcommon');
var auth = {
keyfile : './certs/priv.pem',
certfile : './certs/pub.pem'
}
var inputNames = {
subscriptionId: '167a0c69-cb6f-4522-ba3e-d3bdc9c504e1',
serviceName: 'testjsService',
};
var svcmgmt = azure.createServiceManagementService(inputNames.subscriptionId, auth);
svcmgmt.deleteHostedService(inputNames.serviceName, function(rspobj) {
if (rspobj.response && rspobj.response.isSuccessful) {
if (rspobj.response.statusCode == 200) {
console.log('OK');
} else {
console.log('Pending');
console.log('RequestID: ' + rspobj.response.headers['x-ms-request-id']);
}
} else {
testCommon.showErrorResponse(rspobj);
}
});

Просмотреть файл

@ -0,0 +1,31 @@
var azure = require('../../lib/azure');
var testCommon = require('./testcommon');
var auth = {
keyfile: './certs/priv.pem',
certfile: './certs/pub.pem'
}
var inputNames = {
subscriptionId: '167a0c69-cb6f-4522-ba3e-d3bdc9c504e1',
imageName: 'testjsImage'
};
var svcmgmt = azure.createServiceManagementService(inputNames.subscriptionId, auth);
svcmgmt.deleteOSImage(inputNames.imageName, function(rspobj) {
if (rspobj.response && rspobj.response.isSuccessful) {
if (rspobj.response.statusCode == 200) {
console.log('OK');
} else {
console.log('Pending');
console.log('RequestID: ' + rspobj.response.headers['x-ms-request-id']);
}
} else {
testCommon.showErrorResponse(rspobj);
}
});

Просмотреть файл

@ -0,0 +1,31 @@
var azure = require('../../lib/azure');
var testCommon = require('./testcommon');
var auth = {
keyfile : './certs/priv.pem',
certfile : './certs/pub.pem'
}
var inputNames = {
subscriptionId: '167a0c69-cb6f-4522-ba3e-d3bdc9c504e1',
serviceName: 'testjsService',
deploymentName: 'testjsDeployment',
roleName: 'testjsRole',
};
var svcmgmt = azure.createServiceManagementService(inputNames.subscriptionId, auth);
svcmgmt.deleteRole(inputNames.serviceName, inputNames.deploymentName, inputNames.roleName, function(rspobj) {
if (rspobj.response && rspobj.response.isSuccessful) {
if (rspobj.response.statusCode == 200) {
console.log('OK');
} else {
console.log('Pending');
console.log('RequestID: ' + rspobj.response.headers['x-ms-request-id']);
}
} else {
testCommon.showErrorResponse(rspobj);
}
});

Просмотреть файл

@ -0,0 +1,39 @@
var azure = require('../../lib/azure');
var testCommon = require('./testcommon');
var auth = {
keyfile: './certs/priv.pem',
certfile: './certs/pub.pem'
}
var inputNames = {
subscriptionId: '167a0c69-cb6f-4522-ba3e-d3bdc9c504e1',
serviceName: 'testjsService',
deploymentName: 'testjsDeployment',
deploymentSlot: 'Staging'
};
var svcmgmt = azure.createServiceManagementService(inputNames.subscriptionId, auth);
svcmgmt.getDeploymentBySlot(inputNames.serviceName, inputNames.deploymentSlot, function(rspobj) {
if (rspobj.response && rspobj.response.isSuccessful && rspobj.response.body) {
var rsp = rspobj.response.body;
console.log('*** Deployments By Slot results ***');
testCommon.showDeployment(rsp);
} else {
testCommon.showErrorResponse(rspobj);
}
});
svcmgmt.getDeployment(inputNames.serviceName, inputNames.deploymentName, function(rspobj) {
if (rspobj.response && rspobj.response.isSuccessful && rspobj.response.body) {
var rsp = rspobj.response.body;
console.log('*** Deployments By Name results ***');
testCommon.showDeployment(rsp);
} else {
testCommon.showErrorResponse(rspobj);
}
});

Просмотреть файл

@ -0,0 +1,47 @@
var azure = require('../../lib/azure');
var testCommon = require('./testcommon');
var auth = {
keyfile: './certs/priv.pem',
certfile: './certs/pub.pem'
}
var inputNames = {
subscriptionId: '167a0c69-cb6f-4522-ba3e-d3bdc9c504e1',
diskName: 'EduardK-20120201195834'
};
var svcmgmt = azure.createServiceManagementService(inputNames.subscriptionId, auth);
svcmgmt.getDisk(inputNames.diskName, function(rspobj) {
if (rspobj.response && rspobj.response.isSuccessful && rspobj.response.body) {
var rsp = rspobj.response.body;
console.log('** named disk information **');
testCommon.showDisk(rsp);
} else {
testCommon.showErrorResponse(rspobj);
}
});
svcmgmt.listDisks(function(rspobj) {
if (rspobj.response && rspobj.response.isSuccessful && rspobj.response.body) {
var rsp = rspobj.response.body;
console.log('** List of Disks **');
if (rsp.Disk) {
if (rsp.Disk instanceof Array) {
for (var i = 0; i < rsp.Disk.length; i++) {
console.log('** Disk **');
testCommon.showDisk(rsp.Disk[i]);
}
} else {
testCommon.showDisk(rsp.Disk);
}
}
} else {
testCommon.showErrorResponse(rspobj);
}
});

Просмотреть файл

@ -0,0 +1,30 @@
var azure = require('../../lib/azure');
var testCommon = require('./testcommon');
var auth = {
keyfile: './certs/priv.pem',
certfile: './certs/pub.pem'
}
var inputNames = {
subscriptionId: '167a0c69-cb6f-4522-ba3e-d3bdc9c504e1',
serviceName: 'testjsService'
};
var svcmgmt = azure.createServiceManagementService(inputNames.subscriptionId, auth);
svcmgmt.getHostedService(inputNames.serviceName, function(rspobj) {
if (rspobj.response && rspobj.response.isSuccessful && rspobj.response.body) {
var rsp = rspobj.response.body;
console.log('ServiceName: ' + rsp.ServiceName);
console.log('Description: ' + rsp.HostedServiceProperties.Description);
console.log('Location: ' + rsp.HostedServiceProperties.Location);
console.log('AffinityGroup: ' + rsp.HostedServiceProperties.AffinityGroup);
console.log('Label: ' + rsp.HostedServiceProperties.Label);
} else {
testCommon.showErrorResponse(rspobj);
}
});

Просмотреть файл

@ -0,0 +1,31 @@
var azure = require('../../lib/azure');
var testCommon = require('./testcommon');
var auth = {
keyfile: './certs/priv.pem',
certfile: './certs/pub.pem'
}
var inputNames = {
subscriptionId: '167a0c69-cb6f-4522-ba3e-d3bdc9c504e1',
serviceName: 'testjsService'
};
var svcmgmt = azure.createServiceManagementService(inputNames.subscriptionId, auth);
svcmgmt.setProxyUrl('http://itgproxy:80');
svcmgmt.getHostedService(inputNames.serviceName, function(rspobj) {
if (rspobj.response && rspobj.response.isSuccessful && rspobj.response.body) {
var rsp = rspobj.response.body;
console.log('ServiceName: ' + rsp.ServiceName);
console.log('Description: ' + rsp.HostedServiceProperties.Description);
console.log('Location: ' + rsp.HostedServiceProperties.Location);
console.log('AffinityGroup: ' + rsp.HostedServiceProperties.AffinityGroup);
console.log('Label: ' + rsp.HostedServiceProperties.Label);
} else {
testCommon.showErrorResponse(rspobj);
}
});

Просмотреть файл

@ -0,0 +1,36 @@
var azure = require('../../lib/azure');
var testCommon = require('./testcommon');
var auth = {
keyfile : './certs/priv.pem',
certfile : './certs/pub.pem'
}
var inputNames = {
subscriptionId: '167a0c69-cb6f-4522-ba3e-d3bdc9c504e1',
};
if (process.argv.length < 3) {
console.log('Pass the request id on the command line');
process.exit();
}
var reqid = process.argv[2];
var svcmgmt = azure.createServiceManagementService(inputNames.subscriptionId, auth);
svcmgmt.getOperationStatus(reqid, function(rspobj) {
if (rspobj.response && rspobj.response.isSuccessful && rspobj.response.body) {
var rsp = rspobj.response.body;
console.log(rsp.Status);
if (rsp.HttpStatusCode) console.log('HTTP Status: ' + rsp.HttpStatusCode);
if (rsp.Error) {
console.log('Error code: ' + rsp.Error.Code);
console.log('Error Message: ' + rsp.Error.Message);
}
} else {
testCommon.showErrorResponse(rspobj);
}
});

Просмотреть файл

@ -0,0 +1,46 @@
var azure = require('../../lib/azure');
var testCommon = require('./testcommon');
var auth = {
keyfile: './certs/priv.pem',
certfile: './certs/pub.pem'
}
var inputNames = {
subscriptionId: '167a0c69-cb6f-4522-ba3e-d3bdc9c504e1',
imageName: 'testjsImage'
};
var svcmgmt = azure.createServiceManagementService(inputNames.subscriptionId, auth);
svcmgmt.getOSImage(inputNames.imageName, function(rspobj) {
if (rspobj.response && rspobj.response.isSuccessful && rspobj.response.body) {
var rsp = rspobj.response.body;
console.log('** named image information **');
testCommon.showOSImage(rsp);
} else {
testCommon.showErrorResponse(rspobj);
}
});
svcmgmt.listOSImage(function(rspobj) {
if (rspobj.response && rspobj.response.isSuccessful && rspobj.response.body) {
var rsp = rspobj.response.body;
console.log('** List of Images **');
if (rsp.OSImage) {
if (rsp.OSImage instanceof Array) {
for (var i = 0; i < rsp.OSImage.length; i++) {
console.log('** Image **');
testCommon.showOSImage(rsp.OSImage[i]);
}
} else {
testCommon.showOSImage(rsp.OSImage);
}
}
} else {
testCommon.showErrorResponse(rspobj);
}
});

Просмотреть файл

@ -0,0 +1,28 @@
var azure = require('../../lib/azure');
var testCommon = require('./testcommon');
var auth = {
keyfile : './certs/priv.pem',
certfile : './certs/pub.pem'
}
var inputNames = {
subscriptionId: '167a0c69-cb6f-4522-ba3e-d3bdc9c504e1',
serviceName: 'testjsService',
deploymentName: 'testjsDeployment',
roleName: 'testjsRole',
};
var svcmgmt = azure.createServiceManagementService(inputNames.subscriptionId, auth);
svcmgmt.getRole(inputNames.serviceName, inputNames.deploymentName, inputNames.roleName, function(rspobj) {
if (rspobj.response && rspobj.response.isSuccessful && rspobj.response.body) {
var rsp = rspobj.response.body;
testCommon.showRole(rsp);
} else {
testCommon.showErrorResponse(rspobj);
}
});

Просмотреть файл

@ -0,0 +1,40 @@
var azure = require('../../lib/azure');
var testCommon = require('./testcommon');
var auth = {
keyfile: './certs/priv.pem',
certfile: './certs/pub.pem'
}
var inputNames = {
subscriptionId: '167a0c69-cb6f-4522-ba3e-d3bdc9c504e1',
storageServicename: 'auxpreview181imagestore',
badServicename: 'auxpreviewunknown'
};
var svcmgmt = azure.createServiceManagementService(inputNames.subscriptionId, auth);
svcmgmt.getStorageAccountKeys(inputNames.storageServicename, function(rspobj) {
if (rspobj.response && rspobj.response.isSuccessful && rspobj.response.body) {
var rsp = rspobj.response.body;
console.log('URL = ' + rsp.Url);
console.log('Primary = ' + rsp.StorageServiceKeys.Primary);
console.log('Secondary = ' + rsp.StorageServiceKeys.Secondary);
} else {
testCommon.showErrorResponse(rspobj);
}
});
svcmgmt.getStorageAccountKeys(inputNames.badServicename, function(rspobj) {
if (rspobj.isSuccessful && rspobj.response) {
console.log('Calling with bad storage service name: Unexpected success');
} else {
if (rspobj.error.Code == 'ResourceNotFound') {
console.log('Calling with bad storage service name: Received expected failure code');
}
}
});

Просмотреть файл

@ -0,0 +1,25 @@
var azure = require('../../lib/azure');
var testCommon = require('./testcommon');
var auth = {
keyfile : './certs/priv.pem',
certfile : './certs/pub.pem'
}
var inputNames = {
subscriptionId: '167a0c69-cb6f-4522-ba3e-d3bdc9c504e1'
}
var svcmgmt = azure.createServiceManagementService(inputNames.subscriptionId, auth);
svcmgmt.listDisks(function(rspobj) {
if (rspobj.response && rspobj.response.isSuccessful && rspobj.response.body) {
var rsp = rspobj.response.body;
console.log(rsp);
} else {
testCommon.showErrorResponse(rspobj);
}
});

Просмотреть файл

@ -0,0 +1,36 @@
var azure = require('../../lib/azure');
var testCommon = require('./testcommon');
var auth = {
keyfile : './certs/priv.pem',
certfile : './certs/pub.pem'
}
var inputNames = {
subscriptionId: '167a0c69-cb6f-4522-ba3e-d3bdc9c504e1'
};
var svcmgmt = azure.createServiceManagementService(inputNames.subscriptionId, auth);
svcmgmt.listHostedServices(function(rspobj) {
if (rspobj.response && rspobj.response.isSuccessful && rspobj.response.body) {
var rsp = rspobj.response.body;
if (rsp.HostedService instanceof Array) {
var len = rsp.HostedService.length;
console.log('Number of hosted services: ' + len);
for (var i = 0; i < len; i++) {
console.log('# ' + i +' ServiceName: ' + rsp.HostedService[i].ServiceName);
}
} else if (rsp.HostedService) {
console.log('Number of hosted services: 1');
console.log('ServiceName: ' + rsp.HostedService.ServiceName);
} else {
console.log('Number of hosted services: 0');
}
} else {
console.log(rspobj);
testCommon.showErrorResponse(rspobj);
}
});

Просмотреть файл

@ -0,0 +1,52 @@
var azure = require('../../lib/azure');
var testCommon = require('./testcommon');
var auth = {
keyfile: './certs/priv.pem',
certfile: './certs/pub.pem'
}
var inputNames = {
subscriptionId: '167a0c69-cb6f-4522-ba3e-d3bdc9c504e1',
serviceName: 'testjsService',
deploymentName: 'testjsDeployment',
roleName: 'testjsRole',
LUN: 0
}
// data disk
// One of DiskName, SourceMediaLink, or LogicalDiskSize must be specified for createDeployment
// DiskName - ref to Data Disk in User Image Repository
// SourceMediaLink may be used in Create to specifiy location of BLOB in XSTORE
// MediaLink location of BLOB - not required in create
// DiskLabel - friendly name - optional
// HostCaching - “None”, ”ReadOnly”, “ReadWrite”. optional. Default ReadOnly
var dataDisk = {
LUN : 0,
LogicalDiskSizeInGB : 10,
DiskLabel: 'disklabel',
MediaLink: 'http://sergei.blob.core.azure-preview.com/vhdstore/ImageCopy.vhd'
};
var svcmgmt = azure.createServiceManagementService(inputNames.subscriptionId, auth);
svcmgmt.modifyDataDisk(inputNames.serviceName,
inputNames.deploymentName,
inputNames.roleName,
inputNames.LUN,
dataDisk, function(rspobj) {
if (rspobj.response && rspobj.response.isSuccessful) {
if (rspobj.response.statusCode == 200) {
console.log('OK');
} else {
console.log('Pending');
console.log('RequestID: ' + rspobj.response.headers['x-ms-request-id']);
}
} else {
testCommon.showErrorResponse(rspobj);
}
});

Просмотреть файл

@ -0,0 +1,87 @@
var azure = require('../../lib/azure');
var testCommon = require('./testcommon');
var auth = {
keyfile : './certs/priv.pem',
certfile : './certs/pub.pem'
}
var inputNames = {
subscriptionId: '167a0c69-cb6f-4522-ba3e-d3bdc9c504e1',
serviceName: 'testjsService',
deploymentName: 'testjsDeployment',
roleName: 'testjsRole'
}
// data for VM Role
// OS Disk for VM role
// One of DiskId, SourceImageID, or MediaLink must be specified for createDeployment
// DiskId - guid reference to User Image Repository
// SourceImageId - reference to PlatformStockImage or UserImage Repository
// MediaLink - location of physical BLOB backing OS disk. Blob in customer storage account
// DiskLabel - friendly name - optional
// HostCaching - ”ReadOnly”, “ReadWrite”. optional. Default ReadWrite
var osDisk = {
SourceImageName : 'Win2K8SP1.110809-2000.201108-01.en.us.30GB.vhd',
};
// data disk
// One of DiskId, SourceMediaLink, or LogicalDiskSize must be specified for createDeployment
// DiskId - ref to Data Disk in User Image Repository
// SourceMediaLink may be used in Create to specifiy location of BLOB in XSTORE
// MediaLink location of BLOB - not required in create
// DiskName - friendly name - optional
// HostCaching - “None”, ”ReadOnly”, “ReadWrite”. optional. Default ReadOnly
var dataDisk2 = {
LogicalDiskSizeInGB : 10,
LUN : 1
};
// Defines network endpoint
var externalEndpoint1 = {
Name: 'endpname1',
Protocol: 'tcp',
Port: '59919',
LocalPort: '3395'
};
// network configuration set
// Type maybe 'VirtualnetworkConfiguration' - doc ambiguous
var networkConfigurationSet = {
ConfigurationSetType: 'NetworkConfiguration',
InputEndpoints: [externalEndpoint1]
};
// VMRole is required
// RoleSize is optional
// RoleType must be 'PersistentVMRole'. Filled in automatically
// For Modify Role do not include provisioningConfigurationSet
var VMRole = {
RoleName: inputNames.roleName,
RoleSize: 'Medium',
ConfigurationSets: [networkConfigurationSet]
}
var svcmgmt = azure.createServiceManagementService(inputNames.subscriptionId, auth);
svcmgmt.modifyRole(inputNames.serviceName,
inputNames.deploymentName,
inputNames.roleName,
VMRole, function(rspobj) {
if (rspobj.response && rspobj.response.isSuccessful) {
if (rspobj.response.statusCode == 200) {
console.log('OK');
} else {
console.log('Pending');
console.log('RequestID: ' + rspobj.response.headers['x-ms-request-id']);
}
} else {
testCommon.showErrorResponse(rspobj);
}
});

Просмотреть файл

@ -0,0 +1,37 @@
var azure = require('../../lib/azure');
var testCommon = require('./testcommon');
var auth = {
keyfile: './certs/priv.pem',
certfile: './certs/pub.pem'
}
var inputNames = {
subscriptionId: '167a0c69-cb6f-4522-ba3e-d3bdc9c504e1',
serviceName: 'testjsService',
deploymentName: 'testjsDeployment',
roleName: 'testjsRole',
LUN: 0
}
var svcmgmt = azure.createServiceManagementService(inputNames.subscriptionId, auth);
svcmgmt.removeDataDisk(inputNames.serviceName,
inputNames.deploymentName,
inputNames.roleName,
inputNames.LUN,
function(rspobj) {
if (rspobj.response && rspobj.response.isSuccessful) {
if (rspobj.response.statusCode == 200) {
console.log('OK');
} else {
console.log('Pending');
console.log('RequestID: ' + rspobj.response.headers['x-ms-request-id']);
}
} else {
testCommon.showErrorResponse(rspobj);
}
});

Просмотреть файл

@ -0,0 +1,64 @@
var azure = require('../../lib/azure');
var testCommon = require('./testcommon');
var auth = {
keyfile : './certs/priv.pem',
certfile : './certs/pub.pem'
}
var inputNames = {
subscriptionId: '167a0c69-cb6f-4522-ba3e-d3bdc9c504e1',
serviceName: 'testjsService',
deploymentName: 'testjsDeployment',
roleInstance: 'testjsRole_IN_0',
};
if (process.argv.length < 3) {
console.log('Pass either shutdown or restart on the command line');
process.exit();
}
var reqid = process.argv[2];
var svcmgmt = azure.createServiceManagementService(inputNames.subscriptionId, auth);
if (reqid.toLowerCase() == 'shutdown') {
svcmgmt.shutdownRoleInstance(inputNames.serviceName,
inputNames.deploymentName,
inputNames.roleInstance,
function(rspobj) {
if (rspobj.response && rspobj.response.isSuccessful) {
if (rspobj.response.statusCode == 200) {
console.log('OK');
} else {
console.log('Pending');
console.log('RequestID: ' + rspobj.response.headers['x-ms-request-id']);
}
} else {
testCommon.showErrorResponse(rspobj);
}
});
} else if (reqid.toLowerCase() == 'restart') {
svcmgmt.restartRoleInstance(inputNames.serviceName,
inputNames.deploymentName,
inputNames.roleInstance,
function(rspobj) {
if (rspobj.response && rspobj.response.isSuccessful) {
if (rspobj.response.statusCode == 200) {
console.log('OK');
} else {
console.log('Pending');
console.log('RequestID: ' + rspobj.response.headers['x-ms-request-id']);
}
} else {
testCommon.showErrorResponse(rspobj);
}
});
} else {
console.log('Pass either shutdown or restart on the command line');
process.exit();
}

Просмотреть файл

@ -97,6 +97,35 @@ exports.createServiceBusService = function (namespace, accessKey, issuer, acsNam
return new ServiceBusService(namespace, accessKey, issuer, acsNamespace, host, authenticationProvider);
};
/**
* ServiceManagement client exports.
*/
var ServiceManagementService = require('./services/ServiceManagement/servicemanagementservice');
exports.ServiceManagementService = ServiceManagementService;
/**
* Creates a new ServiceManagementService object.
*
* @param {string} subscriptionId The subscription ID for the account.
* @param {string} authentication The authentication object for the client.
* {
* keyfile: 'path to .pem',
* certfile: 'path to .pem',
* keyvalue: privatekey value,
* certvalue: public cert value
* }
* @param {string} hostOptions The host options to override defaults.
* {
* host: 'management.core.windows.net',
* apiversion: '2012-03-01',
* serializetype: 'XML'
* }
*/
exports.createServiceManagementService = function(subscriptionId, authentication, hostOptions) {
return new ServiceManagementService(subscriptionId, authentication, hostOptions);
};
/**
* Other exports.
*/

Просмотреть файл

@ -46,7 +46,9 @@ ServiceClient.EnvironmentVariables = {
HTTP_PROXY: 'HTTP_PROXY',
HTTPS_PROXY: 'HTTPS_PROXY',
ALL_PROXY: 'ALL_PROXY',
EMULATED: 'EMULATED'
EMULATED: 'EMULATED',
AZURE_CERTFILE: 'AZURE_CERTFILE',
AZURE_KEYFILE: 'AZURE_KEYFILE'
};
/**
@ -233,7 +235,7 @@ ServiceClient.prototype._performRequest = function (webResource, body, options,
};
var request;
if (self.protocol.substr(0, 5) === 'https') {
if (self.protocol.substr(0, 5).toLowerCase() === 'https') {
request = https.request(finalRequestOptions, processResponse);
} else {
request = http.request(finalRequestOptions, processResponse);
@ -410,6 +412,30 @@ ServiceClient.prototype._parseHost = function (host) {
return parsedUrl;
};
/*
* Returns the environment values ALL_PROXY, HTTPS_PROXY and HTTP_PROXY
* in case those are set.
*
* @return {string} or null
*/
ServiceClient.prototype._loadEnvironmentProxyValue = function() {
var proxyUrl = null;
if (process.env[ServiceClient.EnvironmentVariables.ALL_PROXY]) {
proxyUrl = process.env[ServiceClient.EnvironmentVariables.ALL_PROXY];
} else if (process.env[ServiceClient.EnvironmentVariables.ALL_PROXY.toLowerCase()]) {
proxyUrl = process.env[ServiceClient.EnvironmentVariables.ALL_PROXY.toLowerCase()];
} else if (process.env[ServiceClient.EnvironmentVariables.HTTPS_PROXY]) {
proxyUrl = process.env[ServiceClient.EnvironmentVariables.HTTPS_PROXY];
} else if (process.env[ServiceClient.EnvironmentVariables.HTTPS_PROXY.toLowerCase()]) {
proxyUrl = process.env[ServiceClient.EnvironmentVariables.HTTPS_PROXY.toLowerCase()];
} else if (process.env[ServiceClient.EnvironmentVariables.HTTP_PROXY]) {
proxyUrl = process.env[ServiceClient.EnvironmentVariables.HTTP_PROXY];
} else if (process.env[ServiceClient.EnvironmentVariables.HTTP_PROXY.toLowerCase()]) {
proxyUrl = process.env[ServiceClient.EnvironmentVariables.HTTP_PROXY.toLowerCase()];
}
return proxyUrl;
};
/*
* Loads the fields "useProxy" and respective protocol, port and url
* from the environment values ALL_PROXY, HTTPS_PROXY and HTTP_PROXY
@ -418,14 +444,7 @@ ServiceClient.prototype._parseHost = function (host) {
* @return {undefined}
*/
ServiceClient.prototype._loadEnvironmentProxy = function() {
var proxyUrl = null;
if (process.env[ServiceClient.EnvironmentVariables.ALL_PROXY]) {
proxyUrl = process.env[ServiceClient.EnvironmentVariables.ALL_PROXY];
} else if (process.env[ServiceClient.EnvironmentVariables.HTTPS_PROXY]) {
proxyUrl = process.env[ServiceClient.EnvironmentVariables.HTTPS_PROXY];
} else if (process.env[ServiceClient.EnvironmentVariables.HTTP_PROXY]) {
proxyUrl = process.env[ServiceClient.EnvironmentVariables.HTTP_PROXY];
}
var proxyUrl = this._loadEnvironmentProxyValue();
if (proxyUrl) {
this.useProxy = true;
@ -466,6 +485,12 @@ ServiceClient.prototype._buildResponse = function (isSuccessful, body, headers,
*/
ServiceClient.prototype._parseResponse = function (response) {
if (!azureutil.objectIsNull(response.body) && response.body.trim() !== '') {
if (this.serializetype && this.serializetype != 'XML') {
// TODO: hande JSON
response.isSuccessful = false;
response.parsingError = { parsingError: Constants.GeneralErrorCodeStrings.INVALID_CONTENT_TYPE };
return;
}
var parser = new xml2js.Parser();
var error = null;
parser.on('error', function (e) { error = e; });

Просмотреть файл

@ -0,0 +1,286 @@
// Module dependencies.
var https = require('https');
var util = require('util');
var fs = require('fs');
var url = require('url');
var tunnel = require('tunnel');
var WebResource = require('../../http/webresource');
var ServiceClient = require('./serviceclient');
var Constants = require('../../util/constants');
var HeaderConstants = Constants.HeaderConstants;
// Expose 'ServiceManagementClient'.
exports = module.exports = ServiceManagementClient;
/**
* Error messages.
*/
ServiceManagementClient.missingKeyValue = 'Client private key certificate is required';
ServiceManagementClient.missingCertValue = 'Client public certificate is required';
ServiceManagementClient.invalidSerializeType = 'serializetype must be XML or JSON';
// The hostOptions object may be used to override the following defaults
// Default host name.
// TODO: Change when API becomes public
ServiceManagementClient.DefaultHost = 'management-preview.core.windows-int.net';
// Default API Version
// TODO: Change when API becomes public
ServiceManagementClient.DefaultAPIVersion = '2012-03-01';
// Default serialization Type: XML or JSON
// TODO: Change when JSON becomes available
ServiceManagementClient.DefaultSerializeType = 'XML';
/**
* Creates a new ServiceClient object.
*
* @constructor
* @param {string} hostOptions The host options to override defaults.
* {
* host: 'management.core.windows.net',
* port: optional port number
* apiversion: '2012-03-01',
* serializetype: 'XML'
* }
*/
function ServiceManagementClient(authentication, hostOptions) {
ServiceManagementClient.super_.call(this);
this._setAuthentication(authentication);
this._setServiceHost(hostOptions);
this._setDefaultProxy();
}
util.inherits(ServiceManagementClient, ServiceClient);
/**
* Sets the client authentication credentials using provided values
* private key and public certificate values may be passed as strings, or will be read from files
*
* @return {Void}
*/
ServiceManagementClient.prototype._setAuthentication = function(authentication) {
this.keyvalue = null;
this.certvalue = null;
if (authentication) {
if (typeof authentication.keyvalue === 'string' && authentication.keyvalue.length > 0) {
this.keyvalue = authentication.keyvalue;
} else if (typeof authentication.keyfile === 'string' && authentication.keyfile.length > 0) {
this.keyvalue = fs.readFileSync(authentication.keyfile, 'ascii');
}
if (typeof authentication.certvalue === 'string' && authentication.certvalue.length > 0) {
this.certvalue = authentication.certvalue;
} else if (typeof authentication.certfile === 'string' && authentication.certfile.length > 0) {
this.certvalue = fs.readFileSync(authentication.certfile, 'ascii');
}
}
if (this.keyvalue === null || this.keyvalue.length === 0) {
var keyfile = process.env[ServiceClient.EnvironmentVariables.AZURE_KEYFILE];
if (typeof keyfile === 'string' && keyfile.length > 0) {
this.keyvalue = fs.readFileSync(keyfile, 'ascii');
}
}
if (this.certvalue === null || this.certvalue.length === 0) {
var certfile = process.env[ServiceClient.EnvironmentVariables.AZURE_CERTFILE];
if (typeof certfile === 'string' && certfile.length > 0) {
this.certvalue = fs.readFileSync(certfile, 'ascii');
}
}
if (this.keyvalue === null || this.keyvalue.length === 0) {
throw new Error(ServiceManagementClient.missingKeyValue);
}
if (this.certvalue === null || this.certvalue.length === 0) {
throw new Error(ServiceManagementClient.missingCertValue);
}
};
/**
* Sets the service host options using provided values
* Options are host name, serialization type, and API version string
* If not specified, then the defaults are used
*
* @return {Void}
*/
ServiceManagementClient.prototype._setServiceHost = function(hostOptions) {
this.host = ServiceManagementClient.DefaultHost;
this.apiversion = ServiceManagementClient.DefaultAPIVersion;
this.serializetype = ServiceManagementClient.DefaultSerializeType;
this.port = null;
this.protocol = Constants.HTTPS;
if (hostOptions) {
if (hostOptions.host) {
this.host = hostOptions.host;
}
if (hostOptions.apiversion) {
this.apiversion = hostOptions.apiversion;
}
if (hostOptions.serializetype) {
if (hostOptions.serializetype != 'XML' && hostOptions.serializetype != 'JSON') {
throw new Error(ServiceManagementClient.invalidSerializeType);
}
this.serializetype = hostOptions.serializetype;
}
if (hostOptions.port) {
this.port = hostOptions.port;
}
}
};
/**
* Get the content-type string based on serializeType
*
* @return {string}
*/
ServiceManagementClient.prototype._getContentType = function() {
if (this.serializetype === 'XML') {
return 'application/xml';
} else {
return 'application/json';
}
};
/**
* Builds the request options to be passed to the http.request method.
*
* @param {WebResource} webResource The webresource where to build the options from.
* @param {object} options The request options.
* @param {function(error, requestOptions)} callback The callback function.
* @return {undefined}
*/
ServiceManagementClient.prototype._buildRequestOptions = function(webResource, options, callback) {
var self = this;
options.disableContentMD5 = true;
webResource.addOptionalHeader(HeaderConstants.CONTENT_TYPE, self._getContentType());
webResource.addOptionalHeader(HeaderConstants.ACCEPT_HEADER, self._getContentType());
webResource.addOptionalHeader(HeaderConstants.ACCEPT_CHARSET_HEADER, 'UTF-8');
webResource.addOptionalHeader(HeaderConstants.STORAGE_VERSION_HEADER, self.apiversion);
webResource.addOptionalHeader(HeaderConstants.HOST_HEADER, self.host);
var requestOptions = {
method: webResource.httpVerb,
path: webResource.path,
key: self.keyvalue,
cert: self.certvalue,
host: self.host,
headers: webResource.headers
};
if (self.port) {
requestOptions.port = self.port;
}
self._setAgent(self, requestOptions, self.protocol.substr(0, 5).toLowerCase() === Constants.HTTPS);
callback(null, requestOptions);
};
/**
* Sets the service host default proxy from the environment.
* Can be overridden by calling _setProxyUrl or _setProxy
*
*/
ServiceManagementClient.prototype._setDefaultProxy = function() {
var proxyUrl = this._loadEnvironmentProxyValue();
this._setProxyUrl(proxyUrl);
};
/*
* Sets proxy object from a proxy url.
*
* @param {string} proxyurl url of proxy server. ex: http:corpproxy:80
* if null or undefined, clears proxy
*/
ServiceManagementClient.prototype._setProxyUrl = function(proxyurl) {
if (proxyurl) {
var parsedUrl = url.parse(proxyurl);
if (!parsedUrl.port) {
parsedUrl.port = 80;
}
this._setProxy({
host: parsedUrl.hostname,
port: parsedUrl.port
},
parsedUrl.protocol.substr(0, 5).toLowerCase() === Constants.HTTPS);
} else {
this._setProxy(null);
}
};
/*
* Sets proxy object specified by caller.
*
* @param {object} proxy proxy to use for tunneling
* {
* host: hostname
* port: port number
* proxyAuth: 'user:password' for basic auth
* headers: {...} headers for proxy server
* key: key for proxy server
* ca: ca for proxy server
* cert: cert for proxy server
* }
* if null or undefined, clears proxy
* @param {bool} isHTTPS true - use https to proxy. Otherwise use http.
*/
ServiceManagementClient.prototype._setProxy = function(proxy, isHTTPS) {
if (proxy) {
this.useTunnelProxy = true;
this.proxy = proxy;
this.proxyIsHTTPS = isHTTPS || false;
} else {
this.useTunnelProxy = false;
this.proxy = null;
}
};
/**
* Set the Agent to use for the request
* Result depends on proxy settings and protocol
*
* @param {object} reqopts request options for request
* @param {bool} isHTTPS true - use https to proxy. Otherwise use http.
*/
ServiceManagementClient.prototype._setAgent = function(self, reqopts, isHTTPS) {
if (self.useTunnelProxy && self.proxy) {
var agentinfo = {
proxy: self.proxy
};
if (reqopts.key) {
agentinfo.key = reqopts.key;
}
if (reqopts.cert) {
agentinfo.cert = reqopts.cert;
}
if (this.maxSockets) {
agentinfo.maxSockets = self.maxSockets;
}
if (isHTTPS) {
if (self.proxyIsHTTPS) {
reqopts.agent = tunnel.httpsOverHttps(agentinfo);
} else {
reqopts.agent = tunnel.httpsOverHttp(agentinfo);
}
} else {
if (self.proxyIsHTTPS) {
reqopts.agent = tunnel.httpOverHttps(agentinfo);
} else {
reqopts.agent = tunnel.httpOverHttp(agentinfo);
}
}
} else if (isHTTPS) {
reqopts.agent = new https.Agent(reqopts);
}
};

Просмотреть файл

@ -0,0 +1,454 @@
//
// Build request body from parameters and parse response body
//
var util = require('util');
var xmlbuilder = require('xmlbuilder');
// Expose 'ServiceManagementSerialize'.
exports = module.exports = ServiceManagementSerialize;
/**
* Error message if serialize type is not supported.
*/
ServiceManagementSerialize.invalidContentType = 'The response content type is invalid';
/**
* Creates a new ServiceManagementSerialize object.
*
* @constructor
*/
function ServiceManagementSerialize() {
}
/**
* Create the message body for CreateHostedService
* Use the specified serialization - for now only XML
*
* @param {string} serviceName The name of the service.
* @param {object} serviceOptions The properties for the new service.
* @param {object} client The servicemanagement object.
*/
ServiceManagementSerialize.prototype.buildCreateHostedService = function(serviceName, serviceOptions, client) {
if (client.serializetype === 'XML') {
var doc = _createXmlRoot('CreateHostedService');
_addDefinedValueXml(doc, 'ServiceName', serviceName);
var encLabel;
if (serviceOptions.Label) {
encLabel = new Buffer(serviceOptions.Label).toString('base64');
}
_addDefinedValueXml(doc, 'Label', encLabel);
_addDefinedValueXml(doc, 'Description', serviceOptions.Description);
_addDefinedValueXml(doc, 'Location', serviceOptions.Location);
return doc.toString();
} else {
// JSON not supported yet
throw new Error(ServiceManagementSerialize.invalidContentType);
}
};
/**
* Create the message body for CreateOSImage
* Use the specified serialization - for now only XML
*
* @param {string} imageName The name of the image.
* @param {string} mediaLink The mediaLink value.
* @param {object} imageOptions The optional properties for the new image.
* @param {object} client The servicemanagement object.
*/
ServiceManagementSerialize.prototype.buildCreateOSImage = function(imageName, mediaLink, imageOptions, client) {
if (!imageOptions) {
imageOptions = {};
}
if (!imageOptions.Label) {
imageOptions.Label = imageName;
}
if (client.serializetype === 'XML') {
var doc = _createXmlRoot('OSImage');
// add required and optional elements in alpha order
_addDefinedValueXml(doc, 'Category', imageOptions.Category);
_addDefinedValueXml(doc, 'Label', imageOptions.Label);
_addDefinedValueXml(doc, 'Location', imageOptions.Location);
_addDefinedValueXml(doc, 'MediaLink', mediaLink);
_addDefinedValueXml(doc, 'Name', imageName);
_addDefinedValueXml(doc, 'RoleSize', imageOptions.RoleSize);
return doc.toString();
} else {
// JSON not supported yet
throw new Error(ServiceManagementSerialize.invalidContentType);
}
};
/**
* Create the message body for CreateDeployment
* Use the specified serialization - for now only XML
*
* @param {string} serviceName The name of the service.
* @param {string} deploymentName The name of the deployment.
* @param {object} VMRole The properties for the new role.
* @param {object} deploymentOptions The optional properties for the new deployment.
* @param {object} client The servicemanagement object.
*/
ServiceManagementSerialize.prototype.buildCreateDeployment = function(serviceName, deploymentName,
VMRole, deploymentOptions, client) {
if (client.serializetype === 'XML') {
var doc = _createXmlRoot('Deployment');
_addDefinedValueXml(doc, 'Name', deploymentName);
_addDefinedValueXml(doc, 'DeploymentSlot', deploymentOptions.DeploymentSlot);
_addDefinedValueXml(doc, 'Label', new Buffer(deploymentOptions.Label).toString('base64'));
_addDefinedNumericXml(doc, 'UpgradeDomainCount', deploymentOptions.UpgradeDomainCount);
// must have 1 role
var child = doc.ele('RoleList').ele('Role');
this._buildPersistentVMRoleXml(VMRole, child);
return doc.toString();
} else {
// JSON not supported yet
throw new Error(ServiceManagementSerialize.invalidContentType);
}
};
/**
* Create the message body for AddRole
* Use the specified serialization - for now only XML
*
* @param {string} serviceName The name of the service.
* @param {string} deploymentName The name of the deployment.
* @param {object} VMRole The properties for the new role.
* @param {object} client The servicemanagement object.
*/
ServiceManagementSerialize.prototype.buildAddRole = function(serviceName, deploymentName,
VMRole, client) {
if (client.serializetype === 'XML') {
var doc = _createXmlRoot('Role');
this._buildPersistentVMRoleXml(VMRole, doc);
return doc.toString();
} else {
// JSON not supported yet
throw new Error(ServiceManagementSerialize.invalidContentType);
}
};
/**
* Create the message body for ModifyRole
* Use the specified serialization - for now only XML
*
* @param {string} serviceName The name of the service.
* @param {string} deploymentName The name of the deployment.
* @param {string} roleName The name of the role.
* @param {object} VMRole The properties for the updated role.
* @param {object} client The servicemanagement object.
*/
ServiceManagementSerialize.prototype.buildModifyRole = function(serviceName, deploymentName,
roleName, VMRole, client) {
if (client.serializetype === 'XML') {
var doc = _createXmlRoot('Role');
this._buildPersistentVMRoleXml(VMRole, doc);
return doc.toString();
} else {
// JSON not supported yet
throw new Error(ServiceManagementSerialize.invalidContentType);
}
};
/**
* Create the message body for AddDataDisk
* Use the specified serialization - for now only XML
*
* @param {string} serviceName The name of the service.
* @param {string} deploymentName The name of the deployment.
* @param {string} roleName The name of the role.
* @param {object} datadisk The properties for the new disk.
* @param {object} client The servicemanagement object.
*/
ServiceManagementSerialize.prototype.buildAddDataDisk = function(serviceName, deploymentName,
roleName, datadisk, client) {
if (client.serializetype === 'XML') {
var doc = _createXmlRoot('DataDisk');
this._buildDataDiskXml(datadisk, doc);
return doc.toString();
} else {
// JSON not supported yet
throw new Error(ServiceManagementSerialize.invalidContentType);
}
};
/**
* Create the message body for ModifyDataDisk
* Use the specified serialization - for now only XML
*
* @param {string} serviceName The name of the service.
* @param {string} deploymentName The name of the deployment.
* @param {string} roleName The name of the role.
* @param {number} LUN The number for the disk.
* @param {object} datadisk The properties for the updated disk.
* @param {object} client The servicemanagement object.
*/
ServiceManagementSerialize.prototype.buildModifyDataDisk = function(serviceName, deploymentName,
roleName, LUN, datadisk, client) {
if (client.serializetype === 'XML') {
var doc = _createXmlRoot('DataDisk');
this._buildDataDiskXml(datadisk, doc);
return doc.toString();
} else {
// JSON not supported yet
throw new Error(ServiceManagementSerialize.invalidContentType);
}
};
/**
* Create the message body for ShutdownRoleInstance
* Use the specified serialization - for now only XML
*
* @param {string} serviceName The name of the service.
* @param {string} deploymentName The name of the deployment.
* @param {string} roleInstance The name of the role instance.
* @param {object} client The servicemanagement object.
*/
ServiceManagementSerialize.prototype.buildShutdownRoleInstance = function(serviceName, deploymentName,
roleInstance, client) {
if (client.serializetype === 'XML') {
var doc = _createXmlRoot('ShutdownRoleOperation');
return doc.toString();
} else {
// JSON not supported yet
throw new Error(ServiceManagementSerialize.invalidContentType);
}
};
/**
* Create the message body for RestartRoleInstance
* Use the specified serialization - for now only XML
*
* @param {string} serviceName The name of the service.
* @param {string} deploymentName The name of the deployment.
* @param {string} roleInstance The name of the role instance.
* @param {object} client The servicemanagement object.
*/
ServiceManagementSerialize.prototype.buildRestartRoleInstance = function(serviceName, deploymentName,
roleInstance, client) {
if (client.serializetype === 'XML') {
var doc = _createXmlRoot('RestartRoleOperation');
return doc.toString();
} else {
// JSON not supported yet
throw new Error(ServiceManagementSerialize.invalidContentType);
}
};
/**
* Create the message body for CaptureRoleInstance
* Use the specified serialization - for now only XML
*
* @param {string} serviceName The name of the service.
* @param {string} deploymentName The name of the deployment.
* @param {string} roleInstance The name of the role instance.
* @param {object} captureOptions The options for the capture operation.
* @param {object} client The servicemanagement object.
*/
ServiceManagementSerialize.prototype.buildCaptureRoleInstance = function(serviceName, deploymentName,
roleInstance, captureOptions, client) {
if (client.serializetype === 'XML') {
var doc = _createXmlRoot('CaptureRoleOperation');
_addDefinedValueXml(doc, 'PostCaptureAction', captureOptions.PostCaptureAction);
if (captureOptions.ProvisioningConfiguration) {
var inst = doc.ele('ProvisioningConfiguration');
this._buildProvisioningConfigurationXml(captureOptions.ProvisioningConfiguration, inst);
}
_addDefinedValueXml(doc, 'SupportsStatelessDeployment', captureOptions.SupportsStatelessDeployment);
_addDefinedValueXml(doc, 'TargetImageLabel', captureOptions.TargetImageLabel);
_addDefinedValueXml(doc, 'TargetImageName', captureOptions.TargetImageName);
return doc.toString();
} else {
// JSON not supported yet
throw new Error(ServiceManagementSerialize.invalidContentType);
}
};
/**
* Create root node with specified name and common namespaces
* returns xmlbuilder node object
*
* @param {string} rootName The XML root element name.
*/
function _createXmlRoot(rootName) {
var doc = xmlbuilder.create();
return doc.begin(rootName, { 'version': '1.0', 'encoding': 'utf-8' })
.att('xmlns', 'http://schemas.microsoft.com/windowsazure')
.att('xmlns:i', 'http://www.w3.org/2001/XMLSchema-instance');
}
/**
* Add an element to the node if the value exists
* returns xmlbuilder node object
*
* @param {object} node The XML parent node.
* @param {string} elename The XML element name.
* @param {string} value The value for the new node.
*/
function _addDefinedValueXml(node, elename, value) {
if (value) node.ele(elename).txt(value);
}
/**
* Add an element to the node if the value is a number
* returns xmlbuilder node object
* note: using _addDefinedValueXml will fail if value is 0
*
* @param {object} node The XML parent node.
* @param {string} elename The XML element name.
* @param {string} value The value for the new node.
*/
function _addDefinedNumericXml(node, elename, value) {
if (typeof value === 'number') node.ele(elename).txt(value);
}
/**
* Add a VM Role node tree to the specifed node
* returns xmlbuilder node object
*
* @param {object} VMRole The Role object properties.
* @param {object} node The XML parent node.
*/
ServiceManagementSerialize.prototype._buildPersistentVMRoleXml = function(VMRole, node) {
var child;
var inst;
var alen;
var i;
_addDefinedValueXml(node, 'RoleName', VMRole.RoleName);
_addDefinedValueXml(node, 'RoleType', VMRole.RoleType);
_addDefinedValueXml(node, 'AvailabilitySetName', VMRole.AvailabilitySetName);
if (VMRole.ConfigurationSets) {
child = node.ele('ConfigurationSets');
alen = VMRole.ConfigurationSets.length;
for (i = 0; i < alen; i++) {
inst = child.ele('ConfigurationSet');
if (VMRole.ConfigurationSets[i].ConfigurationSetType === 'ProvisioningConfiguration') {
this._buildProvisioningConfigurationXml(VMRole.ConfigurationSets[i], inst);
} else if (VMRole.ConfigurationSets[i].ConfigurationSetType === 'NetworkConfiguration') {
this._buildNetworkConfigurationXml(VMRole.ConfigurationSets[i], inst);
} else {
throw new Error(ServiceManagementSerialize.unknownConfigsetType +
VMRole.ConfigurationSets[i].ConfigurationSetType);
}
}
}
if (VMRole.OSDisk) {
child = node.ele('OSDisk');
this._buildOSDiskXml(VMRole.OSDisk, child);
}
if (VMRole.DataDisks) {
child = node.ele('DataDisks');
alen = VMRole.DataDisks.length;
for (i = 0; i < alen; i++) {
inst = child.ele('DataDisk');
this._buildDataDiskXml(VMRole.DataDisks[i], inst);
}
}
_addDefinedValueXml(node, 'RoleSize', VMRole.RoleSize);
};
/**
* Add OSDisk properties to the specifed node
* returns xmlbuilder node object
*
* @param {object} OSDisk The OSDisk object properties.
* @param {object} node The XML parent node.
*/
ServiceManagementSerialize.prototype._buildOSDiskXml = function(OSDisk, node) {
_addDefinedValueXml(node, 'DisableWriteCache', OSDisk.DisableWriteCache);
_addDefinedValueXml(node, 'DiskLabel', OSDisk.DiskLabel);
_addDefinedValueXml(node, 'DiskName', OSDisk.DiskName);
_addDefinedValueXml(node, 'MediaLink', OSDisk.MediaLink);
_addDefinedValueXml(node, 'SourceImageName', OSDisk.SourceImageName);
return node;
};
/**
* Add DataDisk properties to the specifed node
* returns xmlbuilder node object
*
* @param {object} DataDisk The DataDisk object properties.
* @param {object} node The XML parent node.
*/
ServiceManagementSerialize.prototype._buildDataDiskXml = function(DataDisk, node) {
_addDefinedValueXml(node, 'DiskName', DataDisk.DiskName);
_addDefinedNumericXml(node, 'LUN', DataDisk.LUN);
_addDefinedValueXml(node, 'DisableReadCache', DataDisk.DisableReadCache);
_addDefinedValueXml(node, 'DiskLabel', DataDisk.DiskLabel);
_addDefinedValueXml(node, 'EnableWriteCache', DataDisk.EnableWriteCache);
_addDefinedValueXml(node, 'LogicalDiskSizeInGB', DataDisk.LogicalDiskSizeInGB);
_addDefinedValueXml(node, 'MediaLink', DataDisk.MediaLink);
_addDefinedValueXml(node, 'SourceMediaLink', DataDisk.SourceMediaLink);
return node;
};
/**
* Add ProvisioningConfiguration properties to the specifed node
* returns xmlbuilder node object
*
* @param {object} cfgset The ProvisioningConfiguration object properties.
* @param {object} node The XML parent node.
*/
ServiceManagementSerialize.prototype._buildProvisioningConfigurationXml = function(cfgset, node) {
_addDefinedValueXml(node, 'ConfigurationSetType', cfgset.ConfigurationSetType);
_addDefinedValueXml(node, 'AdminPassword', cfgset.AdminPassword);
_addDefinedValueXml(node, 'MachineName', cfgset.MachineName);
_addDefinedValueXml(node, 'ProvisioningMediaLink', cfgset.ProvisioningMediaLink);
_addDefinedValueXml(node, 'ResetPasswordOnFirstLogon', cfgset.ResetPasswordOnFirstLogon);
if (cfgset.StoredCertificateSettings) {
var cset = node.ele('StoredCertificateSettings');
_addDefinedValueXml(cset, 'StoreName', cfgset.StoredCertificateSettings.StoreName);
_addDefinedValueXml(cset, 'StoreLocation', cfgset.StoredCertificateSettings.StoreLocation);
_addDefinedValueXml(cset, 'Thumbprint', cfgset.StoredCertificateSettings.Thumbprint);
}
};
/**
* Add NetworkConfiguration properties to the specifed node
* returns xmlbuilder node object
*
* @param {object} cfgset The NetworkConfiguration object properties.
* @param {object} node The XML parent node.
*/
ServiceManagementSerialize.prototype._buildNetworkConfigurationXml = function(cfgset, node) {
_addDefinedValueXml(node, 'ConfigurationSetType', cfgset.ConfigurationSetType);
if (cfgset.InputEndpoints) {
var child = node.ele('InputEndpoints');
this._buildExternalEndpoints(cfgset, child);
}
};
/**
* Add ExternalEndpoints properties to the specifed node
* returns xmlbuilder node object
*
* @param {object} cfgset An array of ExternalEndpoints object properties.
* @param {object} node The XML parent node.
*/
ServiceManagementSerialize.prototype._buildExternalEndpoints = function(cfgset, node) {
var alen = cfgset.InputEndpoints.length;
for (var i = 0; i < alen; i++) {
var external = cfgset.InputEndpoints[i];
var child = node.ele('ExternalEndpoint');
_addDefinedValueXml(child, 'LoadBalancedEndpointSetName', external.LoadBalancedEndpointSetName);
if (external.LoadBalancerProbe) {
var probe = child.ele('LoadBalancerProbe');
_addDefinedValueXml(probe, 'Port', external.LoadBalancerProbe.Port);
_addDefinedValueXml(probe, 'Protocol', external.LoadBalancerProbe.Protocol);
_addDefinedValueXml(probe, 'RelativeUri', external.LoadBalancerProbe.RelativeUri);
}
_addDefinedValueXml(child, 'LocalPort', external.LocalPort);
_addDefinedValueXml(child, 'Name', external.Name);
_addDefinedValueXml(child, 'Port', external.Port);
_addDefinedValueXml(child, 'Protocol', external.Protocol);
}
};

Просмотреть файл

@ -0,0 +1,866 @@
// Module dependencies.
var util = require('util');
var url = require('url');
var ServiceManagementClient = require('../core/servicemanagementclient');
var Constants = require('../../util/constants');
var WebResource = require('../../http/webresource');
var ServiceManagementSerialize = require('./models/servicemanagementserialize');
var HttpConstants = Constants.HttpConstants;
// Expose 'ServiceManagementService'.
exports = module.exports = ServiceManagementService;
/**
* Creates a new ServiceManagementService object.
*
* @constructor
* @param {string} subscriptionId The subscription ID for the account.
* @param {string} authentication The authentication object for the client.
* {
* keyfile: 'path to .pem',
* certfile: 'path to .pem',
* keyvalue: privatekey value,
* certvalue: public cert value
* }
* @param {string} hostOptions The host options to override defaults.
* {
* host: 'management.core.windows.net',
* apiversion: '2012-03-01',
* serializetype: 'XML'
* }
*/
function ServiceManagementService(subscriptionId, authentication, hostOptions) {
if (typeof subscriptionId != 'string' || subscriptionId.length === 0) {
throw new Error('SubscriptionId is required');
}
ServiceManagementService.super_.call(this, authentication, hostOptions);
this.subscriptionId = subscriptionId;
this.serialize = new ServiceManagementSerialize();
}
util.inherits(ServiceManagementService, ServiceManagementClient);
/**
* Returns status of operation that returned 202 Accepted.
*
* @param {string} requestid The ms-request-id value. Required.
* @param {function} callback The callback function called on completion. Required.
*/
ServiceManagementService.prototype.getOperationStatus = function(requestid, callback) {
testStringArgument(requestid, 'requestid', 'getOperationStatus');
testObjectArgument(callback, 'callback', 'getOperationStatus');
var mypath = '/' + this.subscriptionId + '/operations/' + requestid;
var webres = WebResource.get(mypath);
var self = this;
this.performRequest(webres, null, {}, function(rspobj, next) {
next(rspobj, function(retobj) {
callback(retobj);
});
});
};
/**
* Get properties of specified OS Image.
*
* @param {string} imageName The name of the image. Required.
* @param {function} callback The callback function called on completion. Required.
*/
ServiceManagementService.prototype.getOSImage = function(imageName, callback) {
testStringArgument(imageName, 'imageName', 'getOSImage');
testObjectArgument(callback, 'callback', 'getOSImage');
var mypath = '/' + this.subscriptionId + '/images/' + imageName;
var webres = WebResource.get(mypath);
var self = this;
this.performRequest(webres, null, {}, function(rspobj, next) {
next(rspobj, function(retobj) {
callback(retobj);
});
});
};
/**
* Gets properties of specified OS Image.
*
* @param {function} callback The callback function called on completion. Required.
*/
ServiceManagementService.prototype.listOSImage = function(callback) {
testObjectArgument(callback, 'callback', 'listOSImage');
var mypath = '/' + this.subscriptionId + '/images';
var webres = WebResource.get(mypath);
var self = this;
this.performRequest(webres, null, {}, function(rspobj, next) {
next(rspobj, function(retobj) {
callback(retobj);
});
});
};
/**
* Creates an image from blob storage data.
*
* @param {string} imageName The name of the image. Required.
* @param {string} mediaLink The mediaLink URL. Required.
* @param {string} imageOptions Object with properties for the image. Optional
* {
* Label: optional. Defaults to imageName
* Category: optional. Default by server
* Location: optional. Default by server
* RoleSize: optional Default by server
* }
* @param {function} callback The callback function called on completion. Required.
*/
ServiceManagementService.prototype.createOSImage = function(imageName, mediaLink, imageOptions, callback) {
if (!callback) {
if (typeof imageOptions === 'function') {
callback = imageOptions;
imageOptions = null;
}
}
testStringArgument(imageName, 'imageName', 'createOSImage');
testStringArgument(mediaLink, 'mediaLink', 'createOSImage');
testObjectArgument(callback, 'callback', 'createOSImage');
if (!imageOptions) imageOptions = {};
if (!imageOptions.Label) imageOptions.Label = imageName;
var mypath = '/' + this.subscriptionId + '/images';
var webres = WebResource.post(mypath);
webres.withOkCode(HttpConstants.HttpResponseCodes.OK_CODE, true);
var self = this;
var outbody = this.serialize.buildCreateOSImage(imageName, mediaLink, imageOptions, this);
this.performRequest(webres, outbody, {}, function(rspobj, next) {
next(rspobj, function(retobj) {
callback(retobj);
});
});
};
/**
* Deletes a specified OS Image.
*
* @param {string} imageName The name of the image. Required.
* @param {function} callback The callback function called on completion. Required.
*/
ServiceManagementService.prototype.deleteOSImage = function(imageName, callback) {
testStringArgument(imageName, 'imageName', 'deleteOSImage');
testObjectArgument(callback, 'callback', 'deleteOSImage');
var mypath = '/' + this.subscriptionId + '/images/' + imageName;
var webres = WebResource.del(mypath);
webres.withOkCode(HttpConstants.HttpResponseCodes.OK_CODE, true);
var self = this;
this.performRequest(webres, null, {}, function(rspobj, next) {
next(rspobj, function(retobj) {
callback(retobj);
});
});
};
/**
* Gets list of disksin repository.
*
* @param {function} callback The callback function called on completion. Required.
*/
ServiceManagementService.prototype.listDisks = function(callback) {
testObjectArgument(callback, 'callback', 'listDisks');
var mypath = '/' + this.subscriptionId + '/disks';
var webres = WebResource.get(mypath);
var self = this;
this.performRequest(webres, null, {}, function(rspobj, next) {
next(rspobj, function(retobj) {
callback(retobj);
});
});
};
/**
* Gets properties of specified Disk.
*
* @param {string} diskName The name of the disk. Required.
* @param {function} callback The callback function called on completion. Required.
*/
ServiceManagementService.prototype.getDisk = function(diskName, callback) {
testStringArgument(diskName, 'diskName', 'getDisk');
testObjectArgument(callback, 'callback', 'getDisk');
var mypath = '/' + this.subscriptionId + '/disks/' + diskName;
var webres = WebResource.get(mypath);
var self = this;
this.performRequest(webres, null, {}, function(rspobj, next) {
next(rspobj, function(retobj) {
callback(retobj);
});
});
};
/**
* Deletes specified Disk.
*
* @param {string} diskName The name of the disk. Required.
* @param {function} callback The callback function called on completion. Required.
*/
ServiceManagementService.prototype.deleteDisk = function(diskName, callback) {
testStringArgument(diskName, 'diskName', 'deleteDisk');
testObjectArgument(callback, 'callback', 'deleteDisk');
var mypath = '/' + this.subscriptionId + '/disks/' + diskName;
var webres = WebResource.del(mypath);
webres.withOkCode(HttpConstants.HttpResponseCodes.OK_CODE, true);
var self = this;
this.performRequest(webres, null, {}, function(rspobj, next) {
next(rspobj, function(retobj) {
callback(retobj);
});
});
};
/**
* Gets list of hosted services.
*
* @param {function} callback The callback function called on completion. Required.
*/
ServiceManagementService.prototype.listHostedServices = function(callback) {
testObjectArgument(callback, 'callback', 'listHostedServices');
var mypath = '/' + this.subscriptionId + '/services/hostedservices';
var webres = WebResource.get(mypath);
var self = this;
this.performRequest(webres, null, {}, function(rspobj, next) {
next(rspobj, function(retobj) {
callback(retobj);
});
});
};
/**
* Gets properties of a named hosted service.
*
* @param {string} serviceName The name of the service. Required.
* @param {function} callback The callback function called on completion. Required.
*/
ServiceManagementService.prototype.getHostedService = function(serviceName, callback) {
testStringArgument(serviceName, 'serviceName', 'getHostedService');
testObjectArgument(callback, 'callback', 'getHostedService');
var mypath = '/' + this.subscriptionId + '/services/hostedservices/' + serviceName;
var webres = WebResource.get(mypath);
var self = this;
this.performRequest(webres, null, {}, function(rspobj, next) {
next(rspobj, function(retobj) {
callback(retobj);
});
});
};
/**
* Creates a hosted service for the subscription
*
* @param {string} serviceName The name of the new service. Required.
* @param {string} serviceOptions Object with properties for the service. Optional
* {
* Description: optional. Defaults to 'Service host'
* Location: optional. Defaults to 'Windows Azure Preview'
* Label: optional. Defaults to serviceName
* }
* @param {function} callback The callback function called on completion. Required.
*/
ServiceManagementService.prototype.createHostedService = function(serviceName, serviceOptions, callback) {
if (!callback) {
if (typeof serviceOptions === 'function') {
callback = serviceOptions;
serviceOptions = null;
}
}
testStringArgument(serviceName, 'serviceName', 'createHostedService');
testObjectArgument(callback, 'callback', 'createHostedService');
if (!serviceOptions) {
serviceOptions = {};
}
if (!serviceOptions.Label) {
serviceOptions.Label = serviceName;
}
if (!serviceOptions.Description) {
serviceOptions.Description = 'Service host';
}
if (!serviceOptions.Location) {
serviceOptions.Location = 'Windows Azure Preview';
}
var mypath = '/' + this.subscriptionId + '/services/hostedservices';
var webres = WebResource.post(mypath);
var outbody = this.serialize.buildCreateHostedService(serviceName, serviceOptions, this);
var self = this;
this.performRequest(webres, outbody, {}, function(rspobj, next) {
next(rspobj, function(retobj) {
callback(retobj);
});
});
};
/**
* Deletes named hosted service.
*
* @param {string} serviceName The name of the service. Required.
* @param {function} callback The callback function called on completion. Required.
*/
ServiceManagementService.prototype.deleteHostedService = function(serviceName, callback) {
testStringArgument(serviceName, 'serviceName', 'deleteHostedService');
testObjectArgument(callback, 'callback', 'deleteHostedService');
var mypath = '/' + this.subscriptionId + '/services/hostedservices/' + serviceName;
var webres = WebResource.del(mypath);
webres.withOkCode(HttpConstants.HttpResponseCodes.OK_CODE, true);
var self = this;
this.performRequest(webres, null, {}, function(rspobj, next) {
next(rspobj, function(retobj) {
callback(retobj);
});
});
};
/**
* Returns keys of specified storage account.
*
* @param {string} serviceName The name of the storage service. Required.
* @param {function} callback The callback function called on completion. Required.
*/
ServiceManagementService.prototype.getStorageAccountKeys = function(serviceName, callback) {
testStringArgument(serviceName, 'serviceName', 'getStorageAccountKeys');
testObjectArgument(callback, 'callback', 'getStorageAccountKeys');
var mypath = '/' + this.subscriptionId + '/services/storageservices/' + serviceName +
'/keys';
var webres = WebResource.get(mypath);
var self = this;
this.performRequest(webres, null, {}, function(rspobj, next) {
next(rspobj, function(retobj) {
callback(retobj);
});
});
};
/**
* Gets deployment properties for named deployment
*
* @param {string} serviceName The name of the hosted service. Required.
* @param {string} deploymentName The name of the deployment. Required.
* @param {function} callback The callback function called on completion. Required.
*/
ServiceManagementService.prototype.getDeployment = function(serviceName, deploymentName, callback) {
testStringArgument(serviceName, 'serviceName', 'getDeployment');
testStringArgument(deploymentName, 'deploymentName', 'getDeployment');
testObjectArgument(callback, 'callback', 'getDeployment');
var mypath = '/' + this.subscriptionId + '/services/hostedservices/' + serviceName +
'/deployments/' + deploymentName;
var webres = WebResource.get(mypath);
var self = this;
this.performRequest(webres, null, {}, function(rspobj, next) {
next(rspobj, function(retobj) {
callback(retobj);
});
});
};
/**
* Gets deployment properties for specified slot
*
* @param {string} serviceName The name of the hosted service. Required.
* @param {string} deploymentSlot The name of the slot (Production or Staging). Required.
* @param {function} callback The callback function called on completion. Required.
*/
ServiceManagementService.prototype.getDeploymentBySlot = function(serviceName, deploymentSlot, callback) {
testStringArgument(serviceName, 'serviceName', 'getDeploymentBySlot');
testStringArgument(deploymentSlot, 'deploymentSlot', 'getDeploymentBySlot');
testObjectArgument(callback, 'callback', 'getDeploymentBySlot');
var mypath = '/' + this.subscriptionId + '/services/hostedservices/' + serviceName +
'/deploymentslots/' + deploymentSlot;
var webres = WebResource.get(mypath);
var self = this;
this.performRequest(webres, null, {}, function(rspobj, next) {
next(rspobj, function(retobj) {
callback(retobj);
});
});
};
/**
* Creates a persistentVM in the hosted service
*
* @param {string} serviceName The name of the hosted service. Required.
* @param {string} deploymentName The name of the deployment. Required.
* @param {object} VMRole The PersistentVMRole object
* @param {object} deploymentOptions Options for deployment creation
* {
* DeploymentSlot: optional. Defaults to 'Staging'
* Label: optional. Defaults to deploymentName
* }
* @param {function} callback The callback function called on completion. Required.
*/
ServiceManagementService.prototype.createDeployment = function(serviceName, deploymentName, VMRole,
deploymentOptions, callback) {
if (!callback) {
if (typeof deploymentOptions === 'function') {
callback = deploymentOptions;
deploymentOptions = null;
}
}
testStringArgument(serviceName, 'serviceName', 'createDeployment');
testStringArgument(deploymentName, 'deploymentName', 'createDeployment');
testObjectArgument(VMRole, 'VMRole', 'createDeployment');
testObjectValue(VMRole.RoleName, 'VMRole.RoleName', 'createDeployment');
testObjectValue(VMRole.OSDisk, 'VMRole.OSDisk', 'createDeployment');
testObjectArgument(callback, 'callback', 'createDeployment');
if (!VMRole.RoleType) {
VMRole.RoleType = 'PersistentVMRole';
}
if (!deploymentOptions) {
deploymentOptions = {};
}
if (!deploymentOptions.Label) {
deploymentOptions.Label = deploymentName;
}
if (!deploymentOptions.DeploymentSlot) {
deploymentOptions.DeploymentSlot = 'Production';
}
var mypath = '/' + this.subscriptionId + '/services/hostedservices/' +
serviceName + '/deployments';
var webres = WebResource.post(mypath);
webres.withOkCode(HttpConstants.HttpResponseCodes.ACCEPTED_CODE, true);
var outbody = this.serialize.buildCreateDeployment(serviceName, deploymentName,
VMRole, deploymentOptions, this);
var self = this;
this.performRequest(webres, outbody, {}, function(rspobj, next) {
next(rspobj, function(retobj) {
callback(retobj);
});
});
};
/**
* Deletes a named deployment
*
* @param {string} serviceName The name of the hosted service. Required.
* @param {string} deploymentName The name of the deployment. Required.
* @param {function} callback The callback function called on completion. Required.
*/
ServiceManagementService.prototype.deleteDeployment = function(serviceName, deploymentName, callback) {
testStringArgument(serviceName, 'serviceName', 'getDeployment');
testStringArgument(deploymentName, 'deploymentName', 'getDeployment');
testObjectArgument(callback, 'callback', 'getDeployment');
var mypath = '/' + this.subscriptionId + '/services/hostedservices/' + serviceName +
'/deployments/' + deploymentName;
var webres = WebResource.del(mypath);
webres.withOkCode(HttpConstants.HttpResponseCodes.ACCEPTED_CODE, true);
var self = this;
this.performRequest(webres, null, {}, function(rspobj, next) {
next(rspobj, function(retobj) {
callback(retobj);
});
});
};
/**
* Gets role properties for named role in deployment
*
* @param {string} serviceName The name of the hosted service. Required.
* @param {string} deploymentName The name of the deployment. Required.
* @param {string} roleName The name of the role. Required.
* @param {function} callback The callback function called on completion. Required.
*/
ServiceManagementService.prototype.getRole = function(serviceName, deploymentName, roleName, callback) {
testStringArgument(serviceName, 'serviceName', 'getRole');
testStringArgument(deploymentName, 'deploymentName', 'getRole');
testStringArgument(roleName, 'roleName', 'getRole');
testObjectArgument(callback, 'callback', 'getRole');
var mypath = '/' + this.subscriptionId + '/services/hostedservices/' + serviceName +
'/deployments/' + deploymentName +
'/Roles/' + roleName;
var webres = WebResource.get(mypath);
var self = this;
this.performRequest(webres, null, {}, function(rspobj, next) {
next(rspobj, function(retobj) {
callback(retobj);
});
});
};
/**
* Creates a persistent role from image in the hosted service
*
* @param {string} serviceName The name of the hosted service. Required.
* @param {string} deploymentName The name of the deployment. Required.
* @param {object} VMRole The PersistentVMRole object
* @param {function} callback The callback function called on completion. Required.
*/
ServiceManagementService.prototype.addRole = function(serviceName, deploymentName, VMRole,
callback) {
testStringArgument(serviceName, 'serviceName', 'addRole');
testStringArgument(deploymentName, 'deploymentName', 'addRole');
testObjectArgument(VMRole, 'VMRole', 'addRole');
testObjectValue(VMRole.RoleName, 'VMRole.RoleName', 'addRole');
testObjectValue(VMRole.OSDisk, 'VMRole.OSDisk', 'addRole');
testObjectArgument(callback, 'callback', 'addRole');
if (!VMRole.RoleType) {
VMRole.RoleType = 'PersistentVMRole';
}
var mypath = '/' + this.subscriptionId + '/services/hostedservices/' +
serviceName + '/deployments/' +
deploymentName + '/Roles';
var webres = WebResource.post(mypath);
webres.withOkCode(HttpConstants.HttpResponseCodes.ACCEPTED_CODE, true);
var outbody = this.serialize.buildAddRole(serviceName, deploymentName,
VMRole, this);
var self = this;
this.performRequest(webres, outbody, {}, function(rspobj, next) {
next(rspobj, function(retobj) {
callback(retobj);
});
});
};
/**
* Updates a persistent role from image in the hosted service
*
* @param {string} serviceName The name of the hosted service. Required.
* @param {string} deploymentName The name of the deployment. Required.
* @param {string} roleName The name of the role. Required.
* @param {object} VMRole The PersistentVMRole object
* @param {function} callback The callback function called on completion. Required.
*/
ServiceManagementService.prototype.modifyRole = function(serviceName, deploymentName, roleName,
VMRole, callback) {
testStringArgument(serviceName, 'serviceName', 'modifyRole');
testStringArgument(deploymentName, 'deploymentName', 'modifyRole');
testStringArgument(roleName, 'roleName', 'modifyRole');
testObjectArgument(VMRole, 'VMRole', 'modifyRole');
testObjectValue(VMRole.RoleName, 'VMRole.RoleName', 'modifyRole');
testObjectArgument(callback, 'callback', 'modifyRole');
if (!VMRole.RoleType) {
VMRole.RoleType = 'PersistentVMRole';
}
var mypath = '/' + this.subscriptionId + '/services/hostedservices/' +
serviceName + '/deployments/' +
deploymentName + '/Roles/' +
roleName;
var webres = WebResource.put(mypath);
webres.withOkCode(HttpConstants.HttpResponseCodes.ACCEPTED_CODE, true);
var outbody = this.serialize.buildModifyRole(serviceName, deploymentName,
roleName, VMRole, this);
var self = this;
this.performRequest(webres, outbody, {}, function(rspobj, next) {
next(rspobj, function(retobj) {
callback(retobj);
});
});
};
/**
* Deletes a role from deplyment in the hosted service
*
* @param {string} serviceName The name of the hosted service. Required.
* @param {string} deploymentName The name of the deployment. Required.
* @param {string} roleName The name of the role. Required.
* @param {function} callback The callback function called on completion. Required.
*/
ServiceManagementService.prototype.deleteRole = function(serviceName, deploymentName, roleName,
callback) {
testStringArgument(serviceName, 'serviceName', 'deleteRole');
testStringArgument(deploymentName, 'deploymentName', 'deleteRole');
testStringArgument(roleName, 'roleName', 'deleteRole');
testObjectArgument(callback, 'callback', 'deleteRole');
var mypath = '/' + this.subscriptionId + '/services/hostedservices/' +
serviceName + '/deployments/' +
deploymentName + '/Roles/' +
roleName;
var webres = WebResource.del(mypath);
webres.withOkCode(HttpConstants.HttpResponseCodes.ACCEPTED_CODE, true);
var self = this;
this.performRequest(webres, null, {}, function(rspobj, next) {
next(rspobj, function(retobj) {
callback(retobj);
});
});
};
/**
* Adds a data disk to a role in the deployment
* Note: There are 3 modes supported with a single API call.
* The mode is determined by which properties are specified
* in the diskOptions - DiskName, SourceMediaLink, MediaLink
*
* @param {string} serviceName The name of the hosted service. Required.
* @param {string} deploymentName The name of the deployment. Required.
* @param {string} roleName The name of the role. Required.
* @param {object} datadisk The disk properties used for creation. Required.
* @param {function} callback The callback function called on completion. Required.
*/
ServiceManagementService.prototype.addDataDisk = function(serviceName, deploymentName, roleName,
datadisk, callback) {
testStringArgument(serviceName, 'serviceName', 'addDataDisk');
testStringArgument(deploymentName, 'deploymentName', 'addDataDisk');
testStringArgument(roleName, 'roleName', 'addDataDisk');
testObjectArgument(datadisk, 'datadisk', 'addDataDisk');
testObjectArgument(callback, 'callback', 'addDataDisk');
if (typeof datadisk.LUN != 'number') {
throwMissingVal('datadisk.LUN', 'addDataDisk');
}
var mypath = '/' + this.subscriptionId + '/services/hostedservices/' +
serviceName + '/deployments/' +
deploymentName + '/Roles/' +
roleName + '/DataDisks';
var webres = WebResource.post(mypath);
webres.withOkCode(HttpConstants.HttpResponseCodes.ACCEPTED_CODE, true);
var outbody = this.serialize.buildAddDataDisk(serviceName, deploymentName,
roleName, datadisk, this);
var self = this;
this.performRequest(webres, outbody, {}, function(rspobj, next) {
next(rspobj, function(retobj) {
callback(retobj);
});
});
};
/**
* Modifies a data disk properties in the deployment
*
* @param {string} serviceName The name of the hosted service. Required.
* @param {string} deploymentName The name of the deployment. Required.
* @param {string} roleName The name of the role. Required.
* @param {number} LUN The LUN of the disk. Required.
* @param {object} datadisk The disk properties used for modification. Required.
* @param {function} callback The callback function called on completion. Required.
*/
ServiceManagementService.prototype.modifyDataDisk = function(serviceName, deploymentName, roleName, LUN,
datadisk, callback) {
testStringArgument(serviceName, 'serviceName', 'modifyDataDisk');
testStringArgument(deploymentName, 'deploymentName', 'modifyDataDisk');
testStringArgument(roleName, 'roleName', 'modifyDataDisk');
testObjectArgument(datadisk, 'datadisk', 'modifyDataDisk');
testObjectArgument(callback, 'callback', 'modifyDataDisk');
if (typeof datadisk.LUN != 'number') {
throwMissingVal('datadisk.LUN', 'modifyDataDisk');
}
var mypath = '/' + this.subscriptionId + '/services/hostedservices/' +
serviceName + '/deployments/' +
deploymentName + '/Roles/' +
roleName + '/DataDisks/' +
LUN;
var webres = WebResource.put(mypath);
webres.withOkCode(HttpConstants.HttpResponseCodes.ACCEPTED_CODE, true);
var outbody = this.serialize.buildModifyDataDisk(serviceName, deploymentName,
roleName, LUN, datadisk, this);
var self = this;
this.performRequest(webres, outbody, {}, function(rspobj, next) {
next(rspobj, function(retobj) {
callback(retobj);
});
});
};
/**
* Removes a data disk from the deployment
*
* @param {string} serviceName The name of the hosted service. Required.
* @param {string} deploymentName The name of the deployment. Required.
* @param {string} roleName The name of the role. Required.
* @param {number} LUN The LUN of the disk. Required.
* @param {function} callback The callback function called on completion. Required.
*/
ServiceManagementService.prototype.removeDataDisk = function(serviceName, deploymentName, roleName, LUN,
callback) {
testStringArgument(serviceName, 'serviceName', 'removeDataDisk');
testStringArgument(deploymentName, 'deploymentName', 'removeDataDisk');
testStringArgument(roleName, 'roleName', 'removeDataDisk');
testObjectArgument(callback, 'callback', 'removeDataDisk');
if (typeof LUN != 'number') {
throwMissingVal('LUN', 'removeDataDisk');
}
var mypath = '/' + this.subscriptionId + '/services/hostedservices/' +
serviceName + '/deployments/' +
deploymentName + '/Roles/' +
roleName + '/DataDisks/' +
LUN;
var webres = WebResource.del(mypath);
webres.withOkCode(HttpConstants.HttpResponseCodes.ACCEPTED_CODE, true);
var self = this;
this.performRequest(webres, null, {}, function(rspobj, next) {
next(rspobj, function(retobj) {
callback(retobj);
});
});
};
/**
* Request a shutdown on the specified instance
*
* @param {string} serviceName The name of the hosted service. Required.
* @param {string} deploymentName The name of the deployment. Required.
* @param {string} roleInstance The name of the role instance. Required.
* @param {function} callback The callback function called on completion. Required.
*/
ServiceManagementService.prototype.shutdownRoleInstance = function(serviceName, deploymentName,
roleInstance, callback) {
testStringArgument(serviceName, 'serviceName', 'shutdownRoleInstance');
testStringArgument(deploymentName, 'deploymentName', 'shutdownRoleInstance');
testStringArgument(roleInstance, 'roleInstance', 'shutdownRoleInstance');
testObjectArgument(callback, 'callback', 'shutdownRoleInstance');
var mypath = '/' + this.subscriptionId + '/services/hostedservices/' +
serviceName + '/deployments/' +
deploymentName + '/RoleInstances/' +
roleInstance + '/Operations';
var webres = WebResource.post(mypath);
webres.withOkCode(HttpConstants.HttpResponseCodes.ACCEPTED_CODE, true);
var outbody = this.serialize.buildShutdownRoleInstance(serviceName, deploymentName,
roleInstance, this);
var self = this;
this.performRequest(webres, outbody, {}, function(rspobj, next) {
next(rspobj, function(retobj) {
callback(retobj);
});
});
};
/**
* Request a restart on the specified instance
*
* @param {string} serviceName The name of the hosted service. Required.
* @param {string} deploymentName The name of the deployment. Required.
* @param {string} roleInstance The name of the role instance. Required.
* @param {function} callback The callback function called on completion. Required.
*/
ServiceManagementService.prototype.restartRoleInstance = function(serviceName, deploymentName,
roleInstance, callback) {
testStringArgument(serviceName, 'serviceName', 'restartRoleInstance');
testStringArgument(deploymentName, 'deploymentName', 'restartRoleInstance');
testStringArgument(roleInstance, 'roleInstance', 'restartRoleInstance');
testObjectArgument(callback, 'callback', 'restartRoleInstance');
var mypath = '/' + this.subscriptionId + '/services/hostedservices/' +
serviceName + '/deployments/' +
deploymentName + '/RoleInstances/' +
roleInstance + '/Operations';
var webres = WebResource.post(mypath);
webres.withOkCode(HttpConstants.HttpResponseCodes.ACCEPTED_CODE, true);
var outbody = this.serialize.buildRestartRoleInstance(serviceName, deploymentName,
roleInstance, this);
var self = this;
this.performRequest(webres, outbody, {}, function(rspobj, next) {
next(rspobj, function(retobj) {
callback(retobj);
});
});
};
/**
* Request a restart on the specified instance
*
* @param {string} serviceName The name of the hosted service. Required.
* @param {string} deploymentName The name of the deployment. Required.
* @param {string} roleInstance The name of the role instance. Required.
* @param {object} captureOptions Parameters for the capture operation. Required.
* @param {function} callback The callback function called on completion. Required.
*/
ServiceManagementService.prototype.captureRoleInstance = function(serviceName, deploymentName,
roleInstance, captureOptions, callback) {
testStringArgument(serviceName, 'serviceName', 'captureRoleInstance');
testStringArgument(deploymentName, 'deploymentName', 'captureRoleInstance');
testStringArgument(roleInstance, 'roleInstance', 'captureRoleInstance');
testObjectArgument(captureOptions, 'captureOptions', 'captureRoleInstance');
testObjectArgument(callback, 'callback', 'captureRoleInstance');
var mypath = '/' + this.subscriptionId + '/services/hostedservices/' +
serviceName + '/deployments/' +
deploymentName + '/RoleInstances/' +
roleInstance + '/Operations';
var webres = WebResource.post(mypath);
webres.withOkCode(HttpConstants.HttpResponseCodes.ACCEPTED_CODE, true);
var outbody = this.serialize.buildCaptureRoleInstance(serviceName, deploymentName,
roleInstance, captureOptions, this);
var self = this;
this.performRequest(webres, outbody, {}, function(rspobj, next) {
next(rspobj, function(retobj) {
callback(retobj);
});
});
};
/*
* Sets proxy object from a proxy url.
*
* @param {string} proxyurl url of proxy server. ex: http:corpproxy:80
* if null or undefined, clears proxy
*/
ServiceManagementService.prototype.setProxyUrl = function(proxyurl) {
this._setProxyUrl(proxyurl);
};
/*
* Sets proxy object as specified by caller.
*
* @param {object} proxy proxy to use for tunneling
* {
* host: hostname
* port: port number
* proxyAuth: 'user:password' for basic auth
* headers: {...} headers for proxy server
* key: key for proxy server
* cert: cert for proxy server
* ca: ca for proxy server
* }
* if null or undefined, clears proxy
* @param {bool} isHTTPS true - use https to proxy. Otherwise use http.
*/
ServiceManagementService.prototype.setProxy = function(proxy, isHTTPS) {
this._setProxy(proxy, isHTTPS);
};
// common functions for validating arguments
function throwMissingArg(name, func) {
throw new Error('Required argument ' + name + ' for function ' + func + ' is not defined');
}
function testStringArgument(val, name, func) {
if (typeof val != 'string' || val.length === 0) {
throwMissingArg(name, func);
}
}
function testObjectArgument(val, name, func) {
if (!val) {
throwMissingArg(name, func);
}
}
function testObjectValue(val, name, func) {
if (!val) {
throwMissingArg(name, func);
}
}

Просмотреть файл

@ -640,7 +640,7 @@ var Constants = {
* @type {string}
*/
METRICS_ELEMENT: 'Metrics',
/**
* XML element for IncludeAPIs.
*
@ -905,7 +905,7 @@ var Constants = {
* @const
* @enum {string}
*/
ResourceTypes : {
ResourceTypes: {
CONTAINER: 'c',
BLOB: 'b'
},
@ -918,7 +918,7 @@ var Constants = {
* @const
* @enum {string}
*/
SharedAccessPermissions : {
SharedAccessPermissions: {
READ: 'r',
WRITE: 'w',
DELETE: 'd',
@ -990,9 +990,9 @@ var Constants = {
/**
* Defines constants for use with table storage.
*
* @const
* @type {string}
*/
* @const
* @type {string}
*/
TableConstants: {
/**
* The next continuation row key token.
@ -1816,7 +1816,7 @@ var Constants = {
BROKER_PROPERTIES_HEADER: 'brokerproperties'
},
QueryStringConstants : {
QueryStringConstants: {
/**
* The Comp value.
*
@ -2058,14 +2058,14 @@ var Constants = {
LOCK_ID: 'lockid'
},
HttpConstants : {
HttpConstants: {
/**
* Http Verbs
*
* @const
* @enum {string}
*/
HttpVerbs : {
HttpVerbs: {
PUT: 'PUT',
GET: 'GET',
DELETE: 'DELETE',
@ -2080,28 +2080,28 @@ var Constants = {
* @const
* @enum {int}
*/
HttpResponseCodes : {
OK_CODE : 200,
CREATED_CODE : 201,
ACCEPTED_CODE : 202,
HttpResponseCodes: {
OK_CODE: 200,
CREATED_CODE: 201,
ACCEPTED_CODE: 202,
NO_CONTENT_CODE: 204,
PARTIAL_CONTENT: 206,
BAD_REQUEST_CODE : 400,
FORBIDDEN_CODE : 403,
NOT_FOUND_CODE : 404,
CONFLICT_CODE : 409,
LENGTH_REQUIRED_CODE : 411,
PRECONDITION_FAILED_CODE : 412
BAD_REQUEST_CODE: 400,
FORBIDDEN_CODE: 403,
NOT_FOUND_CODE: 404,
CONFLICT_CODE: 409,
LENGTH_REQUIRED_CODE: 411,
PRECONDITION_FAILED_CODE: 412
}
},
BlobErrorCodeStrings : {
INVALID_BLOCK_ID : 'InvalidBlockId',
BLOB_NOT_FOUND : 'BlobNotFound',
BlobErrorCodeStrings: {
INVALID_BLOCK_ID: 'InvalidBlockId',
BLOB_NOT_FOUND: 'BlobNotFound',
BLOB_ALREADY_EXISTS: 'BlobAlreadyExists',
CONTAINER_ALREADY_EXISTS: 'ContainerAlreadyExists',
INVALID_BLOB_OR_BLOCK : 'InvalidBlobOrBlock',
INVALID_BLOCK_LIST : 'InvalidBlockList'
INVALID_BLOB_OR_BLOCK: 'InvalidBlobOrBlock',
INVALID_BLOCK_LIST: 'InvalidBlockList'
},
ServiceBusErrorCodeStrings: {
@ -2111,87 +2111,91 @@ var Constants = {
RULE_NOT_FOUND: 'RuleNotFound'
},
QueueErrorCodeStrings : {
QUEUE_NOT_FOUND : 'QueueNotFound',
QUEUE_DISABLED : 'QueueDisabled',
QUEUE_ALREADY_EXISTS : 'QueueAlreadyExists',
QUEUE_NOT_EMPTY : 'QueueNotEmpty',
QUEUE_BEING_DELETED : 'QueueBeingDeleted',
POP_RECEIPT_MISMATCH : 'PopReceiptMismatch',
INVALID_PARAMETER : 'InvalidParameter',
MESSAGE_NOT_FOUND : 'MessageNotFound',
MESSAGE_TOO_LARGE : 'MessageTooLarge',
INVALID_MARKER : 'InvalidMarker'
QueueErrorCodeStrings: {
QUEUE_NOT_FOUND: 'QueueNotFound',
QUEUE_DISABLED: 'QueueDisabled',
QUEUE_ALREADY_EXISTS: 'QueueAlreadyExists',
QUEUE_NOT_EMPTY: 'QueueNotEmpty',
QUEUE_BEING_DELETED: 'QueueBeingDeleted',
POP_RECEIPT_MISMATCH: 'PopReceiptMismatch',
INVALID_PARAMETER: 'InvalidParameter',
MESSAGE_NOT_FOUND: 'MessageNotFound',
MESSAGE_TOO_LARGE: 'MessageTooLarge',
INVALID_MARKER: 'InvalidMarker'
},
StorageErrorCodeStrings : {
UNSUPPORTED_HTTP_VERB : 'UnsupportedHttpVerb',
MISSING_CONTENT_LENGTH_HEADER : 'MissingContentLengthHeader',
MISSING_REQUIRED_HEADER : 'MissingRequiredHeader',
MISSING_REQUIRED_XML_NODE : 'MissingRequiredXmlNode',
UNSUPPORTED_HEADER : 'UnsupportedHeader',
UNSUPPORTED_XML_NODE : 'UnsupportedXmlNode',
INVALID_HEADER_VALUE : 'InvalidHeaderValue',
INVALID_XML_NODE_VALUE : 'InvalidXmlNodeValue',
MISSING_REQUIRED_QUERY_PARAMETER : 'MissingRequiredQueryParameter',
UNSUPPORTED_QUERY_PARAMETER : 'UnsupportedQueryParameter',
INVALID_QUERY_PARAMETER_VALUE : 'InvalidQueryParameterValue',
OUT_OF_RANGE_QUERY_PARAMETER_VALUE : 'OutOfRangeQueryParameterValue',
INVALID_URI : 'InvalidUri',
INVALID_HTTP_VERB : 'InvalidHttpVerb',
EMPTY_METADATA_KEY : 'EmptyMetadataKey',
REQUEST_BODY_TOO_LARGE : 'RequestBodyTooLarge',
INVALID_XML_DOCUMENT : 'InvalidXmlDocument',
INTERNAL_ERROR : 'InternalError',
AUTHENTICATION_FAILED : 'AuthenticationFailed',
MD5_MISMATCH : 'Md5Mismatch',
INVALID_MD5 : 'InvalidMd5',
OUT_OF_RANGE_INPUT : 'OutOfRangeInput',
INVALID_INPUT : 'InvalidInput',
OPERATION_TIMED_OUT : 'OperationTimedOut',
RESOURCE_NOT_FOUND : 'ResourceNotFound',
INVALID_METADATA : 'InvalidMetadata',
METADATA_TOO_LARGE : 'MetadataTooLarge',
StorageErrorCodeStrings: {
UNSUPPORTED_HTTP_VERB: 'UnsupportedHttpVerb',
MISSING_CONTENT_LENGTH_HEADER: 'MissingContentLengthHeader',
MISSING_REQUIRED_HEADER: 'MissingRequiredHeader',
MISSING_REQUIRED_XML_NODE: 'MissingRequiredXmlNode',
UNSUPPORTED_HEADER: 'UnsupportedHeader',
UNSUPPORTED_XML_NODE: 'UnsupportedXmlNode',
INVALID_HEADER_VALUE: 'InvalidHeaderValue',
INVALID_XML_NODE_VALUE: 'InvalidXmlNodeValue',
MISSING_REQUIRED_QUERY_PARAMETER: 'MissingRequiredQueryParameter',
UNSUPPORTED_QUERY_PARAMETER: 'UnsupportedQueryParameter',
INVALID_QUERY_PARAMETER_VALUE: 'InvalidQueryParameterValue',
OUT_OF_RANGE_QUERY_PARAMETER_VALUE: 'OutOfRangeQueryParameterValue',
INVALID_URI: 'InvalidUri',
INVALID_HTTP_VERB: 'InvalidHttpVerb',
EMPTY_METADATA_KEY: 'EmptyMetadataKey',
REQUEST_BODY_TOO_LARGE: 'RequestBodyTooLarge',
INVALID_XML_DOCUMENT: 'InvalidXmlDocument',
INTERNAL_ERROR: 'InternalError',
AUTHENTICATION_FAILED: 'AuthenticationFailed',
MD5_MISMATCH: 'Md5Mismatch',
INVALID_MD5: 'InvalidMd5',
OUT_OF_RANGE_INPUT: 'OutOfRangeInput',
INVALID_INPUT: 'InvalidInput',
OPERATION_TIMED_OUT: 'OperationTimedOut',
RESOURCE_NOT_FOUND: 'ResourceNotFound',
INVALID_METADATA: 'InvalidMetadata',
METADATA_TOO_LARGE: 'MetadataTooLarge',
CONDITION_NOT_MET: 'ConditionNotMet',
UPDATE_CONDITION_NOT_SATISFIED: 'UpdateConditionNotSatisfied',
INVALID_RANGE : 'InvalidRange',
CONTAINER_NOT_FOUND : 'ContainerNotFound',
CONTAINER_ALREADY_EXISTS : 'ContainerAlreadyExists',
CONTAINER_DISABLED : 'ContainerDisabled',
CONTAINER_BEING_DELETED : 'ContainerBeingDeleted',
SERVER_BUSY : 'ServerBusy'
INVALID_RANGE: 'InvalidRange',
CONTAINER_NOT_FOUND: 'ContainerNotFound',
CONTAINER_ALREADY_EXISTS: 'ContainerAlreadyExists',
CONTAINER_DISABLED: 'ContainerDisabled',
CONTAINER_BEING_DELETED: 'ContainerBeingDeleted',
SERVER_BUSY: 'ServerBusy'
},
TableErrorCodeStrings : {
XMETHOD_NOT_USING_POST : 'XMethodNotUsingPost',
XMETHOD_INCORRECT_VALUE : 'XMethodIncorrectValue',
XMETHOD_INCORRECT_COUNT : 'XMethodIncorrectCount',
TABLE_HAS_NO_PROPERTIES : 'TableHasNoProperties',
DUPLICATE_PROPERTIES_SPECIFIED : 'DuplicatePropertiesSpecified',
TABLE_HAS_NO_SUCH_PROPERTY : 'TableHasNoSuchProperty',
DUPLICATE_KEY_PROPERTY_SPECIFIED : 'DuplicateKeyPropertySpecified',
TABLE_ALREADY_EXISTS : 'TableAlreadyExists',
TABLE_NOT_FOUND : 'TableNotFound',
ENTITY_NOT_FOUND : 'EntityNotFound',
ENTITY_ALREADY_EXISTS : 'EntityAlreadyExists',
PARTITION_KEY_NOT_SPECIFIED : 'PartitionKeyNotSpecified',
OPERATOR_INVALID : 'OperatorInvalid',
UPDATE_CONDITION_NOT_SATISFIED : 'UpdateConditionNotSatisfied',
PROPERTIES_NEED_VALUE : 'PropertiesNeedValue',
PARTITION_KEY_PROPERTY_CANNOT_BE_UPDATED : 'PartitionKeyPropertyCannotBeUpdated',
TOO_MANY_PROPERTIES : 'TooManyProperties',
ENTITY_TOO_LARGE : 'EntityTooLarge',
PROPERTY_VALUE_TOO_LARGE : 'PropertyValueTooLarge',
INVALID_VALUE_TYPE : 'InvalidValueType',
TABLE_BEING_DELETED : 'TableBeingDeleted',
TABLE_SERVER_OUT_OF_MEMORY : 'TableServerOutOfMemory',
PRIMARY_KEY_PROPERTY_IS_INVALID_TYPE : 'PrimaryKeyPropertyIsInvalidType',
PROPERTY_NAME_TOO_LONG : 'PropertyNameTooLong',
PROPERTY_NAME_INVALID : 'PropertyNameInvalid',
BATCH_OPERATION_NOT_SUPPORTED : 'BatchOperationNotSupported',
JSON_FORMAT_NOT_SUPPORTED : 'JsonFormatNotSupported',
METHOD_NOT_ALLOWED : 'MethodNotAllowed',
NOT_IMPLEMENTED : 'NotImplemented'
TableErrorCodeStrings: {
XMETHOD_NOT_USING_POST: 'XMethodNotUsingPost',
XMETHOD_INCORRECT_VALUE: 'XMethodIncorrectValue',
XMETHOD_INCORRECT_COUNT: 'XMethodIncorrectCount',
TABLE_HAS_NO_PROPERTIES: 'TableHasNoProperties',
DUPLICATE_PROPERTIES_SPECIFIED: 'DuplicatePropertiesSpecified',
TABLE_HAS_NO_SUCH_PROPERTY: 'TableHasNoSuchProperty',
DUPLICATE_KEY_PROPERTY_SPECIFIED: 'DuplicateKeyPropertySpecified',
TABLE_ALREADY_EXISTS: 'TableAlreadyExists',
TABLE_NOT_FOUND: 'TableNotFound',
ENTITY_NOT_FOUND: 'EntityNotFound',
ENTITY_ALREADY_EXISTS: 'EntityAlreadyExists',
PARTITION_KEY_NOT_SPECIFIED: 'PartitionKeyNotSpecified',
OPERATOR_INVALID: 'OperatorInvalid',
UPDATE_CONDITION_NOT_SATISFIED: 'UpdateConditionNotSatisfied',
PROPERTIES_NEED_VALUE: 'PropertiesNeedValue',
PARTITION_KEY_PROPERTY_CANNOT_BE_UPDATED: 'PartitionKeyPropertyCannotBeUpdated',
TOO_MANY_PROPERTIES: 'TooManyProperties',
ENTITY_TOO_LARGE: 'EntityTooLarge',
PROPERTY_VALUE_TOO_LARGE: 'PropertyValueTooLarge',
INVALID_VALUE_TYPE: 'InvalidValueType',
TABLE_BEING_DELETED: 'TableBeingDeleted',
TABLE_SERVER_OUT_OF_MEMORY: 'TableServerOutOfMemory',
PRIMARY_KEY_PROPERTY_IS_INVALID_TYPE: 'PrimaryKeyPropertyIsInvalidType',
PROPERTY_NAME_TOO_LONG: 'PropertyNameTooLong',
PROPERTY_NAME_INVALID: 'PropertyNameInvalid',
BATCH_OPERATION_NOT_SUPPORTED: 'BatchOperationNotSupported',
JSON_FORMAT_NOT_SUPPORTED: 'JsonFormatNotSupported',
METHOD_NOT_ALLOWED: 'MethodNotAllowed',
NOT_IMPLEMENTED: 'NotImplemented'
},
GeneralErrorCodeStrings: {
INVALID_CONTENT_TYPE: 'The response content type is invalid'
}
};

Просмотреть файл

@ -17,7 +17,8 @@
"mime": ">= 1.2.4",
"dateformat": "1.0.2-1.2.3",
"underscore": ">= 1.3.1",
"underscore.string": ">= 2.0.0"
"underscore.string": ">= 2.0.0",
"tunnel": ">= 0.0.1"
},
"devDependencies": {
"mocha": "*",

Просмотреть файл

@ -102,6 +102,87 @@
<Content Include="..\..\examples\samples\snapshotsample.js">
<Link>examples\samples\snapshotsample.js</Link>
</Content>
<Content Include="..\..\examples\servicemanagement\testadddatadiskbyblob.js">
<Link>examples\servicemanagement\testadddatadiskbyblob.js</Link>
</Content>
<Content Include="..\..\examples\servicemanagement\testadddatadiskbyname.js">
<Link>examples\servicemanagement\testadddatadiskbyname.js</Link>
</Content>
<Content Include="..\..\examples\servicemanagement\testadddatadiskempty.js">
<Link>examples\servicemanagement\testadddatadiskempty.js</Link>
</Content>
<Content Include="..\..\examples\servicemanagement\testaddrole.js">
<Link>examples\servicemanagement\testaddrole.js</Link>
</Content>
<Content Include="..\..\examples\servicemanagement\testcapturerole.js">
<Link>examples\servicemanagement\testcapturerole.js</Link>
</Content>
<Content Include="..\..\examples\servicemanagement\testcommon.js">
<Link>examples\servicemanagement\testcommon.js</Link>
</Content>
<Content Include="..\..\examples\servicemanagement\testcreatedeployment.js">
<Link>examples\servicemanagement\testcreatedeployment.js</Link>
</Content>
<Content Include="..\..\examples\servicemanagement\testcreatehostedservice.js">
<Link>examples\servicemanagement\testcreatehostedservice.js</Link>
</Content>
<Content Include="..\..\examples\servicemanagement\testcreateosimage.js">
<Link>examples\servicemanagement\testcreateosimage.js</Link>
</Content>
<Content Include="..\..\examples\servicemanagement\testdeletedeployment.js">
<Link>examples\servicemanagement\testdeletedeployment.js</Link>
</Content>
<Content Include="..\..\examples\servicemanagement\testdeletehostedservice.js">
<Link>examples\servicemanagement\testdeletehostedservice.js</Link>
</Content>
<Content Include="..\..\examples\servicemanagement\testdeleteosimage.js">
<Link>examples\servicemanagement\testdeleteosimage.js</Link>
</Content>
<Content Include="..\..\examples\servicemanagement\testdeleterole.js">
<Link>examples\servicemanagement\testdeleterole.js</Link>
</Content>
<Content Include="..\..\examples\servicemanagement\testgetdeployment.js">
<Link>examples\servicemanagement\testgetdeployment.js</Link>
</Content>
<Content Include="..\..\examples\servicemanagement\testgetdisk.js">
<Link>examples\servicemanagement\testgetdisk.js</Link>
</Content>
<Content Include="..\..\examples\servicemanagement\testgethostedservice.js">
<Link>examples\servicemanagement\testgethostedservice.js</Link>
</Content>
<Content Include="..\..\examples\servicemanagement\testgethostedservicewithproxy.js">
<Link>examples\servicemanagement\testgethostedservicewithproxy.js</Link>
</Content>
<Content Include="..\..\examples\servicemanagement\testgetoperationstatus.js">
<Link>examples\servicemanagement\testgetoperationstatus.js</Link>
</Content>
<Content Include="..\..\examples\servicemanagement\testgetosimage.js">
<Link>examples\servicemanagement\testgetosimage.js</Link>
</Content>
<Content Include="..\..\examples\servicemanagement\testgetrole.js">
<Link>examples\servicemanagement\testgetrole.js</Link>
</Content>
<Content Include="..\..\examples\servicemanagement\testgetstorageaccountkeys.js">
<Link>examples\servicemanagement\testgetstorageaccountkeys.js</Link>
</Content>
<Content Include="..\..\examples\servicemanagement\testlistdatadisk.js">
<Link>examples\servicemanagement\testlistdatadisk.js</Link>
</Content>
<Content Include="..\..\examples\servicemanagement\testlisthostedservices.js">
<Link>examples\servicemanagement\testlisthostedservices.js</Link>
</Content>
<Content Include="..\..\examples\servicemanagement\testmodifydatadisk.js">
<Link>examples\servicemanagement\testmodifydatadisk.js</Link>
</Content>
<Content Include="..\..\examples\servicemanagement\testmodifyrole.js">
<Link>examples\servicemanagement\testmodifyrole.js</Link>
</Content>
<Content Include="..\..\examples\servicemanagement\testremovedatadisk.js">
<Link>examples\servicemanagement\testremovedatadisk.js</Link>
</Content>
<Content Include="..\..\examples\servicemanagement\testshutdownrestart.js">
<Link>examples\servicemanagement\testshutdownrestart.js</Link>
</Content>
<Content Include="..\..\examples\tasklist\home.js">
<Link>examples\tasklist\home.js</Link>
</Content>
@ -168,6 +249,9 @@
<Content Include="..\..\lib\services\core\serviceclient.js">
<Link>lib\services\core\serviceclient.js</Link>
</Content>
<Content Include="..\..\lib\services\core\servicemanagementclient.js">
<Link>lib\services\core\servicemanagementclient.js</Link>
</Content>
<Content Include="..\..\lib\services\core\storageserviceclient.js">
<Link>lib\services\core\storageserviceclient.js</Link>
</Content>
@ -216,6 +300,12 @@
<Content Include="..\..\lib\services\serviceBus\wraptokenmanager.js">
<Link>lib\services\serviceBus\wraptokenmanager.js</Link>
</Content>
<Content Include="..\..\lib\services\servicemanagement\servicemanagementservice.js">
<Link>lib\services\servicemanagement\servicemanagementservice.js</Link>
</Content>
<Content Include="..\..\lib\services\servicemanagement\models\servicemanagementserialize.js">
<Link>lib\services\servicemanagement\models\servicemanagementserialize.js</Link>
</Content>
<Content Include="..\..\lib\services\table\batchserviceclient.js">
<Link>lib\services\table\batchserviceclient.js</Link>
</Content>