diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-11-19 01:46:41 +0200 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-11-19 01:46:41 +0200 |
| commit | 466340a97f8a158570f84fc12238101ca9c124ec (patch) | |
| tree | 5400eb9aeeac9571079b4d80fb4eeac5abf103fa /Software/Visual_Studio/DataStore/Tango.DataStore.CLI/Program.cs | |
| parent | cd5006f765c65482033d671095f34453acfc416b (diff) | |
| download | Tango-466340a97f8a158570f84fc12238101ca9c124ec.tar.gz Tango-466340a97f8a158570f84fc12238101ca9c124ec.zip | |
Data store improvements.
Added line number to logs viewer.
Added DataStore Create Write Global permission.
Added FSE application path to "Path" environment variable for dsUtil.
Completed dsUtil.
Diffstat (limited to 'Software/Visual_Studio/DataStore/Tango.DataStore.CLI/Program.cs')
| -rw-r--r-- | Software/Visual_Studio/DataStore/Tango.DataStore.CLI/Program.cs | 66 |
1 files changed, 5 insertions, 61 deletions
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.CLI/Program.cs b/Software/Visual_Studio/DataStore/Tango.DataStore.CLI/Program.cs index db4f54620..85dfbb0bb 100644 --- a/Software/Visual_Studio/DataStore/Tango.DataStore.CLI/Program.cs +++ b/Software/Visual_Studio/DataStore/Tango.DataStore.CLI/Program.cs @@ -19,7 +19,7 @@ namespace Tango.DataStore.CLI { var console = new DataStoreConsole(); - var result = Parser.Default.ParseArguments<GetOptions, PutOptions>(args) + var result = Parser.Default.ParseArguments<GetOptions, PutOptions, LoginConfig>(args) .WithParsed<GetOptions>((options) => { console.Get(options); @@ -28,6 +28,10 @@ namespace Tango.DataStore.CLI { console.Put(options); }) + .WithParsed<LoginConfig>((options) => + { + console.AutoLogin(options); + }) .WithNotParsed((errors) => { @@ -41,64 +45,4 @@ namespace Tango.DataStore.CLI } } } - - public class DataStoreConsole - { - public void Get(GetOptions options) - { - try - { - if (options.MachineSerialNumber != null) - { - Console.WriteLine($"Retrieving data store values for '{options.MachineSerialNumber}'..."); - } - else - { - Console.WriteLine("Retrieving global data store values..."); - } - - var client = CreateClient(options.Email, options.Password, options.Environment); - - var items = client.Get(options.MachineSerialNumber, options.Collection, options.Key).ToList(); - - ConsoleTable table = new ConsoleTable("COLLECTION", "KEY", "DATA TYPE", "STATE", "GLOBAL", "LOCAL"); - - foreach (var item in items) - { - table.AddRow(item.Collection, item.Key, item.DataType, item.Type, item.GlobalValue.ToStringSafe().ToOneLine(), item.LocalValue.ToStringSafe().ToOneLine()); - } - - Console.WriteLine(); - Console.WriteLine("DATA STORE RESULTS:"); - Console.WriteLine(); - - table.Write(); - } - catch (Exception ex) - { - Console.WriteLine(ex.FlattenMessage()); - } - } - - public void Put(PutOptions options) - { - - } - - private DataStoreClient CreateClient(String email, String password, DeploymentSlot slot) - { - String token = String.Empty; - - HttpClient http = new HttpClient(); - DataStoreClient dsClient = new DataStoreClient(slot.ToAddress(), http); - var response = dsClient.Login(new LoginRequest() - { - Email = "roy@twine-s.com", - Password = "1Creativity", - }); - http.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", response.Token); - - return dsClient; - } - } } |
