Mini Kabibi Habibi

Current Path : C:/Program Files/McAfee/WebAdvisor/Analytics/Scripts/
Upload File :
Current File : C:/Program Files/McAfee/WebAdvisor/Analytics/Scripts/transport_aws_apigateway_v1.js

/*! $FileVersion=1.2.229 */ var transport_aws_apigateway_v1_fileVersion = "1.2.229"; 
function CreateAWSAPIGatewayV1Transport(){function b(){this._apikey=null;this._partitionKey=null;this._url="https://{dns}.awscommon.mcafee.com/1.0/{gateway}/v1/record"}b.prototype=ModuleManager.create("rest_transport");b.prototype.constructor=b;b.prototype._setup=function(){this._apikey=this._config.apikey;if(!this._apikey){logError("AWS_APIGateway_V1_Transport:: Initialize failed API key not provided");return false}var c=this._config.dns;if(!c){logError("AWS_APIGateway_V1_Transport:: Initialize failed DNS not provided");return false}var e=this._config.gateway;if(!e){logError("AWS_APIGateway_V1_Transport:: Initialize failed Gateway not provided");return false}this._updateURL("{dns}",c);this._updateURL("{gateway}",e);this._partitionKey=engine.getContextId();if(!this._partitionKey){this._partitionKey=generateAlphaNumericString(256)}this._createRESTclientPlugin();if(this.GetVersion()&&(this.GetVersion()!="1")&&(this.GetVersion()!="2")){this._usingRESTclientPlugin=true;logInformation("Calling parent class to setup using the restful plugin");this._plugin.SetHttpMode("PUT");var d=getSystemPlugin();this._plugin.SetAgentName("McAfee Mosaic API V1 transmitter_"+d.CreateGUID());this._plugin.Connect(this._url)}else{this._plugin=null}return true};b.prototype._updateURL=function(c,d){this._url=updateStringWithReplacement(this._url,c,d)};b.prototype._sendUsingRestClient=function(f){try{var d=this._Send(f);var c=JSON.parse(d);if(!c){logError("AWS_APIGateway_V1_Transport::_sendUsingRestClient: Unable to parse result from transmission");return null}return c.statusCode}catch(g){logError("AWS_APIGateway_V1_Transport::_sendUsingRestClient: Exception caught with message: "+g.message)}};b.prototype._sendUsingXmlHttp=function(f){var d;try{var g=ModuleManager.create("xmlHttpComObj");if(!g.setup()){logError("AWS_APIGateway_V1_Transport::_sendUsingXmlHttp: couldnt create a xmlHttpCom");return null}d=g.getSelectedObjName();logInformation("AWS_APIGateway_V1_Transport::_sendUsingXmlHttp: Using "+d);g.open("PUT",this._url,false);for(var i in this._requestHeaders){g.setRequestHeader(i,this._requestHeaders[i])}g.send(f);var k=g.getResponseHeader("x-amzn-ErrorType");var c=(k==null)||(k=="")?true:false;if(true===c){return"200"}var h="";try{h=g.getAllResponseHeaders();h=h.split("\r").join(" ");h=h.split("\n").join(" ")}catch(j){}this._reportExceptionTelemetry(d,"ResponseHeader:"+h,f);return null}catch(j){logError("AWS_APIGateway_V1_Transport::_sendUsingXmlHttp: Using COM obj ("+d+"). Exception caught with message: "+j.message);this._reportExceptionTelemetry(d,"ErrorMsg: "+j.message,f);return null}};b.prototype._sendUsingCommonHttpClient=function(c){try{var d=sendRequestInJSRT(this._url,this._requestHeaders,c);if(d===200){return d}else{logError("AWS_APIGateway_V1_Transport::_sendUsingCommonHttpClient: request failed with "+d+"status code");return null}}catch(f){logError("AWS_APIGateway_V1_Transport::_sendUsingCommonHttpClient. Exception caught with message: "+f.message);return null}};b.prototype._reportExceptionTelemetry=function(f,d,c){try{}catch(g){logError("AWS_APIGateway_V1_Transport::_reportExceptionTelemetry: Exception caught with message"+g.message)}};b.prototype.Send=function(g){try{var f=sanitizeJSONData(g);var h=ModuleManager.getSingleton("mappings");var m=h._map(this._dictionary,f,false);var n=this._appendDottedKeys(m);var d=JSON.stringify(n);logDebug("AWS_APIGateway_V1_Transport::Send: Sending using uri ("+this._url+")");var k=false;var c=0;this._AddRequestHeader("Content-Type","application/json");this._AddRequestHeader("x-api-key",this._apikey);var l=JSON.stringify({Data:n,PartitionKey:this._partitionKey});if(this._usingRESTclientPlugin){c=this._sendUsingRestClient(l)}else{if(enableAnalyticsSDKForUWP){c=this._sendUsingCommonHttpClient(l)}else{c=this._sendUsingXmlHttp(l)}}logInformation("sendStatusCode: "+c);k=(c=="200")?true:false;if(!k){logError("AWS_APIGateway_V1_Transport.Send: Failed to send. Send status code: "+c)}var i=f.hit_event_id;if(this._usingRESTclientPlugin){this._transportLog(i,l,k)}else{this._transportLog(i,l,k,this.GetName()+"_xmlhttp")}return k}catch(j){logError("AWS_APIGateway_V1_Transport::Send: Exception caught when sending to ("+this._url+") with message: "+j.message);return false}};b.prototype._appendDottedKeys=function(e){var f=["csp_clientid","event_category","event_action","event_label","engagement_interactive","engagement_userinitiated","hit_type","hit_uniqueid","hit_severity","hit_label_1","hit_label_2","device_antimalware_provider_enabled","device_os_type","wss_istrial"];for(var d in f){var c=f[d];if(c in e){e[c.replace(/_/g,".")]=e[c]}}return e};var a=new b();return a}ModuleManager.registerFactory("transport_aws_apigateway_v1",CreateAWSAPIGatewayV1Transport);
//1894CCA2D338CA401C83D7F28C6330EF1BF24C640B3D20334D4E6B575141BDE01920326B89419BFCB466DDBBE4A61664064F76D1E3B9F9F4BE1B2FC52BD2DC67++