@autorest/powershell 4.0.0-dev.8 → 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 (494) hide show
  1. package/.rush/temp/package-deps_build.json +214 -206
  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 +27 -2
  6. package/dist/cmdlets/class.d.ts.map +1 -1
  7. package/dist/cmdlets/class.js +913 -549
  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 +3 -0
  38. package/dist/internal/powershell-declarations.d.ts.map +1 -1
  39. package/dist/internal/powershell-declarations.js +5 -2
  40. package/dist/internal/powershell-declarations.js.map +1 -1
  41. package/dist/internal/project.d.ts +14 -8
  42. package/dist/internal/project.d.ts.map +1 -1
  43. package/dist/internal/project.js +27 -20
  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 +25 -11
  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 +4 -12
  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 +10 -5
  101. package/dist/llcsharp/project.d.ts.map +1 -1
  102. package/dist/llcsharp/project.js +15 -4
  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 +5 -9
  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 +17 -7
  193. package/dist/plugins/create-commands-v2.d.ts.map +1 -1
  194. package/dist/plugins/create-commands-v2.js +302 -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 +14 -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 +135 -88
  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 +39 -10
  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/resourceName.d.ts +3 -0
  297. package/dist/utils/resourceName.d.ts.map +1 -0
  298. package/dist/utils/resourceName.js +29 -0
  299. package/dist/utils/resourceName.js.map +1 -0
  300. package/dist/utils/schema.d.ts +1 -1
  301. package/dist/utils/schema.d.ts.map +1 -1
  302. package/dist/utils/schema.js +11 -11
  303. package/dist/utils/schema.js.map +1 -1
  304. package/dist/utils/security-scheme.d.ts +2 -2
  305. package/dist/utils/security-scheme.d.ts.map +1 -1
  306. package/dist/utils/security-scheme.js +2 -2
  307. package/dist/utils/security-scheme.js.map +1 -1
  308. package/dist/utils/sort-parameters.d.ts +3 -0
  309. package/dist/utils/sort-parameters.d.ts.map +1 -0
  310. package/dist/utils/sort-parameters.js +33 -0
  311. package/dist/utils/sort-parameters.js.map +1 -0
  312. package/dist/utils/tsp-generator.d.ts +3 -0
  313. package/dist/utils/tsp-generator.d.ts.map +1 -0
  314. package/dist/utils/tsp-generator.js +65 -0
  315. package/dist/utils/tsp-generator.js.map +1 -0
  316. package/dist/utils/tsp-host.d.ts +42 -0
  317. package/dist/utils/tsp-host.d.ts.map +1 -0
  318. package/dist/utils/tsp-host.js +56 -0
  319. package/dist/utils/tsp-host.js.map +1 -0
  320. package/generators/readme.ts +0 -3
  321. package/package.json +11 -10
  322. package/resources/assets/build-module.ps1 +31 -4
  323. package/resources/assets/check-dependencies.ps1 +3 -3
  324. package/resources/assets/create-model-cmdlets.ps1 +34 -5
  325. package/resources/assets/export-surface.ps1 +3 -3
  326. package/resources/assets/generate-help.ps1 +5 -5
  327. package/resources/assets/generate-portal-ux.ps1 +9 -25
  328. package/resources/assets/run-module.ps1 +4 -4
  329. package/resources/assets/test/loadEnv.ps1 +1 -1
  330. package/resources/assets/test-module.ps1 +11 -7
  331. package/resources/assets/tools/Resources/README.md +0 -3
  332. package/resources/assets/tools/Resources/custom/New-AzDeployment.ps1 +2 -2
  333. package/resources/assets/tools/Resources/how-to.md +2 -0
  334. package/resources/built-time-cmdlets.csproj +1 -0
  335. package/resources/modules/Az.Accounts/2.13.1/Accounts.format.ps1xml +554 -0
  336. package/resources/modules/Az.Accounts/2.13.1/Accounts.generated.format.ps1xml +471 -0
  337. package/resources/modules/Az.Accounts/2.13.1/Accounts.types.ps1xml +306 -0
  338. package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Az.Accounts.nuspec +4 -5
  339. package/resources/modules/Az.Accounts/2.13.1/Az.Accounts.psd1 +389 -0
  340. package/resources/modules/Az.Accounts/2.13.1/Az.Accounts.psm1 +365 -0
  341. package/resources/modules/Az.Accounts/2.13.1/FuzzySharp.dll +0 -0
  342. package/resources/modules/Az.Accounts/2.13.1/Microsoft.ApplicationInsights.dll +0 -0
  343. package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.AssemblyLoading.dll +0 -0
  344. package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Authentication.Abstractions.dll +0 -0
  345. package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Authentication.ResourceManager.dll +0 -0
  346. package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Authentication.dll +0 -0
  347. package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.AuthenticationAssemblyLoadContext.dll +0 -0
  348. package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Authenticators.dll +0 -0
  349. package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Clients.Aks.dll +0 -0
  350. package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Clients.Authorization.dll +0 -0
  351. package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Clients.Compute.dll +0 -0
  352. package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Clients.Graph.Rbac.dll +0 -0
  353. package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Clients.KeyVault.dll +0 -0
  354. package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Clients.Monitor.dll +0 -0
  355. package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Clients.Network.dll +0 -0
  356. package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Clients.PolicyInsights.dll +0 -0
  357. package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Clients.ResourceManager.dll +0 -0
  358. package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Clients.Storage.Management.dll +0 -0
  359. package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Clients.Websites.dll +0 -0
  360. package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Cmdlets.Accounts.dll +0 -0
  361. package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Cmdlets.Accounts.dll-Help.xml +2510 -779
  362. package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Common.Share.dll +0 -0
  363. package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Common.dll +0 -0
  364. package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Storage.dll +0 -0
  365. package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Strategies.dll +0 -0
  366. package/resources/modules/Az.Accounts/2.13.1/Microsoft.Rest.ClientRuntime.dll +0 -0
  367. package/resources/modules/Az.Accounts/2.13.1/PostImportScripts/LoadAuthenticators.ps1 +222 -0
  368. package/resources/modules/Az.Accounts/2.13.1/StartupScripts/AzError.ps1 +281 -0
  369. package/resources/modules/Az.Accounts/2.13.1/StartupScripts/InitializeAssemblyResolver.ps1 +242 -0
  370. package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/[Content_Types].xml +2 -3
  371. package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/_rels/.rels +2 -2
  372. package/resources/modules/Az.Accounts/2.13.1/lib/netcoreapp2.1/Azure.Core.dll +0 -0
  373. package/resources/modules/Az.Accounts/2.13.1/lib/netcoreapp2.1/Microsoft.Identity.Client.dll +0 -0
  374. package/resources/modules/Az.Accounts/2.13.1/lib/netcoreapp3.1/Microsoft.Identity.Client.Extensions.Msal.dll +0 -0
  375. package/resources/modules/Az.Accounts/2.13.1/lib/netfx/Azure.Core.dll +0 -0
  376. package/resources/modules/Az.Accounts/2.13.1/lib/netfx/Microsoft.Identity.Client.Extensions.Msal.dll +0 -0
  377. package/resources/modules/Az.Accounts/2.13.1/lib/netfx/Microsoft.Identity.Client.dll +0 -0
  378. package/resources/modules/Az.Accounts/2.13.1/lib/netfx/Newtonsoft.Json.dll +0 -0
  379. package/resources/modules/Az.Accounts/2.13.1/lib/netfx/System.Diagnostics.DiagnosticSource.dll +0 -0
  380. package/resources/modules/Az.Accounts/2.13.1/lib/netfx/System.Reflection.DispatchProxy.dll +0 -0
  381. package/resources/modules/Az.Accounts/2.13.1/lib/netfx/System.Runtime.CompilerServices.Unsafe.dll +0 -0
  382. package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/Azure.Identity.BrokeredAuthentication.dll +0 -0
  383. package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/Azure.Identity.dll +0 -0
  384. package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/Microsoft.Identity.Client.Broker.dll +0 -0
  385. package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/Microsoft.Identity.Client.NativeInterop.dll +0 -0
  386. package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/Microsoft.IdentityModel.Abstractions.dll +0 -0
  387. package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/System.Security.AccessControl.dll +0 -0
  388. package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/System.Security.Permissions.dll +0 -0
  389. package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/System.Security.Principal.Windows.dll +0 -0
  390. package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/msalruntime.dll +0 -0
  391. package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/msalruntime_arm64.dll +0 -0
  392. package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/msalruntime_x86.dll +0 -0
  393. package/resources/modules/Az.Accounts/2.13.1/package/services/metadata/core-properties/f9ac9c2e40914e78a646a7b0b997403b.psmdcp +11 -0
  394. package/resources/psruntime/Attributes/PSArgumentCompleterAttribute.cs +52 -0
  395. package/resources/psruntime/BuildTime/Cmdlets/ExportHelpMarkdown.cs +4 -1
  396. package/resources/psruntime/BuildTime/Cmdlets/ExportProxyCmdlet.cs +6 -3
  397. package/resources/psruntime/BuildTime/Cmdlets/ExportPsd1.cs +7 -4
  398. package/resources/psruntime/BuildTime/Cmdlets/ExportTestStub.cs +130 -81
  399. package/resources/psruntime/BuildTime/Cmdlets/NewAssemblyInfo.cs +64 -0
  400. package/resources/psruntime/BuildTime/MarkdownRenderer.cs +17 -9
  401. package/resources/psruntime/BuildTime/Models/PsProxyOutputs.cs +53 -8
  402. package/resources/psruntime/BuildTime/Models/PsProxyTypes.cs +35 -11
  403. package/resources/psruntime/BuildTime/PsAttributes.cs +5 -0
  404. package/resources/psruntime/BuildTime/PsHelpers.cs +4 -3
  405. package/resources/psruntime/MessageAttribute.cs +45 -55
  406. package/resources/psruntime/MessageAttributeHelper.cs +30 -7
  407. package/resources/psruntime/Properties/Resources.Designer.cs +25 -3
  408. package/resources/psruntime/Properties/Resources.resx +8 -2
  409. package/resources/runtime/csharp/pipeline/ISendAsync.cs +113 -0
  410. package/resources/runtime/csharp/pipeline/PipelineMocking.cs +1 -1
  411. package/resources/templates/azureMethod.ejs +2 -2
  412. package/resources/templates/azureMethodGroup.ejs +2 -2
  413. package/resources/templates/azureServiceClient.ejs +11 -4
  414. package/resources/templates/enum.ejs +3 -3
  415. package/resources/templates/extensionMethod.ejs +18 -12
  416. package/resources/templates/extensions.ejs +9 -2
  417. package/resources/templates/longRunningOperationMethod.ejs +10 -8
  418. package/resources/templates/method.ejs +10 -8
  419. package/resources/templates/methodBodyRestCall.ejs +77 -32
  420. package/resources/templates/methodGroupInterface.ejs +2 -61
  421. package/resources/templates/methodGroupInterfaceBody.ejs +60 -0
  422. package/resources/templates/model.ejs +15 -15
  423. package/resources/templates/serviceClientBody.ejs +8 -8
  424. package/resources/templates/serviceClientInterface.ejs +10 -4
  425. package/resources/utils/Get-SubscriptionIdTestSafe.ps1 +7 -0
  426. package/dist/utils/WrapComments.d.ts +0 -2
  427. package/dist/utils/WrapComments.d.ts.map +0 -1
  428. package/dist/utils/WrapComments.js +0 -46
  429. package/dist/utils/WrapComments.js.map +0 -1
  430. package/resources/modules/Az.Accounts/2.7.5/Accounts.format.ps1xml +0 -496
  431. package/resources/modules/Az.Accounts/2.7.5/Accounts.generated.format.ps1xml +0 -468
  432. package/resources/modules/Az.Accounts/2.7.5/Accounts.types.ps1xml +0 -303
  433. package/resources/modules/Az.Accounts/2.7.5/Az.Accounts.psd1 +0 -387
  434. package/resources/modules/Az.Accounts/2.7.5/Az.Accounts.psm1 +0 -375
  435. package/resources/modules/Az.Accounts/2.7.5/AzSharedAlcAssemblies/Azure.Core.dll +0 -0
  436. package/resources/modules/Az.Accounts/2.7.5/AzSharedAlcAssemblies/Azure.Identity.dll +0 -0
  437. package/resources/modules/Az.Accounts/2.7.5/AzSharedAlcAssemblies/Microsoft.Identity.Client.Extensions.Msal.dll +0 -0
  438. package/resources/modules/Az.Accounts/2.7.5/AzSharedAlcAssemblies/Microsoft.Identity.Client.dll +0 -0
  439. package/resources/modules/Az.Accounts/2.7.5/Microsoft.ApplicationInsights.dll +0 -0
  440. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authentication.Abstractions.dll +0 -0
  441. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authentication.ResourceManager.deps.json +0 -2309
  442. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authentication.ResourceManager.dll +0 -0
  443. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authentication.deps.json +0 -2273
  444. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authentication.dll +0 -0
  445. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.AuthenticationAssemblyLoadContext.deps.json +0 -1316
  446. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.AuthenticationAssemblyLoadContext.dll +0 -0
  447. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authenticators.dll +0 -0
  448. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Clients.Aks.dll +0 -0
  449. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Clients.Graph.Rbac.dll +0 -0
  450. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Clients.ResourceManager.dll +0 -0
  451. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Cmdlets.Accounts.deps.json +0 -2413
  452. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Cmdlets.Accounts.dll +0 -0
  453. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Common.Share.dll +0 -0
  454. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Common.dll +0 -0
  455. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Rest.ClientRuntime.dll +0 -0
  456. package/resources/modules/Az.Accounts/2.7.5/PostImportScripts/LoadAuthenticators.ps1 +0 -219
  457. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/Azure.Core.dll +0 -0
  458. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/Azure.Identity.dll +0 -0
  459. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/Microsoft.Azure.PowerShell.Authenticators.dll +0 -0
  460. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/Microsoft.Bcl.AsyncInterfaces.dll +0 -0
  461. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/Microsoft.Identity.Client.Extensions.Msal.dll +0 -0
  462. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/Microsoft.Identity.Client.dll +0 -0
  463. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/Newtonsoft.Json.12.0.3.dll +0 -0
  464. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/Newtonsoft.Json.dll +0 -0
  465. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Diagnostics.DiagnosticSource.dll +0 -0
  466. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Memory.Data.dll +0 -0
  467. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Reflection.DispatchProxy.dll +0 -0
  468. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Runtime.CompilerServices.Unsafe.dll +0 -0
  469. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Security.AccessControl.dll +0 -0
  470. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Security.Permissions.dll +0 -0
  471. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Security.Principal.Windows.dll +0 -0
  472. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Text.Json.dll +0 -0
  473. package/resources/modules/Az.Accounts/2.7.5/StartupScripts/AzError.ps1 +0 -278
  474. package/resources/modules/Az.Accounts/2.7.5/StartupScripts/InitializeAssemblyResolver.ps1 +0 -234
  475. package/resources/modules/Az.Accounts/2.7.5/package/services/metadata/core-properties/1aa0749a068a4238881858013f1a5b7f.psmdcp +0 -11
  476. /package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Hyak.Common.dll +0 -0
  477. /package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.Common.dll +0 -0
  478. /package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Rest.ClientRuntime.Azure.dll +0 -0
  479. /package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.WindowsAzure.Storage.DataMovement.dll +0 -0
  480. /package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.WindowsAzure.Storage.dll +0 -0
  481. /package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/en-US/about_az.help.txt +0 -0
  482. /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netfx}/System.Numerics.Vectors.dll +0 -0
  483. /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netfx}/System.Security.Cryptography.Cng.dll +0 -0
  484. /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netfx}/System.Text.Encodings.Web.dll +0 -0
  485. /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netfx}/System.Xml.ReaderWriter.dll +0 -0
  486. /package/resources/modules/Az.Accounts/{2.7.5/AzSharedAlcAssemblies → 2.13.1/lib/netstandard2.0}/Microsoft.Bcl.AsyncInterfaces.dll +0 -0
  487. /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netstandard2.0}/System.Buffers.dll +0 -0
  488. /package/resources/modules/Az.Accounts/{2.7.5/AzSharedAlcAssemblies → 2.13.1/lib/netstandard2.0}/System.Memory.Data.dll +0 -0
  489. /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netstandard2.0}/System.Memory.dll +0 -0
  490. /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netstandard2.0}/System.Net.Http.WinHttpHandler.dll +0 -0
  491. /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netstandard2.0}/System.Private.ServiceModel.dll +0 -0
  492. /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netstandard2.0}/System.ServiceModel.Primitives.dll +0 -0
  493. /package/resources/modules/Az.Accounts/{2.7.5/AzSharedAlcAssemblies → 2.13.1/lib/netstandard2.0}/System.Text.Json.dll +0 -0
  494. /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,6 +121,21 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
121
121
  : String.Empty;
122
122
  }
123
123
 
124
+ internal class PSArgumentCompleterOutput : ArgumentCompleterOutput
125
+ {
126
+ public PSArgumentCompleterInfo PSArgumentCompleterInfo { get; }
127
+
128
+ public PSArgumentCompleterOutput(PSArgumentCompleterInfo completerInfo) : base(completerInfo)
129
+ {
130
+ PSArgumentCompleterInfo = completerInfo;
131
+ }
132
+
133
+
134
+ public override string ToString() => PSArgumentCompleterInfo != null
135
+ ? $"{Indent}[{typeof(PSArgumentCompleterAttribute)}({(PSArgumentCompleterInfo.IsTypeCompleter ? $"[{PSArgumentCompleterInfo.Type.Unwrap().ToPsType()}]" : $"{PSArgumentCompleterInfo.ResourceTypes?.Select(r => $"\"{r}\"")?.JoinIgnoreEmpty(", ")}")})]{Environment.NewLine}"
136
+ : String.Empty;
137
+ }
138
+
124
139
  internal class DefaultInfoOutput
125
140
  {
126
141
  public bool HasDefaultInfo { get; }
@@ -173,6 +188,7 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
173
188
  public VariantGroup VariantGroup { get; }
174
189
 
175
190
  protected static readonly bool IsAzure = Convert.ToBoolean(@"${$project.azure}");
191
+
176
192
  public BaseOutput(VariantGroup variantGroup)
177
193
  {
178
194
  VariantGroup = variantGroup;
@@ -191,15 +207,22 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
191
207
 
192
208
  public string GetProcessCustomAttributesAtRuntime()
193
209
  {
194
- 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)";
195
217
  }
218
+
196
219
  private string GetTelemetry()
197
220
  {
198
221
  if (!VariantGroup.IsInternal && IsAzure)
199
222
  {
200
223
  return $@"
201
224
  {Indent}{Indent}if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) {{
202
- {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()
203
226
  {Indent}{Indent}}}
204
227
  {Indent}{Indent}$preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId
205
228
  {Indent}{Indent}if ($preTelemetryId -eq '') {{
@@ -263,15 +286,35 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
263
286
  var parameterName = defaultInfo.ParameterGroup.ParameterName;
264
287
  sb.AppendLine();
265
288
  var setCondition = " ";
266
- if (!String.IsNullOrEmpty(defaultInfo.SetCondition)) {
289
+ if (!String.IsNullOrEmpty(defaultInfo.SetCondition))
290
+ {
267
291
  setCondition = $" -and {defaultInfo.SetCondition}";
268
292
  }
269
- sb.AppendLine($"{Indent}{Indent}if (({variantListString}) -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('{parameterName}'){setCondition}) {{");
270
- sb.AppendLine($"{Indent}{Indent}{Indent}$PSBoundParameters['{parameterName}'] = {defaultInfo.Script}");
271
- 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
+
272
314
  }
273
315
  return sb.ToString();
274
316
  }
317
+
275
318
  }
276
319
 
277
320
  internal class ProcessOutput : BaseOutput
@@ -569,7 +612,9 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
569
612
 
570
613
  public static AllowEmptyArrayOutput ToAllowEmptyArray(this bool hasAllowEmptyArray) => new AllowEmptyArrayOutput(hasAllowEmptyArray);
571
614
 
572
- public static ArgumentCompleterOutput ToArgumentCompleterOutput(this CompleterInfo completerInfo) => new ArgumentCompleterOutput(completerInfo);
615
+ public static ArgumentCompleterOutput ToArgumentCompleterOutput(this CompleterInfo completerInfo) => (completerInfo is PSArgumentCompleterInfo psArgumentCompleterInfo) ? psArgumentCompleterInfo.ToArgumentCompleterOutput() : new ArgumentCompleterOutput(completerInfo);
616
+
617
+ public static PSArgumentCompleterOutput ToArgumentCompleterOutput(this PSArgumentCompleterInfo completerInfo) => new PSArgumentCompleterOutput(completerInfo);
573
618
 
574
619
  public static DefaultInfoOutput ToDefaultInfoOutput(this ParameterGroup parameterGroup) => new DefaultInfoOutput(parameterGroup);
575
620
 
@@ -610,7 +655,7 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
610
655
  return ni.IsComplexInterface
611
656
  ? ni.ToNoteOutput(nestedIndent, includeDashes, includeBackticks, false)
612
657
  : RenderProperty(ni, nestedIndent, includeDashes, includeBackticks);
613
- }).Prepend(RenderProperty(complexInterfaceInfo, currentIndent, !isFirst && includeDashes, !isFirst && includeBackticks));
658
+ }).Prepend(RenderProperty(complexInterfaceInfo, currentIndent, !isFirst && includeDashes, includeBackticks));
614
659
  return String.Join(Environment.NewLine, nested);
615
660
  }
616
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
  }
@@ -210,6 +221,7 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
210
221
  HasValidateNotNull = Parameters.SelectMany(p => p.Attributes.OfType<ValidateNotNullAttribute>()).Any();
211
222
  HasAllowEmptyArray = Parameters.SelectMany(p => p.Attributes.OfType<AllowEmptyCollectionAttribute>()).Any();
212
223
  CompleterInfo = Parameters.Select(p => p.CompleterInfoAttribute).FirstOrDefault()?.ToCompleterInfo()
224
+ ?? Parameters.Select(p => p.PSArgumentCompleterAttribute).FirstOrDefault()?.ToPSArgumentCompleterInfo()
213
225
  ?? Parameters.Select(p => p.ArgumentCompleterAttribute).FirstOrDefault()?.ToCompleterInfo();
214
226
  DefaultInfo = Parameters.Select(p => p.DefaultInfoAttribute).FirstOrDefault()?.ToDefaultInfo(this)
215
227
  ?? Parameters.Select(p => p.DefaultValueAttribute).FirstOrDefault(dv => dv != null)?.ToDefaultInfo(this);
@@ -244,7 +256,6 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
244
256
  public ParameterMetadata Metadata { get; }
245
257
  public PsParameterHelpInfo HelpInfo { get; }
246
258
  public Type ParameterType { get; }
247
-
248
259
  public Attribute[] Attributes { get; }
249
260
  public ParameterCategory[] Categories { get; }
250
261
  public ParameterCategory OrderCategory { get; }
@@ -254,6 +265,7 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
254
265
  public bool SupportsWildcards { get; }
255
266
  public CompleterInfoAttribute CompleterInfoAttribute { get; }
256
267
  public ArgumentCompleterAttribute ArgumentCompleterAttribute { get; }
268
+ public PSArgumentCompleterAttribute PSArgumentCompleterAttribute { get; }
257
269
 
258
270
  public bool ValueFromPipeline { get; }
259
271
  public bool ValueFromPipelineByPropertyName { get; }
@@ -286,7 +298,8 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
286
298
  }
287
299
  SupportsWildcards = Attributes.OfType<SupportsWildcardsAttribute>().Any();
288
300
  CompleterInfoAttribute = Attributes.OfType<CompleterInfoAttribute>().FirstOrDefault();
289
- ArgumentCompleterAttribute = Attributes.OfType<ArgumentCompleterAttribute>().FirstOrDefault();
301
+ PSArgumentCompleterAttribute = Attributes.OfType<PSArgumentCompleterAttribute>().FirstOrDefault();
302
+ ArgumentCompleterAttribute = Attributes.OfType<ArgumentCompleterAttribute>().FirstOrDefault(attr => !attr.GetType().Equals(typeof(PSArgumentCompleterAttribute)));
290
303
 
291
304
  ValueFromPipeline = ParameterAttribute.ValueFromPipeline;
292
305
  ValueFromPipelineByPropertyName = ParameterAttribute.ValueFromPipelineByPropertyName;
@@ -295,10 +308,10 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
295
308
  IsMandatory = ParameterAttribute.Mandatory;
296
309
 
297
310
  var complexParameterName = ParameterName.ToUpperInvariant();
298
- var complexMessage = $"{Environment.NewLine}To construct, see NOTES section for {complexParameterName} properties and create a hash table.";
311
+ var complexMessage = $"{Environment.NewLine}";
299
312
  var description = ParameterAttribute.HelpMessage.NullIfEmpty() ?? HelpInfo.Description.NullIfEmpty() ?? InfoAttribute?.Description.NullIfEmpty() ?? String.Empty;
300
313
  // Remove the complex type message as it will be reinserted if this is a complex type
301
- description = description.NormalizeNewLines().Replace(complexMessage, String.Empty).Replace(complexMessage.ToPsSingleLine(), String.Empty);
314
+ description = description.NormalizeNewLines();
302
315
  // Make an InfoAttribute for processing only if one isn't provided
303
316
  InfoAttribute = Attributes.OfType<InfoAttribute>().FirstOrDefault() ?? new InfoAttribute { PossibleTypes = new[] { ParameterType.Unwrap() }, Required = IsMandatory };
304
317
  // Set the description if the InfoAttribute does not have one since they are exported without a description
@@ -318,7 +331,7 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
318
331
  public bool Required { get; }
319
332
  public bool ReadOnly { get; }
320
333
  public string Description { get; }
321
-
334
+
322
335
  public ComplexInterfaceInfo[] NestedInfos { get; }
323
336
  public bool IsComplexInterface { get; }
324
337
 
@@ -335,7 +348,7 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
335
348
  var unwrappedType = Type.Unwrap();
336
349
  var hasBeenSeen = seenTypes?.Contains(unwrappedType) ?? false;
337
350
  (seenTypes ?? (seenTypes = new List<Type>())).Add(unwrappedType);
338
- NestedInfos = hasBeenSeen ? new ComplexInterfaceInfo[]{} :
351
+ NestedInfos = hasBeenSeen ? new ComplexInterfaceInfo[] { } :
339
352
  unwrappedType.GetInterfaces()
340
353
  .Concat(InfoAttribute.PossibleTypes)
341
354
  .SelectMany(pt => pt.GetProperties()
@@ -424,6 +437,16 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
424
437
  }
425
438
  }
426
439
 
440
+ internal class PSArgumentCompleterInfo : CompleterInfo
441
+ {
442
+ public string[] ResourceTypes { get; }
443
+
444
+ public PSArgumentCompleterInfo(PSArgumentCompleterAttribute completerAttribute) : base(completerAttribute)
445
+ {
446
+ ResourceTypes = completerAttribute.ResourceTypes;
447
+ }
448
+ }
449
+
427
450
  internal class DefaultInfo
428
451
  {
429
452
  public string Name { get; }
@@ -485,7 +508,8 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
485
508
  parameterHelp = parameterHelp.Where(ph => (!ph.ParameterSetNames.Any() || ph.ParameterSetNames.Any(psn => psn == variant.VariantName || psn == AllParameterSets)) && ph.Name != "IncludeTotalCount");
486
509
  }
487
510
  var result = parameters.Select(p => new Parameter(variant.VariantName, p.Key, p.Value, parameterHelp.FirstOrDefault(ph => ph.Name == p.Key)));
488
- if (variant.SupportsPaging) {
511
+ if (variant.SupportsPaging)
512
+ {
489
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
490
514
  variant.Info.Parameters["First"].Attributes.OfType<ParameterAttribute>().FirstOrDefault(pa => pa.ParameterSetName == variant.VariantName || pa.ParameterSetName == AllParameterSets).HelpMessage = "Gets only the first 'n' objects.";
491
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.";
@@ -513,7 +537,7 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
513
537
 
514
538
  public static CompleterInfo ToCompleterInfo(this CompleterInfoAttribute infoAttribute) => new CompleterInfo(infoAttribute);
515
539
  public static CompleterInfo ToCompleterInfo(this ArgumentCompleterAttribute completerAttribute) => new CompleterInfo(completerAttribute);
516
-
540
+ public static PSArgumentCompleterInfo ToPSArgumentCompleterInfo(this PSArgumentCompleterAttribute completerAttribute) => new PSArgumentCompleterInfo(completerAttribute);
517
541
  public static DefaultInfo ToDefaultInfo(this DefaultInfoAttribute infoAttribute, ParameterGroup parameterGroup) => new DefaultInfo(infoAttribute, parameterGroup);
518
542
  public static DefaultInfo ToDefaultInfo(this PSDefaultValueAttribute defaultValueAttribute, ParameterGroup parameterGroup) => new DefaultInfo(defaultValueAttribute, parameterGroup);
519
543
  }
@@ -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
  {