<commit_before>/*
Copyright [2016] [Relevance Lab]

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 AzureArm = require('_pr/model/azure-arm');
var errorResponses = require('./error_responses');
var AWSCloudFormation = require('_pr/lib/awsCloudFormation');
var appConfig = require('_pr/config');
var Cryptography = require('_pr/lib/utils/cryptography');
var AWSProvider = require('_pr/model/classes/masters/cloudprovider/awsCloudProvider.js');
var logger = require('_pr/logger')(module);
var instancesDao = require('_pr/model/classes/instance/instance');
var configmgmtDao = require('_pr/model/d4dmasters/configmgmt');
var Chef = require('_pr/lib/chef.js');
var ARM = require('_pr/lib/azure-arm.js');
var azureProvider = require('_pr/model/classes/masters/cloudprovider/azureCloudProvider.js');
var appConfig = require('_pr/config');
var uuid = require('node-uuid');
var azureTemplateFunctionEvaluater = require('_pr/lib/azureTemplateFunctionEvaluater');
var logsDao = require('_pr/model/dao/logsdao.js');
var instanceLogModel = require('_pr/model/log-trail/instanceLog.js');


module.exports.setRoutes = function(app, sessionVerificationFunc) {

    app.all('/azure-arm/*', sessionVerificationFunc);

    app.post('/azure-arm/evaluateVMs', function(req, res) {

        var parameters = req.body.parameters;
        var variables = req.body.variables;<commit_msg>Add soft delete in AzureArmTemplate<commit_after>/*
Copyright [2016] [Relevance Lab]

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 AzureArm = require('_pr/model/azure-arm');
var errorResponses = require('./error_responses');
var AWSCloudFormation = require('_pr/lib/awsCloudFormation');
var appConfig = require('_pr/config');
var Cryptography = require('_pr/lib/utils/cryptography');
var AWSProvider = require('_pr/model/classes/masters/cloudprovider/awsCloudProvider.js');
var logger = require('_pr/logger')(module);
var instancesDao = require('_pr/model/classes/instance/instance');
var configmgmtDao = require('_pr/model/d4dmasters/configmgmt');
var Chef = require('_pr/lib/chef.js');
var ARM = require('_pr/lib/azure-arm.js');
var azureProvider = require('_pr/model/classes/masters/cloudprovider/azureCloudProvider.js');
var appConfig = require('_pr/config');
var uuid = require('node-uuid');
var azureTemplateFunctionEvaluater = require('_pr/lib/azureTemplateFunctionEvaluater');
var logsDao = require('_pr/model/dao/logsdao.js');
var instanceLogModel = require('_pr/model/log-trail/instanceLog.js');
var apiUtil = require('_pr/lib/utils/apiUtil.js');
var async = require('async');


module.exports.setRoutes = function(app, sessionVerificationFunc) {

    app.all('/azure-arm*', sessionVerificationFunc);

    app.get('/azure-arm', function(req, res) {
        async.waterfall([
            function(next){
                apiUtil.queryFilterBy(req.query,next);
            },
            function(filterObj,next){
                AzureArm.getAzureArmList(filterObj,next);
            }
        ],function(err,azureArmList){
            if(err){
                res.status(500).send(errorResponses.db.error);
                return;
            }else if(azureArmList.length > 0){
                res.send(200, azureArmList);
            }else{
                res.send(404, {
                    message: "AzureArm is not found"
                })
            }
        });
    });

    app.post('/azure-arm/evaluateVMs', function(req, res) {

        var parameters = req.body.parameters;
        var variables = req.body.variables;
{'fraction_non_alphanumeric': 0.12407614781634939, 'fraction_numerical': 0.006270996640537514, 'mean_word_length': 4.0292792792792795, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '913542', 'n_tokens_mistral': 1323, 'n_tokens_neox': 1283, 'n_words': 329}