<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.
*/


// This file act as a Model which contains provider schema and dao methods.

var logger = require('_pr/logger')(module);
var mongoose = require('mongoose');
var extend = require('mongoose-schema-extend');
var ObjectId = require('mongoose').Types.ObjectId;
var schemaValidator = require('../../../dao/schema-validator');
var uniqueValidator = require('mongoose-unique-validator');

var Schema = mongoose.Schema;


var awsProviderSchema = new Schema({
	id: {
		type: Number,
		required: true
	},
	providerName: {
		type: String,
		required: true,
		trim: true
	},
	providerType: {
		type: String,
		required: true,
		trim: true
	},
	accessKey: {
		type: String,
		required: true,
		trim: true
	},
	secretKey: {
		type: String,
		required: true,
		trim: true
	},
	isDefault: {
		type: Boolean,
		required: true,
		trim: false,
		default: false
	},
	orgId: {
		type: [String],
		required: true,
		trim: true
	}
});

// Static methods :- 

// creates a new Provider
awsProviderSchema.statics.createNew = function(providerData, callback) {
	logger.debug("Enter createNew");
	var providerObj = providerData;
	var that = this;
	var provider = new that(providerObj);
	provider.save(function(err, aProvider) {
		if (err) {
			logger.error(err);
			callback(err, null);
			return;
		}
		logger.debug("Exit createNew with provider present");<commit_msg>secret key and access key for aws providers made non-mandatory<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.
*/


// This file act as a Model which contains provider schema and dao methods.

var logger = require('_pr/logger')(module);
var mongoose = require('mongoose');
var extend = require('mongoose-schema-extend');
var ObjectId = require('mongoose').Types.ObjectId;
var schemaValidator = require('../../../dao/schema-validator');
var uniqueValidator = require('mongoose-unique-validator');

var Schema = mongoose.Schema;


var awsProviderSchema = new Schema({
	id: {
		type: Number,
		required: true
	},
	providerName: {
		type: String,
		required: true,
		trim: true
	},
	providerType: {
		type: String,
		required: true,
		trim: true
	},
	accessKey: {
		type: String,
		required: false,
		trim: true
	},
	secretKey: {
		type: String,
		required: false,
		trim: true
	},
	isDefault: {
		type: Boolean,
		required: true,
		trim: false,
		default: false
	},
	orgId: {
		type: [String],
		required: true,
		trim: true
	}
});

// Static methods :- 

// creates a new Provider
awsProviderSchema.statics.createNew = function(providerData, callback) {
	logger.debug("Enter createNew");
	var providerObj = providerData;
	var that = this;
	var provider = new that(providerObj);
	provider.save(function(err, aProvider) {
		if (err) {
			logger.error(err);
			callback(err, null);
			return;
		}
		logger.debug("Exit createNew with provider present");
{'fraction_non_alphanumeric': 0.11294057113455107, 'fraction_numerical': 0.004116285052739903, 'mean_word_length': 4.122529644268774, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4740575', 'n_tokens_mistral': 1247, 'n_tokens_neox': 1177, 'n_words': 416}