@autorest/powershell 4.0.0-dev.8 → 4.0.0-dev.9

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 (60) hide show
  1. package/.rush/temp/package-deps_build.json +26 -23
  2. package/dist/cmdlets/class.d.ts +4 -0
  3. package/dist/cmdlets/class.d.ts.map +1 -1
  4. package/dist/cmdlets/class.js +152 -73
  5. package/dist/cmdlets/class.js.map +1 -1
  6. package/dist/internal/powershell-declarations.d.ts +1 -0
  7. package/dist/internal/powershell-declarations.d.ts.map +1 -1
  8. package/dist/internal/powershell-declarations.js +2 -1
  9. package/dist/internal/powershell-declarations.js.map +1 -1
  10. package/dist/internal/project.d.ts +0 -2
  11. package/dist/internal/project.d.ts.map +1 -1
  12. package/dist/internal/project.js +3 -7
  13. package/dist/internal/project.js.map +1 -1
  14. package/dist/llcsharp/model/interface.d.ts.map +1 -1
  15. package/dist/llcsharp/model/interface.js +14 -0
  16. package/dist/llcsharp/model/interface.js.map +1 -1
  17. package/dist/llcsharp/model/namespace.d.ts.map +1 -1
  18. package/dist/llcsharp/model/namespace.js +3 -11
  19. package/dist/llcsharp/model/namespace.js.map +1 -1
  20. package/dist/llcsharp/project.d.ts +2 -1
  21. package/dist/llcsharp/project.d.ts.map +1 -1
  22. package/dist/llcsharp/project.js +5 -3
  23. package/dist/llcsharp/project.js.map +1 -1
  24. package/dist/llcsharp/schema/schema-resolver.d.ts.map +1 -1
  25. package/dist/llcsharp/schema/schema-resolver.js +3 -8
  26. package/dist/llcsharp/schema/schema-resolver.js.map +1 -1
  27. package/dist/plugins/create-commands-v2.d.ts +1 -0
  28. package/dist/plugins/create-commands-v2.d.ts.map +1 -1
  29. package/dist/plugins/create-commands-v2.js +39 -6
  30. package/dist/plugins/create-commands-v2.js.map +1 -1
  31. package/dist/plugins/llcsharp-v2.d.ts.map +1 -1
  32. package/dist/plugins/llcsharp-v2.js +4 -1
  33. package/dist/plugins/llcsharp-v2.js.map +1 -1
  34. package/dist/plugins/modifiers-v2.d.ts.map +1 -1
  35. package/dist/plugins/modifiers-v2.js +21 -2
  36. package/dist/plugins/modifiers-v2.js.map +1 -1
  37. package/dist/plugins/plugin-tweak-m4-model.d.ts.map +1 -1
  38. package/dist/plugins/plugin-tweak-m4-model.js +12 -0
  39. package/dist/plugins/plugin-tweak-m4-model.js.map +1 -1
  40. package/dist/utils/resourceName.d.ts +3 -0
  41. package/dist/utils/resourceName.d.ts.map +1 -0
  42. package/dist/utils/resourceName.js +29 -0
  43. package/dist/utils/resourceName.js.map +1 -0
  44. package/dist/utils/sort-parameters.d.ts +3 -0
  45. package/dist/utils/sort-parameters.d.ts.map +1 -0
  46. package/dist/utils/sort-parameters.js +33 -0
  47. package/dist/utils/sort-parameters.js.map +1 -0
  48. package/package.json +1 -1
  49. package/resources/assets/build-module.ps1 +3 -3
  50. package/resources/assets/check-dependencies.ps1 +3 -3
  51. package/resources/assets/create-model-cmdlets.ps1 +33 -5
  52. package/resources/assets/export-surface.ps1 +3 -3
  53. package/resources/assets/generate-help.ps1 +3 -3
  54. package/resources/assets/generate-portal-ux.ps1 +3 -3
  55. package/resources/assets/run-module.ps1 +4 -4
  56. package/resources/assets/test-module.ps1 +6 -6
  57. package/resources/psruntime/Attributes/PSArgumentCompleterAttribute.cs +52 -0
  58. package/resources/psruntime/BuildTime/Models/PsProxyOutputs.cs +18 -1
  59. package/resources/psruntime/BuildTime/Models/PsProxyTypes.cs +15 -2
  60. package/resources/runtime/csharp/pipeline/ISendAsync.cs +113 -0
@@ -8,7 +8,7 @@
8
8
  "powershell/autorest-configuration-for-sdk.md": "af94f23cde0b8a9a0f8b7e30341e747061d672a2",
9
9
  "powershell/autorest-configuration.md": "328f63beac732c2f4b9c188b0d3e02f88bd8ffee",
10
10
  "powershell/changelog.md": "438e32cc7c4d86e08e32c2fd4085928c0e70b1b9",
11
- "powershell/cmdlets/class.ts": "893bedf0675d7e354869b99fa342b05a75b009e1",
11
+ "powershell/cmdlets/class.ts": "5ca4faef3504a9ca3598d0d371c370fa01934857",
12
12
  "powershell/cmdlets/namespace.ts": "c07ec678f014fd2eae89e15e9d63f8f37b1957a8",
13
13
  "powershell/cmdlets/parameter.ts": "7c67fea43eded2c358ad802306dde505c8d0e30f",
14
14
  "powershell/enums/namespace.ts": "1206b2c779837a0660b314059e312a472a145c87",
@@ -26,8 +26,8 @@
26
26
  "powershell/generators/readme.ts": "b8563b454f6deaeb4d66424ebc278b90a5836776",
27
27
  "powershell/generators/script-cmdlet.ts": "369849c81f6dc161b49dbaeda65d6c245bbb4d72",
28
28
  "powershell/internal/name-inferrer.ts": "425704ee9cbf78949f9021861db6e8a148a7b2d3",
29
- "powershell/internal/powershell-declarations.ts": "7480a3e24f514929471f924f88d3f30359f76b77",
30
- "powershell/internal/project.ts": "dcd11d4e6337cabf75560be3e344415c2778fd45",
29
+ "powershell/internal/powershell-declarations.ts": "3588199ba2b200c46d7da8e565562372ec99e7a7",
30
+ "powershell/internal/project.ts": "b572367ec248a449d0a73985ddf0a9238adf3447",
31
31
  "powershell/internal/state.ts": "c5253f50958621596d983fde9d984a2e72d75f8f",
32
32
  "powershell/internal/verbs.ts": "c8fd6b534923b1dd1bd71be0f33936265468942e",
33
33
  "powershell/llcsharp/clientruntime.ts": "66d0937fb4f22323c444574102227896e0c64d50",
@@ -40,18 +40,18 @@
40
40
  "powershell/llcsharp/generator.ts": "b24d9690c6dffd223faac1419f79cb80afdd73c7",
41
41
  "powershell/llcsharp/messages.ts": "8877bbe9db148d73fd8a3cac30dcb55ab840845f",
42
42
  "powershell/llcsharp/model/idictionary.ts": "2ca8a2a997e23b17bd23eb9b6732414aea5f013f",
43
- "powershell/llcsharp/model/interface.ts": "715c3845c2065b2775d89cea844f1a0f000f8f48",
43
+ "powershell/llcsharp/model/interface.ts": "d3fffc809e846689ec162ca03104ce8ae821c058",
44
44
  "powershell/llcsharp/model/model-class-dictionary.ts": "fe5be9aa69792534b7800ea4269f052ae11c163b",
45
45
  "powershell/llcsharp/model/model-class-json.ts": "5175028256c8430bf9a00634cfae1d3955c65358",
46
46
  "powershell/llcsharp/model/model-class-serializer.ts": "24cf0191f3a079480ffc5c53eea2df607da7e4de",
47
47
  "powershell/llcsharp/model/model-class.ts": "f047f0f4c814a587197933d43ebc50ee69a805b1",
48
- "powershell/llcsharp/model/namespace.ts": "5eb8d2fa9869a3ad5319223306e851c7b2ff1bfd",
48
+ "powershell/llcsharp/model/namespace.ts": "77d1b16230758be5c3bcf74649755c4c2143e855",
49
49
  "powershell/llcsharp/model/property.ts": "94a82a74ee43919c0dddd406901c2a847c75f8db",
50
50
  "powershell/llcsharp/operation/api-class.ts": "1d66df80f692574b8533ec9e6a0b324cdca526e8",
51
51
  "powershell/llcsharp/operation/method.ts": "298d172a5effb91c3a5df4ce6e6f54c913a23a3d",
52
52
  "powershell/llcsharp/operation/namespace.ts": "22f6a2736a67c76677cd903adc2901d358e1cc6b",
53
53
  "powershell/llcsharp/operation/parameter.ts": "e46c779bedbe0b5150dd37ef455c5bbc6081a02b",
54
- "powershell/llcsharp/project.ts": "76b9c12543d73bcce7f54b0a43e3e50e988027a4",
54
+ "powershell/llcsharp/project.ts": "1a775246b9189da8b5e738fe33f723fee23c430a",
55
55
  "powershell/llcsharp/schema/Uuid.ts": "750348055617a265ccee1588e28c7b0ad5b39ccc",
56
56
  "powershell/llcsharp/schema/array.ts": "eb00cd7e80e7deb3bd97b70166cc999989ff8f9b",
57
57
  "powershell/llcsharp/schema/binary.ts": "49091f193c8171d99f9f768fa7dc10fc60d07716",
@@ -68,7 +68,7 @@
68
68
  "powershell/llcsharp/schema/object.ts": "fb6c5e461dd9395f08dafa11c8781190584a1c6c",
69
69
  "powershell/llcsharp/schema/password.ts": "2da4f9d7bb775e7dfca0aedc5306788c46ea749e",
70
70
  "powershell/llcsharp/schema/primitive.ts": "60ce81387d40d16adfe132315d45b8f86ad6212b",
71
- "powershell/llcsharp/schema/schema-resolver.ts": "3badb4711f8ca330e284caa13147ad8605e367da",
71
+ "powershell/llcsharp/schema/schema-resolver.ts": "b00ed1a8726ae58e3c9f799570847bf5eeb5eb1c",
72
72
  "powershell/llcsharp/schema/string.ts": "0bb2229d97633e9cc02725964f367b3f5621441a",
73
73
  "powershell/llcsharp/schema/uri.ts": "58d8f8a09fc34a4567374ecfbb05c0dd9b8422f4",
74
74
  "powershell/llcsharp/validations.ts": "0a86cb8934b4536461efbce10de737075c599866",
@@ -76,14 +76,14 @@
76
76
  "powershell/models/model-extensions.ts": "f8d9711d5020e593ae943ae6472b742554e6db59",
77
77
  "powershell/module/module-class.ts": "327af665b5d81e4cc1b8fa9da7382e9c73300de5",
78
78
  "powershell/module/module-namespace.ts": "f6afc90087e8d733f0323b0de8ba41d923955732",
79
- "powershell/package.json": "cfff472b3ff7fb13255d11f978fe33b044e396c5",
79
+ "powershell/package.json": "7ef52b58241d8be09bbd660237495f17dd609fc1",
80
80
  "powershell/plugins/add-azure-completers-v2.ts": "557ce4326318c82f91445490a162f20fa029fed3",
81
- "powershell/plugins/create-commands-v2.ts": "2df96f89474fad884af03531b8028ef8e0a90ed3",
81
+ "powershell/plugins/create-commands-v2.ts": "588c7abb84c08f02c76e9669de963c70ac6a80fd",
82
82
  "powershell/plugins/cs-namer-v2.ts": "b1844bab421529bb6e5e341eef5a741c8c8ab35f",
83
- "powershell/plugins/llcsharp-v2.ts": "c90a8a2c61de26fdcef583565b26004de9ef85a0",
84
- "powershell/plugins/modifiers-v2.ts": "bca35cc62de33c1b60f3216011db4450d11361ad",
83
+ "powershell/plugins/llcsharp-v2.ts": "55c99aba1da4d616b2ad5f6fed5c891fb97f453f",
84
+ "powershell/plugins/modifiers-v2.ts": "7ad59a5e5cbf1ba43d245017796c66eb11f3ddb8",
85
85
  "powershell/plugins/plugin-create-inline-properties.ts": "c0b9bfaba261d6c317014876dc33675430be6858",
86
- "powershell/plugins/plugin-tweak-m4-model.ts": "7fed3e6797d5df1a7390eb92f1967343cc762795",
86
+ "powershell/plugins/plugin-tweak-m4-model.ts": "2b135cfc64f1b8a1289f3c49ef2070e2dba81924",
87
87
  "powershell/plugins/plugin-tweak-model-azure-v2.ts": "78945acc6ac5e3b0e10846132c9f32aa96538a04",
88
88
  "powershell/plugins/plugin-tweak-model.ts": "7bd4acd1b43235f8d5d4670c97b509b86160e572",
89
89
  "powershell/plugins/powershell-v2.ts": "e9230f656d1df3eff65b54d82e264033fd418bc1",
@@ -94,23 +94,23 @@
94
94
  "powershell/plugins/sdk-generate.ts": "f7d2ecdd5bd70de7880fd8c1ac307922a3aa130a",
95
95
  "powershell/plugins/sdk-tweak-model.ts": "16cf569c7b5c52d2250d57840c02828de65a4514",
96
96
  "powershell/readme.md": "eeb191589b240161a10502f6d21e35b23f9bc805",
97
- "powershell/resources/assets/build-module.ps1": "240ca42b9250638bc76c4af372f099ad156a0ba4",
98
- "powershell/resources/assets/check-dependencies.ps1": "fdbc4bc30bde12fcdefe905acc55614e9d570a67",
99
- "powershell/resources/assets/create-model-cmdlets.ps1": "c0c981c16d15a454487df904aa877cd85b07ec6e",
97
+ "powershell/resources/assets/build-module.ps1": "ede1cbedba44661f97788dda72a74e95482d9083",
98
+ "powershell/resources/assets/check-dependencies.ps1": "2b60454c4749ce45ebabb419e2228b0b80b89545",
99
+ "powershell/resources/assets/create-model-cmdlets.ps1": "029eceefb311addf11e18d9478c3e0d8a2578c66",
100
100
  "powershell/resources/assets/custom/README.md": "8f35d9de2dd67e37c4135b2d91dc194b33c9cd3f",
101
101
  "powershell/resources/assets/docs/README.md": "7ea7065e913f5792b57d826f5cf12c603c87421d",
102
102
  "powershell/resources/assets/examples/README.md": "a0ad7c4631b6944a22edd0c2d23fe0bc66365ac7",
103
- "powershell/resources/assets/export-surface.ps1": "b97888449ac519ffe26d3f6dddef18b7be7c96d4",
103
+ "powershell/resources/assets/export-surface.ps1": "836175c819a8e55a8318c9b12f7c976fdaec8ea7",
104
104
  "powershell/resources/assets/exports/README.md": "c8a90f9d2e9134c3366ae18eb6f2d5f169a8ee4b",
105
- "powershell/resources/assets/generate-help.ps1": "c89c2d32e94fe4a62612ecb7937983cafcf528f1",
106
- "powershell/resources/assets/generate-portal-ux.ps1": "78b89bd0e7e226e10471e16b379e027a9bda2d36",
105
+ "powershell/resources/assets/generate-help.ps1": "6b945ca9e59d2b8998259e6f8c3d3d76a7d05fd9",
106
+ "powershell/resources/assets/generate-portal-ux.ps1": "5825cbce76a4dfdd88ad975c50767770d5ef0d10",
107
107
  "powershell/resources/assets/how-to.md": "a2fc9c53d35275e0e4cd8423e4e194744d359afd",
108
108
  "powershell/resources/assets/internal/README.md": "ec115a67f403df03f07892213b3b9e83867cdd41",
109
109
  "powershell/resources/assets/license.txt": "b9f3180fb9aff09aa7665db6b3226e492f670be6",
110
110
  "powershell/resources/assets/pack-module.ps1": "3a263c5fd58c6f124693c3004db4b960ed579f39",
111
111
  "powershell/resources/assets/resources/README.md": "c532566d4700f25121ebf7cd78071002f888d096",
112
- "powershell/resources/assets/run-module.ps1": "eb6557320316b6de2c2ec3ab39f9c10c54fcd9cd",
113
- "powershell/resources/assets/test-module.ps1": "517b9d1e7b781a2b47a058645cce3ab1c991ab36",
112
+ "powershell/resources/assets/run-module.ps1": "1ddd04852650ade2491a9e6b80b449d609d54105",
113
+ "powershell/resources/assets/test-module.ps1": "8cb568fd8d0352844bcba50193231191c42fc834",
114
114
  "powershell/resources/assets/test/README.md": "bef2317f03ce8baf52bff238510e27a0ffe79aaa",
115
115
  "powershell/resources/assets/test/loadEnv.ps1": "1d350fe78c673fb88c577c04f61277ab75bdcf25",
116
116
  "powershell/resources/assets/tools/Resources/.gitattributes": "2125666142eb661091cc5f32af2ed2f3fc65571d",
@@ -210,6 +210,7 @@
210
210
  "powershell/resources/psruntime/AsyncJob.cs": "a8ccf259bb62954fdae31a7fe5ed59b6bba574fb",
211
211
  "powershell/resources/psruntime/AsyncOperationResponse.cs": "858ae5bb8c53e738bcf577103f11a64de58ff780",
212
212
  "powershell/resources/psruntime/Attributes/ExternalDocsAttribute.cs": "351f0211537f9a38562884273f3ce1b0f59b423c",
213
+ "powershell/resources/psruntime/Attributes/PSArgumentCompleterAttribute.cs": "f761a8b8716c34f6465ffc8059002b7a6b05b009",
213
214
  "powershell/resources/psruntime/BuildTime/Cmdlets/ExportCmdletSurface.cs": "2183825bf22f36d40118ea2e78b50c40c8775886",
214
215
  "powershell/resources/psruntime/BuildTime/Cmdlets/ExportExampleStub.cs": "29ffa8a0b71f535d7ec91a42cd40fa0f04bee0bb",
215
216
  "powershell/resources/psruntime/BuildTime/Cmdlets/ExportFormatPs1xml.cs": "e974093cbafba7c6190c7c07219f84ed81bad063",
@@ -227,8 +228,8 @@
227
228
  "powershell/resources/psruntime/BuildTime/Models/PsHelpMarkdownOutputs.cs": "056be554968d76667c0659d169f674ef5dbb74ed",
228
229
  "powershell/resources/psruntime/BuildTime/Models/PsHelpTypes.cs": "34d832146757eab7d8e1bd3feba5d411577f388a",
229
230
  "powershell/resources/psruntime/BuildTime/Models/PsMarkdownTypes.cs": "c2c068932d2e4ab31a46d566e7b24f357f68c6f8",
230
- "powershell/resources/psruntime/BuildTime/Models/PsProxyOutputs.cs": "6f80f840f4f51b3982d8ea15f0988d585c8c420f",
231
- "powershell/resources/psruntime/BuildTime/Models/PsProxyTypes.cs": "beba5f1aa6d9d9431dc180ccad5269df64522a36",
231
+ "powershell/resources/psruntime/BuildTime/Models/PsProxyOutputs.cs": "96f2edd887a287c448991eff88f5184276ae6dd3",
232
+ "powershell/resources/psruntime/BuildTime/Models/PsProxyTypes.cs": "a792ccf3e36a88ce51756c827b055e2f3055728b",
232
233
  "powershell/resources/psruntime/BuildTime/PsAttributes.cs": "7435d3a1d83bdb34759a1eebb21cf092684656ae",
233
234
  "powershell/resources/psruntime/BuildTime/PsExtensions.cs": "52083232ddc161a0f41496cbdf979d709c490194",
234
235
  "powershell/resources/psruntime/BuildTime/PsHelpers.cs": "9958d6426383fc7325c13722d221554467b1fa93",
@@ -327,7 +328,7 @@
327
328
  "powershell/resources/runtime/csharp/pipeline/EventData.cs": "e0ad3c5ea54e9615ca7bc3e71672e3c1c74b2b27",
328
329
  "powershell/resources/runtime/csharp/pipeline/EventListener.cs": "350991c330499c8770e33d0ca3cf34edfd93bf0a",
329
330
  "powershell/resources/runtime/csharp/pipeline/Events.cs": "63b08de750ffa3eb77fb45012d4d1b19d1c52654",
330
- "powershell/resources/runtime/csharp/pipeline/ISendAsync.cs": "8bda5bc6f964056058b18446b5ba67f86cc5472b",
331
+ "powershell/resources/runtime/csharp/pipeline/ISendAsync.cs": "479c7ab4908d8049afc28187d694cdc2687118c7",
331
332
  "powershell/resources/runtime/csharp/pipeline/PipelineMocking.cs": "33810ca9f7e477886759085fb20990e0ab5a0243",
332
333
  "powershell/resources/runtime/csharp/pipeline/Response.cs": "0916ff12e3cbe15950a260245274af684256158b",
333
334
  "powershell/resources/runtime/csharp/pipeline/delegates.cs": "3abbd1354807e026f0d05a72e7d538533d775984",
@@ -377,8 +378,10 @@
377
378
  "powershell/utils/powershell-comment.ts": "06963a59ff78eafdb453e6ddf2cb7a3252b8a998",
378
379
  "powershell/utils/programatic-operation.ts": "98c8fe7ede1af122695cea7ee9786656c02fb985",
379
380
  "powershell/utils/resolve-conflicts.ts": "ce9f4a6b62c9b7aecf10291b3ad362551290d222",
381
+ "powershell/utils/resourceName.ts": "238dc698ac70477a1a9c6c16bde7b92355115219",
380
382
  "powershell/utils/schema.ts": "3ad7de2dc72dcf4c81d2be7faf5c258351dea839",
381
383
  "powershell/utils/security-scheme.ts": "5ad1d05e51b94b9645c95104a08d748c17b8d3ac",
384
+ "powershell/utils/sort-parameters.ts": "97dd28394d5c65ebc395fae810e3dc8b44f7e686",
382
385
  "powershell/utils/uid.ts": "dbeb7ffd9dba79a6ce37a9b21955c00e42c8f6ae"
383
386
  },
384
387
  "arguments": "tsc -p . "
@@ -1,3 +1,4 @@
1
+ import { Schema as NewSchema } from '@azure-tools/codemodel';
1
2
  import { VirtualParameter } from '@azure-tools/codemodel-v3';
2
3
  import { CommandOperation, VirtualParameter as NewVirtualParameter } from '../utils/command-operation';
3
4
  import { DeepPartial } from '@azure-tools/codegen';
@@ -6,6 +7,8 @@ import { State } from '../internal/state';
6
7
  export declare function createStepper(p: Expression): Expression;
7
8
  export declare function addCompleterInfo(targetProperty: Property, parameter: VirtualParameter): void;
8
9
  export declare function NewAddCompleterInfo(targetProperty: Property, parameter: NewVirtualParameter): void;
10
+ export declare function isEnumImplementation(schema: NewSchema | undefined): boolean;
11
+ export declare function addPSArgumentCompleterAttribute(targetProperty: Property, parameterSchema: any): void;
9
12
  export declare function addParameterBreakingChange(targetProperty: Property, parameter: any): void;
10
13
  export declare function addPreviewMessage(targetProperty: Property, parameter: any): void;
11
14
  export declare function addDefaultInfo(targetProperty: Property, parameter: any): void;
@@ -31,6 +34,7 @@ export declare class CmdletClass extends Class {
31
34
  private hasStreamOutput;
32
35
  private outFileParameter?;
33
36
  private clientsidePagination?;
37
+ private inputObjectParameterName;
34
38
  constructor(namespace: Namespace, operation: CommandOperation, state: State, objectInitializer?: DeepPartial<CmdletClass>);
35
39
  init(): Promise<this>;
36
40
  get headerComment(): string;
@@ -1 +1 @@
1
- {"version":3,"file":"class.d.ts","sourceRoot":"","sources":["../../cmdlets/class.ts"],"names":[],"mappings":"AAOA,OAAO,EAA4J,gBAAgB,EAAmB,MAAM,2BAA2B,CAAC;AACxO,OAAO,EAAE,gBAAgB,EAAiB,gBAAgB,IAAI,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEtH,OAAO,EAAmD,WAAW,EAAa,MAAM,sBAAsB,CAAC;AAE/G,OAAO,EACqC,KAAK,EAAwC,UAAU,EAA4F,SAAS,EAAkC,QAAQ,EAC/K,KAAK,EAAgE,eAAe,EACtJ,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AA0H1C,wBAAgB,aAAa,CAAC,CAAC,EAAE,UAAU,cAM1C;AAED,wBAAgB,gBAAgB,CAAC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ClC,aAAa,EAAG,KAAK,CAAC;IACtB,eAAe,EAAG,KAAK,CAAC;IACxB,cAAc,EAAG,QAAQ,CAAC;IAC1B,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAkB;IACpD,OAAO,CAAC,aAAa,CAAC,CAAW;IACjC,OAAO,CAAC,iBAAiB,CAAC,CAAwD;IAClF,OAAO,CAAC,MAAM,CAAC,CAAW;IAC1B,OAAO,CAAC,SAAS,CAAmB;IACpC,OAAO,CAAC,SAAS,CAAC,CAAU;IAC5B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,aAAa,CAAU;IAC/B,OAAO,CAAC,eAAe,CAAU;IACjC,OAAO,CAAC,gBAAgB,CAAC,CAAW;IACpC,OAAO,CAAC,oBAAoB,CAAC,CAAU;IACvC,OAAO,CAAC,wBAAwB,CAAS;gBAE7B,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,gBAAgB,EAAE,KAAK,EAAE,KAAK,EAAE,iBAAiB,CAAC,EAAE,WAAW,CAAC,WAAW,CAAC;IAyBnH,IAAI;IA8DV,IAAW,aAAa,IAAI,MAAM,CA4BjC;IAED,OAAO,CAAC,qBAAqB;IAc7B,OAAO,CAAC,aAAa;IAarB,OAAO,CAAC,0BAA0B;IA4ClC,OAAO,CAAC,cAAc;IA+EtB,OAAO,CAAC,mBAAmB;IAc3B,OAAO,CAAC,yBAAyB;IAqFjC,OAAO,CAAC,8BAA8B;IA6iBtC,OAAO,CAAC,yBAAyB;IAqCjC,OAAO,CAAC,qBAAqB;IAK7B,OAAO,CAAC,iBAAiB;IAUzB,OAAO,CAAC,uBAAuB;IAiJ/B,OAAO,CAAC,0BAA0B;IAiVlC;;;;;OAKG;IACH,OAAO,CAAC,cAAc;IAUtB,OAAO,CAAC,qBAAqB;CAoM9B"}
@@ -4,7 +4,7 @@
4
4
  * Licensed under the MIT License. See License.txt in the project root for license information.
5
5
  *--------------------------------------------------------------------------------------------*/
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.CmdletClass = exports.NewAddInfoAttribute = exports.addInfoAttribute = exports.addDefaultInfo = exports.addPreviewMessage = exports.addParameterBreakingChange = exports.NewAddCompleterInfo = exports.addCompleterInfo = exports.createStepper = void 0;
7
+ exports.CmdletClass = exports.NewAddInfoAttribute = exports.addInfoAttribute = exports.addDefaultInfo = exports.addPreviewMessage = exports.addParameterBreakingChange = exports.addPSArgumentCompleterAttribute = exports.isEnumImplementation = exports.NewAddCompleterInfo = exports.addCompleterInfo = exports.createStepper = void 0;
8
8
  const ejs = require('ejs');
9
9
  const codemodel_1 = require("@azure-tools/codemodel");
10
10
  const codemodel_v3_1 = require("@azure-tools/codemodel-v3");
@@ -18,6 +18,7 @@ const powershell_declarations_1 = require("../internal/powershell-declarations")
18
18
  const autorest_extension_base_1 = require("@azure-tools/autorest-extension-base");
19
19
  const codegen_csharp_2 = require("@azure-tools/codegen-csharp");
20
20
  const model_class_1 = require("../llcsharp/model/model-class");
21
+ const resourceName_1 = require("../utils/resourceName");
21
22
  const PropertiesRequiringNew = new Set(['Host', 'Events']);
22
23
  const Verbs = {
23
24
  Common: 'global::System.Management.Automation.VerbsCommon',
@@ -160,6 +161,16 @@ function NewAddCompleterInfo(targetProperty, parameter) {
160
161
  }
161
162
  }
162
163
  exports.NewAddCompleterInfo = NewAddCompleterInfo;
164
+ function isEnumImplementation(schema) {
165
+ return ((schema === null || schema === void 0 ? void 0 : schema.type) === codemodel_1.SchemaType.SealedChoice && !schema.language.default.skip) ||
166
+ ((schema === null || schema === void 0 ? void 0 : schema.extensions) && schema.extensions['x-ms-enum']);
167
+ }
168
+ exports.isEnumImplementation = isEnumImplementation;
169
+ function addPSArgumentCompleterAttribute(targetProperty, parameterSchema) {
170
+ const enumValues = linq_1.values(parameterSchema.language.csharp.enum.values).select(v => `"${v.value}"`).toArray().join(", ");
171
+ targetProperty.add(new codegen_csharp_1.Attribute(powershell_declarations_1.PSArgumentCompleterAttribute, { parameters: [`${enumValues}`] }));
172
+ }
173
+ exports.addPSArgumentCompleterAttribute = addPSArgumentCompleterAttribute;
163
174
  function addParameterBreakingChange(targetProperty, parameter) {
164
175
  if (parameter.breakingChange) {
165
176
  const parameters = [];
@@ -329,6 +340,7 @@ class CmdletClass extends codegen_csharp_1.Class {
329
340
  this.eventListener = new exports_1.EventListener(new codegen_csharp_1.LiteralExpression(`((${exports_1.ClientRuntime.IEventListener})this)`), true);
330
341
  this.isViaIdentity = variantName.indexOf('ViaIdentity') > 0;
331
342
  this.clientsidePagination = !!operation.details.csharp.clientsidePagination && !!((_a = operation.callGraph[0].language.csharp) === null || _a === void 0 ? void 0 : _a.pageable);
343
+ this.inputObjectParameterName = 'InputObject';
332
344
  }
333
345
  async init() {
334
346
  // basic stuff
@@ -405,7 +417,7 @@ class CmdletClass extends codegen_csharp_1.Class {
405
417
  return ops ? `${header}\n${codegen_1.docComment(codegen_csharp_1.xmlize('remarks', ops))}` : header;
406
418
  }
407
419
  AddSwitchViewProperty(responseType = codegen_csharp_1.dotnet.Object) {
408
- var fieldNames = this.fields.map(f => f.name);
420
+ const fieldNames = this.fields.map(f => f.name);
409
421
  if (!fieldNames.includes('_responseSize')) {
410
422
  this.add(new codegen_csharp_1.Field('_responseSize', codegen_csharp_1.dotnet.Int, {
411
423
  initialValue: '0', description: 'A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. Two means multiple returned objects in response.', access: codegen_csharp_1.Access.Private
@@ -418,9 +430,9 @@ class CmdletClass extends codegen_csharp_1.Class {
418
430
  }
419
431
  }
420
432
  FlushResponse(singleFlush = true) {
421
- var fieldNames = this.fields.map(f => f.name);
433
+ const fieldNames = this.fields.map(f => f.name);
422
434
  return fieldNames.includes('_responseSize') ?
423
- codegen_csharp_1.If(`1 ==_responseSize`, function* () {
435
+ codegen_csharp_1.If('1 ==_responseSize', function* () {
424
436
  yield '// Flush buffer';
425
437
  if (singleFlush) {
426
438
  yield 'WriteObject(_firstResponse);';
@@ -430,26 +442,25 @@ class CmdletClass extends codegen_csharp_1.Class {
430
442
  }
431
443
  }) : '';
432
444
  }
433
- ;
434
445
  WriteObjectWithViewControl(valueName, isEnumerable = false) {
435
446
  const $this = this;
436
447
  if ($this.state.project.autoSwitchView) {
437
448
  if (isEnumerable) {
438
449
  return function* () {
439
450
  yield `var outputObjects = ${valueName};`;
440
- yield codegen_csharp_1.If(`null != outputObjects`, function* () {
441
- yield codegen_csharp_1.If(`0 == _responseSize && 1 == outputObjects.Count`, function* () {
442
- yield `_firstResponse = outputObjects[0];`;
443
- yield `_responseSize = 1;`;
451
+ yield codegen_csharp_1.If('null != outputObjects', function* () {
452
+ yield codegen_csharp_1.If('0 == _responseSize && 1 == outputObjects.Count', function* () {
453
+ yield '_firstResponse = outputObjects[0];';
454
+ yield '_responseSize = 1;';
444
455
  });
445
456
  yield codegen_csharp_1.Else(function* () {
446
457
  yield $this.FlushResponse(false);
447
458
  yield 'var values = new System.Collections.Generic.List<System.Management.Automation.PSObject>();';
448
- yield codegen_csharp_1.ForEach(`value`, `outputObjects`, function* () {
449
- yield `values.Add(value.AddMultipleTypeNameIntoPSObject());`;
459
+ yield codegen_csharp_1.ForEach('value', 'outputObjects', function* () {
460
+ yield 'values.Add(value.AddMultipleTypeNameIntoPSObject());';
450
461
  });
451
462
  yield 'WriteObject(values, true); ';
452
- yield `_responseSize = 2;`;
463
+ yield '_responseSize = 2;';
453
464
  });
454
465
  });
455
466
  };
@@ -457,15 +468,15 @@ class CmdletClass extends codegen_csharp_1.Class {
457
468
  else {
458
469
  return function* () {
459
470
  yield `var outputObject = ${valueName};`;
460
- yield codegen_csharp_1.If(`null != outputObject`, function* () {
461
- yield codegen_csharp_1.If(`0 == _responseSize`, function* () {
462
- yield `_firstResponse = outputObject;`;
463
- yield `_responseSize = 1;`;
471
+ yield codegen_csharp_1.If('null != outputObject', function* () {
472
+ yield codegen_csharp_1.If('0 == _responseSize', function* () {
473
+ yield '_firstResponse = outputObject;';
474
+ yield '_responseSize = 1;';
464
475
  });
465
476
  yield codegen_csharp_1.Else(function* () {
466
477
  yield $this.FlushResponse(false);
467
- yield `WriteObject(outputObject.AddMultipleTypeNameIntoPSObject());`;
468
- yield `_responseSize = 2;`;
478
+ yield 'WriteObject(outputObject.AddMultipleTypeNameIntoPSObject());';
479
+ yield '_responseSize = 2;';
469
480
  });
470
481
  });
471
482
  };
@@ -673,7 +684,7 @@ class CmdletClass extends codegen_csharp_1.Class {
673
684
  };
674
685
  for (const vParam of [...vps.body, ...vps.operation]) {
675
686
  if (vParam.hidden) {
676
- const td = $this.state.project.schemaDefinitionResolver.resolveTypeDeclaration(vParam.schema, true, $this.state);
687
+ const td = $this.state.project.schemaDefinitionResolver.resolveTypeDeclaration(vParam.schema, true, $this.state, true);
677
688
  yield codegen_csharp_1.If(`true == this.MyInvocation?.BoundParameters?.ContainsKey("${vParam.name}")`, `${vParam.name} = (${td.declaration})this.MyInvocation.BoundParameters["${vParam.name}"];`);
678
689
  }
679
690
  }
@@ -834,12 +845,12 @@ class CmdletClass extends codegen_csharp_1.Class {
834
845
  const vp = schema_1.getVirtualPropertyFromPropertyName((_m = schema.language.csharp) === null || _m === void 0 ? void 0 : _m.virtualProperties, valueProperty.serializedName);
835
846
  if (vp) {
836
847
  if ($this.clientsidePagination) {
837
- yield (codegen_csharp_1.If('(ulong)result.Value.Length <= this.PagingParameters.Skip', function* () {
838
- yield ('this.PagingParameters.Skip = this.PagingParameters.Skip - (ulong)result.Value.Length;');
848
+ yield (codegen_csharp_1.If('(ulong)result.Value.Count <= this.PagingParameters.Skip', function* () {
849
+ yield ('this.PagingParameters.Skip = this.PagingParameters.Skip - (ulong)result.Value.Count;');
839
850
  }));
840
851
  yield codegen_csharp_1.Else(function* () {
841
- yield ('ulong toRead = Math.Min(this.PagingParameters.First, (ulong)result.Value.Length - this.PagingParameters.Skip);');
842
- yield ('var requiredResult = result.Value.SubArray((int)this.PagingParameters.Skip, (int)toRead);');
852
+ yield ('ulong toRead = Math.Min(this.PagingParameters.First, (ulong)result.Value.Count - this.PagingParameters.Skip);');
853
+ yield ('var requiredResult = result.Value.GetRange((int)this.PagingParameters.Skip, (int)toRead);');
843
854
  yield $this.WriteObjectWithViewControl(`requiredResult`, true);
844
855
  yield ('this.PagingParameters.Skip = 0;');
845
856
  yield ('this.PagingParameters.First = this.PagingParameters.First <= toRead ? 0 : this.PagingParameters.First - toRead;');
@@ -972,7 +983,11 @@ class CmdletClass extends codegen_csharp_1.Class {
972
983
  const actualCall = function* () {
973
984
  var _a, _b;
974
985
  yield $this.eventListener.signal(powershell_declarations_1.Events.CmdletBeforeAPICall);
975
- const idOpParams = operationParameters.filter(each => !each.isPathParam);
986
+ const nonPathParams = operationParameters.filter(each => !each.isPathParam);
987
+ const allParams = [];
988
+ const idOpParamsNotFromIdentity = [];
989
+ const idOpParamsFromIdentity = [];
990
+ const idOpParamsFromIdentityserializedName = [];
976
991
  const idschema = linq_1.values($this.state.project.model.schemas.objects).first(each => each.language.default.uid === 'universal-parameter-type');
977
992
  let serializationMode = null;
978
993
  if ($this.bodyParameter) {
@@ -984,59 +999,123 @@ class CmdletClass extends codegen_csharp_1.Class {
984
999
  }
985
1000
  }
986
1001
  if ($this.isViaIdentity) {
1002
+ if (idschema) {
1003
+ const allVPs = schema_1.getAllPublicVirtualProperties((_a = idschema.language.csharp) === null || _a === void 0 ? void 0 : _a.virtualProperties);
1004
+ const props = [...linq_1.values(idschema.properties)];
1005
+ operationParameters.forEach(each => {
1006
+ var _a, _b, _c, _d, _e, _f;
1007
+ const pascalName = codegen_1.pascalCase(`${each.name}`);
1008
+ //push parameters that is not path parameters into allParams and idOpParamsNotFromIdentity
1009
+ if (!each.isPathParam) {
1010
+ const param = {
1011
+ name: undefined,
1012
+ value: codegen_csharp_1.valueOf(each.expression)
1013
+ };
1014
+ allParams.push(param);
1015
+ idOpParamsNotFromIdentity.push(param);
1016
+ return;
1017
+ }
1018
+ const match = props.find(p => codegen_1.pascalCase(p.serializedName) === pascalName);
1019
+ if (match) {
1020
+ const defaultOfType = $this.state.project.schemaDefinitionResolver.resolveTypeDeclaration(match.schema, true, $this.state).defaultOfType;
1021
+ // match up vp name
1022
+ const vp = allVPs.find(pp => codegen_1.pascalCase(pp.property.serializedName) === pascalName);
1023
+ //push path parameters that form current identity into allParams, idOpParamsFromIdentity and idOpParamsFromIdentityserializedName
1024
+ if (vp && each.expression === codegen_csharp_1.dotnet.Null) {
1025
+ const param = {
1026
+ name: `${$this.inputObjectParameterName}.${vp.name}`,
1027
+ value: `${$this.inputObjectParameterName}.${vp.name} ?? ${defaultOfType}`
1028
+ };
1029
+ allParams.push(param);
1030
+ idOpParamsFromIdentity.push(param);
1031
+ idOpParamsFromIdentityserializedName.push(match.serializedName);
1032
+ return;
1033
+ }
1034
+ // fall back!
1035
+ console.error(`Unable to match identity parameter '${each.name}' member to appropriate virtual parameter. (Guessing '${codegen_1.pascalCase((_b = (_a = match.language.csharp) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : '')}').`);
1036
+ //push path parameters that current identity does not contain into allParams and idOpParamsNotFromIdentity
1037
+ const param = {
1038
+ name: `${codegen_1.pascalCase((_d = (_c = match.language.csharp) === null || _c === void 0 ? void 0 : _c.name) !== null && _d !== void 0 ? _d : '')}`,
1039
+ value: `${codegen_1.pascalCase((_f = (_e = match.language.csharp) === null || _e === void 0 ? void 0 : _e.name) !== null && _f !== void 0 ? _f : '')}`
1040
+ };
1041
+ allParams.push(param);
1042
+ idOpParamsNotFromIdentity.push(param);
1043
+ }
1044
+ else {
1045
+ console.error(`Unable to match identity parameter '${each.name}' member to appropriate virtual parameter. (Guessing '${pascalName}')`);
1046
+ /*
1047
+ push path parameters do not match the name in identity schema into allParams and idOpParamsNotFromIdentity
1048
+ for example, module 'Service' has only one GET API:
1049
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Service/resource1/{resource1Name}/resource2/{resource2Name}/resource3/{resource3Name}
1050
+ the identity schema 'ServiceIdentity.cs' will have properties: {subscriptionId, resourceGroupName, resource1Name, resource2Name, resource3Name}
1051
+ for variant which has (identity of resource2 + resource3Name) combined as parameters, the parameter name for 'resource3Name' is called 'Name' which do not match 'resource3Name' in 'ServiceIdentity.cs'
1052
+ */
1053
+ const param = {
1054
+ name: `${pascalName}`,
1055
+ value: `${pascalName}`
1056
+ };
1057
+ allParams.push(param);
1058
+ idOpParamsNotFromIdentity.push(param);
1059
+ }
1060
+ });
1061
+ }
1062
+ const parameters = [codegen_csharp_1.toExpression(`${$this.inputObjectParameterName}.Id`), ...nonPathParams.map(each => each.expression), ...callbackMethods, codegen_csharp_1.dotnet.This, pipeline];
1063
+ //when identity does not contain property: 'Id'
987
1064
  const identityFromPathParams = function* () {
988
- var _a, _b;
1065
+ var _a;
989
1066
  yield '// try to call with PATH parameters from Input Object';
990
1067
  if (idschema) {
991
- const allVPs = schema_1.getAllPublicVirtualProperties((_a = idschema.language.csharp) === null || _a === void 0 ? void 0 : _a.virtualProperties);
992
- const props = [...linq_1.values(idschema.properties)];
993
- const idOpParams = operationParameters.map(each => {
994
- var _a, _b, _c, _d, _e, _f;
995
- const pascalName = codegen_1.pascalCase(`${each.name}`);
996
- if (!each.isPathParam) {
997
- return {
998
- name: undefined,
999
- value: codegen_csharp_1.valueOf(each.expression)
1000
- };
1068
+ for (const opParam of idOpParamsFromIdentity) {
1069
+ if (opParam && opParam.name) {
1070
+ yield codegen_csharp_1.If(codegen_csharp_1.IsNull(opParam.name), `ThrowTerminatingError( new ${powershell_declarations_1.ErrorRecord}(new global::System.Exception("${$this.inputObjectParameterName} has null value for ${opParam.name}"),string.Empty, ${powershell_declarations_1.ErrorCategory('InvalidArgument')}, ${$this.inputObjectParameterName}) );`);
1001
1071
  }
1002
- const match = props.find(p => codegen_1.pascalCase(p.serializedName) === pascalName);
1003
- if (match) {
1004
- const defaultOfType = $this.state.project.schemaDefinitionResolver.resolveTypeDeclaration(match.schema, true, $this.state).defaultOfType;
1005
- // match up vp name
1006
- const vp = allVPs.find(pp => codegen_1.pascalCase(pp.property.serializedName) === pascalName);
1007
- if (vp) {
1008
- return {
1009
- name: `InputObject.${vp.name}`,
1010
- value: `InputObject.${vp.name} ?? ${defaultOfType}`
1011
- };
1012
- }
1013
- // fall back!
1014
- console.error(`Unable to match identity parameter '${each.name}' member to appropriate virtual parameter. (Guessing '${codegen_1.pascalCase((_b = (_a = match.language.csharp) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : '')}').`);
1015
- return {
1016
- name: `InputObject.${codegen_1.pascalCase((_d = (_c = match.language.csharp) === null || _c === void 0 ? void 0 : _c.name) !== null && _d !== void 0 ? _d : '')}`,
1017
- value: `InputObject.${codegen_1.pascalCase((_f = (_e = match.language.csharp) === null || _e === void 0 ? void 0 : _e.name) !== null && _f !== void 0 ? _f : '')} ?? ${defaultOfType}`
1018
- };
1072
+ }
1073
+ yield `await this.${$this.$('Client').invokeMethod(`${(_a = apiCall.language.csharp) === null || _a === void 0 ? void 0 : _a.name}`, ...[...allParams.map(each => codegen_csharp_1.toExpression(each.value)), ...callbackMethods, codegen_csharp_1.dotnet.This, pipeline]).implementation}`;
1074
+ }
1075
+ };
1076
+ //when identity does contain property: 'Id'
1077
+ const identityParams = function* () {
1078
+ var _a, _b, _c, _d;
1079
+ const path = (_c = (_b = (_a = $this.operation.callGraph) === null || _a === void 0 ? void 0 : _a[0].requests) === null || _b === void 0 ? void 0 : _b[0].protocol.http) === null || _c === void 0 ? void 0 : _c.path;
1080
+ let pathParams = '';
1081
+ //append path parameters which are not part of current identity
1082
+ idOpParamsNotFromIdentity.forEach(each => {
1083
+ var _a;
1084
+ const serializedName = (_a = linq_1.values($this.properties)
1085
+ .where(p => p.metadata.parameterDefinition)
1086
+ .first(p => p.name === each.name)) === null || _a === void 0 ? void 0 : _a.metadata.parameterDefinition.language.csharp.serializedName;
1087
+ if (each.name && serializedName) {
1088
+ if (!pathParams) {
1089
+ pathParams += '$"';
1019
1090
  }
1020
- console.error(`Unable to match identity parameter '${each.name}' member to appropriate virtual parameter. (Guessing '${pascalName}')`);
1021
- return {
1022
- name: `InputObject.${pascalName}`,
1023
- value: `InputObject.${pascalName}`
1024
- };
1025
- });
1026
- for (const opParam of idOpParams) {
1027
- if (opParam.name) {
1028
- yield codegen_csharp_1.If(codegen_csharp_1.IsNull(opParam.name), `ThrowTerminatingError(new ${powershell_declarations_1.ErrorRecord}(new global::System.Exception("InputObject has null value for ${opParam.name}"),string.Empty, ${powershell_declarations_1.ErrorCategory('InvalidArgument')}, InputObject));`);
1091
+ const resourceName = resourceName_1.getResourceNameFromPath(path, serializedName);
1092
+ if (resourceName) {
1093
+ pathParams += `/${resourceName}/{(global::System.Uri.EscapeDataString(this.${each.name}.ToString()))}`;
1029
1094
  }
1030
1095
  }
1031
- yield `await this.${$this.$('Client').invokeMethod(`${(_b = apiCall.language.csharp) === null || _b === void 0 ? void 0 : _b.name}`, ...[...idOpParams.map(each => codegen_csharp_1.toExpression(each.value)), ...callbackMethods, codegen_csharp_1.dotnet.This, pipeline]).implementation}`;
1096
+ });
1097
+ const hasPath = pathParams && pathParams.length > 0;
1098
+ //add child resource to path for list operation
1099
+ if ($this.operation.variant.startsWith('List') && (idOpParamsFromIdentityserializedName === null || idOpParamsFromIdentityserializedName === void 0 ? void 0 : idOpParamsFromIdentityserializedName[idOpParamsFromIdentityserializedName.length - 1])) {
1100
+ const childResourceName = resourceName_1.getChildResourceNameFromPath(path, idOpParamsFromIdentityserializedName === null || idOpParamsFromIdentityserializedName === void 0 ? void 0 : idOpParamsFromIdentityserializedName[idOpParamsFromIdentityserializedName.length - 1]);
1101
+ if (pathParams && pathParams.length > 0) {
1102
+ pathParams += `/${childResourceName}`;
1103
+ }
1104
+ else {
1105
+ pathParams += `"/${childResourceName}`;
1106
+ }
1107
+ }
1108
+ if (pathParams && pathParams.length > 0) {
1109
+ pathParams += '";';
1110
+ yield `this.${$this.inputObjectParameterName}.Id += ${pathParams}`;
1032
1111
  }
1112
+ yield `await this.${$this.$('Client').invokeMethod(`${(_d = apiCall.language.csharp) === null || _d === void 0 ? void 0 : _d.name}ViaIdentity`, ...parameters).implementation}`;
1033
1113
  };
1034
1114
  if (idschema && linq_1.values(idschema.properties).first(each => { var _a; return ((_a = each.language.csharp) === null || _a === void 0 ? void 0 : _a.uid) === 'universal-parameter:resource identity'; })) {
1035
- const parameters = [codegen_csharp_1.toExpression('InputObject.Id'), ...idOpParams.map(each => each.expression), ...callbackMethods, codegen_csharp_1.dotnet.This, pipeline];
1036
1115
  if (serializationMode) {
1037
1116
  parameters.push(serializationMode);
1038
1117
  }
1039
- yield codegen_csharp_1.If('InputObject?.Id != null', `await this.${$this.$('Client').invokeMethod(`${(_a = apiCall.language.csharp) === null || _a === void 0 ? void 0 : _a.name}ViaIdentity`, ...parameters).implementation}`);
1118
+ yield codegen_csharp_1.If(`${$this.inputObjectParameterName}?.Id != null`, identityParams);
1040
1119
  yield codegen_csharp_1.Else(identityFromPathParams);
1041
1120
  }
1042
1121
  else {
@@ -1399,10 +1478,9 @@ class CmdletClass extends codegen_csharp_1.Class {
1399
1478
  addDefaultInfo(cmdletParameter, vParam);
1400
1479
  this.addDoNotExport(cmdletParameter, vParam);
1401
1480
  }
1402
- const isEnum = propertyType instanceof exports_1.EnumImplementation;
1403
- const hasEnum = propertyType instanceof exports_1.ArrayOf && propertyType.elementType instanceof exports_1.EnumImplementation;
1404
- if (isEnum || hasEnum) {
1405
- cmdletParameter.add(new codegen_csharp_1.Attribute(powershell_declarations_1.ArgumentCompleterAttribute, { parameters: [`typeof(${hasEnum ? propertyType.elementType.declaration : propertyType.declaration})`] }));
1481
+ const addArgumentCompleter = isEnumImplementation(vParam.schema) || propertyType instanceof exports_1.ArrayOf && isEnumImplementation(propertyType.elementType.schema);
1482
+ if (addArgumentCompleter) {
1483
+ addPSArgumentCompleterAttribute(cmdletParameter, vParam.schema);
1406
1484
  }
1407
1485
  // add aliases if there is any
1408
1486
  if (linq_1.length(vParam.alias) > 0) {
@@ -1442,10 +1520,12 @@ class CmdletClass extends codegen_csharp_1.Class {
1442
1520
  }
1443
1521
  }
1444
1522
  if (this.isViaIdentity) {
1523
+ const viaIdentityRegex = /ViaIdentity\d?/g;
1524
+ this.inputObjectParameterName = `${this.name.split(viaIdentityRegex)[1].split('Expanded')[0]}InputObject`;
1445
1525
  // add in the pipeline parameter for the identity
1446
1526
  const idschema = linq_1.values(this.state.project.model.schemas.objects).first(each => each.language.default.uid === 'universal-parameter-type');
1447
1527
  const idtd = this.state.project.schemaDefinitionResolver.resolveTypeDeclaration(idschema, true, this.state);
1448
- const idParam = this.add(new codegen_csharp_1.BackedProperty('InputObject', idtd, {
1528
+ const idParam = this.add(new codegen_csharp_1.BackedProperty(this.inputObjectParameterName, idtd, {
1449
1529
  description: 'Identity Parameter'
1450
1530
  }));
1451
1531
  const parameters = [new codegen_csharp_1.LiteralExpression('Mandatory = true'), new codegen_csharp_1.LiteralExpression('HelpMessage = "Identity Parameter"'), new codegen_csharp_1.LiteralExpression('ValueFromPipeline = true')];
@@ -1542,10 +1622,9 @@ class CmdletClass extends codegen_csharp_1.Class {
1542
1622
  }));
1543
1623
  }
1544
1624
  }
1545
- const isEnum = propertyType instanceof exports_1.EnumImplementation;
1546
- const hasEnum = propertyType instanceof exports_1.ArrayOf && propertyType.elementType instanceof exports_1.EnumImplementation;
1547
- if (propertyType && (isEnum || hasEnum)) {
1548
- regularCmdletParameter.add(new codegen_csharp_1.Attribute(powershell_declarations_1.ArgumentCompleterAttribute, { parameters: [`typeof(${hasEnum ? propertyType.elementType.declaration : propertyType.declaration})`] }));
1625
+ const addArgumentCompleter = isEnumImplementation(vParam.schema) || propertyType instanceof exports_1.ArrayOf && isEnumImplementation(propertyType.elementType.schema);
1626
+ if (addArgumentCompleter) {
1627
+ addPSArgumentCompleterAttribute(regularCmdletParameter, vParam.schema);
1549
1628
  }
1550
1629
  }
1551
1630
  const ifmatch = this.properties.find((v) => v.name.toLowerCase() === 'ifmatch');