コード例 #1
0
        // TODODOCS.
        /// <summary>
        /// Initializes a new instance of the <see cref="AzureDataLakeStorageGen2DataFeedSource"/> class.
        /// </summary>
        /// <param name="accountName">The name of the Storage Account.</param>
        /// <param name="accountKey">The Storage Account key.</param>
        /// <param name="fileSystemName">The name of the file system.</param>
        /// <param name="directoryTemplate">The directory template.</param>
        /// <param name="fileTemplate"></param>
        /// <exception cref="ArgumentNullException"><paramref name="accountName"/>, <paramref name="accountKey"/>, <paramref name="fileSystemName"/>, <paramref name="directoryTemplate"/>, or <paramref name="fileTemplate"/> is null.</exception>
        /// <exception cref="ArgumentException"><paramref name="accountName"/>, <paramref name="accountKey"/>, <paramref name="fileSystemName"/>, <paramref name="directoryTemplate"/>, or <paramref name="fileTemplate"/> is empty.</exception>
        public AzureDataLakeStorageGen2DataFeedSource(string accountName, string accountKey, string fileSystemName, string directoryTemplate, string fileTemplate)
            : base(DataFeedSourceType.AzureDataLakeStorageGen2)
        {
            Argument.AssertNotNullOrEmpty(accountName, nameof(accountName));
            Argument.AssertNotNullOrEmpty(accountKey, nameof(accountKey));
            Argument.AssertNotNullOrEmpty(fileSystemName, nameof(fileSystemName));
            Argument.AssertNotNullOrEmpty(directoryTemplate, nameof(directoryTemplate));
            Argument.AssertNotNullOrEmpty(fileTemplate, nameof(fileTemplate));

            Parameter = new AzureDataLakeStorageGen2Parameter(accountName, accountKey, fileSystemName, directoryTemplate, fileTemplate);
        }
        internal AzureDataLakeStorageGen2DataFeedSource(AzureDataLakeStorageGen2Parameter parameter)
            : base(DataFeedSourceType.AzureDataLakeStorageGen2)
        {
            Argument.AssertNotNull(parameter, nameof(parameter));

            Parameter = parameter;

            AccountName       = parameter.AccountName;
            AccountKey        = parameter.AccountKey;
            FileSystemName    = parameter.FileSystemName;
            DirectoryTemplate = parameter.DirectoryTemplate;
            FileTemplate      = parameter.FileTemplate;
        }
        internal AzureDataLakeStorageGen2DataFeedSource(AzureDataLakeStorageGen2Parameter parameter, AuthenticationTypeEnum?authentication, string credentialId)
            : base(DataFeedSourceType.AzureDataLakeStorageGen2)
        {
            Argument.AssertNotNull(parameter, nameof(parameter));

            AccountName       = parameter.AccountName;
            AccountKey        = parameter.AccountKey;
            FileSystemName    = parameter.FileSystemName;
            DirectoryTemplate = parameter.DirectoryTemplate;
            FileTemplate      = parameter.FileTemplate;

            SetAuthentication(authentication);
            DatasourceCredentialId = credentialId;
        }
コード例 #4
0
        public AzureDataLakeStorageGen2DataFeed(string dataFeedName, DataFeedGranularityType granularityName, IEnumerable <DataFeedMetric> metrics, DateTimeOffset dataStartFrom, AzureDataLakeStorageGen2Parameter dataSourceParameter) : base(dataFeedName, granularityName, metrics, dataStartFrom)
        {
            if (dataFeedName == null)
            {
                throw new ArgumentNullException(nameof(dataFeedName));
            }
            if (metrics == null)
            {
                throw new ArgumentNullException(nameof(metrics));
            }
            if (dataSourceParameter == null)
            {
                throw new ArgumentNullException(nameof(dataSourceParameter));
            }

            DataSourceParameter = dataSourceParameter;
            DataSourceType      = DataFeedSourceKind.AzureDataLakeStorage;
        }
        internal static AzureDataLakeStorageGen2DataFeed DeserializeAzureDataLakeStorageGen2DataFeed(JsonElement element)
        {
            AzureDataLakeStorageGen2Parameter 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 <DataFeedDimension> > 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 <DataFeedAccessMode>               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;
            Optional <AuthenticationTypeEnum>           authenticationType        = default;
            Optional <string>                           credentialId              = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("dataSourceParameter"))
                {
                    dataSourceParameter = AzureDataLakeStorageGen2Parameter.DeserializeAzureDataLakeStorageGen2Parameter(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"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <DataFeedDimension> array = new List <DataFeedDimension>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(DataFeedDimension.DeserializeDataFeedDimension(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"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    startOffsetInSeconds = property.Value.GetInt64();
                    continue;
                }
                if (property.NameEquals("maxConcurrency"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    maxConcurrency = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("minRetryIntervalInSeconds"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    minRetryIntervalInSeconds = property.Value.GetInt64();
                    continue;
                }
                if (property.NameEquals("stopRetryAfterInSeconds"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    stopRetryAfterInSeconds = property.Value.GetInt64();
                    continue;
                }
                if (property.NameEquals("needRollup"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    needRollup = new DataFeedRollupType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("rollUpMethod"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    rollUpMethod = new DataFeedAutoRollupMethod(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("rollUpColumns"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    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"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    fillMissingPointType = new DataFeedMissingDataPointFillType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("fillMissingPointValue"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    fillMissingPointValue = property.Value.GetDouble();
                    continue;
                }
                if (property.NameEquals("viewMode"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    viewMode = new DataFeedAccessMode(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("admins"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <string> array = new List <string>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(item.GetString());
                    }
                    admins = array;
                    continue;
                }
                if (property.NameEquals("viewers"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <string> array = new List <string>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(item.GetString());
                    }
                    viewers = array;
                    continue;
                }
                if (property.NameEquals("isAdmin"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    isAdmin = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("creator"))
                {
                    creator = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("status"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    status = new DataFeedStatus(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("createdTime"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    createdTime = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("actionLinkTemplate"))
                {
                    actionLinkTemplate = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("authenticationType"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    authenticationType = new AuthenticationTypeEnum(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("credentialId"))
                {
                    credentialId = property.Value.GetString();
                    continue;
                }
            }
            return(new AzureDataLakeStorageGen2DataFeed(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, Optional.ToNullable(authenticationType), credentialId.Value, dataSourceParameter));
        }
コード例 #6
0
 internal AzureDataLakeStorageGen2DataFeed(DataFeedSourceKind dataSourceType, string dataFeedId, string dataFeedName, string dataFeedDescription, DataFeedGranularityType granularityName, int?granularityAmount, IList <DataFeedMetric> metrics, IList <DataFeedDimension> dimension, string timestampColumn, DateTimeOffset dataStartFrom, long?startOffsetInSeconds, int?maxConcurrency, long?minRetryIntervalInSeconds, long?stopRetryAfterInSeconds, DataFeedRollupType?needRollup, DataFeedAutoRollupMethod?rollUpMethod, IList <string> rollUpColumns, string allUpIdentification, DataFeedMissingDataPointFillType?fillMissingPointType, double?fillMissingPointValue, DataFeedAccessMode?viewMode, IList <string> admins, IList <string> viewers, bool?isAdmin, string creator, DataFeedStatus?status, DateTimeOffset?createdTime, string actionLinkTemplate, AuthenticationTypeEnum?authenticationType, string credentialId, AzureDataLakeStorageGen2Parameter dataSourceParameter) : base(dataSourceType, dataFeedId, dataFeedName, dataFeedDescription, granularityName, granularityAmount, metrics, dimension, timestampColumn, dataStartFrom, startOffsetInSeconds, maxConcurrency, minRetryIntervalInSeconds, stopRetryAfterInSeconds, needRollup, rollUpMethod, rollUpColumns, allUpIdentification, fillMissingPointType, fillMissingPointValue, viewMode, admins, viewers, isAdmin, creator, status, createdTime, actionLinkTemplate, authenticationType, credentialId)
 {
     DataSourceParameter = dataSourceParameter;
     DataSourceType      = dataSourceType;
 }
コード例 #7
0
        /// <summary> Initializes a new instance of a data source specific DataFeedDetail. </summary>
        /// <param name="dataFeedName"> data feed name. </param>
        /// <param name="dataFeedGranularity"></param>
        /// <param name="dataFeedSchema"></param>
        /// <param name="dataFeedIngestionSettings"></param>
        /// <param name="dataFeedOptions"></param>
        internal void SetDetail(string dataFeedName, DataFeedGranularity dataFeedGranularity, DataFeedSchema dataFeedSchema, DataFeedIngestionSettings dataFeedIngestionSettings, DataFeedOptions dataFeedOptions)
        {
            dataFeedIngestionSettings.IngestionStartTime = ClientCommon.NormalizeDateTimeOffset(dataFeedIngestionSettings.IngestionStartTime);

            DataFeedDetail = Parameter switch
            {
                AzureApplicationInsightsParameter p => new AzureApplicationInsightsDataFeed(dataFeedName, dataFeedGranularity.GranularityType, dataFeedSchema.MetricColumns, dataFeedIngestionSettings.IngestionStartTime, p),
                AzureBlobParameter p => new AzureBlobDataFeed(dataFeedName, dataFeedGranularity.GranularityType, dataFeedSchema.MetricColumns, dataFeedIngestionSettings.IngestionStartTime, p),
                AzureCosmosDBParameter p => new AzureCosmosDBDataFeed(dataFeedName, dataFeedGranularity.GranularityType, dataFeedSchema.MetricColumns, dataFeedIngestionSettings.IngestionStartTime, p),
                AzureDataLakeStorageGen2Parameter p => new AzureDataLakeStorageGen2DataFeed(dataFeedName, dataFeedGranularity.GranularityType, dataFeedSchema.MetricColumns, dataFeedIngestionSettings.IngestionStartTime, p),
                AzureTableParameter p => new AzureTableDataFeed(dataFeedName, dataFeedGranularity.GranularityType, dataFeedSchema.MetricColumns, dataFeedIngestionSettings.IngestionStartTime, p),
                ElasticsearchParameter p => new ElasticsearchDataFeed(dataFeedName, dataFeedGranularity.GranularityType, dataFeedSchema.MetricColumns, dataFeedIngestionSettings.IngestionStartTime, p),
                HttpRequestParameter p => new HttpRequestDataFeed(dataFeedName, dataFeedGranularity.GranularityType, dataFeedSchema.MetricColumns, dataFeedIngestionSettings.IngestionStartTime, p),
                InfluxDBParameter p => new InfluxDBDataFeed(dataFeedName, dataFeedGranularity.GranularityType, dataFeedSchema.MetricColumns, dataFeedIngestionSettings.IngestionStartTime, p),
                SqlSourceParameter p when DataFeedSourceType == DataFeedSourceType.AzureDataExplorer => new AzureDataExplorerDataFeed(dataFeedName, dataFeedGranularity.GranularityType, dataFeedSchema.MetricColumns, dataFeedIngestionSettings.IngestionStartTime, p),
                SqlSourceParameter p when DataFeedSourceType == DataFeedSourceType.MySql => new MySqlDataFeed(dataFeedName, dataFeedGranularity.GranularityType, dataFeedSchema.MetricColumns, dataFeedIngestionSettings.IngestionStartTime, p),
                SqlSourceParameter p when DataFeedSourceType == DataFeedSourceType.PostgreSql => new PostgreSqlDataFeed(dataFeedName, dataFeedGranularity.GranularityType, dataFeedSchema.MetricColumns, dataFeedIngestionSettings.IngestionStartTime, p),
                SqlSourceParameter p when DataFeedSourceType == DataFeedSourceType.SqlServer => new SQLServerDataFeed(dataFeedName, dataFeedGranularity.GranularityType, dataFeedSchema.MetricColumns, dataFeedIngestionSettings.IngestionStartTime, p),
                MongoDBParameter p => new MongoDBDataFeed(dataFeedName, dataFeedGranularity.GranularityType, dataFeedSchema.MetricColumns, dataFeedIngestionSettings.IngestionStartTime, p),
                _ => throw new InvalidOperationException("Invalid DataFeedDetail type")
            };

            DataFeedDetail.GranularityAmount = dataFeedGranularity.CustomGranularityValue;
            foreach (var column in dataFeedSchema.DimensionColumns)
            {
                DataFeedDetail.Dimension.Add(column);
            }
            DataFeedDetail.TimestampColumn           = dataFeedSchema.TimestampColumn;
            DataFeedDetail.MaxConcurrency            = dataFeedIngestionSettings.DataSourceRequestConcurrency;
            DataFeedDetail.MinRetryIntervalInSeconds = (long?)dataFeedIngestionSettings.IngestionRetryDelay?.TotalSeconds;
            DataFeedDetail.StartOffsetInSeconds      = (long?)dataFeedIngestionSettings.IngestionStartOffset?.TotalSeconds;
            DataFeedDetail.StopRetryAfterInSeconds   = (long?)dataFeedIngestionSettings.StopRetryAfter?.TotalSeconds;
            if (dataFeedOptions != null)
            {
                foreach (var admin in dataFeedOptions.Administrators)
                {
                    DataFeedDetail.Admins.Add(admin);
                }
                foreach (var viewer in dataFeedOptions.Viewers)
                {
                    DataFeedDetail.Viewers.Add(viewer);
                }
                DataFeedDetail.DataFeedDescription = dataFeedOptions.Description;
                DataFeedDetail.ViewMode            = dataFeedOptions.AccessMode;
                if (dataFeedOptions.RollupSettings != null)
                {
                    foreach (var columnName in dataFeedOptions.RollupSettings.AutoRollupGroupByColumnNames)
                    {
                        DataFeedDetail.RollUpColumns.Add(columnName);
                    }
                    DataFeedDetail.RollUpMethod = dataFeedOptions.RollupSettings.RollupMethod;
                    DataFeedDetail.NeedRollup   = dataFeedOptions.RollupSettings.RollupType;
                }
                if (dataFeedOptions.MissingDataPointFillSettings != null)
                {
                    DataFeedDetail.FillMissingPointType  = dataFeedOptions.MissingDataPointFillSettings.FillType;
                    DataFeedDetail.FillMissingPointValue = dataFeedOptions.MissingDataPointFillSettings.CustomFillValue;
                }
                DataFeedDetail.ActionLinkTemplate = dataFeedOptions.ActionLinkTemplate;
            }
        }
    }