How to use the azure-common.util function in azure-common

To help you get started, we’ve selected a few azure-common examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Azure / azure-sdk-for-node / test / services / queue / queueservice-tests.js View on Github external
//
// See the License for the specific language governing permissions and
// limitations under the License.
//

var assert = require('assert');

// Test includes
var testutil = require('../../util/util');
var queuetestutil = require('../../framework/queue-test-utils');

// Lib includes
var azure = testutil.libRequire('azure');
var common = require('azure-common');
var storage = require('azure-storage-legacy');
var azureutil = common.util;

var Constants = common.Constants;
var ServiceClientConstants = common.ServiceClientConstants;
var HttpConstants = Constants.HttpConstants;

var queueService;
var queueNames = [];
var queueNamesPrefix = 'queue';

var testPrefix = 'queueservice-tests';

var tableService;
var suiteUtil;

suite('queueservice-tests', function () {
  suiteSetup(function (done) {
github Azure / azure-sdk-for-node / lib / services / legacyStorage / lib / queue / queueservice.js View on Github external
//   http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// 
// See the License for the specific language governing permissions and
// limitations under the License.
// 

// Module dependencies.
var util = require('util');
var _ = require('underscore');

var azureCommon = require('azure-common');
var azureutil = azureCommon.util;
var validate = azureCommon.validate;

var StorageServiceClient = azureCommon.StorageServiceClient;
var SharedKey = require('../blob/internal/sharedkey');
var WebResource = azureCommon.WebResource;
var Constants = azureCommon.Constants;
var QueryStringConstants = Constants.QueryStringConstants;
var HttpConstants = Constants.HttpConstants;
var HeaderConstants = Constants.HeaderConstants;

// Models requires
var ListQueuesResultContinuation = require('./models/listqueuesresultcontinuation');
var QueueResult = require('./models/queueresult');
var QueueMessageResult = require('./models/queuemessageresult');
var servicePropertiesResult = require('./models/servicepropertiesresult');
github Azure / azure-sdk-for-node / lib / services / legacyStorage / lib / sharedkey.js View on Github external
// You may obtain a copy of the License at
//   http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// 
// See the License for the specific language governing permissions and
// limitations under the License.
// 

// Module dependencies.
var _ = require('underscore');

var azureCommon = require('azure-common');
var azureutil = azureCommon.util;
var HeaderConstants = azureCommon.Constants.HeaderConstants;
var HmacSha256Sign = azureCommon.HmacSha256Sign;

/**
* Creates a new SharedKey object.
*
* @constructor
* @param {string} storageAccount    The storage account.
* @param {string} storageAccessKey  The storage account's access key.
* @param {bool}   usePathStyleUri   Boolean value indicating if the path, or the hostname, should include the storage account.
*/
function SharedKey(storageAccount, storageAccessKey, usePathStyleUri) {
  this.storageAccount = storageAccount;
  this.storageAccessKey = storageAccessKey;
  this.usePathStyleUri = usePathStyleUri;
  this.signer = new HmacSha256Sign(storageAccessKey);
github Azure / azure-sdk-for-node / lib / services / legacyStorage / lib / table / internal / sharedkeylitetable.js View on Github external
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//   http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// 
// See the License for the specific language governing permissions and
// limitations under the License.
// 

// Module dependencies.
var azureCommon = require('azure-common');
var azureutil = azureCommon.util;
var HmacSha256Sign = azureCommon.HmacSha256Sign;
var Constants = azureCommon.Constants;
var HeaderConstants = Constants.HeaderConstants;
var QueryStringConstants = Constants.QueryStringConstants;

/**
* Creates a new SharedKeyLiteTable object.
*
* @constructor
* @param {string} storageAccount    The storage account.
* @param {string} storageAccessKey  The storage account's access key.
* @param {bool}   usePathStyleUri   Boolean value indicating if the path, or the hostname, should include the storage account.
*/
function SharedKeyLiteTable(storageAccount, storageAccessKey, usePathStyleUri) {
  this.storageAccount = storageAccount;
  this.storageAccessKey = storageAccessKey;
github Azure / azure-sdk-for-node / lib / services / legacyStorage / lib / table / models / queryentitiesresultcontinuation.js View on Github external
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//   http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// 
// See the License for the specific language governing permissions and
// limitations under the License.
// 

// Module dependencies.
var azureCommon = require('azure-common');
var azureutil = azureCommon.util;
var Constants = azureCommon.Constants;
var TableConstants = Constants.TableConstants;

function QueryEntitiesResultContinuation(tableService, tableQuery, nextPartitionKey, nextRowKey) {
  if (tableService) {
    this.tableService = tableService;
  }

  if (tableQuery) {
    this.tableQuery = tableQuery;
  }

  if (nextPartitionKey) {
    this.nextPartitionKey = nextPartitionKey;
  }
github Azure / azure-sdk-for-node / lib / services / legacyStorage / lib / batchoperation.js View on Github external
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// 
// See the License for the specific language governing permissions and
// limitations under the License.
// 

var util = require('util');
var http = require('http');
var https = require('https');
var EventEmitter = require('events').EventEmitter;
var os = require('os');

var azureCommon = require('azure-common');
var utils = azureCommon.util;
var Logger = azureCommon.Logger;

var DEFAULT_OPERATION_MEMORY_USAGE = azureCommon.Constants.BlobConstants.DEFAULT_WRITE_BLOCK_SIZE_IN_BYTES;
var DEFAULT_GLOBAL_CONCURRENCY = 5; //Default http connection limitation for nodejs

var SystemTotalMemory = os.totalmem();
var nodeVersion = utils.getNodeVersion();
var enableReuseSocket = nodeVersion.major >= 0 && nodeVersion.minor >= 10;

/**
* Concurrent execute batch operation and call operation callback randomly or in sequence.
* Random mode is for uploading.
*   1. Fire user callback when the operation is done.
* Sequence mode is for downloading.
*   1. Fire user callback when the operation is done and all previous operation and callback has finished.
*   2. BatchOperation guarantee the user callback is fired one by one.
github Azure / azure-sdk-for-node / lib / services / legacyStorage / lib / listblobsresultcontinuation.js View on Github external
// 
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//   http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// 
// See the License for the specific language governing permissions and
// limitations under the License.
// 

// Module dependencies.
var azureutil = require('azure-common').util;

/**
* Creates a new ListBlobsResultContinuation object.
*/
function ListBlobsResultContinuation(blobService, container, options, nextMarker) {
  if (blobService) {
    this.blobService = blobService;
  }

  if (container) {
    this.container = container;
  }

  if (options) {
    this.options = options;
  }
github Azure / azure-sdk-for-node / lib / services / serviceBus / lib / models / queuemessageresult.js View on Github external
// 
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//   http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// 
// See the License for the specific language governing permissions and
// limitations under the License.
// 

// Module dependencies.
var azureutil = require('azure-common').util;
var RFC1123 = require('azure-common').RFC1123;

var Constants = require('azure-common').Constants;
var HeaderConstants = Constants.HeaderConstants;

exports = module.exports;

exports.parse = function (responseObject) {
  var queueMessageResult = {};

  queueMessageResult.body = responseObject.body;

  if (responseObject.headers[HeaderConstants.BROKER_PROPERTIES_HEADER]) {
    queueMessageResult.brokerProperties = {};

    var brokerProperties = JSON.parse(responseObject.headers[HeaderConstants.BROKER_PROPERTIES_HEADER]);
github Azure / azure-sdk-for-node / lib / serviceruntime / roleenvironment.js View on Github external
//   http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// 
// See the License for the specific language governing permissions and
// limitations under the License.
// 

// Module dependencies.
var events = require('events');
var uuid = require('node-uuid');

var azureCommon = require('azure-common');
var azureutil = azureCommon.util;
var RuntimeKernel = require('./runtimekernel');
var Constants = azureCommon.Constants;
var ServiceRuntimeConstants = Constants.ServiceRuntimeConstants;

// Expose 'RoleEnvironment'.
exports = module.exports;
/**
* RoleEnvironment provides methos that allow you to interact with the machine environment
* where the current role is running.
*
* 
* __Note__: RoleEnvironment will only work if your code is running in a worker role
* inside the Azure emulator or in a Microsoft Azure Cloud Service!
* @exports RoleEnvironment
*
*/
github Azure / azure-sdk-for-node / lib / services / serviceBus / lib / gcmservice.js View on Github external
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

var _ = require('underscore');

var azureCommon = require('azure-common');
var azureutil = azureCommon.util;
var Constants = azureCommon.Constants;
var validate = azureCommon.validate;
var HeaderConstants = Constants.HeaderConstants;
var WebResource = azureCommon.WebResource;

var registrationResult = require('./models/registrationresult');

/**
* Creates a new GcmService object.
* 
*
* __Note__: An instance of this object is created automatically when a {@link NotificationHubService}
* object is created. See {@link NotificationHubService#gcm}.
* @class
* The GcmService class is used to send notifications using [Google Cloud Messaging](http://developer.android.com/google/gcm/index.html).
* @constructor