Пример #1
0
        public bool IsValid(CommandInput input)
        {
            EnvironmentType envType;

            return input.HasArgument("name") && input.HasArgument("type") && input.HasArgument("sid")
                   && Enum.TryParse(input["type"], out environmentType);
        }
Пример #2
0
        public CommandOutput OnExecute(CommandInput arguments)
        {
            var output = new CommandOutput {PostAction = CommandOutput.PostCommandAction.None};

            var name = arguments["name"];

            long userId = arguments.GetUserId();

            if (string.IsNullOrEmpty(name))
            {
                output.DisplayMessage = "Suite Name missing";
                output.PostAction = CommandOutput.PostCommandAction.ShowCommandHelp;
                output.MessageType = CommandOutput.DisplayMessageType.Error;
            }
            else
            {
                var keys = EncryptionEngine.Default.CreateKeys();
                var model = new SuiteCreateModel
                {
                    SuiteName = name,
                    SuiteType = SuiteTypes.PersonalWithMultiEnvironment,
                    PrivateKey = keys.Item1,
                    UsesSysEncryption = true,
                    PublicKey = keys.Item2,
                    UserId = userId
                };

                model.Environments.Add(new EnvironmentModel
                {
                    EnvironmentName = "*",
                    EnvironmentType = EnvironmentType.PROD
                });

                model.Applications.Add(new ApplicationModel
                {
                    ApplicationName = "*",
                    Description = "All Applications in Suite " + name
                });

                model.Regions.Add(new RegionModel
                {
                    RegionName = "*",
                    Description = "All Regions in Suite " + name
                });

                model.Servers.Add(new ServerModel
                {
                    ServerName = "*",
                    Description = "All Servers in Suite " + name
                });

                var suite = CurrentHostContext.Default.Provider.ConfigurationStore.AddSuite(model);
                output.Data = suite;
                output.DisplayMessage = "Success";

                output.PostAction = CommandOutput.PostCommandAction.None;
            }

            return output;
        }
Пример #3
0
        public bool IsValid(CommandInput input)
        {
            if (input.HasArgument("record"))
            {
                model = input["record"].FromJsonToObject<AuditRecordModel>();
                return model != null;
            }
            AuditArea auditArea = AuditArea.Suite;
            AuditReason auditReason = AuditReason.Retrieved;
            bool valid = Enum.TryParse(input["a"], out auditArea)
                         && input.HasArgument("akey")
                         && input.HasArgument("m")
                         && Enum.TryParse(input["r"], out auditReason);

            if (valid)
            {
                model = new AuditRecordModel
                {
                    Area = auditArea,
                    Key = input["akey"],
                    Message = input["m"],
                    Reason = auditReason
                };
            }

            return valid;
        }
Пример #4
0
        public CommandOutput OnExecute(CommandInput arguments)
        {
            var output = new CommandOutput {PostAction = CommandOutput.PostCommandAction.None};
            long parameterId = long.Parse(arguments["pid"]);
            long suiteId = long.Parse(arguments["sid"]);
            long serverId = -1, appId = -1, regionId = -1, environmentId = -1;
            long userId = arguments.GetUserId();

            var suite = CurrentHostContext.Default.Provider.ConfigurationStore.GetSuite(userId, suiteId);
            var parameter = CurrentHostContext.Default.Provider.ConfigurationStore.GetParameter(userId, parameterId);
            if (parameter.SuiteId != suite.SuiteId)
            {
                output.DisplayMessage = "No such parameter id (pid) exists for suite id:" + suite.SuiteId;
                output.MessageType = CommandOutput.DisplayMessageType.Error;
                return output;
            }

            if (!long.TryParse(arguments["srid"], out serverId) && suite.Servers.Any(x => x.ServerName == "*"))
                serverId = suite.Servers.First(x => x.ServerName == "*").ServerId.GetValueOrDefault();

            if (!long.TryParse(arguments["aid"], out appId) && suite.Applications.Any(x => x.ApplicationName == "*"))
                appId = suite.Applications.First(x => x.ApplicationName == "*").ApplicationId.GetValueOrDefault();

            if (!long.TryParse(arguments["rid"], out regionId) && suite.Regions.Any(x => x.RegionName == "*"))
                regionId = suite.Regions.First(x => x.RegionName == "*").RegionId.GetValueOrDefault();

            if (!long.TryParse(arguments["eid"], out environmentId) &&
                suite.Environments.Any(x => x.EnvironmentName == "*" && x.EnvironmentType == EnvironmentType.PROD))
                environmentId =
                    suite.Environments.First(x => x.EnvironmentName == "*" && x.EnvironmentType == EnvironmentType.PROD)
                        .EnvironmentId.GetValueOrDefault();

            if (serverId == 0 || appId == 0 || regionId == 0 || environmentId == 0)
            {
                output.DisplayMessage = "Invalid Map Parameters. Please try providing optional fields";
                output.MessageType = CommandOutput.DisplayMessageType.Error;
                output.PostAction = CommandOutput.PostCommandAction.ShowCommandHelp;

                return output;
            }

            var model = new MappingModel
            {
                ApplicationId = appId,
                EnvironmentId = environmentId,
                ParameterId = parameterId,
                RegionId = regionId,
                ServerId = serverId,
                SuiteId = suiteId,
                UserId = userId
            };

            MappingModel mapping = CurrentHostContext.Default.Provider.ConfigurationStore.AddMapping(model);

            output.Data = mapping;
            output.DisplayMessage = "Success";

            return output;
        }
Пример #5
0
        public CommandOutput OnExecute(CommandInput arguments)
        {
            var output = new CommandOutput {PostAction = CommandOutput.PostCommandAction.None};
            long suiteId = -1;
            long userId = arguments.GetUserId();
            long.TryParse(arguments["sid"], out suiteId);
            var name = arguments["name"];

            List<ParameterModel> listOfParams = new List<ParameterModel>();

            if (suiteId != -1)
            {
                listOfParams = CurrentHostContext.Default.Provider.ConfigurationStore.GetParametersLike(userId, suiteId,
                    name);
            }
            else
            {
                output.DisplayMessage = "No such suite id exists: " + suiteId;
                output.PostAction = CommandOutput.PostCommandAction.ShowCommandHelp;
                output.MessageType = CommandOutput.DisplayMessageType.Error;
            }

            if (listOfParams.Count > 0)
            {
                var pk = arguments["pk"];
                if (pk != null)
                {
                    var suite = CurrentHostContext.Default.Provider.ConfigurationStore.GetSuite(userId, suiteId);

                    if (suite.PublicKey.Equals(pk, StringComparison.InvariantCulture))
                    {
                        listOfParams.ForEach(
                            x =>
                            {
                                x.ParameterValue = EncryptionEngine.Default.Decrypt(x.ParameterValue, suite.PrivateKey,
                                    null);
                            });
                    }
                    else
                    {
                        output.DisplayMessage = "Invalid combination of Private / Public Key to decrypt ParameterValue";
                        output.MessageType = CommandOutput.DisplayMessageType.Error;

                        return output;
                    }
                }
                output.Data = listOfParams;
                output.DisplayMessage = "Success";
            }
            else
            {
                output.DisplayMessage = DoesNotExist;
                output.MessageType = CommandOutput.DisplayMessageType.Error;
            }

            return output;
        }
Пример #6
0
        public CommandOutput OnExecute(CommandInput arguments)
        {
            var output = new CommandOutput {PostAction = CommandOutput.PostCommandAction.None};
            var listOfSuites = CurrentHostContext.Default.Provider.ConfigurationStore.GetSuites(arguments.GetUserId());

            output.Data = listOfSuites;
            output.DisplayMessage = "Success";

            return output;
        }
Пример #7
0
 public AuditRecordModel GetAuditCommand(CommandInput input)
 {
     return new AuditRecordModel
     {
         Area = AuditArea.Mapping,
         Reason = AuditReason.Removed,
         Message = input.Command,
         Key = input["mid"],
         UserId = input.GetUserId()
     };
 }
Пример #8
0
 public CommandOutput OnExecute(CommandInput arguments)
 {
     var authOutput = CurrentHostContext.Default.GetUsers();
     var output = new CommandOutput
     {
         PostAction = CommandOutput.PostCommandAction.None,
         Data = authOutput,
         DisplayMessage = "Success"
     };
     return output;
 }
Пример #9
0
 public AuditRecordModel GetAuditCommand(CommandInput input)
 {
     return new AuditRecordModel
     {
         Area = AuditArea.Region,
         Reason = AuditReason.Retrieved,
         Message = input.Command,
         Key = input["sid"],
         UserId = input.GetUserId()
     };
 }
Пример #10
0
        public CommandOutput OnExecute(CommandInput arguments)
        {
            var output = new CommandOutput {PostAction = CommandOutput.PostCommandAction.None};
            var regionId = long.Parse(arguments["rid"]);
            long userId = arguments.GetUserId();
            var success = CurrentHostContext.Default.Provider.ConfigurationStore.DeleteRegion(userId, regionId);

            output.DisplayMessage = success ? "Region deleted successfully!" : "Could not delete Region";

            return output;
        }
Пример #11
0
 public AuditRecordModel GetAuditCommand(CommandInput input)
 {
     return new AuditRecordModel
     {
         Area = AuditArea.User,
         Reason = AuditReason.Changed,
         Message = input.Command,
         Key = input["user"],
         UserId = input.GetUserId()
     };
 }
Пример #12
0
 public AuditRecordModel GetAuditCommand(CommandInput input)
 {
     return new AuditRecordModel
     {
         Area = AuditArea.Application,
         Reason = AuditReason.Added,
         Message = input.Command,
         Key = input["name"],
         UserId = input.GetUserId()
     };
 }
Пример #13
0
        public CommandOutput OnExecute(CommandInput arguments)
        {
            model.UserId = arguments.GetUserId();
            if (model.Key == null)
                model.Key = "<Unknown>";
            CurrentHostContext.Default.Provider.ConfigurationStore.AddAuditRecord(model);

            return new CommandOutput
            {
                PostAction = CommandOutput.PostCommandAction.None
            };
        }
Пример #14
0
        public CommandOutput OnExecute(CommandInput arguments)
        {
            var output = new CommandOutput {PostAction = CommandOutput.PostCommandAction.None};
            long suiteId = -1;
            long userId = arguments.GetUserId();
            long.TryParse(arguments["sid"], out suiteId);
            var model = CurrentHostContext.Default.Provider.ConfigurationStore.GetRegions(userId, suiteId);

            output.Data = model;
            output.DisplayMessage = "Success";
            return output;
        }
Пример #15
0
        public CommandOutput OnExecute(CommandInput arguments)
        {
            var output = new CommandOutput {PostAction = CommandOutput.PostCommandAction.None};
            long suiteId = long.Parse(arguments["sid"]);
            long userId = arguments.GetUserId();
            List<MappingModel> listOfMaps = CurrentHostContext.Default.Provider.ConfigurationStore.GetMapping(userId,
                suiteId);
            output.Data = listOfMaps;
            output.DisplayMessage = "Success";

            return output;
        }
Пример #16
0
        public CommandOutput OnExecute(CommandInput arguments)
        {
            var output = new CommandOutput {PostAction = CommandOutput.PostCommandAction.None};
            var suiteId = long.Parse(arguments["sid"]);
            long userId = arguments.GetUserId();
            var success = CurrentHostContext.Default.Provider.ConfigurationStore.DeleteSuite(new SuiteModel
            {
                UserId = userId,
                SuiteId = suiteId
            });

            output.DisplayMessage = success ? "Suite deleted successfully!" : "Could not delete suite";

            return output;
        }
Пример #17
0
        public CommandOutput OnExecute(CommandInput arguments)
        {
            var output = new CommandOutput {PostAction = CommandOutput.PostCommandAction.None};
            long suiteId = long.Parse(arguments["sid"]);
            string username = arguments["user"];
            long loggedInUserId = arguments.GetUserId();

            bool success = CurrentHostContext.Default.Provider.ConfigurationStore.RevokeRoleAccessToSuite(suiteId,
                loggedInUserId, username);
            output.Data = success;
            output.DisplayMessage = success
                ? "Grants revoked successfully"
                : "Some problem occured while revoking rights from user";

            return output;
        }
Пример #18
0
        public CommandOutput OnExecute(CommandInput arguments)
        {
            var output = new CommandOutput {PostAction = CommandOutput.PostCommandAction.None};
            long suiteId = long.Parse(arguments["sid"]);
            string username = arguments["user"];
            long loggedInUserId = arguments.GetUserId();
            RoleType role = arguments.HasArgument("role") ? arguments["role"].ToEnum<RoleType>() : RoleType.ReadOnly;
            bool success = CurrentHostContext.Default.Provider.ConfigurationStore.GrantRoleAccessToSuite(suiteId,
                loggedInUserId,
                username, role);

            output.Data = success;
            output.DisplayMessage = success
                ? "Grants added successfully"
                : "Some problem occured while granting rights to user";
            return output;
        }
Пример #19
0
        public CommandOutput OnExecute(CommandInput arguments)
        {
            var output = new CommandOutput {PostAction = CommandOutput.PostCommandAction.None};
            var name = arguments["name"];
            long suiteId = long.Parse(arguments["sid"]);
            long userId = arguments.GetUserId();
            var region = CurrentHostContext.Default.Provider.ConfigurationStore.AddRegion(new RegionModel
            {
                RegionName = name,
                IsActive = true,
                SuiteId = suiteId,
                UserId = userId
            });

            output.Data = region;
            output.DisplayMessage = "Success";

            return output;
        }
Пример #20
0
        public CommandOutput OnExecute(CommandInput arguments)
        {
            var output = new CommandOutput {PostAction = CommandOutput.PostCommandAction.None};
            bool completed = false;
            long userId = arguments.GetUserId();
            ApplicationModel model = default(ApplicationModel);

            if (arguments["name"] != null)
            {
                model = CurrentHostContext.Default.Provider.ConfigurationStore.GetApplication(userId, arguments["name"]);
                completed = true;
            }
            else if (arguments["id"] != null)
            {
                long appId = -1;
                long.TryParse(arguments["id"], out appId);

                if (appId != -1)
                {
                    model = CurrentHostContext.Default.Provider.ConfigurationStore.GetApplication(userId, appId);
                    completed = true;
                }
            }

            if (!completed)
            {
                output.DisplayMessage = "Invalid data in command received";
                output.PostAction = CommandOutput.PostCommandAction.ShowCommandHelp;
                output.MessageType = CommandOutput.DisplayMessageType.Error;
            }
            else if (model != null)
            {
                output.Data = model;
                output.DisplayMessage = "Success";
            }
            else
            {
                output.DisplayMessage = DoesNotExist;
                output.MessageType = CommandOutput.DisplayMessageType.Error;
            }

            return output;
        }
Пример #21
0
        public CommandOutput OnExecute(CommandInput arguments)
        {
            var output = new CommandOutput
            {
                PostAction = CommandOutput.PostCommandAction.None,
                DisplayMessage = "Success"
            };

            bool active = true, autoLoad = true;
            if (arguments.HasArgument("active"))
                bool.TryParse(arguments["active"], out active);

            if (arguments.HasArgument("autoLoad"))
                bool.TryParse(arguments["autoLoad"], out autoLoad);

            output.Data = CurrentHostContext.Default.Provider.ConfigurationStore.GetSettings(active, autoLoad);

            return output;
        }
Пример #22
0
        public CommandOutput OnExecute(CommandInput arguments)
        {
            var commandFactory = CurrentHostContext.Default.CommandFactory;
            var commands = commandFactory.Commands.OrderBy(x => x.Keyword);
            var output = new CommandOutput();
            var builder = new StringBuilder();

            builder.AppendLine("Usage: <command>");
            builder.AppendLine();
            builder.AppendLine("Commands:");
            builder.AppendLine();

            foreach (var command in commands)
            {
                builder.AppendLine(String.Format("{0,-15}\t{1}", command.Keyword, command.Help));
            }

            output.DisplayMessage = builder.ToString();

            return output;
        }
Пример #23
0
        public CommandOutput OnExecute(CommandInput arguments)
        {
            var output = new CommandOutput {PostAction = CommandOutput.PostCommandAction.None};
            var name = arguments["name"];
            long suiteId = long.Parse(arguments["sid"]);
            var value = arguments["val"];
            var isEncrypted = arguments.HasArgument("protect");
            long userId = arguments.GetUserId();
            if (isEncrypted)
            {
                var suite = CurrentHostContext.Default.Provider.ConfigurationStore.GetSuite(userId, suiteId);
                if (suite != null)
                {
                    value = EncryptionEngine.Default.Encrypt(value, suite.PublicKey, null);
                }
                else
                {
                    output.DisplayMessage = "Could not retrieve suite :" + suiteId;
                    output.MessageType = CommandOutput.DisplayMessageType.Error;
                    output.PostAction = CommandOutput.PostCommandAction.ShowCommandHelp;

                    return output;
                }
            }

            var parameter = CurrentHostContext.Default.Provider.ConfigurationStore.AddParameter(new ParameterModel
            {
                ParameterName = name,
                ParameterValue = string.IsNullOrEmpty(value) ? string.Empty : value,
                IsActive = true,
                IsEncrypted = isEncrypted,
                SuiteId = suiteId,
                UserId = userId
            });

            output.Data = parameter;
            output.DisplayMessage = "Success";

            return output;
        }
Пример #24
0
        public CommandOutput OnExecute(CommandInput arguments)
        {
            var output = new CommandOutput();
            var username = arguments["name"];
            var password = arguments["pwd"];
            var confirmPassword = arguments["cpwd"];
            bool runSilent = arguments.HasArgument("silent");

            if (!password.Equals(confirmPassword))
            {
                output.DisplayMessage = "Password and Confirm Password do not match";
                output.PostAction = CommandOutput.PostCommandAction.ShowCommandHelp;
                return output;
            }
            try
            {
                RegisterModel model = CurrentHostContext.Default.Provider.ConfigurationStore.AddUser(username, password,
                    username.GetRandom());

                output.DisplayMessage = "User Added";
                output.Data = model;
                output.PostAction = CommandOutput.PostCommandAction.None;
            }
            catch (UserAlreadyExistsException ex)
            {
                if (!runSilent)
                {
                    output.DisplayMessage = ex.Message;
                }
                output.PostAction = CommandOutput.PostCommandAction.None;
            }
            catch
            {
                throw;
            }

            return output;
        }
Пример #25
0
        public CommandOutput OnExecute(CommandInput arguments)
        {
            var username = arguments["name"];
            var password = arguments["pwd"];
            DateTime nowUtc = DateTime.UtcNow;
            int uniqueTime = (nowUtc.Day*10) + (nowUtc.Month*100) + ((nowUtc.Year%100)*1000);

            string token =
                EncryptionEngine.Get<SHA256Encryption>()
                    .Encrypt(String.Format("{0}{1}{2}", uniqueTime, username, password), null, null);

            // Authenticate in DB
            AuthenticationModel authInfo =
                CurrentHostContext.Default.Provider.ConfigurationStore.GetAuthenticatedInfo(username, password, token);

            if (!CurrentHostContext.Default.UserTokens.Contains(token))
                CurrentHostContext.Default.UserTokens.Add(token);

            var authenticationOutput = CurrentContext.Default.Cache.Get(token,
                () => new AuthenticationOutput
                {
                    Token = token,
                    Username = username,
                    IsAuthenticated = authInfo.IsAuthenticated,
                    UserId = authInfo.UserId,
                    ExpireUtc = DateTime.MaxValue
                }, CachePolicy.AlwaysLive);

            var output = new CommandOutput
            {
                PostAction = CommandOutput.PostCommandAction.None,
                Data = authenticationOutput,
                DisplayMessage = "Success"
            };
            return output;
        }
Пример #26
0
        internal CommandOutput ExecuteCommand(ServiceRequestContext context)
        {
            var userTokenFromCache = CurrentHostContext.Default.Cache.Get<AuthenticationOutput>(context.Token);

            CommandOutput commandOutput = null;
            try
            {
                var input = new CommandInput(new CommandArgs(context.Command));
                input.Add("Request.SessionId", context.SessionId);
                if (input.Keyword == null)
                    throw new InvalidDataException("Could not parse the command");

                var firstKeyword = input.Keyword.ToLower();
                if (_commandFactory.Commands.Any(x => IsCommand(firstKeyword, x, userTokenFromCache)))
                {
                    var commandObject =
                        _commandFactory.Commands.FirstOrDefault(x => IsCommand(firstKeyword, x, userTokenFromCache));

                    if (userTokenFromCache != null) // enrich with UserId
                        input.AssociateUserId(userTokenFromCache.UserId.GetValueOrDefault(-1));

                    if (RequiresCaching(commandObject))
                    {
                        // cache it
                        commandOutput = CurrentHostContext.Default.Cache.Get(context.Command, () =>
                            ExecuteCommandInternal(input, commandObject));
                    }
                    else
                    {
                        commandOutput = ExecuteCommandInternal(input, commandObject);
                    }

                    AuditExecution(userTokenFromCache, input, commandObject);

                    // Execute all subcommands
                    commandOutput.SubCommands.ForEach(x => ExecuteCommand(new ServiceRequestContext
                    {
                        Command = x,
                        SessionId = context.SessionId,
                        Token = context.Token
                    }));
                }
                else
                {
                    commandOutput = _helpCommand.OnExecute(input);
                }
            }
            catch (DbEntityValidationException e)
            {
                var builder = new StringBuilder();

                foreach (var eve in e.EntityValidationErrors)
                {
                    builder.AppendFormat("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:",
                        eve.Entry.Entity.GetType().Name, eve.Entry.State).AppendLine();
                    foreach (var ve in eve.ValidationErrors)
                    {
                        builder.AppendFormat("- Property: \"{0}\", Error: \"{1}\"",
                            ve.PropertyName, ve.ErrorMessage).AppendLine();
                    }
                }

                CurrentHostContext.Default.Log.Error(builder.ToString());
                commandOutput = new CommandOutput
                {
                    MessageType = CommandOutput.DisplayMessageType.Error,
                    DisplayMessage = "Errors: " + builder
                };
            }
            catch (Exception ex)
            {
                CurrentHostContext.Default.Log.Error(ex.GetDetails());
                commandOutput = new CommandOutput
                {
                    MessageType = CommandOutput.DisplayMessageType.Error,
                    DisplayMessage = "Errors: " + ex.GetDetails()
                };
            }

            return commandOutput;
        }
Пример #27
0
        private CommandOutput ExecuteCommandInternal(CommandInput input, ICommand commandObject)
        {
            CommandOutput commandOutput = null;
            bool executed = false;
            if (commandObject != null)
            {
                if (commandObject.IsValid(input))
                {
                    commandOutput = commandObject.OnExecute(input);
                    executed = true;
                }

                if (!executed)
                {
                    commandOutput = new CommandOutput
                    {
                        PostAction = CommandOutput.PostCommandAction.ShowCommandHelp,
                        DisplayMessage = "One or more parameters were not passed correctly",
                        MessageType = CommandOutput.DisplayMessageType.Error
                    };
                }

                if (commandOutput != null && commandOutput.PostAction == CommandOutput.PostCommandAction.ShowCommandHelp)
                {
                    commandOutput.DisplayMessage += Environment.NewLine
                                                    + "\tUsage:"
                                                    + String.Format("\t{0}", commandObject.Command)
                                                    + Environment.NewLine
                                                    + "\tHelp:"
                                                    + Environment.NewLine
                                                    + Environment.NewLine
                                                    + String.Format("\t{0}", commandObject.Help);
                }
            }

            return commandOutput;
        }
Пример #28
0
        private void AuditExecution(IAuthenticationOutput userTokenFromCache,
            CommandInput input, ICommand commandObject)
        {
            // Audit an AUTH Command
            if (CurrentHostContext.Default.Audit.Enabled)
            {
                var authCommand = commandObject as IAuditCommand;
                if (authCommand != null)
                {
                    var auditRecord = authCommand.GetAuditCommand(input);

                    if (auditRecord != null)
                    {
                        Task.Factory.StartNew(() =>
                        {
                            var auditInput = new CommandInput(new CommandArgs("AddAudit"));
                            auditInput.Add("record", auditRecord.ToJson());

                            if (userTokenFromCache != null) // enrich with UserId
                                auditInput.AssociateUserId(userTokenFromCache.UserId.GetValueOrDefault(-1));

                            ExecuteCommandInternal(auditInput, _auditCommand);
                        })
                            .ContinueWith(task =>
                                CurrentHostContext.Default.Log.ErrorFormat("Error adding audit record {0}",
                                    task.Exception.GetDetails()), TaskContinuationOptions.OnlyOnFaulted);
                    }
                }
            }
        }
Пример #29
0
 public bool IsValid(CommandInput input)
 {
     return input.HasArgument("name") || input.HasArgument("id");
 }
Пример #30
0
 public AuditRecordModel GetAuditCommand(CommandInput input)
 {
     return new AuditRecordModel
     {
         Area = AuditArea.Server,
         Reason = AuditReason.Retrieved,
         Message = input.Command,
         Key = input.HasArgument("name") ? input["name"] : input["id"],
         UserId = input.GetUserId()
     };
 }