12
12
# limitations under the License.
13
13
# ----------------------------------------------------------------------------------
14
14
15
- param (
15
+ param
16
+ (
16
17
# VirtualMachine, VirtualMachineScaleSet, etc.
17
18
[Parameter (Mandatory = $true )]
18
19
[string ]$OperationName ,
27
28
[string ]$FileOutputFolder ,
28
29
29
30
[Parameter (Mandatory = $false )]
30
- [System.Reflection.MethodInfo ]$FriendMethodInfo
31
+ [System.Reflection.MethodInfo ]$FriendMethodInfo = $null
31
32
)
32
33
33
34
. " $PSScriptRoot \Import-StringFunction.ps1" ;
@@ -37,22 +38,27 @@ param(
37
38
# Sample: VirtualMachineGetMethod.cs
38
39
function Generate-PsFunctionCommandImpl
39
40
{
40
- param (
41
+ param
42
+ (
41
43
[Parameter (Mandatory = $true )]
42
44
[string ]$opShortName ,
43
45
44
46
[Parameter (Mandatory = $true )]
45
47
[System.Reflection.MethodInfo ]$operation_method_info ,
46
48
47
49
[Parameter (Mandatory = $true )]
48
- [string ]$fileOutputFolder
50
+ [string ]$fileOutputFolder ,
51
+
52
+ [Parameter (Mandatory = $false )]
53
+ [System.Reflection.MethodInfo ]$FriendMethodInfo = $null
49
54
)
50
55
51
56
$componentName = Get-ComponentName $ModelClassNameSpace ;
52
57
$invoke_cmdlet_class_name = ' InvokeAzure' + $componentName + ' MethodCmdlet' ;
53
58
$parameter_cmdlet_class_name = ' NewAzure' + $componentName + ' ArgumentListCmdlet' ;
54
59
55
60
$methodName = ($operation_method_info.Name.Replace (' Async' , ' ' ));
61
+
56
62
$return_type_info = $operation_method_info.ReturnType ;
57
63
$normalized_output_type_name = Get-NormalizedTypeName $return_type_info ;
58
64
$cmdlet_verb = " Invoke" ;
@@ -73,6 +79,13 @@ function Generate-PsFunctionCommandImpl
73
79
74
80
$invoke_param_set_name = $cmdlet_op_short_name + $methodName ;
75
81
82
+ # Process Friend Parameter Set and Method Names
83
+ if ($FriendMethodInfo -ne $null -and $FriendMethodInfo.Name -ne $null )
84
+ {
85
+ $friendMethodName = ($FriendMethodInfo.Name.Replace (' Async' , ' ' ));
86
+ $friend_param_set_name = $cmdlet_op_short_name + $friendMethodName ;
87
+ }
88
+
76
89
$file_full_path = $fileOutputFolder + ' /' + $cmdlet_class_name + ' .cs' ;
77
90
if (Test-Path $file_full_path )
78
91
{
@@ -547,7 +560,8 @@ ${cmdlet_partial_class_code}
547
560
# azure vm get
548
561
function Generate-CliFunctionCommandImpl
549
562
{
550
- param (
563
+ param
564
+ (
551
565
# VirtualMachine, VirtualMachineScaleSet, etc.
552
566
[Parameter (Mandatory = $true )]
553
567
[string ]$OperationName ,
@@ -948,7 +962,7 @@ function Generate-CliFunctionCommandImpl
948
962
return $code ;
949
963
}
950
964
951
- Generate- PsFunctionCommandImpl $OperationName $MethodInfo $FileOutputFolder ;
965
+ Generate- PsFunctionCommandImpl $OperationName $MethodInfo $FileOutputFolder $FriendMethodInfo ;
952
966
953
967
# CLI Function Command Code
954
968
Generate- CliFunctionCommandImpl $OperationName $MethodInfo $ModelClassNameSpace $FileOutputFolder ;
0 commit comments