コード例 #1
0
 public override void InitializeArguments(IArgsManager argsManager)
 {
     Arguments.AddRange(CommonArguments.Create("AwesomeLogger", "5501"));
     Arguments.AddRange(new List <Argument>
     {
         new Argument
         {
             Name         = Constants.File,
             ShortName    = "f",
             Description  = "The log file.",
             Example      = "{name}=c:\\logs\\log.txt",
             DefaultValue = Assembly.GetExecutingAssembly().Location + ".log",
             Action       = (value) => { Console.WriteLine(value); }
         },
         new Argument
         {
             Name          = Constants.AlsoLogOnConsole,
             ShortName     = "c",
             Description   = "This will log to both a file and the console window.",
             Example       = "{name}=true",
             DefaultValue  = "true",
             AllowedValues = CommonAllowedValues.TrueFalse,
             Action        = (value) => { Console.WriteLine(value); }
         },
         new ConfigFileArgument(argsManager) // This is a special Argument type to allow for args in a file
     });
     Arguments.RemoveAt(3);                  // Remove common logger endpoint as this is logger
 }
コード例 #2
0
 public override void InitializeArguments(IArgsManager argsManager)
 {
     Arguments.AddRange(CommonArguments.Create("HealthDistrict", "5552"));
     Arguments.AddRange(new List <Argument>
     {
         new Argument
         {
             Name         = Constants.PublisherEndpoints,
             ShortName    = "p",
             Description  = "A comma separated array of endpoints for the publishers.",
             Example      = "{name}=tcp://127.0.0.1:5553,tcp://127.0.0.1:5554",
             DefaultValue = "tcp://127.0.0.1:5553,tcp://127.0.0.1:5554",
             Action       = (value) => { Console.WriteLine(value); }
         }
     });
 }
コード例 #3
0
 public override void InitializeArguments(IArgsManager argsManager)
 {
     Arguments.AddRange(CommonArguments.Create("NameServer", "6001"));
     Arguments.AddRange(new List <Argument>
     {
         // Add more args here
         new Argument
         {
             Name          = "UseLocalHost",
             ShortName     = "ulh",
             Description   = "Use localhost, 127.0.0.1 for all registrations.",
             Example       = "{name}=true",
             DefaultValue  = "false",
             AllowedValues = CommonAllowedValues.TrueFalse
         },
         new ConfigFileArgument(argsManager) // This is a special Argument type to allow for args in a file
     });
     Arguments.RemoveAt(2);                  // Remove common NameServer endpoint from comon as this is Name Server, so Enpoint is used.
 }
コード例 #4
0
 public override void InitializeArguments(IArgsManager argsManager)
 {
     Arguments.AddRange(CommonArguments.Create("OutbreakAnalyzer", "5555"));
     Arguments.AddRange(new List <Argument>
     {
         new Argument
         {
             Name         = Constants.PublisherName,
             ShortName    = "pn",
             Description  = "The name of the publisher server.",
             Example      = "{name}=Publisher1",
             DefaultValue = "Publisher1",
             Action       = (value) => { Console.WriteLine(value); }
         },
         new Argument
         {
             Name         = Constants.PublisherEndpoint,
             ShortName    = "p",
             Description  = "The endpoint for the server service.",
             Example      = "{name}=tcp://127.0.0.1:5556",
             DefaultValue = "tcp://127.0.0.1:5556",
             Action       = (value) => { Console.WriteLine(value); }
         },
         new Argument
         {
             Name         = Constants.Disease,
             ShortName    = "d",
             Description  = "The disease this service analyzes.",
             DefaultValue = "Influenza",
             Example      = "{name}=Influenza"
         },
         new Argument
         {
             Name         = Constants.Threshold,
             ShortName    = "t",
             Description  = "The number of diseases per day that indicate an outbreak.",
             DefaultValue = "200",
             Example      = "{name}=200"
         }
     });
 }
コード例 #5
0
 public override void InitializeArguments(IArgsManager argsManager)
 {
     Arguments.AddRange(CommonArguments.Create("Simulator", "5552"));
     Arguments.AddRange(new List <Argument>
     {
         new Argument
         {
             Name             = Constants.TimeMultiplier,
             ShortName        = "t",
             Description      = "This is how long 1 second simulates. For example: 3600 simulates 1 hour every second.",
             DefaultValue     = "3600",
             Example          = "{name}=3600",
             CustomValidation = (val) =>
             {
                 return(Regex.IsMatch(val, CommonAllowedValues.Digits));
             }
         },
         new Argument
         {
             Name             = Constants.Duration,
             ShortName        = "u",
             Description      = "The length of time in days the simulation runs. Max time simulation is 9999 days.",
             DefaultValue     = "31",
             Example          = "{name}=31",
             CustomValidation = (val) =>
             {
                 return(Regex.IsMatch(val, "[1-9][0-9]{0,4}"));
             }
         },
         new Argument
         {
             Name             = Constants.Year,
             ShortName        = "y",
             Description      = "The year the simulation starts.",
             DefaultValue     = "2018",
             Example          = "{name}=2018",
             CustomValidation = (val) =>
             {
                 return(Regex.IsMatch(val, "[1-9][0-9]{3}"));
             }
         },
         new Argument
         {
             Name             = Constants.Month,
             ShortName        = "m",
             Description      = "The month the simulation starts.",
             DefaultValue     = "01",
             Example          = "{name}=01",
             CustomValidation = (val) =>
             {
                 return(Regex.IsMatch(val, "[0]?[1-9]|[1][0-2]"));
             }
         },
         new Argument
         {
             Name             = Constants.Day,
             ShortName        = "d",
             Description      = "The day the simulation starts.",
             DefaultValue     = "01",
             Example          = "{name}=01",
             CustomValidation = (val) =>
             {
                 return(Regex.IsMatch(val, "[0]?[1-9]|[1-2][0-9]|[3][0-1]"));
             }
         },
         new ConfigFileArgument(argsManager)
     });
 }
コード例 #6
0
ファイル: ArgsHandler.cs プロジェクト: rhyous/Aws
 public override void InitializeArguments(IArgsManager argsManager)
 {
     Arguments.AddRange(new List <Argument>
     {
         new Argument
         {
             Name          = "Action",
             ShortName     = "a",
             Description   = "The action to run.",
             Example       = "{name}=default",
             DefaultValue  = "Default",
             AllowedValues = new ObservableCollection <string>(
                 typeof(InstanceManager).GetMethods(BindingFlags.Public | BindingFlags.Static | BindingFlags.DeclaredOnly)
                 .Select(m => m.Name)),
             IsRequired = true,
             Action     = (value) =>
             {
                 Console.WriteLine(value);
             }
         },
         new Argument
         {
             Name        = "KeyName",
             ShortName   = "k",
             Description = "A key pair name.",
             Example     = "{name}=MyKeyPair",
             Action      = (value) =>
             {
                 Console.WriteLine(value);
             }
         },
         new Argument
         {
             Name         = "KeyOutputDirectory",
             ShortName    = "ko",
             Description  = "A key pair output directory. If not path is provided, the key pair will save to the Desktop by default.",
             Example      = "{name}=c:\\My\\Path",
             DefaultValue = Environment.GetFolderPath(Environment.SpecialFolder.Desktop),
             Action       = (value) =>
             {
                 Console.WriteLine(value);
             }
         },
         new Argument
         {
             Name             = "KeyFile",
             ShortName        = "pem",
             Description      = "The full path to a public key already created on your file system in PEM format. The full Private key won't work.",
             Example          = "{name}=c:\\My\\Path\\mykeyfile.pem",
             CustomValidation = (value) => File.Exists(value),
             Action           = (value) =>
             {
                 Console.WriteLine(value);
             }
         },
         new Argument
         {
             Name          = "ImageId",
             ShortName     = "i",
             Description   = "The operating system image to use. From the ImageUtilities class.",
             Example       = "{name}=WINDOWS_2012_BASE",
             DefaultValue  = "WINDOWS_2012_BASE",
             AllowedValues = new ObservableCollection <string>(ImageUtilities.ImageKeys),
             Action        = (value) =>
             {
                 Console.WriteLine(value);
             }
         },
         new Argument
         {
             Name        = "InstanceId",
             ShortName   = "id",
             Description = "The instance id. Amazon usually creates this for you.",
             Example     = "{name}=i-00f5ce7f5a30e62ac",
             Action      = (value) =>
             {
                 Console.WriteLine(value);
             }
         },
         new Argument
         {
             Name         = "InstanceName",
             ShortName    = "n",
             Description  = "The instance name to use.",
             Example      = "{name}=MyServer1",
             DefaultValue = "",
             Action       = (value) =>
             {
                 Console.WriteLine(value);
             }
         },
         new Argument
         {
             Name         = "InstanceFqdn",
             ShortName    = "fwdn",
             Description  = "The instance fqdn to use.",
             Example      = "{name}=MyServer1.domain.tld",
             DefaultValue = "",
             Action       = (value) =>
             {
                 Console.WriteLine(value);
             }
         },
         new Argument
         {
             Name         = "username",
             ShortName    = "u",
             Description  = "The user name to login with.",
             Example      = "{name}=Adminstrator",
             DefaultValue = "Administrator",
             Action       = (value) =>
             {
                 Console.WriteLine(value);
             }
         },
         new Argument
         {
             Name         = "password",
             ShortName    = "p",
             Description  = "The password to login with.",
             Example      = "{name}=p@ssw0rd!",
             DefaultValue = "",
             Action       = (value) =>
             {
                 Console.WriteLine(value);
             }
         },
         new Argument
         {
             Name        = "File",
             ShortName   = "f",
             Description = "A file.",
             Example     = "{name}=c:\\my\\file.txt",
             Action      = (value) =>
             {
                 Console.WriteLine(value);
             }
         },
         new Argument
         {
             Name             = "Port",
             ShortName        = "po",
             Description      = "The port to open.",
             Example          = "{name}=22",
             CustomValidation = (value) =>
             {
                 return(Regex.IsMatch(value, CommonAllowedValues.Digits));
             },
             Action = (value) =>
             {
                 Console.WriteLine(value);
             }
         },
         new Argument
         {
             Name         = "Protocol",
             ShortName    = "pro",
             Description  = "The Protocol, such as tcp or udp.",
             Example      = "{name}=tcp",
             DefaultValue = "tcp",
             Action       = (value) =>
             {
                 Console.WriteLine(value);
             }
         },
         new Argument
         {
             Name         = "SecurityGroupName",
             ShortName    = "sgn",
             Description  = "The Security Group Name.",
             Example      = "{name}=MySecurityGroup",
             DefaultValue = "Default",
             Action       = (value) =>
             {
                 Console.WriteLine(value);
             }
         },
     });
 }
コード例 #7
0
 public override void InitializeArguments(IArgsManager argsManager)
 {
     Arguments.AddRange(new List <Argument>
     {
         new Argument
         {
             Name        = Name,
             ShortName   = "n",
             Description = "The worker name or if no name provided, the endpoint.",
             Example     = @"{name}=Worker1",
             Action      = (value) => { Console.WriteLine(value); }
         },
         new Argument
         {
             Name        = PrimaryDirectory,
             ShortName   = "d",
             Description = "The folder",
             Example     = @"{name}=c:\path\to\PrimaryDirectory",
             IsRequired  = true,
             Action      = (value) => { Console.WriteLine(value); }
         },
         new Argument
         {
             Name             = IpAddress,
             ShortName        = "ip",
             Description      = "This worker's Ip Address",
             Example          = @"{name}=10.1.1.2",
             IsRequired       = true,
             CustomValidation = (value) =>
             {
                 return(Regex.IsMatch(value, Models.IpAddress.NaiveRegexPattern));
             },
             Action = (value) => { Console.WriteLine(value); }
         },
         new Argument
         {
             Name             = Port,
             ShortName        = "p",
             Description      = "This worker's Ip Address",
             Example          = @"{name}=2700",
             DefaultValue     = "2700",
             CustomValidation = (value) => Regex.IsMatch(value, CommonAllowedValues.Digits),
             Action           = (value) => { Console.WriteLine(value); }
         },
         new Argument
         {
             Name          = Repo,
             ShortName     = "r",
             Description   = "The repository for hte folder structer: local filesystem or Amazon S3",
             Example       = @"{name}=Local",
             DefaultValue  = "Local",
             AllowedValues = new ObservableCollection <string> {
                 "Local", "S3"
             },
             Action = (value) => { Console.WriteLine(value); }
         },
         new Argument
         {
             Name        = "AccessKey",
             ShortName   = "ak",
             Description = "The access access key provided to you by Amazon.",
             Example     = "{name}=AKA7PXD3H7MN2AWZSR9", // Fake key I made up,
             IsRequired  = true,
             Action      = (value) =>
             {
                 Console.WriteLine(value);
             }
         },
         new Argument
         {
             Name        = "SecretKey",
             ShortName   = "sk",
             Description = "The secret access key provided to you by Amazon.",
             Example     = "{name}=RvOxT8JLRL8P57oEvJYfqVr0YcoQb7Xo0CN2YcBvL", // Fake key I made up
             IsRequired  = true,
             Action      = (value) =>
             {
                 Console.WriteLine(value);
             }
         },
         new Argument
         {
             Name         = "Bucket",
             ShortName    = "b",
             Description  = "The bucket to use.",
             Example      = "{name}=my.first.bucket",
             DefaultValue = "my.first.bucket",
             Action       = (value) =>
             {
                 Console.WriteLine(value);
             }
         },
         new ConfigFileArgument(argsManager) // This is a special Argument type to allow for args in a file
     });
 }
コード例 #8
0
ファイル: ArgsHandler.cs プロジェクト: rhyous/Aws
 public override void InitializeArguments(IArgsManager argsManager)
 {
     Arguments.AddRange(new List <Argument>
     {
         new Argument
         {
             Name          = "Action",
             ShortName     = "a",
             Description   = "The action to run.",
             Example       = "{name}=default",
             DefaultValue  = "Default",
             AllowedValues = new ObservableCollection <string>
             {
                 "CreateBucket",
                 "CreateBucketDirectory",
                 "CreateTextFile",
                 "DeleteBucket",
                 "DeleteBucketDirectory",
                 "ListFiles",
                 "UploadFile",
                 "UploadFiles"
             },
             IsRequired = true,
             Action     = (value) =>
             {
                 Console.WriteLine(value);
             }
         },
         new Argument
         {
             Name             = "Bucket",
             ShortName        = "b",
             Description      = "The bucket name to create. No uppercase or underscores allowed.",
             Example          = "{name}=my.first.bucket",
             DefaultValue     = "my.first.bucket",
             IsRequired       = true,
             CustomValidation = (value) =>
             {
                 return(Regex.IsMatch(value, "^[a-z0-9.]+$"));
             },
             Action = (value) =>
             {
                 Console.WriteLine(value);
             }
         },
         new Argument
         {
             Name             = "File",
             ShortName        = "f",
             Description      = "The file name.",
             Example          = "{name}=c:\\some\file.txt",
             CustomValidation = (value) =>
             {
                 return(File.Exists(value));
             },
             Action = (value) =>
             {
                 Console.WriteLine(value);
             }
         },
         new Argument
         {
             Name             = "Directory",
             ShortName        = "D",
             Description      = "The directory name.",
             Example          = "{name}=MyFolder",
             CustomValidation = (value) =>
             {
                 return(value.All(c => char.IsLetterOrDigit(c)));
             },
             Action = (value) =>
             {
                 Console.WriteLine(value);
             }
         },
         new Argument
         {
             Name        = "FileName",
             ShortName   = "N",
             Description = "The name of text a file to create.",
             Example     = "{name}=MyTextfile.txt",
             Action      = (value) =>
             {
                 Console.WriteLine(value);
             }
         },
         new Argument
         {
             Name        = "Text",
             ShortName   = "T",
             Description = "The text to put in a text file.",
             Example     = "{name}=\"This is some text!\"",
             Action      = (value) =>
             {
                 Console.WriteLine(value);
             }
         },
         new Argument
         {
             Name        = "LocalDirectory",
             ShortName   = "ld",
             Description = "The local directory to copy to S3.",
             Example     = "{name}=C:\\TestDir",
             Action      = (value) =>
             {
                 Console.WriteLine(value);
             }
         },
         new Argument
         {
             Name        = "RemoteDirectory",
             ShortName   = "rd",
             Description = "The remote directory on the S3 Bucket.",
             Example     = "{name}=/My/Remote/Directory",
             Action      = (value) =>
             {
                 Console.WriteLine(value);
             }
         }
     });
 }
コード例 #9
0
 public override void InitializeArguments(IArgsManager argsManager)
 {
     Arguments.AddRange(new List <Argument>
     {
         new Argument
         {
             Name        = "AccessKey",
             ShortName   = "ak",
             Description = "The access access key provided to you by Amazon.",
             Example     = "{name}=AKA7PXD3H7MN2AWZSR9", // Fake key I made up,
             IsRequired  = true,
             Action      = (value) =>
             {
                 Log.Debug(value);
             }
         },
         new Argument
         {
             Name        = "SecretKey",
             ShortName   = "sk",
             Description = "The secret access key provided to you by Amazon.",
             Example     = "{name}=RvOxT8JLRL8P57oEvJYfqVr0YcoQb7Xo0CN2YcBvL", // Fake key I made up
             IsRequired  = true,
             Action      = (value) =>
             {
                 Log.Debug(value);
             }
         },
         new Argument
         {
             Name          = "ImageId",
             ShortName     = "i",
             Description   = "The operating system image to use. From the ImageUtilities class.",
             Example       = "{name}=WINDOWS_2012_BASE",
             DefaultValue  = "WINDOWS_2012_BASE",
             AllowedValues = new ObservableCollection <string>(ImageUtilities.ImageKeys),
             Action        = (value) =>
             {
                 Log.Debug(value);
             }
         },
         new Argument
         {
             Name         = "Bucket",
             ShortName    = "b",
             Description  = "The bucket to use.",
             Example      = "{name}=my.first.bucket",
             DefaultValue = "my.first.bucket",
             Action       = (value) =>
             {
                 Log.Debug(value);
             }
         },
         new Argument
         {
             Name        = "InstanceId",
             ShortName   = "id",
             Description = "The instance id to use.",
             Example     = "{name}=1",
             Action      = (value) =>
             {
                 Log.Debug(value);
             }
         },
         new Argument
         {
             Name         = "InstanceName",
             ShortName    = "n",
             Description  = "The instance name to use.",
             Example      = "{name}=MyServer1",
             DefaultValue = "",
             Action       = (value) =>
             {
                 Log.Debug(value);
             }
         },
         new Argument
         {
             Name         = "Role",
             ShortName    = "R",
             Description  = "The instance role.",
             Example      = "{name}=MyNewRole",
             DefaultValue = "MyNewRole",
             Action       = (value) =>
             {
                 Log.Debug(value);
             }
         },
         new Argument
         {
             Name        = "File",
             ShortName   = "F",
             Description = "A file.",
             Example     = "{name}=C:\\some\\file.txt",
             Action      = (value) =>
             {
                 Log.Debug(value);
             }
         },
         new Argument
         {
             Name        = "KeyName",
             ShortName   = "k",
             Description = "A key pair name.",
             Example     = "{name}=MyKeyPair",
             Action      = (value) =>
             {
                 Log.Debug(value);
             }
         },
         new Argument
         {
             Name        = "KeyPairFile",
             ShortName   = "pem",
             Description = "A key pair file name.",
             Example     = "{name}=MyKeyPair.pem",
             Action      = (value) =>
             {
                 Log.Debug(value);
             }
         },
         new Argument
         {
             Name        = "InstanceProfile",
             ShortName   = "P",
             Description = "The name of the instane profile.",
             Example     = "{name}=Profile1",
             Action      = (value) =>
             {
                 Log.Debug(value);
             }
         },
         new Argument
         {
             Name        = "LocalDirectory",
             ShortName   = "ld",
             Description = "The local directory to copy to S3.",
             Example     = "{name}=C:\\TestDir",
             Action      = (value) =>
             {
                 Log.Debug(value);
             }
         },
         new Argument
         {
             Name        = "RemoteDirectory",
             ShortName   = "rd",
             Description = "The remote directory on the S3 Bucket.",
             Example     = "{name}=/My/Remote/Directory",
             Action      = (value) =>
             {
                 Log.Debug(value);
             }
         },
         new Argument
         {
             Name        = "InstanceDirectory",
             ShortName   = "idir",
             Description = "The directory local to the instance server.",
             Example     = "{name}=C:\\TestDir",
             Action      = (value) =>
             {
                 Log.Debug(value);
             }
         },
         new Argument
         {
             Name             = "LaunchScript",
             ShortName        = "script",
             Description      = "A powershell script to run at instance launch.The local directory to copy to S3.",
             Example          = "{name}=C:\\MyDir\\MyScript.ps1",
             CustomValidation = (value) => File.Exists(value),
             Action           = (value) =>
             {
                 Log.Debug(value);
             }
         },
         new Argument
         {
             Name         = "Region",
             Description  = "The region",
             Example      = "{name}=us-west-2",
             DefaultValue = ConfigurationManager.AppSettings["AWSRegion"],
             Action       = (value) =>
             {
                 Log.Debug(value);
             }
         },
         new Argument
         {
             Name        = "SkipSteps",
             ShortName   = "skip",
             Description = "Steps to skip in a comma separated list.",
             Example     = "{name}=UploadFiles,StartInstance",
             Action      = (value) =>
             {
                 Log.Debug(value);
             }
         }
     });
 }