public PSDataSource(DataSource dataSource, string resourceGroupName, string workspaceName)
        {
            if (dataSource == null)
            {
                throw new ArgumentNullException("dataSource");
            }

            this.ResourceGroupName = resourceGroupName;
            this.WorkspaceName = workspaceName;
            this.Name = dataSource.Name;
            this.ResourceId = dataSource.Id;
            this.Kind = dataSource.Kind;
            switch(this.Kind){
                case PSDataSourceKinds.AzureAuditLog:
                    this.Properties = JsonConvert.DeserializeObject<PSAzureAuditLogDataSourceProperties>(dataSource.Properties);
                    break;
                case PSDataSourceKinds.AzureActivityLog:
                    this.Properties = JsonConvert.DeserializeObject<PSAzureActivityLogDataSourceProperties>(dataSource.Properties);
                    break;
                case PSDataSourceKinds.WindowsEvent:
                    this.Properties = JsonConvert.DeserializeObject<PSWindowsEventDataSourceProperties>(dataSource.Properties);
                    break;
                case PSDataSourceKinds.WindowsPerformanceCounter:
                    this.Properties = JsonConvert.DeserializeObject<PSWindowsPerformanceCounterDataSourceProperties>(dataSource.Properties);
                    break;
                case PSDataSourceKinds.LinuxSyslog:
                    this.Properties = JsonConvert.DeserializeObject<PSLinuxSyslogDataSourceProperties>(dataSource.Properties);
                    break;
                case PSDataSourceKinds.LinuxSyslogCollection:
                    this.Properties = JsonConvert.DeserializeObject<PSLinuxSyslogCollectionDataSourceProperties>(dataSource.Properties);
                    break;
                case PSDataSourceKinds.LinuxPerformanceObject:
                    this.Properties = JsonConvert.DeserializeObject<PSLinuxPerformanceObjectDataSourceProperties>(dataSource.Properties);
                    break;
                case PSDataSourceKinds.LinuxPerformanceCollection:
                    this.Properties = JsonConvert.DeserializeObject<PSLinuxPerformanceCollectionDataSourceProperties>(dataSource.Properties);
                    break;
                case PSDataSourceKinds.CustomLog:
                    this.Properties = JsonConvert.DeserializeObject<PSCustomLogDataSourceProperties>(dataSource.Properties);
                    break;
                case PSDataSourceKinds.CustomLogCollection:
                    this.Properties = JsonConvert.DeserializeObject<PSCustomLogCollectionDataSourceProperties>(dataSource.Properties);
                    break;
                case PSDataSourceKinds.IISLogs:
                    this.Properties = JsonConvert.DeserializeObject<PSIISLogsDataSourceProperties>(dataSource.Properties);
                    break;
            }

        }
        /// <summary>
        /// Validates a storage insight matches the expected properties.  Throws assertion exceptions if validation fails.
        /// </summary>
        /// <param name="expected">Expected data source</param>
        /// <param name="actual">Actual data source</param>
        internal static void ValidateDatasource(DataSource expected, DataSource actual)
        {
            Assert.NotNull(actual);
            Assert.NotNull(actual.Id);
            Assert.Equal(expected.Name, actual.Name);
            Assert.Equal(expected.Kind, actual.Kind);
            Assert.Equal(DataSourceResourceType, actual.Type);

            Assert.NotNull(actual.Properties);
        }