1
1
# generate the json includes breaking change information
2
2
3
- # install-module azpreview
4
-
5
- class breakingchangeResult {
3
+ class breakingchangeResult {
6
4
[System.String ] $Name
7
5
[System.String ] $TypeBreakingChange
8
6
}
9
7
10
- class breakingchangeParaFunc {
8
+ class breakingchangeParaFunc {
11
9
[System.String ] $Name
12
10
[System.String ] $TypeBreakingChange
13
11
[System.String ] $FuncName
14
12
}
15
13
16
- class breakingchangeParaCmdlet {
14
+ class breakingchangeParaCmdlet {
17
15
[System.String ] $Name
18
16
[System.String ] $TypeBreakingChange
19
17
[System.String ] $CmdletName
20
18
}
21
19
22
- $results = @ {
23
- }
20
+ $results = @ {}
24
21
25
22
$results [" updateTime" ] = Get-Date
26
23
$results [" func" ] = @ ()
27
24
$results [" cmdlet" ] = @ ()
28
25
$results [" para_func" ] = @ ()
29
26
$results [" para_cmdlet" ] = @ ()
30
27
31
- $results [" updateTime" ] = $results [" updateTime" ].ToString()
28
+ $results [" updateTime" ] = $results [" updateTime" ].ToString()
32
29
33
- $az_modules = Get-Module az.* - ListAvailable | Where-object {$_.Name -ne " Az.Tools.Migration" }
30
+ $az_modules = Get-Module az.* - ListAvailable | Where-object { $_.Name -ne " Az.Tools.Migration" }
34
31
35
- for ([int ]$i = 0 ; $i -lt $az_modules.Count ; $i ++ ){
32
+ for ([int ]$i = 0 ; $i -lt $az_modules.Count ; $i ++ ) {
36
33
37
-
38
34
import-module $az_modules [$i ].name
39
35
$module = get-module $az_modules [$i ].name
40
36
41
37
$exportedFunctions = $module.ExportedFunctions
42
38
$exportedCmdlets = $module.ExportedCmdlets
43
39
44
-
45
- foreach ($key in $exportedFunctions.Keys ){
40
+ foreach ($key in $exportedFunctions.Keys ) {
46
41
$func = $exportedFunctions [$key ]
47
-
42
+
48
43
# attributes of functions
49
- foreach ($Attribute in $func.ScriptBlock.Attributes ){
50
-
51
- if ($Attribute.TypeId.BaseType.Name -eq " GenericBreakingChangeAttribute" -or $Attribute.TypeId.Name -eq " GenericBreakingChangeAttribute" ){
44
+ foreach ($Attribute in $func.ScriptBlock.Attributes ) {
45
+
46
+ if ($Attribute.TypeId.BaseType.Name -eq " GenericBreakingChangeAttribute" -or $Attribute.TypeId.Name -eq " GenericBreakingChangeAttribute" ) {
52
47
# $Attribute.TypeId.Name
53
48
$result = New-Object - TypeName breakingchangeResult
54
49
$result.Name = $func.name
@@ -58,11 +53,11 @@ for ([int]$i = 0; $i -lt $az_modules.Count; $i++){
58
53
}
59
54
60
55
# attributes of parameters in function
61
- foreach ($parameter_key in $func.Parameters.keys ){
56
+ foreach ($parameter_key in $func.Parameters.keys ) {
62
57
$parameter = $func.Parameters [$parameter_key ]
63
- for ([int ]$k = 0 ; $k -lt $parameter.Attributes.Count ; $k ++ ){
58
+ for ([int ]$k = 0 ; $k -lt $parameter.Attributes.Count ; $k ++ ) {
64
59
$Attribute = $parameter.Attributes [$k ]
65
- if ($Attribute.TypeId.BaseType.Name -eq " GenericBreakingChangeAttribute" -or $Attribute.TypeId.Name -eq " GenericBreakingChangeAttribute" ){
60
+ if ($Attribute.TypeId.BaseType.Name -eq " GenericBreakingChangeAttribute" -or $Attribute.TypeId.Name -eq " GenericBreakingChangeAttribute" ) {
66
61
# $Attribute.TypeId.Name
67
62
$result = New-Object - TypeName breakingchangeParaFunc
68
63
$result.Name = $parameter_key
@@ -74,12 +69,12 @@ for ([int]$i = 0; $i -lt $az_modules.Count; $i++){
74
69
}
75
70
}
76
71
77
- foreach ($key in $exportedCmdlets.Keys ){
72
+ foreach ($key in $exportedCmdlets.Keys ) {
78
73
$Cmdlet = $exportedCmdlets [$key ]
79
74
80
75
# attributes of cmdlets
81
- foreach ($Attribute in $Cmdlet.ImplementingType.CustomAttributes ){
82
- if ($Attribute.AttributeType.BaseType.Name -eq " GenericBreakingChangeAttribute" -or $Attribute.AttributeType.Name -eq " GenericBreakingChangeAttribute" ){
76
+ foreach ($Attribute in $Cmdlet.ImplementingType.CustomAttributes ) {
77
+ if ($Attribute.AttributeType.BaseType.Name -eq " GenericBreakingChangeAttribute" -or $Attribute.AttributeType.Name -eq " GenericBreakingChangeAttribute" ) {
83
78
# $Attribute.AttributeType.Name
84
79
$result = New-Object - TypeName breakingchangeResult
85
80
$result.Name = $Cmdlet.Name
@@ -89,11 +84,11 @@ for ([int]$i = 0; $i -lt $az_modules.Count; $i++){
89
84
}
90
85
91
86
# attributes of parameters in cmdlet
92
- foreach ($parameter_key in $Cmdlet.Parameters.keys ){
87
+ foreach ($parameter_key in $Cmdlet.Parameters.keys ) {
93
88
$parameter = $Cmdlet.Parameters [$parameter_key ]
94
- for ([int ]$k = 0 ; $k -lt $parameter.Attributes.Count ; $k ++ ){
89
+ for ([int ]$k = 0 ; $k -lt $parameter.Attributes.Count ; $k ++ ) {
95
90
$Attribute = $parameter.Attributes [$k ]
96
- if ($Attribute.TypeId.BaseType.Name -eq " GenericBreakingChangeAttribute" -or $Attribute.TypeId.Name -eq " GenericBreakingChangeAttribute" ){
91
+ if ($Attribute.TypeId.BaseType.Name -eq " GenericBreakingChangeAttribute" -or $Attribute.TypeId.Name -eq " GenericBreakingChangeAttribute" ) {
97
92
# $Attribute.TypeId.Name
98
93
$result = New-Object - TypeName breakingchangeParaCmdlet
99
94
$result.Name = $parameter_key
@@ -103,12 +98,7 @@ for ([int]$i = 0; $i -lt $az_modules.Count; $i++){
103
98
}
104
99
}
105
100
}
106
-
107
-
108
101
}
109
-
110
-
111
-
112
102
}
113
103
$json = $results | ConvertTo-Json
114
104
$json > BreakingchangeSpec.json
0 commit comments