public static VolumeObjectTO ParseJson(dynamic json) { VolumeObjectTO result = null; if (json == null) { return(result); } dynamic volumeObjectTOJson = json[CloudStackTypes.VolumeObjectTO]; if (volumeObjectTOJson != null) { result = new VolumeObjectTO() { dataStore = volumeObjectTOJson.dataStore, format = ((string)volumeObjectTOJson.format), name = (string)volumeObjectTOJson.name, uuid = (string)volumeObjectTOJson.uuid }; result.primaryDataStore = PrimaryDataStoreTO.ParseJson(volumeObjectTOJson.dataStore); // Assert if (result.dataStore == null || result.primaryDataStore == null) { String errMsg = "VolumeObjectTO missing primary dataStore in spec " + volumeObjectTOJson.ToString(); logger.Error(errMsg); throw new ArgumentNullException(errMsg); } GuessFileExtension(result); } return(result); }
public static TemplateObjectTO ParseJson(dynamic json) { TemplateObjectTO result = null; dynamic templateObjectTOJson = json[CloudStackTypes.TemplateObjectTO]; if (templateObjectTOJson != null) { result = new TemplateObjectTO() { imageDataStore = templateObjectTOJson.imageDataStore, format = (string)templateObjectTOJson.format, name = (string)templateObjectTOJson.name, uuid = (string)templateObjectTOJson.uuid, path = (string)templateObjectTOJson.path, checksum = (string)templateObjectTOJson.checksum, size = (string)templateObjectTOJson.size, id = (string)templateObjectTOJson.id }; result.s3DataStoreTO = S3TO.ParseJson(templateObjectTOJson.imageDataStore); result.nfsDataStoreTO = NFSTO.ParseJson(templateObjectTOJson.imageDataStore); result.primaryDataStore = PrimaryDataStoreTO.ParseJson(templateObjectTOJson.imageDataStore); } return(result); }