MegaBites-AI/Windows-powershell
0372
1// Copyright (c) Microsoft Corporation.2// Licensed under the MIT License.3 4using System;5 6namespace Microsoft.PowerShell.Cmdletization7{8 /// <summary>9 /// Describes how to handle the method parameter.10 /// </summary>11 [Flags]12 public enum MethodParameterBindings13 {14 /// <summary>15 /// Bind value of a method parameter based on arguments of a cmdlet parameter.16 /// </summary>17 In = 1,18 19 /// <summary>20 /// Method invocation is expected to set the value of the method parameter. Cmdlet should emit the value of method parameter to the downstream pipe.21 /// </summary>22 Out = 2,23 24 /// <summary>25 /// Method invocation is expected to set the value of the method parameter. Cmdlet should emit a non-terminating error when the value evaluates to $true.26 /// </summary>27 Error = 4,28 }29 30 /// <summary>31 /// Parameter of a method in an object model wrapped by <see cref="CmdletAdapter<TObjectInstance>"/>32 /// </summary>33 public sealed class MethodParameter34 {35 /// <summary>36 /// Name of the method parameter.37 /// </summary>38 public string Name { get; set; }39 40 /// <summary>41 /// Type of the parameter (as seen in the PowerShell layer on the client)42 /// </summary>43 public Type ParameterType { get; set; }44 45 /// <summary>46 /// Contents of the ETS type attribute in the CDXML file (or <see langword="null"/> if that attribute was not specified).47 /// The expectation is that the CmdletAdapter will stamp this value onto PSTypeNames of emitted objects.48 /// </summary>49 public string ParameterTypeName { get; set; }50 51 /// <summary>52 /// Bindings of the method parameter (in/out/error)53 /// </summary>54 public MethodParameterBindings Bindings { get; set; }55 56 /// <summary>57 /// Value of the argument of the method parameter.58 /// </summary>59 public object Value { get; set; }60 61 /// <summary>62 /// Whether the value is 1) an explicit default (*) or 2) has been bound from cmdlet parameter63 /// (*) explicit default = whatever was in DefaultValue attribute in Cmdletization XML.64 /// </summary>65 public bool IsValuePresent { get; set; }66 // TODO/FIXME: this should be renamed to ValueExplicitlySpecified or something like this67 }68}69 