Ejemplo n.º 1
0
        /// <summary>
        /// Register plugin. All plugin must be registered first.
        /// </summary>
        private static void RegisterPlugin()
        {
            var job = new PluginJob
            {
                AssemblyPath = PluginAssemblyPath,
                JobName      = "MyAssemblyPluginJob",
                JobGroup     = "MyJobGroup"
            };

            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(Url);
                client.DefaultRequestHeaders.Accept.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

                var    response  = client.PostAsJsonAsync("api/plugins/", job).Result;
                string resultStr = response.Content.ReadAsStringAsync().Result;

                dynamic result = JsonConvert.DeserializeObject <dynamic>(resultStr);

                if (result != null)
                {
                    Console.WriteLine(resultStr);
                    _jobId = new Guid(result.id.ToString());
                }
            }
        }
        private QueryResponse CreateJob(PluginJob model)
        {
            var dataMap = new Dictionary <string, object>
            {
                { "pluginPath", model.AssemblyPath },
            };

            return(base.CreateJob(model, typeof(AssemblyPluginJob), dataMap, model.Description));
        }
        public QueryResponse Post([FromBody] PluginJob model)
        {
            Logger.DebugFormat("Entered AssemblyPluginsController.Post(). Job Name = {0}", model.JobName);
            var authorizedJobGroups = _permissionsHelper.GetAuthorizedJobGroups().ToList();

            if ((authorizedJobGroups.Contains(model.JobGroup) || authorizedJobGroups.Contains("*")) && model.JobGroup != "*")
            {
                return(CreateJob(model));
            }
            throw new HttpResponseException(HttpStatusCode.Unauthorized);
        }
Ejemplo n.º 4
0
        public QueryResponse Post([FromBody] PluginJob model)
        {
            Logger.InfoFormat("Entered AssemblyPluginsController.Post(). Job Name = {0}", model.JobName);

            var dataMap = new Dictionary <string, object>
            {
                { "pluginPath", model.AssemblyPath },
            };

            return(base.CreateJob(model, typeof(AssemblyPluginJob), dataMap, model.Description));
        }
Ejemplo n.º 5
0
        public QueryResponse Post([FromBody] PluginJob model)
        {
            Logger.DebugFormat("Entered AssemblyPluginsController.Post(). Job Name = {0}", model.JobName);

            return(CreateJob(model));
        }