in internal/client/authconfigs/authconfigs.go [227:272]
func Export(folder string) (err error) {
var respBody []byte
count := 1
apiclient.ClientPrintHttpResponse.Set(false)
defer apiclient.ClientPrintHttpResponse.Set(apiclient.GetCmdPrintHttpResponseSetting())
apiclient.SetExportToFile(folder)
if respBody, err = List(100, "", ""); err != nil {
return err
}
fileName := "authconfigs_" + strconv.Itoa(count) + ".json"
if err = apiclient.WriteByteArrayToFile(path.Join(apiclient.GetExportToFile(), fileName), false, respBody); err != nil {
clilog.Error.Println(err)
return err
}
clilog.Info.Printf("Downloaded %s\n", fileName)
aconfigs := authConfigs{}
if err = json.Unmarshal(respBody, &aconfigs); err != nil {
return err
}
for aconfigs.NextPageToken != "" {
if respBody, err = List(100, "", ""); err != nil {
return err
}
if err = json.Unmarshal(respBody, &aconfigs); err != nil {
return err
}
count++
fileName := "authconfigs_" + strconv.Itoa(count) + ".json"
if err = apiclient.WriteByteArrayToFile(path.Join(apiclient.GetExportToFile(), fileName), false, respBody); err != nil {
clilog.Error.Println(err)
return err
}
clilog.Info.Printf("Downloaded %s\n", fileName)
}
return nil
}