MCPcopy Create free account
hub / github.com/Macmod/godap / writeDataExport

Function writeDataExport

tui/main.go:230–254  ·  view source on GitHub ↗
(data map[string]any, dumpSuffix string, dumpFormat string)

Source from the content-addressed store, hash-verified

228}
229
230func writeDataExport(data map[string]any, dumpSuffix string, dumpFormat string) {
231 unixTimestamp := time.Now().UnixMilli()
232 outputFilename := fmt.Sprintf("%d_%s.json", unixTimestamp, dumpSuffix)
233
234 objectToExport := map[string]any{
235 "Data": data,
236 "Format": dumpFormat,
237 }
238
239 jsonExportMap, _ := json.MarshalIndent(objectToExport, "", " ")
240
241 err := os.MkdirAll(ExportDir, 0755)
242 if err != nil {
243 updateLog(fmt.Sprintf("%s", err), "red")
244 }
245
246 outputFilepath := filepath.Join(ExportDir, outputFilename)
247 err = ioutil.WriteFile(outputFilepath, jsonExportMap, 0644)
248
249 if err != nil {
250 updateLog(fmt.Sprintf("%s", err), "red")
251 } else {
252 updateLog("File '"+outputFilepath+"' saved successfully!", "green")
253 }
254}
255
256func upgradeStartTLS() {
257 go func() {

Callers 6

exportADIDNSToFileFunction · 0.85
exportCurrentGroupsFunction · 0.85
exportCurrentMembersFunction · 0.85
exportCurrentGposFunction · 0.85
exportCurrentSDFunction · 0.85
exportCacheToFileFunction · 0.85

Calls 1

updateLogFunction · 0.85

Tested by

no test coverage detected