internal static AzureBlobDataFeed DeserializeAzureBlobDataFeed(JsonElement element) { AzureBlobParameter dataSourceParameter = default; DataFeedSourceType dataSourceType = default; Optional <string> dataFeedId = default; string dataFeedName = default; Optional <string> dataFeedDescription = default; DataFeedGranularityType granularityName = default; Optional <int?> granularityAmount = default; IList <DataFeedMetric> metrics = default; Optional <IList <MetricDimension> > dimension = default; Optional <string> timestampColumn = default; DateTimeOffset dataStartFrom = default; Optional <long> startOffsetInSeconds = default; Optional <int> maxConcurrency = default; Optional <long> minRetryIntervalInSeconds = default; Optional <long> stopRetryAfterInSeconds = default; Optional <DataFeedRollupType> needRollup = default; Optional <DataFeedAutoRollupMethod> rollUpMethod = default; Optional <IList <string> > rollUpColumns = default; Optional <string> allUpIdentification = default; Optional <DataFeedMissingDataPointFillType> fillMissingPointType = default; Optional <double> fillMissingPointValue = default; Optional <AccessMode> viewMode = default; Optional <IList <string> > admins = default; Optional <IList <string> > viewers = default; Optional <bool> isAdmin = default; Optional <string> creator = default; Optional <DataFeedStatus> status = default; Optional <DateTimeOffset> createdTime = default; Optional <string> actionLinkTemplate = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("dataSourceParameter")) { dataSourceParameter = AzureBlobParameter.DeserializeAzureBlobParameter(property.Value); continue; } if (property.NameEquals("dataSourceType")) { dataSourceType = new DataFeedSourceType(property.Value.GetString()); continue; } if (property.NameEquals("dataFeedId")) { dataFeedId = property.Value.GetString(); continue; } if (property.NameEquals("dataFeedName")) { dataFeedName = property.Value.GetString(); continue; } if (property.NameEquals("dataFeedDescription")) { dataFeedDescription = property.Value.GetString(); continue; } if (property.NameEquals("granularityName")) { granularityName = new DataFeedGranularityType(property.Value.GetString()); continue; } if (property.NameEquals("granularityAmount")) { if (property.Value.ValueKind == JsonValueKind.Null) { granularityAmount = null; continue; } granularityAmount = property.Value.GetInt32(); continue; } if (property.NameEquals("metrics")) { List <DataFeedMetric> array = new List <DataFeedMetric>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(DataFeedMetric.DeserializeDataFeedMetric(item)); } metrics = array; continue; } if (property.NameEquals("dimension")) { List <MetricDimension> array = new List <MetricDimension>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(MetricDimension.DeserializeMetricDimension(item)); } dimension = array; continue; } if (property.NameEquals("timestampColumn")) { timestampColumn = property.Value.GetString(); continue; } if (property.NameEquals("dataStartFrom")) { dataStartFrom = property.Value.GetDateTimeOffset("O"); continue; } if (property.NameEquals("startOffsetInSeconds")) { startOffsetInSeconds = property.Value.GetInt64(); continue; } if (property.NameEquals("maxConcurrency")) { maxConcurrency = property.Value.GetInt32(); continue; } if (property.NameEquals("minRetryIntervalInSeconds")) { minRetryIntervalInSeconds = property.Value.GetInt64(); continue; } if (property.NameEquals("stopRetryAfterInSeconds")) { stopRetryAfterInSeconds = property.Value.GetInt64(); continue; } if (property.NameEquals("needRollup")) { needRollup = new DataFeedRollupType(property.Value.GetString()); continue; } if (property.NameEquals("rollUpMethod")) { rollUpMethod = new DataFeedAutoRollupMethod(property.Value.GetString()); continue; } if (property.NameEquals("rollUpColumns")) { List <string> array = new List <string>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(item.GetString()); } rollUpColumns = array; continue; } if (property.NameEquals("allUpIdentification")) { allUpIdentification = property.Value.GetString(); continue; } if (property.NameEquals("fillMissingPointType")) { fillMissingPointType = new DataFeedMissingDataPointFillType(property.Value.GetString()); continue; } if (property.NameEquals("fillMissingPointValue")) { fillMissingPointValue = property.Value.GetDouble(); continue; } if (property.NameEquals("viewMode")) { viewMode = new AccessMode(property.Value.GetString()); continue; } if (property.NameEquals("admins")) { List <string> array = new List <string>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(item.GetString()); } admins = array; continue; } if (property.NameEquals("viewers")) { List <string> array = new List <string>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(item.GetString()); } viewers = array; continue; } if (property.NameEquals("isAdmin")) { isAdmin = property.Value.GetBoolean(); continue; } if (property.NameEquals("creator")) { creator = property.Value.GetString(); continue; } if (property.NameEquals("status")) { status = new DataFeedStatus(property.Value.GetString()); continue; } if (property.NameEquals("createdTime")) { createdTime = property.Value.GetDateTimeOffset("O"); continue; } if (property.NameEquals("actionLinkTemplate")) { actionLinkTemplate = property.Value.GetString(); continue; } } return(new AzureBlobDataFeed(dataSourceType, dataFeedId.Value, dataFeedName, dataFeedDescription.Value, granularityName, Optional.ToNullable(granularityAmount), metrics, Optional.ToList(dimension), timestampColumn.Value, dataStartFrom, Optional.ToNullable(startOffsetInSeconds), Optional.ToNullable(maxConcurrency), Optional.ToNullable(minRetryIntervalInSeconds), Optional.ToNullable(stopRetryAfterInSeconds), Optional.ToNullable(needRollup), Optional.ToNullable(rollUpMethod), Optional.ToList(rollUpColumns), allUpIdentification.Value, Optional.ToNullable(fillMissingPointType), Optional.ToNullable(fillMissingPointValue), Optional.ToNullable(viewMode), Optional.ToList(admins), Optional.ToList(viewers), Optional.ToNullable(isAdmin), creator.Value, Optional.ToNullable(status), Optional.ToNullable(createdTime), actionLinkTemplate.Value, dataSourceParameter)); }
/// <summary> /// Converts a data source specific <see cref="DataFeed"/> into its equivalent data source specific <see cref="DataFeedDetailPatch"/>. /// </summary> internal DataFeedDetailPatch GetPatchModel() { DataFeedDetailPatch patch = DataSource?.InstantiateDataFeedDetailPatch() ?? new DataFeedDetailPatch(); patch.DataFeedName = Name; patch.Status = Status.HasValue ? new DataFeedDetailPatchStatus(Status.ToString()) : default(DataFeedDetailPatchStatus?); if (Schema != null) { patch.TimestampColumn = Schema.TimestampColumn; } if (IngestionSettings != null) { patch.DataStartFrom = IngestionSettings.IngestionStartTime.HasValue ? ClientCommon.NormalizeDateTimeOffset(IngestionSettings.IngestionStartTime.Value) : null; patch.MaxConcurrency = IngestionSettings.DataSourceRequestConcurrency; patch.MinRetryIntervalInSeconds = (long?)IngestionSettings.IngestionRetryDelay?.TotalSeconds; patch.StartOffsetInSeconds = (long?)IngestionSettings.IngestionStartOffset?.TotalSeconds; patch.StopRetryAfterInSeconds = (long?)IngestionSettings.StopRetryAfter?.TotalSeconds; } patch.DataFeedDescription = Description; patch.ActionLinkTemplate = ActionLinkTemplate; patch.ViewMode = AccessMode.HasValue == true ? new DataFeedDetailPatchViewMode(AccessMode.ToString()) : default(DataFeedDetailPatchViewMode?); if (RollupSettings != null) { patch.AllUpIdentification = RollupSettings.AlreadyRollupIdentificationValue; patch.NeedRollup = RollupSettings.RollupType.HasValue ? new DataFeedDetailPatchNeedRollup(RollupSettings.RollupType.ToString()) : default(DataFeedDetailPatchNeedRollup?); patch.RollUpMethod = RollupSettings.RollupMethod.HasValue ? new DataFeedDetailPatchRollUpMethod(RollupSettings.RollupMethod.ToString()) : default(DataFeedDetailPatchRollUpMethod?); patch.RollUpColumns = RollupSettings.AutoRollupGroupByColumnNames; } if (MissingDataPointFillSettings != null) { patch.FillMissingPointType = MissingDataPointFillSettings.FillType.HasValue ? new DataFeedDetailPatchFillMissingPointType(MissingDataPointFillSettings.FillType.ToString()) : default(DataFeedDetailPatchFillMissingPointType?); patch.FillMissingPointValue = MissingDataPointFillSettings.CustomFillValue; } patch.Admins = Administrators; patch.Viewers = Viewers; return(patch); }