/// <summary>
 /// Constructor for HDInisghtKernelService
 /// </summary>
 /// <param name="flowConfig">Config of floe</param>
 /// <param name="connectionInfo">Spark connection info</param>
 /// <param name="logger">Logger for errors/results</param>
 public HDInsightKernelService(FlowConfigObject flowConfig, SparkConnectionInfo connectionInfo, ILogger logger) : base(flowConfig, connectionInfo, logger)
 {
     _baseUrl  = _baseUrl.Replace("$name", flowConfig.JobURLBase);
     _username = connectionInfo.UserName;
     _password = connectionInfo.Password;
     _token    = Base64Encode($"{_username}:{_password}");
 }
        /// <summary>
        /// Constructor for DatabricksKernerService
        /// </summary>
        /// <param name="flowConfig">Config of the flow</param>
        /// <param name="connectionInfo">Spark connection info</param>
        /// <param name="logger">Logger for results/errors</param>
        /// <param name="databricksToken">databricks token</param>
        public DatabricksKernelService(FlowConfigObject flowConfig, SparkConnectionInfo connectionInfo, ILogger logger, string databricksToken) : base(flowConfig, connectionInfo, logger)
        {
            string region = string.IsNullOrEmpty(flowConfig.SparkRegion) ? flowConfig.ResourceGroupLocation : flowConfig.SparkRegion;

            _baseUrl     = _baseUrl.Replace("$region", region);
            _clusterName = flowConfig.SparkClusterName;
            _token       = databricksToken;
        }
Exemplo n.º 3
0
 /// <summary>
 /// The constructor for initializing the KernelService
 /// </summary>
 /// <param name="jobURLBase">jobURLBase based on the subscription used. Required for using Jupyter kernel Apis</param>
 /// <param name="keyvault">keyvault to use</param>
 /// <param name="secretPrefix">secret name prefix</param>
 /// <param name="logger">logger object passed so that telemetry can be added</param>
 public KernelService(FlowConfigObject flowConfig, SparkConnectionInfo connectionInfo, ILogger logger)
 {
     SparkType = flowConfig.SparkType;
     Logger    = logger;
 }
Exemplo n.º 4
0
        /// <summary>
        /// The constructor for initializing the KernelService
        /// </summary>
        /// <param name="jobURLBase">jobURLBase based on the subscription used. Required for using Jupyter kernel Apis</param>
        /// <param name="keyvault">keyvault to use</param>
        /// <param name="secretPrefix">secret name prefix</param>
        /// <param name="logger">logger object passed so that telemetry can be added</param>
        public KernelService(string jobURLBase, string keyvault, string secretPrefix, SparkConnectionInfo connectionInfo, ILogger logger)
        {
            _logger       = logger;
            _baseUrl      = _baseUrl.Replace("$name", jobURLBase);
            _keyvaultName = keyvault;
            _username     = connectionInfo.UserName;
            _password     = connectionInfo.Password;

            string token = Base64Encode($"{_username}:{_password}");

            _client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", token);
            _client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));//ACCEPT header
        }