Esempio n. 1
0
        /// <summary>
        /// Returns true if Event instances are equal
        /// </summary>
        /// <param name="other">Instance of Event to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Event other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Id == other.Id ||
                     Id != null &&
                     Id.Equals(other.Id)
                     ) &&
                 (
                     EventChannels == other.EventChannels ||
                     EventChannels != null &&
                     other.EventChannels != null &&
                     EventChannels.SequenceEqual(other.EventChannels)
                 ) &&
                 (
                     Properties == other.Properties ||
                     Properties != null &&
                     other.Properties != null &&
                     Properties.SequenceEqual(other.Properties)
                 ));
        }
Esempio n. 2
0
 /// <summary>
 /// Initializes a new instance of the EventData class.
 /// </summary>
 /// <param name="channels">the event channels. The regular event logs,
 /// that you see in the Azure Management Portals, flow through the
 /// 'Operation' channel. Possible values include: 'Admin', 'Operation',
 /// 'Debug', 'Analytics'</param>
 /// <param name="level">the event level. Possible values include:
 /// 'Critical', 'Error', 'Warning', 'Informational', 'Verbose'</param>
 /// <param name="eventTimestamp">the timestamp of when the event was
 /// generated by the Azure service processing the request corresponding
 /// the event. It in ISO 8601 format.</param>
 /// <param name="submissionTimestamp">the timestamp of when the event
 /// became available for querying via this API. It is in ISO 8601
 /// format. This value should not be confused eventTimestamp. As there
 /// might be a delay between the occurence time of the event, and the
 /// time that the event is submitted to the Azure logging
 /// infrastructure.</param>
 /// <param name="authorization">the authorization used by the user who
 /// has performed the operation that led to this event. This captures
 /// the RBAC properties of the event. These usually include the
 /// 'action', 'role' and the 'scope'</param>
 /// <param name="claims">key value pairs to identify ARM
 /// permissions.</param>
 /// <param name="caller">the email address of the user who has
 /// performed the operation, the UPN claim or SPN claim based on
 /// availability.</param>
 /// <param name="description">the description of the event.</param>
 /// <param name="id">the Id of this event as required by ARM for RBAC.
 /// It contains the EventDataID and a timestamp information.</param>
 /// <param name="eventDataId">the event data Id. This is a unique
 /// identifier for an event.</param>
 /// <param name="correlationId">the correlation Id, usually a GUID in
 /// the string format. The correlation Id is shared among the events
 /// that belong to the same uber operation.</param>
 /// <param name="eventName">the event name. This value should not be
 /// confused with OperationName. For practical purposes, OperationName
 /// might be more appealing to end users.</param>
 /// <param name="category">the event category.</param>
 /// <param name="httpRequest">the HTTP request info. Usually includes
 /// the 'clientRequestId', 'clientIpAddress' (IP address of the user
 /// who initiated the event) and 'method' (HTTP method e.g.
 /// PUT).</param>
 /// <param name="resourceGroupName">the resource group name of the
 /// impacted resource.</param>
 /// <param name="resourceProviderName">the resource provider name of
 /// the impacted resource.</param>
 /// <param name="resourceId">the resource uri that uniquely identifies
 /// the resource that caused this event.</param>
 /// <param name="resourceType">the resource type</param>
 /// <param name="operationId">It is usually a GUID shared among the
 /// events corresponding to single operation. This value should not be
 /// confused with EventName.</param>
 /// <param name="operationName">the operation name.</param>
 /// <param name="properties">the set of &lt;Key, Value&gt; pairs
 /// (usually a Dictionary&lt;String, String&gt;) that includes details
 /// about the event.</param>
 /// <param name="status">a string describing the status of the
 /// operation. Some typical values are: Started, In progress,
 /// Succeeded, Failed, Resolved.</param>
 /// <param name="subStatus">the event sub status. Most of the time,
 /// when included, this captures the HTTP status code of the REST call.
 /// Common values are: OK (HTTP Status Code: 200), Created (HTTP Status
 /// Code: 201), Accepted (HTTP Status Code: 202), No Content (HTTP
 /// Status Code: 204), Bad Request(HTTP Status Code: 400), Not Found
 /// (HTTP Status Code: 404), Conflict (HTTP Status Code: 409), Internal
 /// Server Error (HTTP Status Code: 500), Service Unavailable (HTTP
 /// Status Code:503), Gateway Timeout (HTTP Status Code: 504)</param>
 /// <param name="subscriptionId">the Azure subscription Id usually a
 /// GUID.</param>
 /// <param name="tenantId">the Azure tenant Id</param>
 public EventData(EventChannels channels, EventLevel level, System.DateTime eventTimestamp, System.DateTime submissionTimestamp, SenderAuthorization authorization = default(SenderAuthorization), System.Collections.Generic.IDictionary <string, string> claims = default(System.Collections.Generic.IDictionary <string, string>), string caller = default(string), string description = default(string), string id = default(string), string eventDataId = default(string), string correlationId = default(string), LocalizableString eventName = default(LocalizableString), LocalizableString category = default(LocalizableString), HttpRequestInfo httpRequest = default(HttpRequestInfo), string resourceGroupName = default(string), LocalizableString resourceProviderName = default(LocalizableString), string resourceId = default(string), LocalizableString resourceType = default(LocalizableString), string operationId = default(string), LocalizableString operationName = default(LocalizableString), System.Collections.Generic.IDictionary <string, string> properties = default(System.Collections.Generic.IDictionary <string, string>), LocalizableString status = default(LocalizableString), LocalizableString subStatus = default(LocalizableString), string subscriptionId = default(string), string tenantId = default(string))
 {
     Authorization        = authorization;
     Channels             = channels;
     Claims               = claims;
     Caller               = caller;
     Description          = description;
     Id                   = id;
     EventDataId          = eventDataId;
     CorrelationId        = correlationId;
     EventName            = eventName;
     Category             = category;
     HttpRequest          = httpRequest;
     Level                = level;
     ResourceGroupName    = resourceGroupName;
     ResourceProviderName = resourceProviderName;
     ResourceId           = resourceId;
     ResourceType         = resourceType;
     OperationId          = operationId;
     OperationName        = operationName;
     Properties           = properties;
     Status               = status;
     SubStatus            = subStatus;
     EventTimestamp       = eventTimestamp;
     SubmissionTimestamp  = submissionTimestamp;
     SubscriptionId       = subscriptionId;
     TenantId             = tenantId;
 }
Esempio n. 3
0
        public IEnumerable <IBrokenRule> Validate(object bo)
        {
            List <IBrokenRule> broke = new List <IBrokenRule>();

            foreach (IRuleDescription rle in ValidationList)
            {
                if (EventChannels.Publish <ValidateCEvent>(new ValidateCEvent(this, "CheckRule", rle)).CheckRule)
                {
                    if (rle is IRule)
                    {
                        if (((IRule)rle).IsBroken(bo))
                        {
                            broke.Add(new BrokenRule(rle, bo));
                        }
                    }
                }
            }
            return(broke);
        }
Esempio n. 4
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (Id != null)
         {
             hashCode = hashCode * 59 + Id.GetHashCode();
         }
         if (EventChannels != null)
         {
             hashCode = hashCode * 59 + EventChannels.GetHashCode();
         }
         if (Properties != null)
         {
             hashCode = hashCode * 59 + Properties.GetHashCode();
         }
         return(hashCode);
     }
 }
Esempio n. 5
0
        //string CreateProfile(){}

        void ParseProfile(string profile)
        {
            EventChannel ech;

            channelNumbers = new List <int>();

            _profile = profile;
            XElement root = XElement.Parse(profile);

            IEnumerable <XElement> channels = root.Elements("Mode")
                                              .Where(p => p.Attribute("Value").Value == Mode.ToString()).Elements();

            ChCount = 0;
            foreach (XElement ch in channels)
            {
                channelNumbers.Add(int.Parse(ch.Attribute("ChannelNo").Value));
                ChCount++;
            }

            int modeCount = root.Elements().Count();

            for (int i = 0; i < root.Elements().Count(); i++)
            {
                ModeList.Add(String.Format("Mode_{0}", i + 1));
            }

            if (Id == 0)
            {
                foreach (XElement ch in channels)
                {
                    foreach (XElement evnt in ch.Elements())
                    {
                        ech           = new EventChannel();
                        ech.ChannelNo = int.Parse(ch.Attribute("ChannelNo").Value);
                        ech.EventName = evnt.Attribute("Name").Value;
                        EventChannels.Add(ech);
                    }
                }
            }
        }