Ejemplo n.º 1
0
        public IActionResult GetCommands()
        {
            CommandsResponse commansResponse = CustomResponseService.CreateCommandsResponse(new CreateCommandsResponsePayload()
            {
                Data = new CommandsData()
                {
                    Commands = new List <Command>()
                    {
                        new Command {
                            Route = "api/ping", Method = "GET", Description = "Ping the Api"
                        },
                        new Command {
                            Route = "api/commands", Method = "GET", Description = "Returns a list of available commands"
                        },
                        new Command {
                            Route = "api/crypto/listing", Method = "GET", Description = "Get crypto listing.", Parameters = "{symbol}"
                        },
                    }
                },
                Message    = "List of available commands",
                Method     = "commands",
                StatusCode = 200,
            }, HttpContext);

            return(new JsonResult(commansResponse));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Runs the specified package path.
        /// </summary>
        /// <param name="client">The client.</param>
        /// <param name="commands">The commands.</param>
        /// <returns></returns>
        public static async Task <NameValueCollection> Run(IHttpClient client, CommandsResponse commands)
        {
            var details = new InstallationConflictDetails(client, commands);

            await Pipeline.Run(PipelineNames.InstallationConflicts, details);

            var result = new NameValueCollection();

            if (!string.IsNullOrEmpty(details.Result))
            {
                result.Add("__RESULT", details.Result);
                result.Add("__PIPELINE", details.RemotePipelineId);
            }

            return(result);
        }
Ejemplo n.º 3
0
        public CommandsResponse ProcessRequest(string Action, Dictionary <string, dynamic> Parameters)
        {
            CommandsResponse resp = new CommandsResponse();

            resp.ids.Add(_id);
            try
            {
                using Client client = new Client("10.10.10.31", 23, new System.Threading.CancellationToken());
                resp.states         = _commands[_id][Action](client, Parameters);
                resp.status         = "SUCCESS";
            }catch (Exception ex)
            {
                resp.status    = "ERROR";
                resp.errorCode = "hardError";
            }

            return(resp);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="InstallationConflictDetails"/> class.
 /// </summary>
 /// <param name="client">The client.</param>
 /// <param name="commandsResponse">The commands response.</param>
 public InstallationConflictDetails(IHttpClient client, CommandsResponse commandsResponse)
 {
     this.Client           = client;
     this.CommandsResponse = commandsResponse;
 }