コード例 #1
0
        /// <summary>
        /// Constructs a new instance of the NormativeAnalysis class and gets analysis
        /// data from the database for the specified script ID.
        /// </summary>
        /// <param name="testID">The database ID for the script for which to retrieve a normative analysis.</param>
        public NormativeAnalysis(int scriptID)
        {
            using (IDataReader Reader = ExecuteReader(GetConnection(),
                                                      "GET_NORMATIVE_ANALYSIS",
                                                      CommandBehavior.CloseConnection,
                                                      "@script_id", scriptID))
            {
                while (Reader.Read())
                {
                    AnalysisMetric Metric = (AnalysisMetric)Reader["metric_id"];
                    List <NormativeAnalysisComponent> MetricList;

                    if (!Components.TryGetValue(Metric, out MetricList))
                    {
                        MetricList = new List <NormativeAnalysisComponent>();
                        Components.Add(Metric, MetricList);
                    }

                    MetricList.Add(new NormativeAnalysisComponent(
                                       Metric,
                                       (TestAnalysisComponentField)Reader["metric_field_id"],
                                       (double)Reader["min"],
                                       (double)Reader["max"]));
                }
            }
        }
コード例 #2
0
        public async Task <Response <MetricList> > ListMetricsAsync(string subscriptionId, string resourceGroupName, string accountName, string region, string databaseRid, string collectionRid, string filter, CancellationToken cancellationToken = default)
        {
            if (subscriptionId == null)
            {
                throw new ArgumentNullException(nameof(subscriptionId));
            }
            if (resourceGroupName == null)
            {
                throw new ArgumentNullException(nameof(resourceGroupName));
            }
            if (accountName == null)
            {
                throw new ArgumentNullException(nameof(accountName));
            }
            if (region == null)
            {
                throw new ArgumentNullException(nameof(region));
            }
            if (databaseRid == null)
            {
                throw new ArgumentNullException(nameof(databaseRid));
            }
            if (collectionRid == null)
            {
                throw new ArgumentNullException(nameof(collectionRid));
            }
            if (filter == null)
            {
                throw new ArgumentNullException(nameof(filter));
            }

            using var message = CreateListMetricsRequest(subscriptionId, resourceGroupName, accountName, region, databaseRid, collectionRid, filter);
            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);

            switch (message.Response.Status)
            {
            case 200:
            {
                MetricList value = default;
                using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);

                value = MetricList.DeserializeMetricList(document.RootElement);
                return(Response.FromValue(value, message.Response));
            }
コード例 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CloudWatchServiceConfiguration"/> class.
 /// </summary>
 public CloudWatchServiceConfiguration()
 {
     Metrics = new MetricList();
 }