@autorest/powershell 4.0.0-dev.9 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (483) hide show
  1. package/.rush/temp/package-deps_build.json +208 -203
  2. package/.rush/temp/shrinkwrap-deps.json +253 -280
  3. package/autorest-configuration-for-sdk.md +9 -3
  4. package/autorest-configuration.md +1 -1
  5. package/dist/cmdlets/class.d.ts +24 -3
  6. package/dist/cmdlets/class.d.ts.map +1 -1
  7. package/dist/cmdlets/class.js +888 -603
  8. package/dist/cmdlets/class.js.map +1 -1
  9. package/dist/cmdlets/namespace.d.ts.map +1 -1
  10. package/dist/cmdlets/namespace.js +39 -5
  11. package/dist/cmdlets/namespace.js.map +1 -1
  12. package/dist/enums/namespace.js +5 -5
  13. package/dist/enums/namespace.js.map +1 -1
  14. package/dist/exports.d.ts +3 -0
  15. package/dist/exports.d.ts.map +1 -0
  16. package/dist/exports.js +19 -0
  17. package/dist/exports.js.map +1 -0
  18. package/dist/generators/gitignore.d.ts.map +1 -1
  19. package/dist/generators/gitignore.js +2 -0
  20. package/dist/generators/gitignore.js.map +1 -1
  21. package/dist/generators/psm1.custom.js +2 -2
  22. package/dist/generators/psm1.custom.js.map +1 -1
  23. package/dist/generators/psm1.d.ts.map +1 -1
  24. package/dist/generators/psm1.internal.js +2 -2
  25. package/dist/generators/psm1.internal.js.map +1 -1
  26. package/dist/generators/psm1.js +17 -11
  27. package/dist/generators/psm1.js.map +1 -1
  28. package/dist/generators/readme.d.ts.map +1 -1
  29. package/dist/generators/readme.js +0 -3
  30. package/dist/generators/readme.js.map +1 -1
  31. package/dist/generators/script-cmdlet.js +18 -18
  32. package/dist/generators/script-cmdlet.js.map +1 -1
  33. package/dist/internal/name-inferrer.d.ts +1 -1
  34. package/dist/internal/name-inferrer.d.ts.map +1 -1
  35. package/dist/internal/name-inferrer.js +12 -12
  36. package/dist/internal/name-inferrer.js.map +1 -1
  37. package/dist/internal/powershell-declarations.d.ts +2 -0
  38. package/dist/internal/powershell-declarations.d.ts.map +1 -1
  39. package/dist/internal/powershell-declarations.js +4 -2
  40. package/dist/internal/powershell-declarations.js.map +1 -1
  41. package/dist/internal/project.d.ts +14 -6
  42. package/dist/internal/project.d.ts.map +1 -1
  43. package/dist/internal/project.js +24 -13
  44. package/dist/internal/project.js.map +1 -1
  45. package/dist/internal/state.d.ts +3 -2
  46. package/dist/internal/state.d.ts.map +1 -1
  47. package/dist/internal/state.js.map +1 -1
  48. package/dist/llcsharp/clientruntime.d.ts +1 -0
  49. package/dist/llcsharp/clientruntime.d.ts.map +1 -1
  50. package/dist/llcsharp/clientruntime.js +12 -11
  51. package/dist/llcsharp/clientruntime.js.map +1 -1
  52. package/dist/llcsharp/code-model.d.ts +7 -7
  53. package/dist/llcsharp/code-model.d.ts.map +1 -1
  54. package/dist/llcsharp/enums/enum.d.ts +1 -1
  55. package/dist/llcsharp/enums/enum.d.ts.map +1 -1
  56. package/dist/llcsharp/enums/enum.js +42 -42
  57. package/dist/llcsharp/enums/enum.js.map +1 -1
  58. package/dist/llcsharp/exports.js +5 -1
  59. package/dist/llcsharp/exports.js.map +1 -1
  60. package/dist/llcsharp/generator.d.ts +3 -2
  61. package/dist/llcsharp/generator.d.ts.map +1 -1
  62. package/dist/llcsharp/generator.js.map +1 -1
  63. package/dist/llcsharp/model/idictionary.js +16 -16
  64. package/dist/llcsharp/model/idictionary.js.map +1 -1
  65. package/dist/llcsharp/model/interface.d.ts +1 -1
  66. package/dist/llcsharp/model/interface.d.ts.map +1 -1
  67. package/dist/llcsharp/model/interface.js +19 -19
  68. package/dist/llcsharp/model/interface.js.map +1 -1
  69. package/dist/llcsharp/model/model-class-dictionary.js +18 -18
  70. package/dist/llcsharp/model/model-class-dictionary.js.map +1 -1
  71. package/dist/llcsharp/model/model-class-json.js +20 -20
  72. package/dist/llcsharp/model/model-class-json.js.map +1 -1
  73. package/dist/llcsharp/model/model-class-serializer.d.ts +1 -1
  74. package/dist/llcsharp/model/model-class-serializer.d.ts.map +1 -1
  75. package/dist/llcsharp/model/model-class-serializer.js +6 -6
  76. package/dist/llcsharp/model/model-class-serializer.js.map +1 -1
  77. package/dist/llcsharp/model/model-class.d.ts +1 -1
  78. package/dist/llcsharp/model/model-class.d.ts.map +1 -1
  79. package/dist/llcsharp/model/model-class.js +108 -97
  80. package/dist/llcsharp/model/model-class.js.map +1 -1
  81. package/dist/llcsharp/model/namespace.d.ts +1 -1
  82. package/dist/llcsharp/model/namespace.d.ts.map +1 -1
  83. package/dist/llcsharp/model/namespace.js +2 -2
  84. package/dist/llcsharp/model/namespace.js.map +1 -1
  85. package/dist/llcsharp/model/property.d.ts +1 -1
  86. package/dist/llcsharp/model/property.d.ts.map +1 -1
  87. package/dist/llcsharp/model/property.js +20 -20
  88. package/dist/llcsharp/model/property.js.map +1 -1
  89. package/dist/llcsharp/operation/api-class.d.ts.map +1 -1
  90. package/dist/llcsharp/operation/api-class.js +26 -1
  91. package/dist/llcsharp/operation/api-class.js.map +1 -1
  92. package/dist/llcsharp/operation/method.d.ts +10 -5
  93. package/dist/llcsharp/operation/method.d.ts.map +1 -1
  94. package/dist/llcsharp/operation/method.js +287 -134
  95. package/dist/llcsharp/operation/method.js.map +1 -1
  96. package/dist/llcsharp/operation/parameter.d.ts +1 -1
  97. package/dist/llcsharp/operation/parameter.d.ts.map +1 -1
  98. package/dist/llcsharp/operation/parameter.js +10 -10
  99. package/dist/llcsharp/operation/parameter.js.map +1 -1
  100. package/dist/llcsharp/project.d.ts +8 -4
  101. package/dist/llcsharp/project.d.ts.map +1 -1
  102. package/dist/llcsharp/project.js +10 -1
  103. package/dist/llcsharp/project.js.map +1 -1
  104. package/dist/llcsharp/schema/Uuid.d.ts +1 -1
  105. package/dist/llcsharp/schema/Uuid.d.ts.map +1 -1
  106. package/dist/llcsharp/schema/Uuid.js +2 -2
  107. package/dist/llcsharp/schema/Uuid.js.map +1 -1
  108. package/dist/llcsharp/schema/array.d.ts +1 -1
  109. package/dist/llcsharp/schema/array.d.ts.map +1 -1
  110. package/dist/llcsharp/schema/array.js +45 -43
  111. package/dist/llcsharp/schema/array.js.map +1 -1
  112. package/dist/llcsharp/schema/binary.d.ts +1 -1
  113. package/dist/llcsharp/schema/binary.d.ts.map +1 -1
  114. package/dist/llcsharp/schema/binary.js +9 -9
  115. package/dist/llcsharp/schema/binary.js.map +1 -1
  116. package/dist/llcsharp/schema/boolean.d.ts +1 -1
  117. package/dist/llcsharp/schema/boolean.d.ts.map +1 -1
  118. package/dist/llcsharp/schema/byte-array.d.ts +1 -1
  119. package/dist/llcsharp/schema/byte-array.d.ts.map +1 -1
  120. package/dist/llcsharp/schema/byte-array.js +24 -24
  121. package/dist/llcsharp/schema/byte-array.js.map +1 -1
  122. package/dist/llcsharp/schema/char.d.ts +1 -1
  123. package/dist/llcsharp/schema/char.d.ts.map +1 -1
  124. package/dist/llcsharp/schema/char.js +1 -1
  125. package/dist/llcsharp/schema/char.js.map +1 -1
  126. package/dist/llcsharp/schema/date-time.d.ts +1 -1
  127. package/dist/llcsharp/schema/date-time.d.ts.map +1 -1
  128. package/dist/llcsharp/schema/date-time.js +45 -41
  129. package/dist/llcsharp/schema/date-time.js.map +1 -1
  130. package/dist/llcsharp/schema/date.d.ts +1 -1
  131. package/dist/llcsharp/schema/date.d.ts.map +1 -1
  132. package/dist/llcsharp/schema/duration.d.ts +1 -1
  133. package/dist/llcsharp/schema/duration.d.ts.map +1 -1
  134. package/dist/llcsharp/schema/duration.js +9 -7
  135. package/dist/llcsharp/schema/duration.js.map +1 -1
  136. package/dist/llcsharp/schema/enum.d.ts +6 -2
  137. package/dist/llcsharp/schema/enum.d.ts.map +1 -1
  138. package/dist/llcsharp/schema/enum.js +13 -4
  139. package/dist/llcsharp/schema/enum.js.map +1 -1
  140. package/dist/llcsharp/schema/extended-type-declaration.d.ts +1 -1
  141. package/dist/llcsharp/schema/extended-type-declaration.d.ts.map +1 -1
  142. package/dist/llcsharp/schema/fixed-array.d.ts +1 -1
  143. package/dist/llcsharp/schema/fixed-array.d.ts.map +1 -1
  144. package/dist/llcsharp/schema/fixed-array.js +44 -42
  145. package/dist/llcsharp/schema/fixed-array.js.map +1 -1
  146. package/dist/llcsharp/schema/integer.d.ts +1 -1
  147. package/dist/llcsharp/schema/integer.d.ts.map +1 -1
  148. package/dist/llcsharp/schema/integer.js +5 -5
  149. package/dist/llcsharp/schema/integer.js.map +1 -1
  150. package/dist/llcsharp/schema/object.d.ts +1 -1
  151. package/dist/llcsharp/schema/object.d.ts.map +1 -1
  152. package/dist/llcsharp/schema/object.js +28 -28
  153. package/dist/llcsharp/schema/object.js.map +1 -1
  154. package/dist/llcsharp/schema/password.d.ts +1 -1
  155. package/dist/llcsharp/schema/password.d.ts.map +1 -1
  156. package/dist/llcsharp/schema/password.js +13 -13
  157. package/dist/llcsharp/schema/password.js.map +1 -1
  158. package/dist/llcsharp/schema/primitive.d.ts +1 -1
  159. package/dist/llcsharp/schema/primitive.d.ts.map +1 -1
  160. package/dist/llcsharp/schema/primitive.js +40 -37
  161. package/dist/llcsharp/schema/primitive.js.map +1 -1
  162. package/dist/llcsharp/schema/schema-resolver.d.ts +1 -1
  163. package/dist/llcsharp/schema/schema-resolver.d.ts.map +1 -1
  164. package/dist/llcsharp/schema/schema-resolver.js +2 -1
  165. package/dist/llcsharp/schema/schema-resolver.js.map +1 -1
  166. package/dist/llcsharp/schema/string.d.ts +1 -1
  167. package/dist/llcsharp/schema/string.d.ts.map +1 -1
  168. package/dist/llcsharp/schema/string.js +48 -44
  169. package/dist/llcsharp/schema/string.js.map +1 -1
  170. package/dist/llcsharp/schema/uri.d.ts +1 -1
  171. package/dist/llcsharp/schema/uri.d.ts.map +1 -1
  172. package/dist/llcsharp/schema/uri.js +2 -2
  173. package/dist/llcsharp/schema/uri.js.map +1 -1
  174. package/dist/llcsharp/validations.js +2 -2
  175. package/dist/llcsharp/validations.js.map +1 -1
  176. package/dist/main.d.ts.map +1 -1
  177. package/dist/main.js +5 -2
  178. package/dist/main.js.map +1 -1
  179. package/dist/models/model-extensions.d.ts +1 -1
  180. package/dist/models/model-extensions.d.ts.map +1 -1
  181. package/dist/models/model-extensions.js +39 -39
  182. package/dist/models/model-extensions.js.map +1 -1
  183. package/dist/module/module-class.d.ts.map +1 -1
  184. package/dist/module/module-class.js +45 -15
  185. package/dist/module/module-class.js.map +1 -1
  186. package/dist/module/module-namespace.js +3 -3
  187. package/dist/module/module-namespace.js.map +1 -1
  188. package/dist/plugins/add-azure-completers-v2.d.ts +6 -1
  189. package/dist/plugins/add-azure-completers-v2.d.ts.map +1 -1
  190. package/dist/plugins/add-azure-completers-v2.js +5 -4
  191. package/dist/plugins/add-azure-completers-v2.js.map +1 -1
  192. package/dist/plugins/create-commands-v2.d.ts +16 -7
  193. package/dist/plugins/create-commands-v2.d.ts.map +1 -1
  194. package/dist/plugins/create-commands-v2.js +269 -66
  195. package/dist/plugins/create-commands-v2.js.map +1 -1
  196. package/dist/plugins/cs-namer-v2.d.ts +6 -1
  197. package/dist/plugins/cs-namer-v2.d.ts.map +1 -1
  198. package/dist/plugins/cs-namer-v2.js +42 -41
  199. package/dist/plugins/cs-namer-v2.js.map +1 -1
  200. package/dist/plugins/llcsharp-v2.d.ts +5 -2
  201. package/dist/plugins/llcsharp-v2.d.ts.map +1 -1
  202. package/dist/plugins/llcsharp-v2.js +11 -9
  203. package/dist/plugins/llcsharp-v2.js.map +1 -1
  204. package/dist/plugins/modifiers-v2.d.ts +6 -1
  205. package/dist/plugins/modifiers-v2.d.ts.map +1 -1
  206. package/dist/plugins/modifiers-v2.js +120 -92
  207. package/dist/plugins/modifiers-v2.js.map +1 -1
  208. package/dist/plugins/plugin-create-inline-properties.d.ts +6 -1
  209. package/dist/plugins/plugin-create-inline-properties.d.ts.map +1 -1
  210. package/dist/plugins/plugin-create-inline-properties.js +44 -32
  211. package/dist/plugins/plugin-create-inline-properties.js.map +1 -1
  212. package/dist/plugins/plugin-tweak-m4-model.d.ts +7 -1
  213. package/dist/plugins/plugin-tweak-m4-model.d.ts.map +1 -1
  214. package/dist/plugins/plugin-tweak-m4-model.js +28 -11
  215. package/dist/plugins/plugin-tweak-m4-model.js.map +1 -1
  216. package/dist/plugins/plugin-tweak-model-azure-v2.d.ts +6 -1
  217. package/dist/plugins/plugin-tweak-model-azure-v2.d.ts.map +1 -1
  218. package/dist/plugins/plugin-tweak-model-azure-v2.js +32 -22
  219. package/dist/plugins/plugin-tweak-model-azure-v2.js.map +1 -1
  220. package/dist/plugins/plugin-tweak-model.d.ts +6 -1
  221. package/dist/plugins/plugin-tweak-model.d.ts.map +1 -1
  222. package/dist/plugins/plugin-tweak-model.js +33 -32
  223. package/dist/plugins/plugin-tweak-model.js.map +1 -1
  224. package/dist/plugins/powershell-v2.d.ts +5 -2
  225. package/dist/plugins/powershell-v2.d.ts.map +1 -1
  226. package/dist/plugins/powershell-v2.js +32 -28
  227. package/dist/plugins/powershell-v2.js.map +1 -1
  228. package/dist/plugins/ps-namer-v2.d.ts +6 -1
  229. package/dist/plugins/ps-namer-v2.d.ts.map +1 -1
  230. package/dist/plugins/ps-namer-v2.js +33 -32
  231. package/dist/plugins/ps-namer-v2.js.map +1 -1
  232. package/dist/plugins/sdk-create-inline-properties.d.ts +1 -1
  233. package/dist/plugins/sdk-create-inline-properties.d.ts.map +1 -1
  234. package/dist/plugins/sdk-create-inline-properties.js +129 -39
  235. package/dist/plugins/sdk-create-inline-properties.js.map +1 -1
  236. package/dist/plugins/sdk-cs-namer.d.ts +1 -1
  237. package/dist/plugins/sdk-cs-namer.d.ts.map +1 -1
  238. package/dist/plugins/sdk-cs-namer.js +59 -34
  239. package/dist/plugins/sdk-cs-namer.js.map +1 -1
  240. package/dist/plugins/sdk-cs-simplifier.d.ts +1 -1
  241. package/dist/plugins/sdk-cs-simplifier.d.ts.map +1 -1
  242. package/dist/plugins/sdk-cs-simplifier.js +3 -3
  243. package/dist/plugins/sdk-cs-simplifier.js.map +1 -1
  244. package/dist/plugins/sdk-generate.d.ts +1 -1
  245. package/dist/plugins/sdk-generate.d.ts.map +1 -1
  246. package/dist/plugins/sdk-generate.js +23 -18
  247. package/dist/plugins/sdk-generate.js.map +1 -1
  248. package/dist/plugins/sdk-modifiers.d.ts +4 -0
  249. package/dist/plugins/sdk-modifiers.d.ts.map +1 -0
  250. package/dist/plugins/sdk-modifiers.js +175 -0
  251. package/dist/plugins/sdk-modifiers.js.map +1 -0
  252. package/dist/plugins/sdk-tweak-model.d.ts +1 -1
  253. package/dist/plugins/sdk-tweak-model.d.ts.map +1 -1
  254. package/dist/plugins/sdk-tweak-model.js +140 -44
  255. package/dist/plugins/sdk-tweak-model.js.map +1 -1
  256. package/dist/sdk/project.d.ts +2 -2
  257. package/dist/sdk/project.d.ts.map +1 -1
  258. package/dist/sdk/project.js +10 -9
  259. package/dist/sdk/project.js.map +1 -1
  260. package/dist/sdk/state.d.ts +2 -2
  261. package/dist/sdk/state.d.ts.map +1 -1
  262. package/dist/sdk/utility.d.ts +12 -3
  263. package/dist/sdk/utility.d.ts.map +1 -1
  264. package/dist/sdk/utility.js +122 -30
  265. package/dist/sdk/utility.js.map +1 -1
  266. package/dist/utils/PwshModel.d.ts +1 -1
  267. package/dist/utils/PwshModel.d.ts.map +1 -1
  268. package/dist/utils/PwshModel.js +1 -1
  269. package/dist/utils/PwshModel.js.map +1 -1
  270. package/dist/utils/SdkModel.d.ts +1 -1
  271. package/dist/utils/SdkModel.d.ts.map +1 -1
  272. package/dist/utils/SdkModel.js +1 -1
  273. package/dist/utils/SdkModel.js.map +1 -1
  274. package/dist/utils/command-operation.d.ts +11 -3
  275. package/dist/utils/command-operation.d.ts.map +1 -1
  276. package/dist/utils/command-operation.js +26 -4
  277. package/dist/utils/command-operation.js.map +1 -1
  278. package/dist/utils/components.d.ts +1 -1
  279. package/dist/utils/components.d.ts.map +1 -1
  280. package/dist/utils/components.js +2 -2
  281. package/dist/utils/components.js.map +1 -1
  282. package/dist/utils/http-operation.d.ts +2 -0
  283. package/dist/utils/http-operation.d.ts.map +1 -1
  284. package/dist/utils/http-operation.js +16 -12
  285. package/dist/utils/http-operation.js.map +1 -1
  286. package/dist/utils/model-state.d.ts +7 -5
  287. package/dist/utils/model-state.d.ts.map +1 -1
  288. package/dist/utils/model-state.js +28 -20
  289. package/dist/utils/model-state.js.map +1 -1
  290. package/dist/utils/programatic-operation.d.ts +1 -1
  291. package/dist/utils/programatic-operation.d.ts.map +1 -1
  292. package/dist/utils/programatic-operation.js +1 -1
  293. package/dist/utils/programatic-operation.js.map +1 -1
  294. package/dist/utils/resolve-conflicts.js +8 -8
  295. package/dist/utils/resolve-conflicts.js.map +1 -1
  296. package/dist/utils/schema.d.ts +1 -1
  297. package/dist/utils/schema.d.ts.map +1 -1
  298. package/dist/utils/schema.js +11 -11
  299. package/dist/utils/schema.js.map +1 -1
  300. package/dist/utils/security-scheme.d.ts +2 -2
  301. package/dist/utils/security-scheme.d.ts.map +1 -1
  302. package/dist/utils/security-scheme.js +2 -2
  303. package/dist/utils/security-scheme.js.map +1 -1
  304. package/dist/utils/sort-parameters.d.ts +1 -1
  305. package/dist/utils/sort-parameters.d.ts.map +1 -1
  306. package/dist/utils/tsp-generator.d.ts +3 -0
  307. package/dist/utils/tsp-generator.d.ts.map +1 -0
  308. package/dist/utils/tsp-generator.js +65 -0
  309. package/dist/utils/tsp-generator.js.map +1 -0
  310. package/dist/utils/tsp-host.d.ts +42 -0
  311. package/dist/utils/tsp-host.d.ts.map +1 -0
  312. package/dist/utils/tsp-host.js +56 -0
  313. package/dist/utils/tsp-host.js.map +1 -0
  314. package/generators/readme.ts +0 -3
  315. package/package.json +11 -10
  316. package/resources/assets/build-module.ps1 +29 -2
  317. package/resources/assets/create-model-cmdlets.ps1 +1 -0
  318. package/resources/assets/generate-help.ps1 +2 -2
  319. package/resources/assets/generate-portal-ux.ps1 +6 -22
  320. package/resources/assets/test/loadEnv.ps1 +1 -1
  321. package/resources/assets/test-module.ps1 +9 -5
  322. package/resources/assets/tools/Resources/README.md +0 -3
  323. package/resources/assets/tools/Resources/custom/New-AzDeployment.ps1 +2 -2
  324. package/resources/assets/tools/Resources/how-to.md +2 -0
  325. package/resources/built-time-cmdlets.csproj +1 -0
  326. package/resources/modules/Az.Accounts/2.13.1/Accounts.format.ps1xml +554 -0
  327. package/resources/modules/Az.Accounts/2.13.1/Accounts.generated.format.ps1xml +471 -0
  328. package/resources/modules/Az.Accounts/2.13.1/Accounts.types.ps1xml +306 -0
  329. package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Az.Accounts.nuspec +4 -5
  330. package/resources/modules/Az.Accounts/2.13.1/Az.Accounts.psd1 +389 -0
  331. package/resources/modules/Az.Accounts/2.13.1/Az.Accounts.psm1 +365 -0
  332. package/resources/modules/Az.Accounts/2.13.1/FuzzySharp.dll +0 -0
  333. package/resources/modules/Az.Accounts/2.13.1/Microsoft.ApplicationInsights.dll +0 -0
  334. package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.AssemblyLoading.dll +0 -0
  335. package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Authentication.Abstractions.dll +0 -0
  336. package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Authentication.ResourceManager.dll +0 -0
  337. package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Authentication.dll +0 -0
  338. package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.AuthenticationAssemblyLoadContext.dll +0 -0
  339. package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Authenticators.dll +0 -0
  340. package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Clients.Aks.dll +0 -0
  341. package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Clients.Authorization.dll +0 -0
  342. package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Clients.Compute.dll +0 -0
  343. package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Clients.Graph.Rbac.dll +0 -0
  344. package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Clients.KeyVault.dll +0 -0
  345. package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Clients.Monitor.dll +0 -0
  346. package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Clients.Network.dll +0 -0
  347. package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Clients.PolicyInsights.dll +0 -0
  348. package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Clients.ResourceManager.dll +0 -0
  349. package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Clients.Storage.Management.dll +0 -0
  350. package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Clients.Websites.dll +0 -0
  351. package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Cmdlets.Accounts.dll +0 -0
  352. package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Cmdlets.Accounts.dll-Help.xml +2510 -779
  353. package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Common.Share.dll +0 -0
  354. package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Common.dll +0 -0
  355. package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Storage.dll +0 -0
  356. package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Strategies.dll +0 -0
  357. package/resources/modules/Az.Accounts/2.13.1/Microsoft.Rest.ClientRuntime.dll +0 -0
  358. package/resources/modules/Az.Accounts/2.13.1/PostImportScripts/LoadAuthenticators.ps1 +222 -0
  359. package/resources/modules/Az.Accounts/2.13.1/StartupScripts/AzError.ps1 +281 -0
  360. package/resources/modules/Az.Accounts/2.13.1/StartupScripts/InitializeAssemblyResolver.ps1 +242 -0
  361. package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/[Content_Types].xml +2 -3
  362. package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/_rels/.rels +2 -2
  363. package/resources/modules/Az.Accounts/2.13.1/lib/netcoreapp2.1/Azure.Core.dll +0 -0
  364. package/resources/modules/Az.Accounts/2.13.1/lib/netcoreapp2.1/Microsoft.Identity.Client.dll +0 -0
  365. package/resources/modules/Az.Accounts/2.13.1/lib/netcoreapp3.1/Microsoft.Identity.Client.Extensions.Msal.dll +0 -0
  366. package/resources/modules/Az.Accounts/2.13.1/lib/netfx/Azure.Core.dll +0 -0
  367. package/resources/modules/Az.Accounts/2.13.1/lib/netfx/Microsoft.Identity.Client.Extensions.Msal.dll +0 -0
  368. package/resources/modules/Az.Accounts/2.13.1/lib/netfx/Microsoft.Identity.Client.dll +0 -0
  369. package/resources/modules/Az.Accounts/2.13.1/lib/netfx/Newtonsoft.Json.dll +0 -0
  370. package/resources/modules/Az.Accounts/2.13.1/lib/netfx/System.Diagnostics.DiagnosticSource.dll +0 -0
  371. package/resources/modules/Az.Accounts/2.13.1/lib/netfx/System.Reflection.DispatchProxy.dll +0 -0
  372. package/resources/modules/Az.Accounts/2.13.1/lib/netfx/System.Runtime.CompilerServices.Unsafe.dll +0 -0
  373. package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/Azure.Identity.BrokeredAuthentication.dll +0 -0
  374. package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/Azure.Identity.dll +0 -0
  375. package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/Microsoft.Identity.Client.Broker.dll +0 -0
  376. package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/Microsoft.Identity.Client.NativeInterop.dll +0 -0
  377. package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/Microsoft.IdentityModel.Abstractions.dll +0 -0
  378. package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/System.Security.AccessControl.dll +0 -0
  379. package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/System.Security.Permissions.dll +0 -0
  380. package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/System.Security.Principal.Windows.dll +0 -0
  381. package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/msalruntime.dll +0 -0
  382. package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/msalruntime_arm64.dll +0 -0
  383. package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/msalruntime_x86.dll +0 -0
  384. package/resources/modules/Az.Accounts/2.13.1/package/services/metadata/core-properties/f9ac9c2e40914e78a646a7b0b997403b.psmdcp +11 -0
  385. package/resources/psruntime/BuildTime/Cmdlets/ExportHelpMarkdown.cs +4 -1
  386. package/resources/psruntime/BuildTime/Cmdlets/ExportProxyCmdlet.cs +6 -3
  387. package/resources/psruntime/BuildTime/Cmdlets/ExportPsd1.cs +7 -4
  388. package/resources/psruntime/BuildTime/Cmdlets/ExportTestStub.cs +130 -81
  389. package/resources/psruntime/BuildTime/Cmdlets/NewAssemblyInfo.cs +64 -0
  390. package/resources/psruntime/BuildTime/MarkdownRenderer.cs +17 -9
  391. package/resources/psruntime/BuildTime/Models/PsProxyOutputs.cs +36 -8
  392. package/resources/psruntime/BuildTime/Models/PsProxyTypes.cs +21 -10
  393. package/resources/psruntime/BuildTime/PsAttributes.cs +5 -0
  394. package/resources/psruntime/BuildTime/PsHelpers.cs +4 -3
  395. package/resources/psruntime/MessageAttribute.cs +45 -55
  396. package/resources/psruntime/MessageAttributeHelper.cs +30 -7
  397. package/resources/psruntime/Properties/Resources.Designer.cs +25 -3
  398. package/resources/psruntime/Properties/Resources.resx +8 -2
  399. package/resources/runtime/csharp/pipeline/PipelineMocking.cs +1 -1
  400. package/resources/templates/azureMethod.ejs +2 -2
  401. package/resources/templates/azureMethodGroup.ejs +2 -2
  402. package/resources/templates/azureServiceClient.ejs +11 -4
  403. package/resources/templates/enum.ejs +3 -3
  404. package/resources/templates/extensionMethod.ejs +18 -12
  405. package/resources/templates/extensions.ejs +9 -2
  406. package/resources/templates/longRunningOperationMethod.ejs +10 -8
  407. package/resources/templates/method.ejs +10 -8
  408. package/resources/templates/methodBodyRestCall.ejs +77 -32
  409. package/resources/templates/methodGroupInterface.ejs +2 -61
  410. package/resources/templates/methodGroupInterfaceBody.ejs +60 -0
  411. package/resources/templates/model.ejs +15 -15
  412. package/resources/templates/serviceClientBody.ejs +8 -8
  413. package/resources/templates/serviceClientInterface.ejs +10 -4
  414. package/resources/utils/Get-SubscriptionIdTestSafe.ps1 +7 -0
  415. package/dist/utils/WrapComments.d.ts +0 -2
  416. package/dist/utils/WrapComments.d.ts.map +0 -1
  417. package/dist/utils/WrapComments.js +0 -46
  418. package/dist/utils/WrapComments.js.map +0 -1
  419. package/resources/modules/Az.Accounts/2.7.5/Accounts.format.ps1xml +0 -496
  420. package/resources/modules/Az.Accounts/2.7.5/Accounts.generated.format.ps1xml +0 -468
  421. package/resources/modules/Az.Accounts/2.7.5/Accounts.types.ps1xml +0 -303
  422. package/resources/modules/Az.Accounts/2.7.5/Az.Accounts.psd1 +0 -387
  423. package/resources/modules/Az.Accounts/2.7.5/Az.Accounts.psm1 +0 -375
  424. package/resources/modules/Az.Accounts/2.7.5/AzSharedAlcAssemblies/Azure.Core.dll +0 -0
  425. package/resources/modules/Az.Accounts/2.7.5/AzSharedAlcAssemblies/Azure.Identity.dll +0 -0
  426. package/resources/modules/Az.Accounts/2.7.5/AzSharedAlcAssemblies/Microsoft.Identity.Client.Extensions.Msal.dll +0 -0
  427. package/resources/modules/Az.Accounts/2.7.5/AzSharedAlcAssemblies/Microsoft.Identity.Client.dll +0 -0
  428. package/resources/modules/Az.Accounts/2.7.5/Microsoft.ApplicationInsights.dll +0 -0
  429. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authentication.Abstractions.dll +0 -0
  430. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authentication.ResourceManager.deps.json +0 -2309
  431. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authentication.ResourceManager.dll +0 -0
  432. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authentication.deps.json +0 -2273
  433. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authentication.dll +0 -0
  434. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.AuthenticationAssemblyLoadContext.deps.json +0 -1316
  435. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.AuthenticationAssemblyLoadContext.dll +0 -0
  436. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authenticators.dll +0 -0
  437. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Clients.Aks.dll +0 -0
  438. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Clients.Graph.Rbac.dll +0 -0
  439. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Clients.ResourceManager.dll +0 -0
  440. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Cmdlets.Accounts.deps.json +0 -2413
  441. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Cmdlets.Accounts.dll +0 -0
  442. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Common.Share.dll +0 -0
  443. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Common.dll +0 -0
  444. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Rest.ClientRuntime.dll +0 -0
  445. package/resources/modules/Az.Accounts/2.7.5/PostImportScripts/LoadAuthenticators.ps1 +0 -219
  446. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/Azure.Core.dll +0 -0
  447. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/Azure.Identity.dll +0 -0
  448. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/Microsoft.Azure.PowerShell.Authenticators.dll +0 -0
  449. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/Microsoft.Bcl.AsyncInterfaces.dll +0 -0
  450. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/Microsoft.Identity.Client.Extensions.Msal.dll +0 -0
  451. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/Microsoft.Identity.Client.dll +0 -0
  452. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/Newtonsoft.Json.12.0.3.dll +0 -0
  453. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/Newtonsoft.Json.dll +0 -0
  454. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Diagnostics.DiagnosticSource.dll +0 -0
  455. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Memory.Data.dll +0 -0
  456. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Reflection.DispatchProxy.dll +0 -0
  457. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Runtime.CompilerServices.Unsafe.dll +0 -0
  458. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Security.AccessControl.dll +0 -0
  459. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Security.Permissions.dll +0 -0
  460. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Security.Principal.Windows.dll +0 -0
  461. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Text.Json.dll +0 -0
  462. package/resources/modules/Az.Accounts/2.7.5/StartupScripts/AzError.ps1 +0 -278
  463. package/resources/modules/Az.Accounts/2.7.5/StartupScripts/InitializeAssemblyResolver.ps1 +0 -234
  464. package/resources/modules/Az.Accounts/2.7.5/package/services/metadata/core-properties/1aa0749a068a4238881858013f1a5b7f.psmdcp +0 -11
  465. /package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Hyak.Common.dll +0 -0
  466. /package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.Common.dll +0 -0
  467. /package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Rest.ClientRuntime.Azure.dll +0 -0
  468. /package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.WindowsAzure.Storage.DataMovement.dll +0 -0
  469. /package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.WindowsAzure.Storage.dll +0 -0
  470. /package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/en-US/about_az.help.txt +0 -0
  471. /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netfx}/System.Numerics.Vectors.dll +0 -0
  472. /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netfx}/System.Security.Cryptography.Cng.dll +0 -0
  473. /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netfx}/System.Text.Encodings.Web.dll +0 -0
  474. /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netfx}/System.Xml.ReaderWriter.dll +0 -0
  475. /package/resources/modules/Az.Accounts/{2.7.5/AzSharedAlcAssemblies → 2.13.1/lib/netstandard2.0}/Microsoft.Bcl.AsyncInterfaces.dll +0 -0
  476. /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netstandard2.0}/System.Buffers.dll +0 -0
  477. /package/resources/modules/Az.Accounts/{2.7.5/AzSharedAlcAssemblies → 2.13.1/lib/netstandard2.0}/System.Memory.Data.dll +0 -0
  478. /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netstandard2.0}/System.Memory.dll +0 -0
  479. /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netstandard2.0}/System.Net.Http.WinHttpHandler.dll +0 -0
  480. /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netstandard2.0}/System.Private.ServiceModel.dll +0 -0
  481. /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netstandard2.0}/System.ServiceModel.Primitives.dll +0 -0
  482. /package/resources/modules/Az.Accounts/{2.7.5/AzSharedAlcAssemblies → 2.13.1/lib/netstandard2.0}/System.Text.Json.dll +0 -0
  483. /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netstandard2.0}/System.Threading.Tasks.Extensions.dll +0 -0
@@ -12,50 +12,96 @@ using static Microsoft.Rest.ClientRuntime.PowerShell.PsHelpers;
12
12
 
13
13
  namespace Microsoft.Rest.ClientRuntime.PowerShell
14
14
  {
15
- [Cmdlet(VerbsData.Export, "TestStub")]
16
- [DoNotExport]
17
- public class ExportTestStub : PSCmdlet
18
- {
19
- [Parameter(Mandatory = true)]
20
- [ValidateNotNullOrEmpty]
21
- public string ModuleName { get; set; }
22
-
23
- [Parameter(Mandatory = true)]
24
- [ValidateNotNullOrEmpty]
25
- public string ExportsFolder { get; set; }
26
-
27
- [Parameter(Mandatory = true)]
28
- [ValidateNotNullOrEmpty]
29
- public string OutputFolder { get; set; }
30
-
31
- [Parameter]
32
- public SwitchParameter IncludeGenerated { get; set; }
33
-
34
- protected override void ProcessRecord()
15
+ [Cmdlet(VerbsData.Export, "TestStub")]
16
+ [DoNotExport]
17
+ public class ExportTestStub : PSCmdlet
35
18
  {
36
- try
37
- {
38
- if (!Directory.Exists(ExportsFolder))
39
- {
40
- throw new ArgumentException($"Exports folder '{ExportsFolder}' does not exist");
41
- }
19
+ [Parameter(Mandatory = true)]
20
+ [ValidateNotNullOrEmpty]
21
+ public string ModuleName { get; set; }
42
22
 
43
- var exportDirectories = Directory.GetDirectories(ExportsFolder);
44
- if (!exportDirectories.Any())
45
- {
46
- exportDirectories = new[] { ExportsFolder };
47
- }
48
- var utilFile = Path.Combine(OutputFolder, "utils.ps1");
49
- if (!File.Exists(utilFile))
23
+ [Parameter(Mandatory = true)]
24
+ [ValidateNotNullOrEmpty]
25
+ public string ExportsFolder { get; set; }
26
+
27
+ [Parameter(Mandatory = true)]
28
+ [ValidateNotNullOrEmpty]
29
+ public string OutputFolder { get; set; }
30
+
31
+ [Parameter]
32
+ public SwitchParameter IncludeGenerated { get; set; }
33
+
34
+ protected override void ProcessRecord()
50
35
  {
51
- var sc = new StringBuilder();
52
- sc.AppendLine(@"function RandomString([bool]$allChars, [int32]$len) {
36
+ try
37
+ {
38
+ if (!Directory.Exists(ExportsFolder))
39
+ {
40
+ throw new ArgumentException($"Exports folder '{ExportsFolder}' does not exist");
41
+ }
42
+
43
+ var exportDirectories = Directory.GetDirectories(ExportsFolder);
44
+ if (!exportDirectories.Any())
45
+ {
46
+ exportDirectories = new[] { ExportsFolder };
47
+ }
48
+ /*var loadEnvFile = Path.Combine(OutputFolder, "loadEnv.ps1");
49
+ if (!File.Exists(loadEnvFile))
50
+ {
51
+ var sc = new StringBuilder();
52
+ sc.AppendLine(@"
53
+ $envFile = 'env.json'
54
+ if ($TestMode -eq 'live') {
55
+ $envFile = 'localEnv.json'
56
+ }
57
+
58
+ if (Test-Path -Path (Join-Path $PSScriptRoot $envFile)) {
59
+ $envFilePath = Join-Path $PSScriptRoot $envFile
60
+ } else {
61
+ $envFilePath = Join-Path $PSScriptRoot '..\$envFile'
62
+ }
63
+ $env = @{}
64
+ if (Test-Path -Path $envFilePath) {
65
+ $env = Get-Content (Join-Path $PSScriptRoot $envFile) | ConvertFrom-Json
66
+ }");
67
+ File.WriteAllText(loadEnvFile, sc.ToString());
68
+ }*/
69
+ var utilFile = Path.Combine(OutputFolder, "utils.ps1");
70
+ if (!File.Exists(utilFile))
71
+ {
72
+ var sc = new StringBuilder();
73
+ sc.AppendLine(@"function RandomString([bool]$allChars, [int32]$len) {
53
74
  if ($allChars) {
54
75
  return -join ((33..126) | Get-Random -Count $len | % {[char]$_})
55
76
  } else {
56
77
  return -join ((48..57) + (97..122) | Get-Random -Count $len | % {[char]$_})
57
78
  }
58
79
  }
80
+ function Start-TestSleep {
81
+ [CmdletBinding(DefaultParameterSetName = 'SleepBySeconds')]
82
+ param(
83
+ [parameter(Mandatory = $true, Position = 0, ParameterSetName = 'SleepBySeconds')]
84
+ [ValidateRange(0.0, 2147483.0)]
85
+ [double] $Seconds,
86
+
87
+ [parameter(Mandatory = $true, ParameterSetName = 'SleepByMilliseconds')]
88
+ [ValidateRange('NonNegative')]
89
+ [Alias('ms')]
90
+ [int] $Milliseconds
91
+ )
92
+
93
+ if ($TestMode -ne 'playback') {
94
+ switch ($PSCmdlet.ParameterSetName) {
95
+ 'SleepBySeconds' {
96
+ Start-Sleep -Seconds $Seconds
97
+ }
98
+ 'SleepByMilliseconds' {
99
+ Start-Sleep -Milliseconds $Milliseconds
100
+ }
101
+ }
102
+ }
103
+ }
104
+
59
105
  $env = @{}
60
106
  if ($UsePreviousConfigForRecord) {
61
107
  $previousEnv = Get-Content (Join-Path $PSScriptRoot 'env.json') | ConvertFrom-Json
@@ -80,37 +126,40 @@ function cleanupEnv() {
80
126
  # Clean resources you create for testing
81
127
  }
82
128
  ");
83
- File.WriteAllText(utilFile, sc.ToString());
84
- }
85
- foreach (var exportDirectory in exportDirectories)
86
- {
87
- var outputFolder = OutputFolder;
88
- if (exportDirectory != ExportsFolder)
89
- {
90
- outputFolder = Path.Combine(OutputFolder, Path.GetFileName(exportDirectory));
91
- Directory.CreateDirectory(outputFolder);
92
- }
93
-
94
- var variantGroups = GetScriptCmdlets(exportDirectory)
95
- .SelectMany(fi => fi.ToVariants())
96
- .Where(v => !v.IsDoNotExport)
97
- .GroupBy(v => v.CmdletName)
98
- .Select(vg => new VariantGroup(ModuleName, vg.Key, vg.Select(v => v).ToArray(), outputFolder, isTest: true))
99
- .Where(vtg => !File.Exists(vtg.FilePath) && (IncludeGenerated || !vtg.IsGenerated));
100
-
101
- foreach (var variantGroup in variantGroups)
102
- {
103
- var sb = new StringBuilder();
104
- sb.AppendLine($"if(($null -eq $TestName) -or ($TestName -contains '{variantGroup.CmdletName}'))");
105
- sb.AppendLine(@"{
129
+ File.WriteAllText(utilFile, sc.ToString());
130
+ }
131
+
132
+
133
+
134
+ foreach (var exportDirectory in exportDirectories)
135
+ {
136
+ var outputFolder = OutputFolder;
137
+ if (exportDirectory != ExportsFolder)
138
+ {
139
+ outputFolder = Path.Combine(OutputFolder, Path.GetFileName(exportDirectory));
140
+ Directory.CreateDirectory(outputFolder);
141
+ }
142
+
143
+ var variantGroups = GetScriptCmdlets(exportDirectory)
144
+ .SelectMany(fi => fi.ToVariants())
145
+ .Where(v => !v.IsDoNotExport)
146
+ .GroupBy(v => v.CmdletName)
147
+ .Select(vg => new VariantGroup(ModuleName, vg.Key, vg.Select(v => v).ToArray(), outputFolder, isTest: true))
148
+ .Where(vtg => !File.Exists(vtg.FilePath) && (IncludeGenerated || !vtg.IsGenerated));
149
+
150
+ foreach (var variantGroup in variantGroups)
151
+ {
152
+ var sb = new StringBuilder();
153
+ sb.AppendLine($"if(($null -eq $TestName) -or ($TestName -contains '{variantGroup.CmdletName}'))");
154
+ sb.AppendLine(@"{
106
155
  $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1'
107
156
  if (-Not (Test-Path -Path $loadEnvPath)) {
108
157
  $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1'
109
158
  }
110
159
  . ($loadEnvPath)"
111
- );
112
- sb.AppendLine($@" $TestRecordingFile = Join-Path $PSScriptRoot '{variantGroup.CmdletName}.Recording.json'");
113
- sb.AppendLine(@" $currentPath = $PSScriptRoot
160
+ );
161
+ sb.AppendLine($@" $TestRecordingFile = Join-Path $PSScriptRoot '{variantGroup.CmdletName}.Recording.json'");
162
+ sb.AppendLine(@" $currentPath = $PSScriptRoot
114
163
  while(-not $mockingPath) {
115
164
  $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File
116
165
  $currentPath = Split-Path -Path $currentPath -Parent
@@ -120,29 +169,29 @@ function cleanupEnv() {
120
169
  ");
121
170
 
122
171
 
123
- sb.AppendLine($"Describe '{variantGroup.CmdletName}' {{");
124
- var variants = variantGroup.Variants
125
- .Where(v => IncludeGenerated || !v.Attributes.OfType<GeneratedAttribute>().Any())
126
- .ToList();
172
+ sb.AppendLine($"Describe '{variantGroup.CmdletName}' {{");
173
+ var variants = variantGroup.Variants
174
+ .Where(v => IncludeGenerated || !v.Attributes.OfType<GeneratedAttribute>().Any())
175
+ .ToList();
127
176
 
128
- foreach (var variant in variants)
177
+ foreach (var variant in variants)
178
+ {
179
+ sb.AppendLine($"{Indent}It '{variant.VariantName}' -skip {{");
180
+ sb.AppendLine($"{Indent}{Indent}{{ throw [System.NotImplementedException] }} | Should -Not -Throw");
181
+ var variantSeparator = variants.IndexOf(variant) == variants.Count - 1 ? String.Empty : Environment.NewLine;
182
+ sb.AppendLine($"{Indent}}}{variantSeparator}");
183
+ }
184
+ sb.AppendLine("}");
185
+
186
+ File.WriteAllText(variantGroup.FilePath, sb.ToString());
187
+ }
188
+ }
189
+ }
190
+ catch (Exception ee)
129
191
  {
130
- sb.AppendLine($"{Indent}It '{variant.VariantName}' -skip {{");
131
- sb.AppendLine($"{Indent}{Indent}{{ throw [System.NotImplementedException] }} | Should -Not -Throw");
132
- var variantSeparator = variants.IndexOf(variant) == variants.Count - 1 ? String.Empty : Environment.NewLine;
133
- sb.AppendLine($"{Indent}}}{variantSeparator}");
192
+ Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}");
193
+ throw ee;
134
194
  }
135
- sb.AppendLine("}");
136
-
137
- File.WriteAllText(variantGroup.FilePath, sb.ToString());
138
- }
139
195
  }
140
- }
141
- catch (Exception ee)
142
- {
143
- Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}");
144
- throw ee;
145
- }
146
196
  }
147
- }
148
197
  }
@@ -0,0 +1,64 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ using System;
6
+ using System.IO;
7
+ using System.Linq;
8
+ using System.Management.Automation;
9
+ using System.Text;
10
+
11
+ namespace Microsoft.Rest.ClientRuntime.PowerShell
12
+ {
13
+ [Cmdlet("New", "AssemblyInfo")]
14
+ [DoNotExport]
15
+ public class NewAssemblyInfo : PSCmdlet
16
+ {
17
+ private readonly string assemblyInfoPath = Path.Combine("${$project.baseFolder}", "Properties", "AssemblyInfo.cs");
18
+ private const string assemblyName = "${$project.title}";
19
+ private const string assemblyVersion = "${$project.moduleVersion}";
20
+ private const string assemblyCompanyName = "${$project.assemblyCompany}";
21
+ private const string assemblyProduct = "${$project.assemblyProduct}";
22
+ private const string assemblyCopyright = "${$project.assemblyCopyright}";
23
+ protected override void ProcessRecord()
24
+ {
25
+ try
26
+ {
27
+ if (File.Exists(assemblyInfoPath))
28
+ {
29
+ return;
30
+ }
31
+ StringBuilder sb = new StringBuilder();
32
+ sb.AppendLine(@"
33
+ # ----------------------------------------------------------------------------------
34
+ ${$project.pwshCommentHeaderForCsharp}
35
+ # ----------------------------------------------------------------------------------
36
+ ");
37
+ sb.Append($"{Environment.NewLine}");
38
+ sb.AppendLine("using System;");
39
+ sb.AppendLine("using System.Reflection;");
40
+ sb.AppendLine("using System.Runtime.InteropServices;");
41
+ sb.Append($"{Environment.NewLine}");
42
+ sb.AppendLine($"[assembly: AssemblyTitle(\"Microsoft Azure Powershell - {assemblyName}\")]");
43
+ sb.AppendLine($"[assembly: AssemblyCompany(\"{assemblyCompanyName}\")]");
44
+ sb.AppendLine($"[assembly: AssemblyProduct(\"{assemblyProduct}\")]");
45
+ sb.AppendLine($"[assembly: AssemblyCopyright(\"{assemblyCopyright}\")]");
46
+ sb.Append($"{Environment.NewLine}");
47
+ sb.AppendLine("[assembly: ComVisible(false)]");
48
+ sb.AppendLine("[assembly: CLSCompliant(false)]");
49
+ sb.AppendLine($"[assembly: Guid(\"{Guid.NewGuid()}\")]");
50
+ sb.AppendLine($"[assembly: AssemblyVersion(\"{assemblyVersion}\")]");
51
+ sb.Append($"[assembly: AssemblyFileVersion(\"{assemblyVersion}\")]");
52
+
53
+ FileInfo assemblyInfo = new FileInfo(assemblyInfoPath);
54
+ assemblyInfo.Directory.Create();
55
+ File.WriteAllText(assemblyInfo.FullName, sb.ToString());
56
+ }
57
+ catch (Exception ee)
58
+ {
59
+ Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}");
60
+ throw ee;
61
+ }
62
+ }
63
+ }
64
+ }
@@ -14,7 +14,7 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
14
14
  {
15
15
  internal static class MarkdownRenderer
16
16
  {
17
- public static void WriteMarkdowns(IEnumerable<VariantGroup> variantGroups, PsModuleHelpInfo moduleHelpInfo, string docsFolder, string examplesFolder)
17
+ public static void WriteMarkdowns(IEnumerable<VariantGroup> variantGroups, PsModuleHelpInfo moduleHelpInfo, string docsFolder, string examplesFolder, bool AddComplexInterfaceInfo = true)
18
18
  {
19
19
  Directory.CreateDirectory(docsFolder);
20
20
  var markdownInfos = variantGroups.Where(vg => !vg.IsInternal).Select(vg => new MarkdownHelpInfo(vg, examplesFolder)).OrderBy(mhi => mhi.CmdletName).ToArray();
@@ -69,24 +69,32 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
69
69
  }
70
70
 
71
71
  sb.Append($"## NOTES{Environment.NewLine}{Environment.NewLine}");
72
- sb.Append($"ALIASES{Environment.NewLine}{Environment.NewLine}");
73
- foreach (var alias in markdownInfo.Aliases)
72
+ if (markdownInfo.Aliases.Any())
74
73
  {
75
- sb.Append($"{alias}{Environment.NewLine}{Environment.NewLine}");
74
+ sb.Append($"ALIASES{Environment.NewLine}{Environment.NewLine}");
76
75
  }
77
- if (markdownInfo.ComplexInterfaceInfos.Any())
76
+ foreach (var alias in markdownInfo.Aliases)
78
77
  {
79
- sb.Append($"{ComplexParameterHeader}{Environment.NewLine}");
78
+ sb.Append($"{alias}{Environment.NewLine}{Environment.NewLine}");
80
79
  }
81
- foreach (var complexInterfaceInfo in markdownInfo.ComplexInterfaceInfos)
80
+
81
+ if (AddComplexInterfaceInfo)
82
82
  {
83
- sb.Append($"{complexInterfaceInfo.ToNoteOutput(includeDashes: true, includeBackticks: true)}{Environment.NewLine}{Environment.NewLine}");
83
+ if (markdownInfo.ComplexInterfaceInfos.Any())
84
+ {
85
+ sb.Append($"{ComplexParameterHeader}{Environment.NewLine}");
86
+ }
87
+ foreach (var complexInterfaceInfo in markdownInfo.ComplexInterfaceInfos)
88
+ {
89
+ sb.Append($"{complexInterfaceInfo.ToNoteOutput(includeDashes: true, includeBackticks: true)}{Environment.NewLine}{Environment.NewLine}");
90
+ }
91
+
84
92
  }
85
93
 
86
94
  sb.Append($"## RELATED LINKS{Environment.NewLine}{Environment.NewLine}");
87
95
  foreach (var relatedLink in markdownInfo.RelatedLinks)
88
96
  {
89
- sb.Append($"{relatedLink}{Environment.NewLine}{Environment.NewLine}");
97
+ sb.Append($"[{relatedLink}]({relatedLink}){Environment.NewLine}{Environment.NewLine}");
90
98
  }
91
99
 
92
100
  File.WriteAllText(Path.Combine(docsFolder, $"{markdownInfo.CmdletName}.md"), sb.ToString());
@@ -121,7 +121,7 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
121
121
  : String.Empty;
122
122
  }
123
123
 
124
- internal class PSArgumentCompleterOutput: ArgumentCompleterOutput
124
+ internal class PSArgumentCompleterOutput : ArgumentCompleterOutput
125
125
  {
126
126
  public PSArgumentCompleterInfo PSArgumentCompleterInfo { get; }
127
127
 
@@ -188,6 +188,7 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
188
188
  public VariantGroup VariantGroup { get; }
189
189
 
190
190
  protected static readonly bool IsAzure = Convert.ToBoolean(@"${$project.azure}");
191
+
191
192
  public BaseOutput(VariantGroup variantGroup)
192
193
  {
193
194
  VariantGroup = variantGroup;
@@ -206,15 +207,22 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
206
207
 
207
208
  public string GetProcessCustomAttributesAtRuntime()
208
209
  {
209
- return VariantGroup.IsInternal ? "" : $@"{Indent}{Indent}$cmdInfo = Get-Command -Name $mapping[$parameterSet]{Environment.NewLine}{Indent}{Indent}[Microsoft.Message.ClientRuntime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)";
210
+ return VariantGroup.IsInternal ? "" : IsAzure ? $@"{Indent}{Indent}$cmdInfo = Get-Command -Name $mapping[$parameterSet]
211
+ {Indent}{Indent}[Microsoft.Message.ClientRuntime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
212
+ {Indent}{Indent}if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Message.ClientRuntime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){{
213
+ {Indent}{Indent}{Indent}[Microsoft.Message.ClientRuntime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
214
+ {Indent}{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name)
215
+ {Indent}{Indent}}}" : $@"{Indent}{Indent}$cmdInfo = Get-Command -Name $mapping[$parameterSet]{Environment.NewLine}{Indent}{Indent}[Microsoft.Message.ClientRuntime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
216
+ {Indent}{Indent}[Microsoft.Message.ClientRuntime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)";
210
217
  }
218
+
211
219
  private string GetTelemetry()
212
220
  {
213
221
  if (!VariantGroup.IsInternal && IsAzure)
214
222
  {
215
223
  return $@"
216
224
  {Indent}{Indent}if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) {{
217
- {Indent}{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString()
225
+ {Indent}{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString()
218
226
  {Indent}{Indent}}}
219
227
  {Indent}{Indent}$preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId
220
228
  {Indent}{Indent}if ($preTelemetryId -eq '') {{
@@ -278,15 +286,35 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
278
286
  var parameterName = defaultInfo.ParameterGroup.ParameterName;
279
287
  sb.AppendLine();
280
288
  var setCondition = " ";
281
- if (!String.IsNullOrEmpty(defaultInfo.SetCondition)) {
289
+ if (!String.IsNullOrEmpty(defaultInfo.SetCondition))
290
+ {
282
291
  setCondition = $" -and {defaultInfo.SetCondition}";
283
292
  }
284
- sb.AppendLine($"{Indent}{Indent}if (({variantListString}) -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('{parameterName}'){setCondition}) {{");
285
- sb.AppendLine($"{Indent}{Indent}{Indent}$PSBoundParameters['{parameterName}'] = {defaultInfo.Script}");
286
- sb.Append($"{Indent}{Indent}}}");
293
+ //Yabo: this is bad to hard code the subscription id, but autorest load input README.md reversely (entry readme -> required readme), there are no other way to
294
+ //override default value set in required readme
295
+ if ("SubscriptionId".Equals(parameterName))
296
+ {
297
+ sb.AppendLine($"{Indent}{Indent}if (({variantListString}) -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('{parameterName}'){setCondition}) {{");
298
+ sb.AppendLine($"{Indent}{Indent}{Indent}$testPlayback = $false");
299
+ sb.AppendLine($"{Indent}{Indent}{Indent}$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object {{ if ($_) {{ $testPlayback = $testPlayback -or ('Microsoft.Message.ClientRuntime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) }} }}");
300
+ sb.AppendLine($"{Indent}{Indent}{Indent}if ($testPlayback) {{");
301
+ sb.AppendLine($"{Indent}{Indent}{Indent}{Indent}$PSBoundParameters['{parameterName}'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')");
302
+ sb.AppendLine($"{Indent}{Indent}{Indent}}} else {{");
303
+ sb.AppendLine($"{Indent}{Indent}{Indent}{Indent}$PSBoundParameters['{parameterName}'] = {defaultInfo.Script}");
304
+ sb.AppendLine($"{Indent}{Indent}{Indent}}}");
305
+ sb.Append($"{Indent}{Indent}}}");
306
+ }
307
+ else
308
+ {
309
+ sb.AppendLine($"{Indent}{Indent}if (({variantListString}) -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('{parameterName}'){setCondition}) {{");
310
+ sb.AppendLine($"{Indent}{Indent}{Indent}$PSBoundParameters['{parameterName}'] = {defaultInfo.Script}");
311
+ sb.Append($"{Indent}{Indent}}}");
312
+ }
313
+
287
314
  }
288
315
  return sb.ToString();
289
316
  }
317
+
290
318
  }
291
319
 
292
320
  internal class ProcessOutput : BaseOutput
@@ -627,7 +655,7 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
627
655
  return ni.IsComplexInterface
628
656
  ? ni.ToNoteOutput(nestedIndent, includeDashes, includeBackticks, false)
629
657
  : RenderProperty(ni, nestedIndent, includeDashes, includeBackticks);
630
- }).Prepend(RenderProperty(complexInterfaceInfo, currentIndent, !isFirst && includeDashes, !isFirst && includeBackticks));
658
+ }).Prepend(RenderProperty(complexInterfaceInfo, currentIndent, !isFirst && includeDashes, includeBackticks));
631
659
  return String.Join(Environment.NewLine, nested);
632
660
  }
633
661
  }
@@ -31,7 +31,7 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
31
31
  {
32
32
  public string ModuleName { get; }
33
33
 
34
- public string RootModuleName {get => @"${$project.rootModuleName}";}
34
+ public string RootModuleName { get => @"${$project.rootModuleName}"; }
35
35
  public string CmdletName { get; }
36
36
  public string CmdletVerb { get; }
37
37
  public string CmdletNoun { get; }
@@ -49,7 +49,6 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
49
49
  public PsHelpInfo HelpInfo { get; }
50
50
  public bool IsGenerated { get; }
51
51
  public bool IsInternal { get; }
52
-
53
52
  public string OutputFolder { get; }
54
53
  public string FileName { get; }
55
54
  public string FilePath { get; }
@@ -84,7 +83,6 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
84
83
  HelpInfo = Variants.Select(v => v.HelpInfo).FirstOrDefault() ?? new PsHelpInfo();
85
84
  IsGenerated = Variants.All(v => v.Attributes.OfType<GeneratedAttribute>().Any());
86
85
  IsInternal = isInternal;
87
-
88
86
  OutputFolder = outputFolder;
89
87
  FileName = $"{CmdletName}{(isTest ? ".Tests" : String.Empty)}.ps1";
90
88
  FilePath = Path.Combine(OutputFolder, FileName);
@@ -101,12 +99,23 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
101
99
  if (String.IsNullOrEmpty(defaultParameterSet))
102
100
  {
103
101
  var variantParamCountGroups = Variants
102
+ .Where(v => !v.IsNotSuggestDefaultParameterSet)
104
103
  .Select(v => (
105
104
  variant: v.VariantName,
106
105
  paramCount: v.CmdletOnlyParameters.Count(p => p.IsMandatory),
107
106
  isSimple: v.CmdletOnlyParameters.Where(p => p.IsMandatory).All(p => p.ParameterType.IsPsSimple())))
108
107
  .GroupBy(vpc => vpc.isSimple)
109
108
  .ToArray();
109
+ if (variantParamCountGroups.Length == 0)
110
+ {
111
+ variantParamCountGroups = Variants
112
+ .Select(v => (
113
+ variant: v.VariantName,
114
+ paramCount: v.CmdletOnlyParameters.Count(p => p.IsMandatory),
115
+ isSimple: v.CmdletOnlyParameters.Where(p => p.IsMandatory).All(p => p.ParameterType.IsPsSimple())))
116
+ .GroupBy(vpc => vpc.isSimple)
117
+ .ToArray();
118
+ }
110
119
  var variantParameterCounts = (variantParamCountGroups.Any(g => g.Key) ? variantParamCountGroups.Where(g => g.Key) : variantParamCountGroups).SelectMany(g => g).ToArray();
111
120
  var smallestParameterCount = variantParameterCounts.Min(vpc => vpc.paramCount);
112
121
  defaultParameterSet = variantParameterCounts.First(vpc => vpc.paramCount == smallestParameterCount).variant;
@@ -135,6 +144,7 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
135
144
  public Parameter[] CmdletOnlyParameters { get; }
136
145
  public bool IsInternal { get; }
137
146
  public bool IsDoNotExport { get; }
147
+ public bool IsNotSuggestDefaultParameterSet { get; }
138
148
  public string[] Profiles { get; }
139
149
 
140
150
  public Variant(string cmdletName, string variantName, CommandInfo info, CommandMetadata metadata, bool hasParameterSets = false, PsHelpInfo helpInfo = null)
@@ -155,6 +165,7 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
155
165
  Parameters = this.ToParameters().OrderBy(p => p.OrderCategory).ThenByDescending(p => p.IsMandatory).ToArray();
156
166
  IsInternal = Attributes.OfType<InternalExportAttribute>().Any();
157
167
  IsDoNotExport = Attributes.OfType<DoNotExportAttribute>().Any();
168
+ IsNotSuggestDefaultParameterSet = Attributes.OfType<NotSuggestDefaultParameterSetAttribute>().Any();
158
169
  CmdletOnlyParameters = Parameters.Where(p => !p.Categories.Any(c => c == ParameterCategory.Azure || c == ParameterCategory.Runtime)).ToArray();
159
170
  Profiles = Attributes.OfType<ProfileAttribute>().SelectMany(pa => pa.Profiles).ToArray();
160
171
  }
@@ -245,7 +256,6 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
245
256
  public ParameterMetadata Metadata { get; }
246
257
  public PsParameterHelpInfo HelpInfo { get; }
247
258
  public Type ParameterType { get; }
248
-
249
259
  public Attribute[] Attributes { get; }
250
260
  public ParameterCategory[] Categories { get; }
251
261
  public ParameterCategory OrderCategory { get; }
@@ -298,10 +308,10 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
298
308
  IsMandatory = ParameterAttribute.Mandatory;
299
309
 
300
310
  var complexParameterName = ParameterName.ToUpperInvariant();
301
- var complexMessage = $"{Environment.NewLine}To construct, see NOTES section for {complexParameterName} properties and create a hash table.";
311
+ var complexMessage = $"{Environment.NewLine}";
302
312
  var description = ParameterAttribute.HelpMessage.NullIfEmpty() ?? HelpInfo.Description.NullIfEmpty() ?? InfoAttribute?.Description.NullIfEmpty() ?? String.Empty;
303
313
  // Remove the complex type message as it will be reinserted if this is a complex type
304
- description = description.NormalizeNewLines().Replace(complexMessage, String.Empty).Replace(complexMessage.ToPsSingleLine(), String.Empty);
314
+ description = description.NormalizeNewLines();
305
315
  // Make an InfoAttribute for processing only if one isn't provided
306
316
  InfoAttribute = Attributes.OfType<InfoAttribute>().FirstOrDefault() ?? new InfoAttribute { PossibleTypes = new[] { ParameterType.Unwrap() }, Required = IsMandatory };
307
317
  // Set the description if the InfoAttribute does not have one since they are exported without a description
@@ -321,7 +331,7 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
321
331
  public bool Required { get; }
322
332
  public bool ReadOnly { get; }
323
333
  public string Description { get; }
324
-
334
+
325
335
  public ComplexInterfaceInfo[] NestedInfos { get; }
326
336
  public bool IsComplexInterface { get; }
327
337
 
@@ -338,7 +348,7 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
338
348
  var unwrappedType = Type.Unwrap();
339
349
  var hasBeenSeen = seenTypes?.Contains(unwrappedType) ?? false;
340
350
  (seenTypes ?? (seenTypes = new List<Type>())).Add(unwrappedType);
341
- NestedInfos = hasBeenSeen ? new ComplexInterfaceInfo[]{} :
351
+ NestedInfos = hasBeenSeen ? new ComplexInterfaceInfo[] { } :
342
352
  unwrappedType.GetInterfaces()
343
353
  .Concat(InfoAttribute.PossibleTypes)
344
354
  .SelectMany(pt => pt.GetProperties()
@@ -427,7 +437,7 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
427
437
  }
428
438
  }
429
439
 
430
- internal class PSArgumentCompleterInfo: CompleterInfo
440
+ internal class PSArgumentCompleterInfo : CompleterInfo
431
441
  {
432
442
  public string[] ResourceTypes { get; }
433
443
 
@@ -498,7 +508,8 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
498
508
  parameterHelp = parameterHelp.Where(ph => (!ph.ParameterSetNames.Any() || ph.ParameterSetNames.Any(psn => psn == variant.VariantName || psn == AllParameterSets)) && ph.Name != "IncludeTotalCount");
499
509
  }
500
510
  var result = parameters.Select(p => new Parameter(variant.VariantName, p.Key, p.Value, parameterHelp.FirstOrDefault(ph => ph.Name == p.Key)));
501
- if (variant.SupportsPaging) {
511
+ if (variant.SupportsPaging)
512
+ {
502
513
  // If supportsPaging is set, we will need to add First and Skip parameters since they are treated as common parameters which as not contained on Metadata>parameters
503
514
  variant.Info.Parameters["First"].Attributes.OfType<ParameterAttribute>().FirstOrDefault(pa => pa.ParameterSetName == variant.VariantName || pa.ParameterSetName == AllParameterSets).HelpMessage = "Gets only the first 'n' objects.";
504
515
  variant.Info.Parameters["Skip"].Attributes.OfType<ParameterAttribute>().FirstOrDefault(pa => pa.ParameterSetName == variant.VariantName || pa.ParameterSetName == AllParameterSets).HelpMessage = "Ignores the first 'n' objects and then gets the remaining objects.";
@@ -55,6 +55,11 @@ namespace Microsoft.Rest
55
55
  public string ApiVersion { get; set; }
56
56
  }
57
57
 
58
+ [AttributeUsage(AttributeTargets.Class)]
59
+ public class NotSuggestDefaultParameterSetAttribute : Attribute
60
+ {
61
+ }
62
+
58
63
  [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
59
64
  public class CategoryAttribute : Attribute
60
65
  {
@@ -39,9 +39,10 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
39
39
  public static IEnumerable<FunctionInfo> GetScriptCmdlets(PSCmdlet cmdlet, string scriptFolder)
40
40
  {
41
41
  // https://stackoverflow.com/a/40969712/294804
42
+ var wrappedFolder = scriptFolder.Contains("'") ? $@"""{scriptFolder}""" : $@"'{scriptFolder}'";
42
43
  var getCmdletsCommand = $@"
43
44
  $currentFunctions = Get-ChildItem function:
44
- Get-ChildItem -Path '{scriptFolder}' -Recurse -Include '*.ps1' -File | ForEach-Object {{ . $_.FullName }}
45
+ Get-ChildItem -Path {wrappedFolder} -Recurse -Include '*.ps1' -File | ForEach-Object {{ . $_.FullName }}
45
46
  Get-ChildItem function: | Where-Object {{ ($currentFunctions -notcontains $_) -and $_.CmdletBinding }}
46
47
  ";
47
48
  return cmdlet?.RunScript<FunctionInfo>(getCmdletsCommand) ?? RunScript<FunctionInfo>(getCmdletsCommand);
@@ -66,7 +67,7 @@ Get-ChildItem function: | Where-Object {{ ($currentFunctions -notcontains $_) -a
66
67
 
67
68
  public static IEnumerable<CmdletAndHelpInfo> GetModuleCmdletsAndHelpInfo(PSCmdlet cmdlet, params string[] modulePaths)
68
69
  {
69
- var getCmdletAndHelp = String.Join(" + ", modulePaths.Select(mp =>
70
+ var getCmdletAndHelp = String.Join(" + ", modulePaths.Select(mp =>
70
71
  $@"(Get-Command -Module (Import-Module '{mp}' -PassThru) | Where-Object {{ $_.CommandType -ne 'Alias' }} | ForEach-Object {{ @{{ CommandInfo = $_; HelpInfo = ( invoke-command {{ try {{ Get-Help -Name $_.Name -Full }} catch{{ '' }} }} ) }} }})"
71
72
  ));
72
73
  return (cmdlet?.RunScript<Hashtable>(getCmdletAndHelp) ?? RunScript<Hashtable>(getCmdletAndHelp))
@@ -87,7 +88,7 @@ Get-ChildItem function: | Where-Object {{ ($currentFunctions -notcontains $_) -a
87
88
  if (File.Exists(psd1Path))
88
89
  {
89
90
  var currentGuid = File.ReadAllLines(psd1Path)
90
- .FirstOrDefault(l => l.StartsWith(GuidStart))?.Split(new[] { " = " }, StringSplitOptions.RemoveEmptyEntries)
91
+ .FirstOrDefault(l => l.TrimStart().StartsWith(GuidStart.TrimStart()))?.Split(new[] { " = " }, StringSplitOptions.RemoveEmptyEntries)
91
92
  .LastOrDefault()?.Replace("'", String.Empty);
92
93
  guid = currentGuid != null ? Guid.Parse(currentGuid) : guid;
93
94
  }