// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; using System.Collections; namespace Microsoft.PowerShell.Cmdletization { /// /// Describes whether to report errors when a given filter doesnt match any objects. /// public enum BehaviorOnNoMatch { /// /// Default behavior is to be consistent with the built-in cmdlets: /// - When a wildcard is specified, then no errors are reported (i.e. Get-Process -Name noSuchProcess*) /// - When no wildcard is specified, then errors are reported (i.e. Get-Process -Name noSuchProcess) /// /// Note that the following conventions are adopted: /// - Min/max queries /// ( and /// ) /// are treated as wildcards /// - Exclusions /// () /// are treated as wildcards /// - Associations /// () /// are treated as not a wildcard. /// Default = 0, /// /// ReportErrors forces reporting of errors that in other circumstances would be reported if no objects matched the filters. /// ReportErrors, /// /// SilentlyContinue suppresses errors that in other circumstances would be reported if no objects matched the filters. /// SilentlyContinue, } /// /// QueryBuilder supports building of object model queries in an object-model-agnostic way. /// public abstract class QueryBuilder { /// /// Modifies the query, so that it only returns objects with a given property value. /// /// Property name to query on. /// Property values to accept in the query. /// /// if should be treated as a containing a wildcard pattern; /// otherwise. /// /// /// Describes how to handle filters that didn't match any objects /// public virtual void FilterByProperty(string propertyName, IEnumerable allowedPropertyValues, bool wildcardsEnabled, BehaviorOnNoMatch behaviorOnNoMatch) { throw new NotImplementedException(); } /// /// Modifies the query, so that it does not return objects with a given property value. /// /// Property name to query on. /// Property values to reject in the query. /// /// if should be treated as a containing a wildcard pattern; /// otherwise. /// /// /// Describes how to handle filters that didn't match any objects /// public virtual void ExcludeByProperty(string propertyName, IEnumerable excludedPropertyValues, bool wildcardsEnabled, BehaviorOnNoMatch behaviorOnNoMatch) { throw new NotImplementedException(); } /// /// Modifies the query, so that it returns only objects that have a property value greater than or equal to a threshold. /// /// Property name to query on. /// Minimum property value. /// /// Describes how to handle filters that didn't match any objects /// public virtual void FilterByMinPropertyValue(string propertyName, object minPropertyValue, BehaviorOnNoMatch behaviorOnNoMatch) { throw new NotImplementedException(); } /// /// Modifies the query, so that it returns only objects that have a property value less than or equal to a threshold. /// /// Property name to query on. /// Maximum property value. /// /// Describes how to handle filters that didn't match any objects /// public virtual void FilterByMaxPropertyValue(string propertyName, object maxPropertyValue, BehaviorOnNoMatch behaviorOnNoMatch) { throw new NotImplementedException(); } /// /// Modifies the query, so that it returns only objects associated with /// /// Object that query results have to be associated with. /// Name of the association. /// Name of the role that has in the association. /// Name of the role that query results have in the association. /// /// Describes how to handle filters that didn't match any objects /// public virtual void FilterByAssociatedInstance(object associatedInstance, string associationName, string sourceRole, string resultRole, BehaviorOnNoMatch behaviorOnNoMatch) { throw new NotImplementedException(); } /// /// Sets a query option. /// /// /// public virtual void AddQueryOption(string optionName, object optionValue) { throw new NotImplementedException(); } } }