agent/containermetadata/write_metadata_windows.go
func writeToMetadataFile(osWrap oswrapper.OS, ioutilWrap ioutilwrapper.IOUtil, data []byte, taskARN string, containerName string, dataDir string) error {
	metadataFileDir, err := getMetadataFilePath(taskARN, containerName, dataDir)
	// Boundary case if file path is bad (Such as if task arn is incorrectly formatted)
	if err != nil {
		return fmt.Errorf("write to metadata file for task %s container %s: %v", taskARN, containerName, err)
	}
	metadataFileName := filepath.Join(metadataFileDir, metadataFile)

	file, err := osWrap.OpenFile(metadataFileName, os.O_WRONLY|os.O_CREATE, metadataPerm)
	if err != nil {
		return err
	}
	defer file.Close()

	_, err = file.Write(data)
	if err != nil {
		return err
	}
	return file.Sync()
}
func writeToMetadataFile(osWrap oswrapper.OS, ioutilWrap ioutilwrapper.IOUtil, data []byte, taskARN string, containerName string, dataDir string) error {
	metadataFileDir, err := getMetadataFilePath(taskARN, containerName, dataDir)
	// Boundary case if file path is bad (Such as if task arn is incorrectly formatted)
	if err != nil {
		return fmt.Errorf("write to metadata file for task %s container %s: %v", taskARN, containerName, err)
	}
	metadataFileName := filepath.Join(metadataFileDir, metadataFile)

	file, err := osWrap.OpenFile(metadataFileName, os.O_WRONLY|os.O_CREATE, metadataPerm)
	if err != nil {
		return err
	}
	defer file.Close()

	_, err = file.Write(data)
	if err != nil {
		return err
	}
	return file.Sync()
}
func writeToMetadataFile ( osWrap oswrapper . OS , ioutilWrap ioutilwrapper . IOUtil , data [ ] byte , taskARN string , containerName string , dataDir string ) error { metadataFileDir , err := getMetadataFilePath ( taskARN , containerName , dataDir ) // Boundary case if file path is bad (Such as if task arn is incorrectly formatted) if err != nil { return fmt . Errorf ( " " , taskARN , containerName , err ) } metadataFileName := filepath . Join ( metadataFileDir , metadataFile ) file , err := osWrap . OpenFile ( metadataFileName , os . O_WRONLY | os . O_CREATE , metadataPerm ) if err != nil { return err } defer file . Close ( ) _ , err = file . Write ( data ) if err != nil { return err } return file . Sync ( ) }
// writeToMetadata puts the metadata into JSON format and writes into
// the metadata file
writeToMetadata puts the metadata into JSON format and writes into the metadata file