private static IDataExchangeAPIClient NewClient(EUEConfiguration conf)
        {
            ContextBuilder cb = new ContextBuilder();

            cb.Software   = conf.Software;
            cb.Os         = conf.Os;
            cb.Hardware   = conf.Hardware;
            cb.InstanceId = conf.InstanceId;
            cb.Location   = conf.Location;
            cb.Script     = conf.ScriptName;
            Context context = cb.build();

            string dataExchangeAPIURL = conf.DataExchangeAPIUrl;
            string dataExchangeAPIKey = conf.ApiKey;

            if (conf.IsDebugEnabled)
            {
                Logger.GetLogger().DebugMessage(
                    "Connecting to data exchange API server. " +
                    "URL: " + dataExchangeAPIURL +
                    ", API key: " + dataExchangeAPIKey +
                    ", Context: " + context);
            }

            if (dataExchangeAPIKey != null && dataExchangeAPIKey != "")
            {
                return(DataExchangeAPIClientFactory.NewClient(conf.DataExchangeAPIUrl, context, dataExchangeAPIKey));
            }
            return(DataExchangeAPIClientFactory.NewClient(conf.DataExchangeAPIUrl, context, ""));
        }
Exemplo n.º 2
0
        public void ConnectToDataExchangeApi(string dataExchangeApiUrl, string apiKey, NeoloadContextData ctx)
        {
            if (_mode != Mode.RUNTIME && _mode != Mode.END_USER_EXPERIENCE)
            {
                return;
            }

            context = CreateContext(ctx);
            if (apiKey == null)
            {
                apiKey = String.Empty;
            }
            this._dataExchangeClient = DataExchangeAPIClientFactory.NewClient(dataExchangeApiUrl, context, apiKey);
        }
Exemplo n.º 3
0
 public void ConnectToDataExchangeApi(string dataExchangeApiUrl, string apiKey, NeoloadContextData ctx)
 {
     context = CreateContext(ctx);
     this.dataExchangeClient = DataExchangeAPIClientFactory.NewClient(dataExchangeApiUrl, context, apiKey);
 }