Socket
Socket
Sign inDemoInstall

azure-asm-subscription

Package Overview
Dependencies
75
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.10.2 to 0.11.0

lib/LICENSE.txt

0

lib/subscription.js

@@ -0,0 +0,0 @@ //

334

lib/subscriptionClient.js

@@ -0,1 +1,11 @@

/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
/* jshint latedef:false */

@@ -5,286 +15,70 @@ /* jshint forin:false */

//
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// 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.
//
'use strict';
// Warning: This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if the
// code is regenerated.
const msRest = require('ms-rest');
const msRestAzure = require('ms-rest-azure');
const ServiceClient = msRestAzure.AzureServiceClient;
'use strict';
const models = require('./models');
const operations = require('./operations');
var util = require('util');
var azureCommon = require('azure-common');
var xml = azureCommon.xml2js;
var js2xml = azureCommon.js2xml;
var Service = azureCommon.Service;
var WebResource = azureCommon.WebResource;
var SubscriptionClient = ( /** @lends SubscriptionClient */ function() {
/** Class representing a SubscriptionClient. */
class SubscriptionClient extends ServiceClient {
/**
* @class
* Initializes a new instance of the SubscriptionClient class.
* @constructor
*
* @param {CloudCredentials} credentials Credentials used to authenticate
* requests.
*
* @param {string} [baseUri] Gets the URI used as the base for all cloud
* service requests.
*
* @param {Array} filters
* Create a SubscriptionClient.
* @param {credentials} credentials - Credentials needed for the client to connect to Azure.
* @param {string} [baseUri] - The base URI of the service.
* @param {object} [options] - The parameter options
* @param {Array} [options.filters] - Filters to be added to the request pipeline
* @param {object} [options.requestOptions] - Options for the underlying request object
* {@link https://github.com/request/request#requestoptions-callback Options doc}
* @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy
* @param {string} [options.acceptLanguage] - Gets or sets the preferred language for the response.
* @param {number} [options.longRunningOperationRetryTimeout] - Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30.
* @param {boolean} [options.generateClientRequestId] - When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.
*/
function SubscriptionClient(credentials, baseUri, filters) {
constructor(credentials, baseUri, options) {
if (credentials === null || credentials === undefined) {
throw new Error('credentials cannot be null.');
throw new Error('\'credentials\' cannot be null.');
}
SubscriptionClient['super_'].call(this, credentials, filters);
this.credentials = credentials;
if (!options) options = {};
super(credentials, options);
this.acceptLanguage = 'en-US';
this.longRunningOperationRetryTimeout = 30;
this.generateClientRequestId = true;
this.baseUri = baseUri;
if (this.baseUri === null || this.baseUri === undefined) {
this.baseUri = 'https://management.core.windows.net';
if (!this.baseUri) {
this.baseUri = 'https://management.azure.com';
}
if (this.apiVersion === null || this.apiVersion === undefined) {
this.apiVersion = '2013-08-01';
this.credentials = credentials;
let packageInfo = this.getPackageJsonInfo(__dirname);
this.addUserAgentInfo(`${packageInfo.name}/${packageInfo.version}`);
if(options.acceptLanguage !== null && options.acceptLanguage !== undefined) {
this.acceptLanguage = options.acceptLanguage;
}
if (this.longRunningOperationInitialTimeout === null || this.longRunningOperationInitialTimeout === undefined) {
this.longRunningOperationInitialTimeout = -1;
if(options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) {
this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout;
}
if (this.longRunningOperationRetryTimeout === null || this.longRunningOperationRetryTimeout === undefined) {
this.longRunningOperationRetryTimeout = -1;
if(options.generateClientRequestId !== null && options.generateClientRequestId !== undefined) {
this.generateClientRequestId = options.generateClientRequestId;
}
/**
* Provides an instance of the
* [SubscriptionOperations](-SubscriptionOperations.html) object.
* @type {object}
*/
this.subscriptions = new SubscriptionOperations(this);
this.operations = new operations.Operations(this);
this.subscriptionOperations = new operations.SubscriptionOperations(this);
this.subscriptionFactory = new operations.SubscriptionFactory(this);
this.subscriptions = new operations.Subscriptions(this);
this.tenants = new operations.Tenants(this);
this.models = models;
msRest.addSerializationMixin(this);
}
util.inherits(SubscriptionClient, Service);
return SubscriptionClient;
})();
exports.SubscriptionClient = SubscriptionClient;
var SubscriptionOperations = ( /** @lends SubscriptionOperations */ function() {
/**
* @class
* __NOTE__: An instance of this class is automatically created for an
* instance of the [SubscriptionClient] {@link
* SubscriptionClient~SubscriptionClient}.
* See [subscriptions] {@link
* SubscriptionClient~SubscriptionClient#subscriptions}.
* Initializes a new instance of the SubscriptionOperations class.
* @constructor
*
* @param {SubscriptionClient} client Reference to the service client.
*/
function SubscriptionOperations(client) {
this.client = client;
}
/**
*
* @param {function} callback
*
* @returns {Stream} The response stream.
*/
SubscriptionOperations.prototype.list = function(callback) {
if (callback === null || callback === undefined) {
throw new Error('callback cannot be null.');
}
// Validate
// Tracing
// Construct URL
var url2 = '';
url2 = url2 + '/subscriptions';
var baseUrl = this.client.baseUri;
// Trim '/' character from the end of baseUrl and beginning of url.
if (baseUrl[baseUrl.length - 1] === '/') {
baseUrl = baseUrl.substring(0, (baseUrl.length - 1) + 0);
}
if (url2[0] === '/') {
url2 = url2.substring(1);
}
url2 = baseUrl + '/' + url2;
url2 = url2.replace(' ', '%20');
// Create HTTP transport objects
var httpRequest = new WebResource();
httpRequest.method = 'GET';
httpRequest.headers = {};
httpRequest.url = url2;
// Set Headers
httpRequest.headers['Content-Type'] = 'application/xml;charset=utf-8';
httpRequest.headers['x-ms-version'] = '2013-08-01';
// Send Request
return this.client.pipeline(httpRequest, function (err, response, body) {
if (err !== null && err !== undefined) {
return callback(err);
}
var statusCode = response.statusCode;
if (statusCode !== 200) {
var error = new Error(body);
error.statusCode = response.statusCode;
return callback(error);
}
// Create Result
var result = null;
// Deserialize Response
if (statusCode === 200) {
var responseContent = body;
result = { subscriptions: [] };
var options = {};
options.trim = false;
options.strict = false;
xml.parseString(responseContent, options, function (err2, responseDoc) {
if (err2 !== null && err2 !== undefined) {
return callback(err2);
}
var subscriptionsElement = js2xml.getElement(responseDoc, responseDoc, 'SUBSCRIPTIONS', 'HTTP://SCHEMAS.MICROSOFT.COM/WINDOWSAZURE');
if (subscriptionsElement !== null && subscriptionsElement !== undefined) {
if (subscriptionsElement !== null && subscriptionsElement !== undefined) {
for (var loweredIndex1 = 0; loweredIndex1 < js2xml.getElements(responseDoc, subscriptionsElement, 'SUBSCRIPTION', 'HTTP://SCHEMAS.MICROSOFT.COM/WINDOWSAZURE').length; loweredIndex1 = loweredIndex1 + 1) {
var subscriptionsElement2 = js2xml.getElements(responseDoc, subscriptionsElement, 'SUBSCRIPTION', 'HTTP://SCHEMAS.MICROSOFT.COM/WINDOWSAZURE')[loweredIndex1];
var subscriptionInstance = {};
result.subscriptions.push(subscriptionInstance);
var subscriptionIDElement = js2xml.getElement(responseDoc, subscriptionsElement2, 'SUBSCRIPTIONID', 'HTTP://SCHEMAS.MICROSOFT.COM/WINDOWSAZURE');
if (subscriptionIDElement !== null && subscriptionIDElement !== undefined) {
var subscriptionIDInstance = subscriptionIDElement;
subscriptionInstance.subscriptionId = subscriptionIDInstance;
}
var subscriptionNameElement = js2xml.getElement(responseDoc, subscriptionsElement2, 'SUBSCRIPTIONNAME', 'HTTP://SCHEMAS.MICROSOFT.COM/WINDOWSAZURE');
if (subscriptionNameElement !== null && subscriptionNameElement !== undefined) {
var subscriptionNameInstance = subscriptionNameElement;
subscriptionInstance.subscriptionName = subscriptionNameInstance;
}
var subscriptionStatusElement = js2xml.getElement(responseDoc, subscriptionsElement2, 'SUBSCRIPTIONSTATUS', 'HTTP://SCHEMAS.MICROSOFT.COM/WINDOWSAZURE');
if (subscriptionStatusElement !== null && subscriptionStatusElement !== undefined && subscriptionStatusElement.length !== 0) {
var subscriptionStatusInstance = subscriptionStatusElement;
subscriptionInstance.subscriptionStatus = subscriptionStatusInstance;
}
var accountAdminLiveEmailIdElement = js2xml.getElement(responseDoc, subscriptionsElement2, 'ACCOUNTADMINLIVEEMAILID', 'HTTP://SCHEMAS.MICROSOFT.COM/WINDOWSAZURE');
if (accountAdminLiveEmailIdElement !== null && accountAdminLiveEmailIdElement !== undefined) {
var accountAdminLiveEmailIdInstance = accountAdminLiveEmailIdElement;
subscriptionInstance.accountAdminLiveEmailId = accountAdminLiveEmailIdInstance;
}
var serviceAdminLiveEmailIdElement = js2xml.getElement(responseDoc, subscriptionsElement2, 'SERVICEADMINLIVEEMAILID', 'HTTP://SCHEMAS.MICROSOFT.COM/WINDOWSAZURE');
if (serviceAdminLiveEmailIdElement !== null && serviceAdminLiveEmailIdElement !== undefined) {
var serviceAdminLiveEmailIdInstance = serviceAdminLiveEmailIdElement;
subscriptionInstance.serviceAdminLiveEmailId = serviceAdminLiveEmailIdInstance;
}
var maxCoreCountElement = js2xml.getElement(responseDoc, subscriptionsElement2, 'MAXCORECOUNT', 'HTTP://SCHEMAS.MICROSOFT.COM/WINDOWSAZURE');
if (maxCoreCountElement !== null && maxCoreCountElement !== undefined && maxCoreCountElement.length !== 0) {
var maxCoreCountInstance = parseInt(maxCoreCountElement, 10);
subscriptionInstance.maximumCoreCount = maxCoreCountInstance;
}
var maxStorageAccountsElement = js2xml.getElement(responseDoc, subscriptionsElement2, 'MAXSTORAGEACCOUNTS', 'HTTP://SCHEMAS.MICROSOFT.COM/WINDOWSAZURE');
if (maxStorageAccountsElement !== null && maxStorageAccountsElement !== undefined && maxStorageAccountsElement.length !== 0) {
var maxStorageAccountsInstance = parseInt(maxStorageAccountsElement, 10);
subscriptionInstance.maximumStorageAccounts = maxStorageAccountsInstance;
}
var maxHostedServicesElement = js2xml.getElement(responseDoc, subscriptionsElement2, 'MAXHOSTEDSERVICES', 'HTTP://SCHEMAS.MICROSOFT.COM/WINDOWSAZURE');
if (maxHostedServicesElement !== null && maxHostedServicesElement !== undefined && maxHostedServicesElement.length !== 0) {
var maxHostedServicesInstance = parseInt(maxHostedServicesElement, 10);
subscriptionInstance.maximumHostedServices = maxHostedServicesInstance;
}
var currentCoreCountElement = js2xml.getElement(responseDoc, subscriptionsElement2, 'CURRENTCORECOUNT', 'HTTP://SCHEMAS.MICROSOFT.COM/WINDOWSAZURE');
if (currentCoreCountElement !== null && currentCoreCountElement !== undefined && currentCoreCountElement.length !== 0) {
var currentCoreCountInstance = parseInt(currentCoreCountElement, 10);
subscriptionInstance.currentCoreCount = currentCoreCountInstance;
}
var currentStorageAccountsElement = js2xml.getElement(responseDoc, subscriptionsElement2, 'CURRENTSTORAGEACCOUNTS', 'HTTP://SCHEMAS.MICROSOFT.COM/WINDOWSAZURE');
if (currentStorageAccountsElement !== null && currentStorageAccountsElement !== undefined && currentStorageAccountsElement.length !== 0) {
var currentStorageAccountsInstance = parseInt(currentStorageAccountsElement, 10);
subscriptionInstance.currentStorageAccounts = currentStorageAccountsInstance;
}
var currentHostedServicesElement = js2xml.getElement(responseDoc, subscriptionsElement2, 'CURRENTHOSTEDSERVICES', 'HTTP://SCHEMAS.MICROSOFT.COM/WINDOWSAZURE');
if (currentHostedServicesElement !== null && currentHostedServicesElement !== undefined && currentHostedServicesElement.length !== 0) {
var currentHostedServicesInstance = parseInt(currentHostedServicesElement, 10);
subscriptionInstance.currentHostedServices = currentHostedServicesInstance;
}
var maxVirtualNetworkSitesElement = js2xml.getElement(responseDoc, subscriptionsElement2, 'MAXVIRTUALNETWORKSITES', 'HTTP://SCHEMAS.MICROSOFT.COM/WINDOWSAZURE');
if (maxVirtualNetworkSitesElement !== null && maxVirtualNetworkSitesElement !== undefined && maxVirtualNetworkSitesElement.length !== 0) {
var maxVirtualNetworkSitesInstance = parseInt(maxVirtualNetworkSitesElement, 10);
subscriptionInstance.maximumVirtualNetworkSites = maxVirtualNetworkSitesInstance;
}
var maxLocalNetworkSitesElement = js2xml.getElement(responseDoc, subscriptionsElement2, 'MAXLOCALNETWORKSITES', 'HTTP://SCHEMAS.MICROSOFT.COM/WINDOWSAZURE');
if (maxLocalNetworkSitesElement !== null && maxLocalNetworkSitesElement !== undefined && maxLocalNetworkSitesElement.length !== 0) {
var maxLocalNetworkSitesInstance = parseInt(maxLocalNetworkSitesElement, 10);
subscriptionInstance.maximumLocalNetworkSites = maxLocalNetworkSitesInstance;
}
var maxDnsServersElement = js2xml.getElement(responseDoc, subscriptionsElement2, 'MAXDNSSERVERS', 'HTTP://SCHEMAS.MICROSOFT.COM/WINDOWSAZURE');
if (maxDnsServersElement !== null && maxDnsServersElement !== undefined && maxDnsServersElement.length !== 0) {
var maxDnsServersInstance = parseInt(maxDnsServersElement, 10);
subscriptionInstance.maximumDnsServers = maxDnsServersInstance;
}
var maxExtraVIPCountElement = js2xml.getElement(responseDoc, subscriptionsElement2, 'MAXEXTRAVIPCOUNT', 'HTTP://SCHEMAS.MICROSOFT.COM/WINDOWSAZURE');
if (maxExtraVIPCountElement !== null && maxExtraVIPCountElement !== undefined && maxExtraVIPCountElement.length !== 0) {
var maxExtraVIPCountInstance = parseInt(maxExtraVIPCountElement, 10);
subscriptionInstance.maximumExtraVirtualIPCount = maxExtraVIPCountInstance;
}
var aADTenantIDElement = js2xml.getElement(responseDoc, subscriptionsElement2, 'AADTENANTID', 'HTTP://SCHEMAS.MICROSOFT.COM/WINDOWSAZURE');
if (aADTenantIDElement !== null && aADTenantIDElement !== undefined) {
var aADTenantIDInstance = aADTenantIDElement;
subscriptionInstance.activeDirectoryTenantId = aADTenantIDInstance;
}
var createdTimeElement = js2xml.getElement(responseDoc, subscriptionsElement2, 'CREATEDTIME', 'HTTP://SCHEMAS.MICROSOFT.COM/WINDOWSAZURE');
if (createdTimeElement !== null && createdTimeElement !== undefined && createdTimeElement.length !== 0) {
var createdTimeInstance = new Date(createdTimeElement);
subscriptionInstance.created = createdTimeInstance;
}
}
}
}
});
}
result.statusCode = statusCode;
result.requestId = response.headers['x-ms-request-id'];
return callback(null, result);
});
};
return SubscriptionOperations;
})();
}
module.exports = SubscriptionClient;
module.exports['default'] = SubscriptionClient;
module.exports.SubscriptionClient = SubscriptionClient;
module.exports.SubscriptionModels = models;

@@ -0,0 +0,0 @@ Apache License

@@ -13,3 +13,3 @@ {

],
"version": "0.10.2",
"version": "0.11.0",
"description": "Microsoft Azure Subscription Management Client Library for node",

@@ -16,0 +16,0 @@ "tags": [

@@ -0,0 +0,0 @@ # Microsoft Azure SDK for Node.js - Subscription Management

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc