private ISensorQueryTargetParameters SynthesizeParameters(ICommandParameters parameters)
        {
            var customParameters = parameters[Parameter.Custom];

            if (customParameters.IsIEnumerable())
            {
                var queryParameters = new SensorQueryTargetParameters();

                var any = false;

                foreach (CustomParameter parameter in customParameters.ToIEnumerable())
                {
                    any = true;

                    queryParameters[parameter.Name] = parameter.Value;
                }

                if (any)
                {
                    return(queryParameters);
                }
            }

            return(null);
        }
        public void Action_DynamicSensorParameters_SensorQueryParameters_ParsesParameters()
        {
            var queryParameters = new SensorQueryTargetParameters
            {
                ["database"] = "XE",
                ["sid_type"] = 0,
                ["prefix"]   = 0
            };

            AssertEx.Throws <PrtgRequestException>(
                () => client.GetDynamicSensorParameters(Settings.Device, "oracletablespace", queryParameters: queryParameters),
                "Specified sensor type may not be valid on this device"
                );
        }
Example #3
0
        private static SensorQueryTargetParameters GetQueryParameters(Hashtable queryParametersRaw)
        {
            if (queryParametersRaw == null)
            {
                return(null);
            }

            var queryParameters = new SensorQueryTargetParameters();

            foreach (var key in queryParametersRaw.Keys.Cast <object>())
            {
                queryParameters[key.ToString()] = PSObjectUtilities.CleanPSObject(queryParametersRaw[key]);
            }

            return(queryParameters);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="SensorMultiQueryTargetParameters"/> class.
 /// </summary>
 /// <param name="queryTarget">The query target to utilize.</param>
 /// <param name="parameters">The query target parameters to utilize.</param>
 public SensorMultiQueryTargetParameters(SensorQueryTarget queryTarget, SensorQueryTargetParameters parameters)
 {
     QueryTarget = queryTarget;
     Parameters  = parameters;
 }