493 lines
19 KiB
C#

//----------------------------------------------------------------------------
//
// Copyright (c) Intel Corporation, 2003 - 2012 All Rights Reserved.
//
// File: CIM_PolicyRule.cs
//
// Contents: The central class used for representing the 'If Condition then Action' semantics of a policy rule. A PolicyRule condition, in the most general sense, is represented as either an ORed set of ANDed conditions (Disjunctive Normal Form, or DNF) or an ANDed set of ORed conditions (Conjunctive Normal Form, or CNF). Individual conditions may either be negated (NOT C) or unnegated (C). The actions specified by a PolicyRule are to be performed if and only if the PolicyRule condition (whether it is represented in DNF or CNF) evaluates to TRUE.
//
// The conditions and actions associated with a PolicyRule are modeled, respectively, with subclasses of PolicyCondition and PolicyAction. These condition and action objects are tied to instances of PolicyRule by the PolicyConditionInPolicyRule and PolicyActionInPolicyRule aggregations.
//
// A PolicyRule may also be associated with one or more policy time periods, indicating the schedule according to which the policy rule is active and inactive. In this case it is the PolicySetValidityPeriod aggregation that provides this linkage.
//
// The PolicyRule class uses the property ConditionListType, to indicate whether the conditions for the rule are in DNF (disjunctive normal form), CNF (conjunctive normal form) or, in the case of a rule with no conditions, as an UnconditionalRule. The PolicyConditionInPolicyRule aggregation contains two additional properties to complete the representation of the Rule's conditional expression. The first of these properties is an integer to partition the referenced PolicyConditions into one or more groups, and the second is a Boolean to indicate whether a referenced Condition is negated. An example shows how ConditionListType and these two additional properties provide a unique representation of a set of PolicyConditions in either DNF or CNF.
//
// Suppose we have a PolicyRule that aggregates five PolicyConditions C1 through C5, with the following values in the properties of the five PolicyConditionInPolicyRule associations:
// C1: GroupNumber = 1, ConditionNegated = FALSE
// C2: GroupNumber = 1, ConditionNegated = TRUE
// C3: GroupNumber = 1, ConditionNegated = FALSE
// C4: GroupNumber = 2, ConditionNegated = FALSE
// C5: GroupNumber = 2, ConditionNegated = FALSE
//
// If ConditionListType = DNF, then the overall condition for the PolicyRule is:
// (C1 AND (NOT C2) AND C3) OR (C4 AND C5)
//
// On the other hand, if ConditionListType = CNF, then the overall condition for the PolicyRule is:
// (C1 OR (NOT C2) OR C3) AND (C4 OR C5)
//
// In both cases, there is an unambiguous specification of the overall condition that is tested to determine whether to perform the PolicyActions associated with the PolicyRule.
//
// PolicyRule instances may also be used to aggregate other PolicyRules and/or PolicyGroups. When used in this way to implement nested rules, the conditions of the aggregating rule apply to the subordinate rules as well. However, any side effects of condition evaluation or the execution of actions MUST NOT affect the result of the evaluation of other conditions evaluated by the rule engine in the same evaluation pass. That is, an implementation of a rule engine MAY evaluate all conditions in any order before applying the priority and determining which actions are to be executed.
// This file was automatically generated from CIM_PolicyRule.mof
//
//----------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
using System.Globalization;
using System.Xml.Serialization;
using System.IO;
using Intel.Manageability.WSManagement;
using Intel.Manageability.Cim.Untyped;
namespace Intel.Manageability.Cim.Typed
{
/// <summary>
///The central class used for representing the 'If Condition then Action' semantics of a policy rule. A PolicyRule condition, in the most general sense, is represented as either an ORed set of ANDed conditions (Disjunctive Normal Form, or DNF) or an ANDed set of ORed conditions (Conjunctive Normal Form, or CNF). Individual conditions may either be negated (NOT C) or unnegated (C). The actions specified by a PolicyRule are to be performed if and only if the PolicyRule condition (whether it is represented in DNF or CNF) evaluates to TRUE.
///The conditions and actions associated with a PolicyRule are modeled, respectively, with subclasses of PolicyCondition and PolicyAction. These condition and action objects are tied to instances of PolicyRule by the PolicyConditionInPolicyRule and PolicyActionInPolicyRule aggregations.
///A PolicyRule may also be associated with one or more policy time periods, indicating the schedule according to which the policy rule is active and inactive. In this case it is the PolicySetValidityPeriod aggregation that provides this linkage.
///The PolicyRule class uses the property ConditionListType, to indicate whether the conditions for the rule are in DNF (disjunctive normal form), CNF (conjunctive normal form) or, in the case of a rule with no conditions, as an UnconditionalRule. The PolicyConditionInPolicyRule aggregation contains two additional properties to complete the representation of the Rule's conditional expression. The first of these properties is an integer to partition the referenced PolicyConditions into one or more groups, and the second is a Boolean to indicate whether a referenced Condition is negated. An example shows how ConditionListType and these two additional properties provide a unique representation of a set of PolicyConditions in either DNF or CNF.
///Suppose we have a PolicyRule that aggregates five PolicyConditions C1 through C5, with the following values in the properties of the five PolicyConditionInPolicyRule associations:
///C1: GroupNumber = 1, ConditionNegated = FALSE
///C2: GroupNumber = 1, ConditionNegated = TRUE
///C3: GroupNumber = 1, ConditionNegated = FALSE
///C4: GroupNumber = 2, ConditionNegated = FALSE
///C5: GroupNumber = 2, ConditionNegated = FALSE
///If ConditionListType = DNF, then the overall condition for the PolicyRule is:
///(C1 AND (NOT C2) AND C3) OR (C4 AND C5)
///On the other hand, if ConditionListType = CNF, then the overall condition for the PolicyRule is:
///(C1 OR (NOT C2) OR C3) AND (C4 OR C5)
///In both cases, there is an unambiguous specification of the overall condition that is tested to determine whether to perform the PolicyActions associated with the PolicyRule.
///PolicyRule instances may also be used to aggregate other PolicyRules and/or PolicyGroups. When used in this way to implement nested rules, the conditions of the aggregating rule apply to the subordinate rules as well. However, any side effects of condition evaluation or the execution of actions MUST NOT affect the result of the evaluation of other conditions evaluated by the rule engine in the same evaluation pass. That is, an implementation of a rule engine MAY evaluate all conditions in any order before applying the priority and determining which actions are to be executed.
/// </summary>
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_PolicyRule")]
[System.Xml.Serialization.XmlRootAttribute("CIM_PolicyRule", Namespace="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_PolicyRule", IsNullable=false)]
public class CIM_PolicyRule : CIM_PolicySet
{
/// <summary>
/// Default constructor.
/// </summary>
public CIM_PolicyRule() :base()
{
}
/// <summary>
/// Constructor that recieves an xml string for deserialization.
/// </summary>
/// <param name="xml">xml string to deserialize</param>
public CIM_PolicyRule(string xml): base((IWSManClient)null)
{
this.Deserialize(xml);
}
/// <summary>
/// Constructor which recieves a Ws-Management client object.
/// </summary>
/// <param name="client">Ws-Management client</param>
public CIM_PolicyRule(IWSManClient client): base(client)
{
}
/// <summary>
/// Remove ConditionListType field.
/// Note: This method will succeed only if this field is optional in the concrete object.
/// </summary>
public virtual void RemoveConditionListType()
{
RemoveField("ConditionListType");
}
/// <summary>
/// Is true if the field ConditionListType exists in the current object,
/// otherwise is false.
/// </summary>
public virtual bool ConditionListTypeExist
{
get
{
return ContainsField("ConditionListType");
}
}
/// <summary>
/// Optional, Indicates whether the list of PolicyConditions associated with this PolicyRule is in disjunctive normal form (DNF), conjunctive normal form (CNF), or has no conditions (i.e., is an UnconditionalRule) and is automatically evaluated to "True." The default value is 1 ("DNF").
/// </summary>
[CimField(false, false)]
public virtual ushort ConditionListType
{
get
{
return ushort.Parse(this["ConditionListType"][0], CultureInfo.InvariantCulture);
}
set
{
this.SetOrAddField("ConditionListType",value.ToString(CultureInfo.InvariantCulture));
}
}
/// <summary>
/// Key, Required, CreationClassName indicates the name of the class or the subclass used in the creation of an instance. When used with the other key properties of this class, this property allows all instances of this class and its subclasses to be uniquely identified.
/// </summary>
[CimField(true, true)]
public virtual string CreationClassName
{
get
{
return this.GetField("CreationClassName")[0];
}
set
{
this.SetOrAddField("CreationClassName",value);
}
}
/// <summary>
/// Remove ExecutionStrategy field.
/// Note: This method will succeed only if this field is optional in the concrete object.
/// </summary>
public virtual void RemoveExecutionStrategy()
{
RemoveField("ExecutionStrategy");
}
/// <summary>
/// Is true if the field ExecutionStrategy exists in the current object,
/// otherwise is false.
/// </summary>
public virtual bool ExecutionStrategyExist
{
get
{
return ContainsField("ExecutionStrategy");
}
}
/// <summary>
/// Optional, ExecutionStrategy defines the strategy to be used in executing the sequenced actions aggregated by this PolicyRule. There are three execution strategies:
///
/// Do Until Success - execute actions according to predefined order, until successful execution of a single action.
/// Do All - execute ALL actions which are part of the modeled set, according to their predefined order. Continue doing this, even if one or more of the actions fails.
/// Do Until Failure - execute actions according to predefined order, until the first failure in execution of an action instance.
/// </summary>
[CimField(false, false)]
public virtual ushort ExecutionStrategy
{
get
{
return ushort.Parse(this["ExecutionStrategy"][0], CultureInfo.InvariantCulture);
}
set
{
this.SetOrAddField("ExecutionStrategy",value.ToString(CultureInfo.InvariantCulture));
}
}
/// <summary>
/// Remove Mandatory field.
/// Note: This method will succeed only if this field is optional in the concrete object.
/// </summary>
public virtual void RemoveMandatory()
{
RemoveField("Mandatory");
}
/// <summary>
/// Is true if the field Mandatory exists in the current object,
/// otherwise is false.
/// </summary>
public virtual bool MandatoryExist
{
get
{
return ContainsField("Mandatory");
}
}
/// <summary>
/// Optional, A flag indicating that the evaluation of the Policy Conditions and execution of PolicyActions (if the Conditions evaluate to TRUE) is required. The evaluation of a PolicyRule MUST be attempted if the Mandatory property value is TRUE. If the Mandatory property is FALSE, then the evaluation of the Rule is 'best effort' and MAY be ignored.
/// </summary>
[CimField(false, false)]
public virtual bool Mandatory
{
get
{
return bool.Parse(this["Mandatory"][0]);
}
set
{
this.SetOrAddField("Mandatory",value.ToString().ToLower(CultureInfo.InvariantCulture));
}
}
/// <summary>
/// Key, Required, A user-friendly name of this PolicyRule.
/// </summary>
[CimField(true, true)]
public virtual string PolicyRuleName
{
get
{
return this.GetField("PolicyRuleName")[0];
}
set
{
this.SetOrAddField("PolicyRuleName",value);
}
}
/// <summary>
/// Remove Priority field.
/// Note: This method will succeed only if this field is optional in the concrete object.
/// </summary>
public virtual void RemovePriority()
{
RemoveField("Priority");
}
/// <summary>
/// Is true if the field Priority exists in the current object,
/// otherwise is false.
/// </summary>
public virtual bool PriorityExist
{
get
{
return ContainsField("Priority");
}
}
/// <summary>
/// Optional, PolicyRule.Priority is deprecated and replaced by providing the priority for a rule (and a group) in the context of the aggregating PolicySet instead of the priority being used for all aggregating PolicySet instances. Thus, the assignment of priority values is much simpler.
///
/// A non-negative integer for prioritizing this Policy Rule relative to other Rules. A larger value indicates a higher priority. The default value is 0.
/// </summary>
[CimField(false, false)]
public virtual ushort Priority
{
get
{
return ushort.Parse(this["Priority"][0], CultureInfo.InvariantCulture);
}
set
{
this.SetOrAddField("Priority",value.ToString(CultureInfo.InvariantCulture));
}
}
/// <summary>
/// Remove RuleUsage field.
/// Note: This method will succeed only if this field is optional in the concrete object.
/// </summary>
public virtual void RemoveRuleUsage()
{
RemoveField("RuleUsage");
}
/// <summary>
/// Is true if the field RuleUsage exists in the current object,
/// otherwise is false.
/// </summary>
public virtual bool RuleUsageExist
{
get
{
return ContainsField("RuleUsage");
}
}
/// <summary>
/// Optional, A free-form string that can be used to provide guidelines on how this PolicyRule should be used.
/// </summary>
[CimField(false, false)]
public virtual string RuleUsage
{
get
{
return this.GetField("RuleUsage")[0];
}
set
{
this.SetOrAddField("RuleUsage",value);
}
}
/// <summary>
/// Remove SequencedActions field.
/// Note: This method will succeed only if this field is optional in the concrete object.
/// </summary>
public virtual void RemoveSequencedActions()
{
RemoveField("SequencedActions");
}
/// <summary>
/// Is true if the field SequencedActions exists in the current object,
/// otherwise is false.
/// </summary>
public virtual bool SequencedActionsExist
{
get
{
return ContainsField("SequencedActions");
}
}
/// <summary>
/// Optional, This property gives a policy administrator a way of specifying how the ordering of the PolicyActions associated with this PolicyRule is to be interpreted. Three values are supported:
/// o mandatory(1): Do the actions in the indicated order, or don't do them at all.
/// o recommended(2): Do the actions in the indicated order if you can, but if you can't do them in this order, do them in another order if you can.
/// o dontCare(3): Do them -- I don't care about the order.
/// The default value is 3 ("DontCare").
/// </summary>
[CimField(false, false)]
public virtual ushort SequencedActions
{
get
{
return ushort.Parse(this["SequencedActions"][0], CultureInfo.InvariantCulture);
}
set
{
this.SetOrAddField("SequencedActions",value.ToString(CultureInfo.InvariantCulture));
}
}
/// <summary>
/// Key, Required, The scoping System's CreationClassName.
/// </summary>
[CimField(true, true)]
public virtual string SystemCreationClassName
{
get
{
return this.GetField("SystemCreationClassName")[0];
}
set
{
this.SetOrAddField("SystemCreationClassName",value);
}
}
/// <summary>
/// Key, Required, The scoping System's Name.
/// </summary>
[CimField(true, true)]
public virtual string SystemName
{
get
{
return this.GetField("SystemName")[0];
}
set
{
this.SetOrAddField("SystemName",value);
}
}
/// <summary>
/// Enumerate instances of CIM_PolicyRule class at an endpoint.
/// </summary>
/// <param name="client">WS-Management client</param>
/// <param name="cimKeys">Keys for selecting the instances</param>
/// <returns>Collection of CIM_PolicyRule objects</returns>
public static new Collection<CIM_PolicyRule> Enumerate(IWSManClient client, CimBase.CimKeys cimKeys)
{
List<CIM_PolicyRule> ret = CimBase.Enumerate<CIM_PolicyRule>(client, cimKeys);
return new Collection<CIM_PolicyRule>(ret);
}
/// <summary>
/// Enumerate instances of CIM_PolicyRule class at an endpoint.
/// </summary>
/// <param name="client">WS-Management client</param>
/// <returns>Collection of CIM_PolicyRule objects</returns>
public static new Collection<CIM_PolicyRule> Enumerate(IWSManClient client)
{
List<CIM_PolicyRule> ret = CimBase.Enumerate<CIM_PolicyRule>(client);
return new Collection<CIM_PolicyRule>(ret);
}
/// <summary>
/// Delete the instance of CIM_PolicyRule if it is singular.
/// Note: This method will succeed only if a single instance of the class exists.
/// </summary>
/// <param name="client">WS-Management client</param>
public static new void Delete(IWSManClient client)
{
CimBase.Delete<CIM_PolicyRule>(client);
}
/// <summary>
/// Represents the keys of the CIM_PolicyRule class.
/// </summary>
public new class CimKeys : CIM_PolicySet.CimKeys
{
/// <summary>
/// Key, Required, CreationClassName indicates the name of the class or the subclass used in the creation of an instance. When used with the other key properties of this class, this property allows all instances of this class and its subclasses to be uniquely identified.
/// </summary>
public virtual string CreationClassName
{
get
{
return GetKey("CreationClassName");
}
set
{
SetOrAddKey("CreationClassName", value);
}
}
/// <summary>
/// Key, Required, A user-friendly name of this PolicyRule.
/// </summary>
public virtual string PolicyRuleName
{
get
{
return GetKey("PolicyRuleName");
}
set
{
SetOrAddKey("PolicyRuleName", value);
}
}
/// <summary>
/// Key, Required, The scoping System's CreationClassName.
/// </summary>
public virtual string SystemCreationClassName
{
get
{
return GetKey("SystemCreationClassName");
}
set
{
SetOrAddKey("SystemCreationClassName", value);
}
}
/// <summary>
/// Key, Required, The scoping System's Name.
/// </summary>
public virtual string SystemName
{
get
{
return GetKey("SystemName");
}
set
{
SetOrAddKey("SystemName", value);
}
}
}
}
}