Example #1
0
        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);
        }
Example #2
0
        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);
        }
Example #3
0
        public static PrimaryDataStoreTO ParseJson(dynamic json)
        {
            PrimaryDataStoreTO result = null;

            if (json == null)
            {
                return(result);
            }

            dynamic primaryDataStoreTOJson = json[CloudStackTypes.PrimaryDataStoreTO];

            if (primaryDataStoreTOJson != null)
            {
                result = new PrimaryDataStoreTO()
                {
                    path     = (string)primaryDataStoreTOJson.path,
                    host     = (string)primaryDataStoreTOJson.host,
                    poolType = (string)primaryDataStoreTOJson.poolType
                };

                if (!result.isLocal)
                {
                    // Delete security credentials in original command.  Prevents logger from spilling the beans, as it were.
                    String uriStr = @"cifs://" + result.host + result.path;
                    result.uri = new Uri(uriStr);
                }
            }
            return(result);
        }
Example #4
0
        public static PrimaryDataStoreTO ParseJson(dynamic json)
        {
            PrimaryDataStoreTO result = null;

            if (json == null)
            {
                return(result);
            }
            dynamic primaryDataStoreTOJson = json[CloudStackTypes.PrimaryDataStoreTO];

            if (primaryDataStoreTOJson != null)
            {
                result = new PrimaryDataStoreTO()
                {
                    path = (string)primaryDataStoreTOJson.path
                };
            }
            return(result);
        }
Example #5
0
        public static PrimaryDataStoreTO ParseJson(dynamic json)
        {
            PrimaryDataStoreTO result = null;
            if (json == null)
            {
                return result;
            }

            dynamic primaryDataStoreTOJson = json[CloudStackTypes.PrimaryDataStoreTO];
            if (primaryDataStoreTOJson != null)
            {
                result = new PrimaryDataStoreTO()
                {
                    path = (string)primaryDataStoreTOJson.path,
                    host = (string)primaryDataStoreTOJson.host,
                    poolType = (string)primaryDataStoreTOJson.poolType
                };

                if (!result.isLocal)
                {
                    // Delete security credentials in original command.  Prevents logger from spilling the beans, as it were.
                    String uriStr = @"cifs://" + result.host + result.path;
                    result.uri = new Uri(uriStr);
                }
            }
            return result;
        }
Example #6
0
        public static PrimaryDataStoreTO ParseJson(dynamic json)
        {
            PrimaryDataStoreTO result = null;

            if (json == null)
            {
                return result;
            }
            dynamic primaryDataStoreTOJson = json[CloudStackTypes.PrimaryDataStoreTO];
            if (primaryDataStoreTOJson != null)
            {
                result = new PrimaryDataStoreTO()
                {
                    path = (string)primaryDataStoreTOJson.path
                };
            }
            return result;
        }