private static void DisableAllDatasetTests() { Initialize("datacop-prod"); string fileFolder = FolderPath + @"\PROD\DataVC\Monitor"; var filePaths = ReadFile.GetFolderSubPaths(fileFolder, ReadType.File, PathType.Absolute); AzureCosmosDBClient azureCosmosDBClient = new AzureCosmosDBClient("DataCop", "DatasetTest"); foreach (var filePath in filePaths) { var fileContentString = ReadFile.ThirdMethod(filePath); var json = JObject.Parse(fileContentString); var id = json["id"].ToString(); if (id.Equals("01883b87-5b20-40f4-90f2-2ce6cbdfa766")) { var jObjectInCosmosDb = azureCosmosDBClient.FindFirstOrDefaultItemAsync <JObject>($"SELECT * FROM c where c.id = '{id}'").Result; if (jObjectInCosmosDb != null) { jObjectInCosmosDb["status"] = "Disabled"; //jObjectInCosmosDb["testContent"]["isStreamSet"] = true; Console.WriteLine(jObjectInCosmosDb); //azureCosmosDBClient.UpsertDocumentAsync(json).Wait(); } } } }
private static void UpdateCFRDatasetJsonForMergingADLSCosmos() { string cfrFolder = Path.Combine(FolderPath, @"\CFR\Cooked\Datasets"); try { var datasetJsonFiles = ReadFile.GetFolderSubPaths(cfrFolder, ReadType.File, PathType.Absolute); foreach (var filePath in datasetJsonFiles) { UpdateDatasetConnectionInfoForMergingADLSCosmos(filePath); } } catch (Exception e) { Console.WriteLine(e.Message); } }
private static void DisableAllDatasetTest() { string fileFolder = Path.Combine(FolderPath, @"PROD\ConsumerPaidSubscription\Monitors\"); var filePaths = ReadFile.GetFolderSubPaths(fileFolder, ReadType.File, PathType.Absolute); foreach (var filePath in filePaths) { var fileContentString = ReadFile.ThirdMethod(filePath); var json = JsonConvert.DeserializeObject <JObject>(fileContentString, new JsonSerializerSettings { // Default value is DateParseHandling.DateTime DateParseHandling = DateParseHandling.None }); var id = json["id"].ToString(); json["status"] = "Disabled"; WriteFile.FirstMethod(filePath, json.ToString()); Console.WriteLine(id); } }
private static void UpdateOldPathSchemaDatasetJsonForMergingADLSCosmos() { var folders = ReadFile.GetFolderSubPaths(FolderPath, ReadType.Directory, PathType.Absolute); int count = 0; foreach (var folder in folders) { Console.WriteLine(folder); string subFolderPath = folder + @"\Dataset"; try { var datasetJsonFiles = ReadFile.GetFolderSubPaths(subFolderPath, ReadType.File, PathType.Absolute); foreach (var filePath in datasetJsonFiles) { UpdateDatasetConnectionInfoForMergingADLSCosmos(filePath); } } catch (Exception e) { Console.WriteLine(e.Message); } } Console.WriteLine(count); }