MegaBites-AI/Windows-powershell
0372
1// Copyright (c) Microsoft Corporation.2// Licensed under the MIT License.3 4using System;5using System.Collections;6 7namespace Microsoft.PowerShell.Cmdletization8{9 /// <summary>10 /// Describes whether to report errors when a given filter doesnt match any objects.11 /// </summary>12 public enum BehaviorOnNoMatch13 {14 /// <summary>15 /// Default behavior is to be consistent with the built-in cmdlets:16 /// - When a wildcard is specified, then no errors are reported (i.e. Get-Process -Name noSuchProcess*)17 /// - When no wildcard is specified, then errors are reported (i.e. Get-Process -Name noSuchProcess)18 ///19 /// Note that the following conventions are adopted:20 /// - Min/max queries21 /// (<see cref="QueryBuilder.FilterByMinPropertyValue(string,object,BehaviorOnNoMatch)"/> and22 /// <see cref="QueryBuilder.FilterByMaxPropertyValue(string,object,BehaviorOnNoMatch)"/>)23 /// are treated as wildcards24 /// - Exclusions25 /// (<see cref="QueryBuilder.ExcludeByProperty(string,System.Collections.IEnumerable,bool,BehaviorOnNoMatch)"/>)26 /// are treated as wildcards27 /// - Associations28 /// (<see cref="QueryBuilder.FilterByAssociatedInstance(object,string,string,string,BehaviorOnNoMatch)"/>)29 /// are treated as not a wildcard.30 /// </summary>31 Default = 0,32 33 /// <summary>34 /// <c>ReportErrors</c> forces reporting of errors that in other circumstances would be reported if no objects matched the filters.35 /// </summary>36 ReportErrors,37 38 /// <summary>39 /// <c>SilentlyContinue</c> suppresses errors that in other circumstances would be reported if no objects matched the filters.40 /// </summary>41 SilentlyContinue,42 }43 44 /// <summary>45 /// QueryBuilder supports building of object model queries in an object-model-agnostic way.46 /// </summary>47 public abstract class QueryBuilder48 {49 /// <summary>50 /// Modifies the query, so that it only returns objects with a given property value.51 /// </summary>52 /// <param name="propertyName">Property name to query on.</param>53 /// <param name="allowedPropertyValues">Property values to accept in the query.</param>54 /// <param name="wildcardsEnabled">55 /// <see langword="true"/> if <paramref name="allowedPropertyValues"/> should be treated as a <see cref="string"/> containing a wildcard pattern;56 /// <see langword="false"/> otherwise.57 /// </param>58 /// <param name="behaviorOnNoMatch">59 /// Describes how to handle filters that didn't match any objects60 /// </param>61 public virtual void FilterByProperty(string propertyName, IEnumerable allowedPropertyValues, bool wildcardsEnabled, BehaviorOnNoMatch behaviorOnNoMatch)62 {63 throw new NotImplementedException();64 }65 66 /// <summary>67 /// Modifies the query, so that it does not return objects with a given property value.68 /// </summary>69 /// <param name="propertyName">Property name to query on.</param>70 /// <param name="excludedPropertyValues">Property values to reject in the query.</param>71 /// <param name="wildcardsEnabled">72 /// <see langword="true"/> if <paramref name="excludedPropertyValues"/> should be treated as a <see cref="string"/> containing a wildcard pattern;73 /// <see langword="false"/> otherwise.74 /// </param>75 /// <param name="behaviorOnNoMatch">76 /// Describes how to handle filters that didn't match any objects77 /// </param>78 public virtual void ExcludeByProperty(string propertyName, IEnumerable excludedPropertyValues, bool wildcardsEnabled, BehaviorOnNoMatch behaviorOnNoMatch)79 {80 throw new NotImplementedException();81 }82 83 /// <summary>84 /// Modifies the query, so that it returns only objects that have a property value greater than or equal to a <paramref name="minPropertyValue"/> threshold.85 /// </summary>86 /// <param name="propertyName">Property name to query on.</param>87 /// <param name="minPropertyValue">Minimum property value.</param>88 /// <param name="behaviorOnNoMatch">89 /// Describes how to handle filters that didn't match any objects90 /// </param>91 public virtual void FilterByMinPropertyValue(string propertyName, object minPropertyValue, BehaviorOnNoMatch behaviorOnNoMatch)92 {93 throw new NotImplementedException();94 }95 96 /// <summary>97 /// Modifies the query, so that it returns only objects that have a property value less than or equal to a <paramref name="maxPropertyValue"/> threshold.98 /// </summary>99 /// <param name="propertyName">Property name to query on.</param>100 /// <param name="maxPropertyValue">Maximum property value.</param>101 /// <param name="behaviorOnNoMatch">102 /// Describes how to handle filters that didn't match any objects103 /// </param>104 public virtual void FilterByMaxPropertyValue(string propertyName, object maxPropertyValue, BehaviorOnNoMatch behaviorOnNoMatch)105 {106 throw new NotImplementedException();107 }108 109 /// <summary>110 /// Modifies the query, so that it returns only objects associated with <paramref name="associatedInstance"/>111 /// </summary>112 /// <param name="associatedInstance">Object that query results have to be associated with.</param>113 /// <param name="associationName">Name of the association.</param>114 /// <param name="resultRole">Name of the role that <paramref name="associatedInstance"/> has in the association.</param>115 /// <param name="sourceRole">Name of the role that query results have in the association.</param>116 /// <param name="behaviorOnNoMatch">117 /// Describes how to handle filters that didn't match any objects118 /// </param>119 public virtual void FilterByAssociatedInstance(object associatedInstance, string associationName, string sourceRole, string resultRole, BehaviorOnNoMatch behaviorOnNoMatch)120 {121 throw new NotImplementedException();122 }123 124 /// <summary>125 /// Sets a query option.126 /// </summary>127 /// <param name="optionName"></param>128 /// <param name="optionValue"></param>129 public virtual void AddQueryOption(string optionName, object optionValue)130 {131 throw new NotImplementedException();132 }133 }134}135 