Esempio n. 1
0
 /// <summary>
 /// Initializes a new instance of the PSMetricValue class.
 /// </summary>
 /// <param name="metricValue">The input MetricValue object</param>
 public PSMetricValue(MetricValue metricValue)
 {
     this.Average    = metricValue.Average;
     this.Count      = metricValue.Count;
     this.Last       = metricValue.Last;
     this.Maximum    = metricValue.Maximum;
     this.Minimum    = metricValue.Minimum;
     this.Properties = new PSDictionaryElement(metricValue.Properties);
     this.Timestamp  = metricValue.Timestamp;
     this.Total      = metricValue.Total;
 }
Esempio n. 2
0
 /// <summary>
 /// Initializes a new instance of the PSMetricValue class.
 /// </summary>
 /// <param name="metricValue">The input MetricValue object</param>
 public PSMetricValue(MetricValue metricValue)
 {
     this.Average = metricValue.Average;
     this.Count = metricValue.Count;
     this.Last = metricValue.Last;
     this.Maximum = metricValue.Maximum;
     this.Minimum = metricValue.Minimum;
     this.Properties = new PSDictionaryElement(metricValue.Properties);
     this.Timestamp = metricValue.Timestamp;
     this.Total = metricValue.Total;
 }
        /// <summary>
        /// Initializes a new instance of the PSAutoscaleSetting class.
        /// </summary>
        /// <param name="autoscaleSettingSpec">The autoscale setting spec</param>
        public PSAutoscaleSetting(AutoscaleSettingResource autoscaleSettingSpec)
        {
            // Keep the original values (types) in the base class
            base.Properties = autoscaleSettingSpec.Properties;
            base.Tags = autoscaleSettingSpec.Tags;

            this.Id = autoscaleSettingSpec.Id;
            this.Location = autoscaleSettingSpec.Location;
            this.Name = autoscaleSettingSpec.Name;
            this.Properties = new PSAutoscaleSettingProperty(autoscaleSettingSpec.Properties);
            this.Tags = new PSDictionaryElement(autoscaleSettingSpec.Tags);
        }
        /// <summary>
        /// Initializes a new instance of the PSAutoscaleSetting class.
        /// </summary>
        /// <param name="autoscaleSettingSpec">The autoscale setting spec</param>
        public PSAutoscaleSetting(AutoscaleSettingResource autoscaleSettingSpec)
        {
            // Keep the original values (types) in the base class
            base.Properties = autoscaleSettingSpec.Properties;
            base.Tags       = autoscaleSettingSpec.Tags;

            this.Id         = autoscaleSettingSpec.Id;
            this.Location   = autoscaleSettingSpec.Location;
            this.Name       = autoscaleSettingSpec.Name;
            this.Properties = new PSAutoscaleSettingProperty(autoscaleSettingSpec.Properties);
            this.Tags       = new PSDictionaryElement(autoscaleSettingSpec.Tags);
        }
Esempio n. 5
0
 /// <summary>
 /// Initializes a new instance of the PSMetric class.
 /// </summary>
 /// <param name="metric">The input Metric object</param>
 public PSMetric(Metric metric)
     : base(metric)
 {
     this.DimensionName = metric.DimensionName == null ? null : metric.DimensionName.Value;
     this.DimensionValue = metric.DimensionValue == null ? null : metric.DimensionValue.Value;
     this.EndTime = metric.EndTime;
     this.MetricValues = new PSMetricValuesCollection(metric.MetricValues);
     this.Name = metric.Name == null ? null : metric.Name.Value;
     this.Properties = new PSDictionaryElement(metric.Properties);
     this.ResourceId = metric.ResourceId;
     this.StartTime = metric.StartTime;
     this.TimeGrain = metric.TimeGrain;
     this.Unit = metric.Unit;
 }
Esempio n. 6
0
 /// <summary>
 /// Initializes a new instance of the PSMetric class.
 /// </summary>
 /// <param name="metric">The input Metric object</param>
 public PSMetric(Metric metric)
     : base(metric)
 {
     this.DimensionName  = metric.DimensionName == null ? null : metric.DimensionName.Value;
     this.DimensionValue = metric.DimensionValue == null ? null : metric.DimensionValue.Value;
     this.EndTime        = metric.EndTime;
     this.MetricValues   = new PSMetricValuesCollection(metric.MetricValues);
     this.Name           = metric.Name == null ? null : metric.Name.Value;
     this.Properties     = new PSDictionaryElement(metric.Properties);
     this.ResourceId     = metric.ResourceId;
     this.StartTime      = metric.StartTime;
     this.TimeGrain      = metric.TimeGrain;
     this.Unit           = metric.Unit;
 }
        /// <summary>
        /// Initializes an new instance of the PSMetricDefinition class
        /// </summary>
        /// <param name="metricDefinition">The MetricDefinition</param>
        public PSMetricDefinition(MetricDefinition metricDefinition)
        {
            // Keep the original value (localized string, Dictionary, List) in the base
            base.Dimensions = metricDefinition.Dimensions;
            base.MetricAvailabilities = metricDefinition.MetricAvailabilities;
            base.Name = metricDefinition.Name;
            base.Properties = metricDefinition.Properties;

            this.MetricAvailabilities = new PSAvailabilityCollection(metricDefinition.MetricAvailabilities);
            this.Name = metricDefinition.Name.ToString(localizedValue: false);
            this.PrimaryAggregationType = metricDefinition.PrimaryAggregationType;
            this.Properties = new PSDictionaryElement(metricDefinition.Properties);
            this.ResourceId = metricDefinition.ResourceId;
            this.Unit = metricDefinition.Unit;
        }
Esempio n. 8
0
        /// <summary>
        /// Initializes an new instance of the PSMetricDefinition class
        /// </summary>
        /// <param name="metricDefinition">The MetricDefinition</param>
        public PSMetricDefinition(MetricDefinition metricDefinition)
        {
            // Keep the original value (localized string, Dictionary, List) in the base
            base.Dimensions           = metricDefinition.Dimensions;
            base.MetricAvailabilities = metricDefinition.MetricAvailabilities;
            base.Name       = metricDefinition.Name;
            base.Properties = metricDefinition.Properties;

            this.MetricAvailabilities = new PSAvailabilityCollection(metricDefinition.MetricAvailabilities);
            this.Name = metricDefinition.Name.ToString(localizedValue: false);
            this.PrimaryAggregationType = metricDefinition.PrimaryAggregationType;
            this.Properties             = new PSDictionaryElement(metricDefinition.Properties);
            this.ResourceId             = metricDefinition.ResourceId;
            this.Unit = metricDefinition.Unit;
        }
Esempio n. 9
0
        /// <summary>
        /// Initializes a new instance of the EventData class.
        /// </summary>
        public PSEventData(EventData eventData)
        {
            this.Authorization = eventData.Authorization != null
                ? new PSEventDataAuthorization
            {
                Action = eventData.Authorization.Action,
                Role   = eventData.Authorization.Role,
                Scope  = eventData.Authorization.Scope
            }
                : null;
            this.Caller        = eventData.Caller;
            this.Claims        = new PSDictionaryElement(eventData.Claims);
            this.CorrelationId = eventData.CorrelationId;
            this.Description   = eventData.Description;

            this.EventDataId    = eventData.EventDataId;
            this.EventName      = eventData.EventName;
            this.Category       = eventData.Category;
            this.EventTimestamp = eventData.EventTimestamp;
            this.HttpRequest    = eventData.HttpRequest != null
                ? new PSEventDataHttpRequest
            {
                ClientId        = eventData.HttpRequest.ClientRequestId,
                ClientIpAddress = eventData.HttpRequest.ClientIpAddress,
                Method          = eventData.HttpRequest.Method,
                Url             = eventData.HttpRequest.Uri
            }
                : null;
            this.Id                   = eventData.Id;
            this.Level                = eventData.Level;
            this.OperationId          = eventData.OperationId;
            this.OperationName        = eventData.OperationName;
            this.Properties           = new PSDictionaryElement(eventData.Properties);
            this.ResourceGroupName    = eventData.ResourceGroupName;
            this.ResourceProviderName = eventData.ResourceProviderName;
            this.ResourceId           = eventData.ResourceId;
            this.Status               = eventData.Status;
            this.SubmissionTimestamp  = eventData.SubmissionTimestamp;
            this.SubscriptionId       = eventData.SubscriptionId;
            this.SubStatus            = eventData.SubStatus;
        }