@autorest/powershell 4.0.0-dev.7 → 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.
- package/.rush/temp/package-deps_build.json +58 -54
- package/autorest-configuration.md +1 -1
- package/dist/cmdlets/class.d.ts +7 -0
- package/dist/cmdlets/class.d.ts.map +1 -1
- package/dist/cmdlets/class.js +248 -81
- package/dist/cmdlets/class.js.map +1 -1
- package/dist/cmdlets/namespace.d.ts.map +1 -1
- package/dist/cmdlets/namespace.js +1 -0
- package/dist/cmdlets/namespace.js.map +1 -1
- package/dist/generators/psm1.js +1 -1
- package/dist/generators/script-cmdlet.js +1 -1
- package/dist/internal/powershell-declarations.d.ts +1 -0
- package/dist/internal/powershell-declarations.d.ts.map +1 -1
- package/dist/internal/powershell-declarations.js +2 -1
- package/dist/internal/powershell-declarations.js.map +1 -1
- package/dist/internal/project.d.ts +9 -4
- package/dist/internal/project.d.ts.map +1 -1
- package/dist/internal/project.js +7 -9
- package/dist/internal/project.js.map +1 -1
- package/dist/llcsharp/clientruntime.d.ts +1 -0
- package/dist/llcsharp/clientruntime.d.ts.map +1 -1
- package/dist/llcsharp/clientruntime.js +1 -0
- package/dist/llcsharp/clientruntime.js.map +1 -1
- package/dist/llcsharp/csharp-declarations.d.ts +1 -0
- package/dist/llcsharp/csharp-declarations.d.ts.map +1 -1
- package/dist/llcsharp/csharp-declarations.js +2 -1
- package/dist/llcsharp/csharp-declarations.js.map +1 -1
- package/dist/llcsharp/model/interface.d.ts.map +1 -1
- package/dist/llcsharp/model/interface.js +14 -0
- package/dist/llcsharp/model/interface.js.map +1 -1
- package/dist/llcsharp/model/model-class.d.ts.map +1 -1
- package/dist/llcsharp/model/model-class.js +27 -11
- package/dist/llcsharp/model/model-class.js.map +1 -1
- package/dist/llcsharp/model/namespace.d.ts.map +1 -1
- package/dist/llcsharp/model/namespace.js +3 -11
- package/dist/llcsharp/model/namespace.js.map +1 -1
- package/dist/llcsharp/project.d.ts +2 -1
- package/dist/llcsharp/project.d.ts.map +1 -1
- package/dist/llcsharp/project.js +5 -3
- package/dist/llcsharp/project.js.map +1 -1
- package/dist/llcsharp/schema/array.js +7 -7
- package/dist/llcsharp/schema/array.js.map +1 -1
- package/dist/llcsharp/schema/fixed-array.d.ts +42 -0
- package/dist/llcsharp/schema/fixed-array.d.ts.map +1 -0
- package/dist/llcsharp/schema/fixed-array.js +251 -0
- package/dist/llcsharp/schema/fixed-array.js.map +1 -0
- package/dist/llcsharp/schema/schema-resolver.d.ts +1 -1
- package/dist/llcsharp/schema/schema-resolver.d.ts.map +1 -1
- package/dist/llcsharp/schema/schema-resolver.js +12 -10
- package/dist/llcsharp/schema/schema-resolver.js.map +1 -1
- package/dist/plugins/create-commands-v2.d.ts +1 -0
- package/dist/plugins/create-commands-v2.d.ts.map +1 -1
- package/dist/plugins/create-commands-v2.js +39 -6
- package/dist/plugins/create-commands-v2.js.map +1 -1
- package/dist/plugins/cs-namer-v2.d.ts.map +1 -1
- package/dist/plugins/cs-namer-v2.js +10 -7
- package/dist/plugins/cs-namer-v2.js.map +1 -1
- package/dist/plugins/llcsharp-v2.d.ts.map +1 -1
- package/dist/plugins/llcsharp-v2.js +4 -1
- package/dist/plugins/llcsharp-v2.js.map +1 -1
- package/dist/plugins/modifiers-v2.d.ts.map +1 -1
- package/dist/plugins/modifiers-v2.js +21 -2
- package/dist/plugins/modifiers-v2.js.map +1 -1
- package/dist/plugins/plugin-tweak-m4-model.d.ts.map +1 -1
- package/dist/plugins/plugin-tweak-m4-model.js +12 -0
- package/dist/plugins/plugin-tweak-m4-model.js.map +1 -1
- package/dist/plugins/sdk-create-inline-properties.d.ts.map +1 -1
- package/dist/plugins/sdk-create-inline-properties.js +26 -0
- package/dist/plugins/sdk-create-inline-properties.js.map +1 -1
- package/dist/plugins/sdk-cs-namer.d.ts.map +1 -1
- package/dist/plugins/sdk-cs-namer.js +17 -9
- package/dist/plugins/sdk-cs-namer.js.map +1 -1
- package/dist/plugins/sdk-tweak-model.d.ts.map +1 -1
- package/dist/plugins/sdk-tweak-model.js +13 -5
- package/dist/plugins/sdk-tweak-model.js.map +1 -1
- package/dist/utils/resourceName.d.ts +3 -0
- package/dist/utils/resourceName.d.ts.map +1 -0
- package/dist/utils/resourceName.js +29 -0
- package/dist/utils/resourceName.js.map +1 -0
- package/dist/utils/sort-parameters.d.ts +3 -0
- package/dist/utils/sort-parameters.d.ts.map +1 -0
- package/dist/utils/sort-parameters.js +33 -0
- package/dist/utils/sort-parameters.js.map +1 -0
- package/package.json +1 -1
- package/resources/assets/build-module.ps1 +4 -4
- package/resources/assets/check-dependencies.ps1 +3 -3
- package/resources/assets/create-model-cmdlets.ps1 +84 -15
- package/resources/assets/custom/README.md +1 -1
- package/resources/assets/docs/README.md +1 -1
- package/resources/assets/export-surface.ps1 +3 -3
- package/resources/assets/exports/README.md +1 -1
- package/resources/assets/generate-help.ps1 +3 -3
- package/resources/assets/generate-portal-ux.ps1 +3 -3
- package/resources/assets/how-to.md +1 -1
- package/resources/assets/internal/README.md +1 -1
- package/resources/assets/run-module.ps1 +4 -4
- package/resources/assets/test-module.ps1 +6 -6
- package/resources/assets/tools/Resources/custom/New-AzDeployment.ps1 +1 -1
- package/resources/assets/tools/Resources/docs/README.md +1 -1
- package/resources/assets/tools/Resources/how-to.md +1 -1
- package/resources/modules/Az.Accounts/2.7.5/Az.Accounts.nuspec +1 -1
- package/resources/modules/Az.Accounts/2.7.5/Az.Accounts.psd1 +1 -1
- package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Cmdlets.Accounts.dll-Help.xml +34 -34
- package/resources/modules/Az.Accounts/2.7.5/en-US/about_az.help.txt +1 -1
- package/resources/modules/Az.Accounts/2.7.5/package/services/metadata/core-properties/1aa0749a068a4238881858013f1a5b7f.psmdcp +1 -1
- package/resources/psruntime/Attributes/PSArgumentCompleterAttribute.cs +52 -0
- package/resources/psruntime/BuildTime/Cmdlets/ExportFormatPs1xml.cs +3 -1
- package/resources/psruntime/BuildTime/Models/PsProxyOutputs.cs +18 -1
- package/resources/psruntime/BuildTime/Models/PsProxyTypes.cs +15 -2
- package/resources/psruntime/BuildTime/PsAttributes.cs +5 -0
- package/resources/psruntime/BuildTime/PsExtensions.cs +7 -0
- package/resources/psruntime/TypeConverterExtensions.cs +50 -0
- package/resources/runtime/csharp/json/Nodes/Collections/XNodeArray.cs +5 -0
- package/resources/runtime/csharp/pipeline/ISendAsync.cs +113 -0
- package/resources/templates/methodBodyRestCall.ejs +1 -1
package/dist/cmdlets/class.js
CHANGED
|
@@ -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
|
|
@@ -404,6 +416,76 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
404
416
|
}
|
|
405
417
|
return ops ? `${header}\n${codegen_1.docComment(codegen_csharp_1.xmlize('remarks', ops))}` : header;
|
|
406
418
|
}
|
|
419
|
+
AddSwitchViewProperty(responseType = codegen_csharp_1.dotnet.Object) {
|
|
420
|
+
const fieldNames = this.fields.map(f => f.name);
|
|
421
|
+
if (!fieldNames.includes('_responseSize')) {
|
|
422
|
+
this.add(new codegen_csharp_1.Field('_responseSize', codegen_csharp_1.dotnet.Int, {
|
|
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
|
|
424
|
+
}));
|
|
425
|
+
}
|
|
426
|
+
if (!fieldNames.includes('_firstResponse')) {
|
|
427
|
+
this.add(new codegen_csharp_1.Field('_firstResponse', responseType, {
|
|
428
|
+
initialValue: codegen_csharp_1.dotnet.Null, description: 'A buffer to record first returned object in response.', access: codegen_csharp_1.Access.Private
|
|
429
|
+
}));
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
FlushResponse(singleFlush = true) {
|
|
433
|
+
const fieldNames = this.fields.map(f => f.name);
|
|
434
|
+
return fieldNames.includes('_responseSize') ?
|
|
435
|
+
codegen_csharp_1.If('1 ==_responseSize', function* () {
|
|
436
|
+
yield '// Flush buffer';
|
|
437
|
+
if (singleFlush) {
|
|
438
|
+
yield 'WriteObject(_firstResponse);';
|
|
439
|
+
}
|
|
440
|
+
else {
|
|
441
|
+
yield 'WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject());';
|
|
442
|
+
}
|
|
443
|
+
}) : '';
|
|
444
|
+
}
|
|
445
|
+
WriteObjectWithViewControl(valueName, isEnumerable = false) {
|
|
446
|
+
const $this = this;
|
|
447
|
+
if ($this.state.project.autoSwitchView) {
|
|
448
|
+
if (isEnumerable) {
|
|
449
|
+
return function* () {
|
|
450
|
+
yield `var outputObjects = ${valueName};`;
|
|
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;';
|
|
455
|
+
});
|
|
456
|
+
yield codegen_csharp_1.Else(function* () {
|
|
457
|
+
yield $this.FlushResponse(false);
|
|
458
|
+
yield 'var values = new System.Collections.Generic.List<System.Management.Automation.PSObject>();';
|
|
459
|
+
yield codegen_csharp_1.ForEach('value', 'outputObjects', function* () {
|
|
460
|
+
yield 'values.Add(value.AddMultipleTypeNameIntoPSObject());';
|
|
461
|
+
});
|
|
462
|
+
yield 'WriteObject(values, true); ';
|
|
463
|
+
yield '_responseSize = 2;';
|
|
464
|
+
});
|
|
465
|
+
});
|
|
466
|
+
};
|
|
467
|
+
}
|
|
468
|
+
else {
|
|
469
|
+
return function* () {
|
|
470
|
+
yield `var outputObject = ${valueName};`;
|
|
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;';
|
|
475
|
+
});
|
|
476
|
+
yield codegen_csharp_1.Else(function* () {
|
|
477
|
+
yield $this.FlushResponse(false);
|
|
478
|
+
yield 'WriteObject(outputObject.AddMultipleTypeNameIntoPSObject());';
|
|
479
|
+
yield '_responseSize = 2;';
|
|
480
|
+
});
|
|
481
|
+
});
|
|
482
|
+
};
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
else {
|
|
486
|
+
return `WriteObject(${valueName}, ${isEnumerable})`;
|
|
487
|
+
}
|
|
488
|
+
}
|
|
407
489
|
addCommonStuff() {
|
|
408
490
|
var _a, _b;
|
|
409
491
|
// add a private copy of invocation information for our own uses.
|
|
@@ -416,6 +498,10 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
416
498
|
this.correlationId = this.add(new codegen_csharp_1.Field('__correlationId', codegen_csharp_1.dotnet.String, { initialValue: 'System.Guid.NewGuid().ToString()', description: 'A unique id generatd for the this cmdlet when it is instantiated.', access: codegen_csharp_1.Access.Private }));
|
|
417
499
|
this.processRecordId = this.add(new codegen_csharp_1.Field('__processRecordId', codegen_csharp_1.dotnet.String, { description: 'A unique id generatd for the this cmdlet when ProcessRecord() is called.', access: codegen_csharp_1.Access.Private }));
|
|
418
500
|
}
|
|
501
|
+
// switch view property
|
|
502
|
+
if (this.state.project.autoSwitchView) {
|
|
503
|
+
this.AddSwitchViewProperty(codegen_csharp_1.dotnet.Object);
|
|
504
|
+
}
|
|
419
505
|
// pipeline property
|
|
420
506
|
this.add(new codegen_csharp_1.Property('Pipeline', exports_1.ClientRuntime.HttpPipeline, { getAccess: codegen_csharp_1.Access.Public, setAccess: codegen_csharp_1.Access.Public, description: `The instance of the <see cref="${exports_1.ClientRuntime.HttpPipeline}" /> that the remote call will use.` }));
|
|
421
507
|
// client API property (gs01: fill this in correctly)
|
|
@@ -428,7 +514,9 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
428
514
|
const $this = this;
|
|
429
515
|
this.add(new codegen_csharp_1.Method('EndProcessing', codegen_csharp_1.dotnet.Void, { access: codegen_csharp_1.Access.Protected, override: codegen_csharp_1.Modifier.Override, description: 'Performs clean-up after the command execution' })).add(function* () {
|
|
430
516
|
// gs01: remember what you were doing here to make it so these can be parallelized...
|
|
431
|
-
|
|
517
|
+
if ($this.state.project.autoSwitchView) {
|
|
518
|
+
yield $this.FlushResponse();
|
|
519
|
+
}
|
|
432
520
|
});
|
|
433
521
|
// debugging
|
|
434
522
|
const brk = this.add(new codegen_csharp_1.Property('Break', powershell_declarations_1.SwitchParameter, { attributes: [], description: 'Wait for .NET debugger to attach' }));
|
|
@@ -596,7 +684,7 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
596
684
|
};
|
|
597
685
|
for (const vParam of [...vps.body, ...vps.operation]) {
|
|
598
686
|
if (vParam.hidden) {
|
|
599
|
-
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);
|
|
600
688
|
yield codegen_csharp_1.If(`true == this.MyInvocation?.BoundParameters?.ContainsKey("${vParam.name}")`, `${vParam.name} = (${td.declaration})this.MyInvocation.BoundParameters["${vParam.name}"];`);
|
|
601
689
|
}
|
|
602
690
|
}
|
|
@@ -757,19 +845,19 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
757
845
|
const vp = schema_1.getVirtualPropertyFromPropertyName((_m = schema.language.csharp) === null || _m === void 0 ? void 0 : _m.virtualProperties, valueProperty.serializedName);
|
|
758
846
|
if (vp) {
|
|
759
847
|
if ($this.clientsidePagination) {
|
|
760
|
-
yield (codegen_csharp_1.If('(ulong)result.Value.
|
|
761
|
-
yield ('this.PagingParameters.Skip = this.PagingParameters.Skip - (ulong)result.Value.
|
|
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;');
|
|
762
850
|
}));
|
|
763
851
|
yield codegen_csharp_1.Else(function* () {
|
|
764
|
-
yield ('ulong toRead = Math.Min(this.PagingParameters.First, (ulong)result.Value.
|
|
765
|
-
yield ('var requiredResult = result.Value.
|
|
766
|
-
yield (
|
|
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);');
|
|
854
|
+
yield $this.WriteObjectWithViewControl(`requiredResult`, true);
|
|
767
855
|
yield ('this.PagingParameters.Skip = 0;');
|
|
768
856
|
yield ('this.PagingParameters.First = this.PagingParameters.First <= toRead ? 0 : this.PagingParameters.First - toRead;');
|
|
769
857
|
});
|
|
770
858
|
}
|
|
771
859
|
else {
|
|
772
|
-
yield
|
|
860
|
+
yield $this.WriteObjectWithViewControl(`${result.value}.${vp.name}`, true);
|
|
773
861
|
}
|
|
774
862
|
}
|
|
775
863
|
const nl = schema_1.getVirtualPropertyFromPropertyName((_o = schema.language.csharp) === null || _o === void 0 ? void 0 : _o.virtualProperties, nextLinkProperty.serializedName);
|
|
@@ -802,7 +890,7 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
802
890
|
// it's just a nested array
|
|
803
891
|
const p = codemodel_v3_1.getVirtualPropertyFromPropertyName((_p = schema.language.csharp) === null || _p === void 0 ? void 0 : _p.virtualProperties, valueProperty.serializedName);
|
|
804
892
|
if (p) {
|
|
805
|
-
yield `
|
|
893
|
+
yield $this.WriteObjectWithViewControl(`(await response).${p.name}`, true);
|
|
806
894
|
}
|
|
807
895
|
return;
|
|
808
896
|
}
|
|
@@ -811,7 +899,7 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
811
899
|
// it's just an array,
|
|
812
900
|
case 'array':
|
|
813
901
|
// just write-object(enumerate) with the output
|
|
814
|
-
yield '
|
|
902
|
+
yield $this.WriteObjectWithViewControl('(await response)', true);
|
|
815
903
|
return;
|
|
816
904
|
}
|
|
817
905
|
// ok, let's see if the response type
|
|
@@ -848,7 +936,7 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
848
936
|
return;
|
|
849
937
|
}
|
|
850
938
|
// let's just return the result object (or unwrapped result object)
|
|
851
|
-
yield
|
|
939
|
+
yield $this.WriteObjectWithViewControl(`${outValue}`);
|
|
852
940
|
return;
|
|
853
941
|
}
|
|
854
942
|
// in m4, there will be no schema deinfed for the binary response, instead, we will have a field called binary with value true.
|
|
@@ -862,8 +950,8 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
862
950
|
yield paths.declarationStatement;
|
|
863
951
|
yield codegen_csharp_1.Try(function* () {
|
|
864
952
|
yield `${paths.value} = this.SessionState.Path.GetResolvedProviderPathFromPSPath(${outfile.value}, out ${provider.declarationExpression});`;
|
|
865
|
-
yield codegen_csharp_1.If(`${provider.value}.Name != "FileSystem" || ${paths.value}.Count == 0`, `ThrowTerminatingError(
|
|
866
|
-
yield codegen_csharp_1.If(`${paths.value}.Count > 1`, `ThrowTerminatingError(
|
|
953
|
+
yield codegen_csharp_1.If(`${provider.value}.Name != "FileSystem" || ${paths.value}.Count == 0`, `ThrowTerminatingError(new System.Management.Automation.ErrorRecord(new global::System.Exception("Invalid output path."), string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, ${outfile.value}));`);
|
|
954
|
+
yield codegen_csharp_1.If(`${paths.value}.Count > 1`, `ThrowTerminatingError(new System.Management.Automation.ErrorRecord(new global::System.Exception("Multiple output paths not allowed."), string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, ${outfile.value}));`);
|
|
867
955
|
});
|
|
868
956
|
const notfound = new codegen_csharp_1.Parameter('', { declaration: 'global::System.Management.Automation.ItemNotFoundException' });
|
|
869
957
|
yield codegen_csharp_1.Catch(notfound, function* () {
|
|
@@ -895,7 +983,11 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
895
983
|
const actualCall = function* () {
|
|
896
984
|
var _a, _b;
|
|
897
985
|
yield $this.eventListener.signal(powershell_declarations_1.Events.CmdletBeforeAPICall);
|
|
898
|
-
const
|
|
986
|
+
const nonPathParams = operationParameters.filter(each => !each.isPathParam);
|
|
987
|
+
const allParams = [];
|
|
988
|
+
const idOpParamsNotFromIdentity = [];
|
|
989
|
+
const idOpParamsFromIdentity = [];
|
|
990
|
+
const idOpParamsFromIdentityserializedName = [];
|
|
899
991
|
const idschema = linq_1.values($this.state.project.model.schemas.objects).first(each => each.language.default.uid === 'universal-parameter-type');
|
|
900
992
|
let serializationMode = null;
|
|
901
993
|
if ($this.bodyParameter) {
|
|
@@ -907,59 +999,123 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
907
999
|
}
|
|
908
1000
|
}
|
|
909
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'
|
|
910
1064
|
const identityFromPathParams = function* () {
|
|
911
|
-
var _a
|
|
1065
|
+
var _a;
|
|
912
1066
|
yield '// try to call with PATH parameters from Input Object';
|
|
913
1067
|
if (idschema) {
|
|
914
|
-
const
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
var _a, _b, _c, _d, _e, _f;
|
|
918
|
-
const pascalName = codegen_1.pascalCase(`${each.name}`);
|
|
919
|
-
if (!each.isPathParam) {
|
|
920
|
-
return {
|
|
921
|
-
name: undefined,
|
|
922
|
-
value: codegen_csharp_1.valueOf(each.expression)
|
|
923
|
-
};
|
|
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}) );`);
|
|
924
1071
|
}
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
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 += '$"';
|
|
942
1090
|
}
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
value: `InputObject.${pascalName}`
|
|
947
|
-
};
|
|
948
|
-
});
|
|
949
|
-
for (const opParam of idOpParams) {
|
|
950
|
-
if (opParam.name) {
|
|
951
|
-
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()))}`;
|
|
952
1094
|
}
|
|
953
1095
|
}
|
|
954
|
-
|
|
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
|
+
}
|
|
955
1107
|
}
|
|
1108
|
+
if (pathParams && pathParams.length > 0) {
|
|
1109
|
+
pathParams += '";';
|
|
1110
|
+
yield `this.${$this.inputObjectParameterName}.Id += ${pathParams}`;
|
|
1111
|
+
}
|
|
1112
|
+
yield `await this.${$this.$('Client').invokeMethod(`${(_d = apiCall.language.csharp) === null || _d === void 0 ? void 0 : _d.name}ViaIdentity`, ...parameters).implementation}`;
|
|
956
1113
|
};
|
|
957
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'; })) {
|
|
958
|
-
const parameters = [codegen_csharp_1.toExpression('InputObject.Id'), ...idOpParams.map(each => each.expression), ...callbackMethods, codegen_csharp_1.dotnet.This, pipeline];
|
|
959
1115
|
if (serializationMode) {
|
|
960
1116
|
parameters.push(serializationMode);
|
|
961
1117
|
}
|
|
962
|
-
yield codegen_csharp_1.If(
|
|
1118
|
+
yield codegen_csharp_1.If(`${$this.inputObjectParameterName}?.Id != null`, identityParams);
|
|
963
1119
|
yield codegen_csharp_1.Else(identityFromPathParams);
|
|
964
1120
|
}
|
|
965
1121
|
else {
|
|
@@ -985,7 +1141,7 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
985
1141
|
});
|
|
986
1142
|
const ure = new codegen_csharp_1.Parameter('urexception', { declaration: `${exports_1.ClientRuntime.fullName}.UndeclaredResponseException` });
|
|
987
1143
|
yield codegen_csharp_1.Catch(ure, function* () {
|
|
988
|
-
yield `WriteError(new global::System.Management.Automation.ErrorRecord(${ure.value}, ${ure.value}.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new {
|
|
1144
|
+
yield `WriteError(new global::System.Management.Automation.ErrorRecord(${ure.value}, ${ure.value}.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ${operationParameters.filter(e => codegen_csharp_1.valueOf(e.expression) !== 'null').map(each => `${each.name}=${each.expression}`).join(',')}})
|
|
989
1145
|
{
|
|
990
1146
|
ErrorDetails = new global::System.Management.Automation.ErrorDetails(${ure.value}.Message) { RecommendedAction = ${ure.value}.Action }
|
|
991
1147
|
});`;
|
|
@@ -1029,7 +1185,7 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
1029
1185
|
}
|
|
1030
1186
|
implementConstructors() {
|
|
1031
1187
|
// default constructor
|
|
1032
|
-
this.add(new codegen_csharp_1.Constructor(this, { description: `
|
|
1188
|
+
this.add(new codegen_csharp_1.Constructor(this, { description: `Initializes a new instance of the <see cref="${this.name}" /> cmdlet class.` }));
|
|
1033
1189
|
}
|
|
1034
1190
|
implementIContext() {
|
|
1035
1191
|
const extensibleParameters = this.add(new codegen_csharp_1.Field('_extensibleParameters', codegen_csharp_1.System.Collections.Generic.Dictionary(codegen_csharp_1.System.String, codegen_csharp_1.System.Object), {
|
|
@@ -1162,12 +1318,12 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
1162
1318
|
yield sw;
|
|
1163
1319
|
if ($this.state.project.azure) {
|
|
1164
1320
|
// in azure mode, we signal the AzAccount module with every event that makes it here.
|
|
1165
|
-
yield `await ${$this.state.project.serviceNamespace.moduleClass.declaration}.Instance.Signal(${id.value}, ${token.value}, ${messageData.value}, (i,t,m) => ((${exports_1.ClientRuntime.IEventListener})this).Signal(i,t,()=> ${exports_1.ClientRuntime.EventDataConverter}.ConvertFrom(
|
|
1321
|
+
yield `await ${$this.state.project.serviceNamespace.moduleClass.declaration}.Instance.Signal(${id.value}, ${token.value}, ${messageData.value}, (i, t, m) => ((${exports_1.ClientRuntime.IEventListener})this).Signal(i, t, () => ${exports_1.ClientRuntime.EventDataConverter}.ConvertFrom(m()) as ${exports_1.ClientRuntime.EventData}), ${$this.invocationInfo.value}, this.ParameterSetName, ${$this.correlationId.value}, ${$this.processRecordId.value}, null );`;
|
|
1166
1322
|
yield codegen_csharp_1.If(`${token.value}.IsCancellationRequested`, codegen_csharp_1.Return());
|
|
1167
1323
|
}
|
|
1168
1324
|
else {
|
|
1169
1325
|
// In Non-Azure Modes, emit the Signal method without coorelation and processrecordid
|
|
1170
|
-
yield `await ${$this.state.project.serviceNamespace.moduleClass.declaration}.Instance.Signal(${id.value}, ${token.value}, ${messageData.value}, (i,t,m) => ((${exports_1.ClientRuntime.IEventListener})this).Signal(i,t,()=> ${exports_1.ClientRuntime.EventDataConverter}.ConvertFrom(
|
|
1326
|
+
yield `await ${$this.state.project.serviceNamespace.moduleClass.declaration}.Instance.Signal(${id.value}, ${token.value}, ${messageData.value}, (i, t, m) => ((${exports_1.ClientRuntime.IEventListener})this).Signal(i, t, () => ${exports_1.ClientRuntime.EventDataConverter}.ConvertFrom(m()) as ${exports_1.ClientRuntime.EventData}), ${$this.invocationInfo.value}, this.ParameterSetName, null ); `;
|
|
1171
1327
|
yield codegen_csharp_1.If(`${token.value}.IsCancellationRequested`, codegen_csharp_1.Return());
|
|
1172
1328
|
}
|
|
1173
1329
|
yield `WriteDebug($"{id}: {(messageData().Message ?? ${codegen_csharp_1.System.String.Empty})}");`;
|
|
@@ -1238,12 +1394,23 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
1238
1394
|
const propertyType = this.state.project.schemaDefinitionResolver.resolveTypeDeclaration(vSchema, true, this.state);
|
|
1239
1395
|
// we need to know if the actual underlying property is actually nullable.
|
|
1240
1396
|
const nullable = this.state.project.schemaDefinitionResolver.resolveTypeDeclaration(vSchema, !!vParam.origin.required, this.state).isNullable;
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1397
|
+
let cmdletParameter;
|
|
1398
|
+
if (propertyType.schema.type !== codemodel_1.SchemaType.Array) {
|
|
1399
|
+
cmdletParameter = new codegen_csharp_1.Property(vParam.name, propertyType, {
|
|
1400
|
+
get: codegen_csharp_1.toExpression(`${expandedBodyParameter.value}.${model_class_1.getVirtualPropertyName(vParam.origin) || vParam.origin.name}${!nullable ? '' : ` ?? ${propertyType.defaultOfType}`}`),
|
|
1401
|
+
// get: toExpression(`null == ${expandedBodyParameter.value}.${vParam.origin.name} ? ${propertyType.defaultOfType} : (${propertyType.declaration}) ${expandedBodyParameter.value}.${vParam.origin.name}`),
|
|
1402
|
+
set: codegen_csharp_1.toExpression(`${expandedBodyParameter.value}.${model_class_1.getVirtualPropertyName(vParam.origin) || vParam.origin.name} = value`),
|
|
1403
|
+
new: PropertiesRequiringNew.has(vParam.name) ? codegen_csharp_1.Modifier.New : codegen_csharp_1.Modifier.None
|
|
1404
|
+
});
|
|
1405
|
+
}
|
|
1406
|
+
else {
|
|
1407
|
+
const fixedArrayPropertyType = this.state.project.schemaDefinitionResolver.resolveTypeDeclaration(vSchema, true, this.state, true);
|
|
1408
|
+
cmdletParameter = new codegen_csharp_1.Property(vParam.name, fixedArrayPropertyType, {
|
|
1409
|
+
get: codegen_csharp_1.toExpression(`${expandedBodyParameter.value}.${model_class_1.getVirtualPropertyName(vParam.origin) || vParam.origin.name}?.ToArray()${` ?? ${fixedArrayPropertyType.defaultOfType}`}`),
|
|
1410
|
+
set: codegen_csharp_1.toExpression(`${expandedBodyParameter.value}.${model_class_1.getVirtualPropertyName(vParam.origin) || vParam.origin.name} = (value != null ? new ${propertyType.declaration}(value) : null)`),
|
|
1411
|
+
new: PropertiesRequiringNew.has(vParam.name) ? codegen_csharp_1.Modifier.New : codegen_csharp_1.Modifier.None
|
|
1412
|
+
});
|
|
1413
|
+
}
|
|
1247
1414
|
if ((_b = vParam.schema.language.csharp) === null || _b === void 0 ? void 0 : _b.byReference) {
|
|
1248
1415
|
// this parameter's schema is marked as 'by-reference' which means we should
|
|
1249
1416
|
// tag it with an ExportAs attribute for the I*Reference type.
|
|
@@ -1311,10 +1478,9 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
1311
1478
|
addDefaultInfo(cmdletParameter, vParam);
|
|
1312
1479
|
this.addDoNotExport(cmdletParameter, vParam);
|
|
1313
1480
|
}
|
|
1314
|
-
const
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
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);
|
|
1318
1484
|
}
|
|
1319
1485
|
// add aliases if there is any
|
|
1320
1486
|
if (linq_1.length(vParam.alias) > 0) {
|
|
@@ -1354,10 +1520,12 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
1354
1520
|
}
|
|
1355
1521
|
}
|
|
1356
1522
|
if (this.isViaIdentity) {
|
|
1523
|
+
const viaIdentityRegex = /ViaIdentity\d?/g;
|
|
1524
|
+
this.inputObjectParameterName = `${this.name.split(viaIdentityRegex)[1].split('Expanded')[0]}InputObject`;
|
|
1357
1525
|
// add in the pipeline parameter for the identity
|
|
1358
1526
|
const idschema = linq_1.values(this.state.project.model.schemas.objects).first(each => each.language.default.uid === 'universal-parameter-type');
|
|
1359
1527
|
const idtd = this.state.project.schemaDefinitionResolver.resolveTypeDeclaration(idschema, true, this.state);
|
|
1360
|
-
const idParam = this.add(new codegen_csharp_1.BackedProperty(
|
|
1528
|
+
const idParam = this.add(new codegen_csharp_1.BackedProperty(this.inputObjectParameterName, idtd, {
|
|
1361
1529
|
description: 'Identity Parameter'
|
|
1362
1530
|
}));
|
|
1363
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')];
|
|
@@ -1454,10 +1622,9 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
1454
1622
|
}));
|
|
1455
1623
|
}
|
|
1456
1624
|
}
|
|
1457
|
-
const
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
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);
|
|
1461
1628
|
}
|
|
1462
1629
|
}
|
|
1463
1630
|
const ifmatch = this.properties.find((v) => v.name.toLowerCase() === 'ifmatch');
|
|
@@ -1582,9 +1749,9 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
1582
1749
|
parameters.push(`"${breakingChange.cmdlet.changeInEfectByDate}"`);
|
|
1583
1750
|
}
|
|
1584
1751
|
if (breakingChange.cmdlet.replacement)
|
|
1585
|
-
parameters.push(`ReplacementCmdletName="${breakingChange.cmdlet.replacement}"`);
|
|
1752
|
+
parameters.push(`ReplacementCmdletName = "${breakingChange.cmdlet.replacement}"`);
|
|
1586
1753
|
if (breakingChange.cmdlet.changeDescription)
|
|
1587
|
-
parameters.push(`ChangeDescription="${breakingChange.cmdlet.changeDescription}"`);
|
|
1754
|
+
parameters.push(`ChangeDescription = "${breakingChange.cmdlet.changeDescription}"`);
|
|
1588
1755
|
this.add(new codegen_csharp_1.Attribute(exports_1.ClientRuntime.CmdletBreakingChangeAttribute, { parameters: parameters }));
|
|
1589
1756
|
}
|
|
1590
1757
|
if (breakingChange.variant) {
|
|
@@ -1596,7 +1763,7 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
1596
1763
|
parameters.push(`"${breakingChange.variant.changeInEfectByDate}"`);
|
|
1597
1764
|
}
|
|
1598
1765
|
if (breakingChange.variant.changeDescription)
|
|
1599
|
-
parameters.push(`ChangeDescription="${breakingChange.variant.changeDescription}"`);
|
|
1766
|
+
parameters.push(`ChangeDescription = "${breakingChange.variant.changeDescription}"`);
|
|
1600
1767
|
this.add(new codegen_csharp_1.Attribute(exports_1.ClientRuntime.ParameterSetBreakingChangeAttribute, { parameters: parameters }));
|
|
1601
1768
|
}
|
|
1602
1769
|
if (breakingChange.output) {
|
|
@@ -1614,19 +1781,19 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
1614
1781
|
parameters.push(`"${breakingChange.output.changeInEfectByDate}"`);
|
|
1615
1782
|
}
|
|
1616
1783
|
if (breakingChange.output.replacement)
|
|
1617
|
-
parameters.push(`ReplacementCmdletOutputType="${breakingChange.output.replacement}"`);
|
|
1784
|
+
parameters.push(`ReplacementCmdletOutputType = "${breakingChange.output.replacement}"`);
|
|
1618
1785
|
if (breakingChange.output.deprecatedOutputProperties) {
|
|
1619
1786
|
const properties = Object.assign([], breakingChange.output.deprecatedOutputProperties);
|
|
1620
1787
|
properties.forEach((element, index) => properties[index] = '"' + element + '"');
|
|
1621
|
-
parameters.push(`DeprecatedOutputProperties=new string[] {${properties.join(',')}}`);
|
|
1788
|
+
parameters.push(`DeprecatedOutputProperties = new string[] {${properties.join(',')}}`);
|
|
1622
1789
|
}
|
|
1623
1790
|
if (breakingChange.output.newOutputProperties) {
|
|
1624
1791
|
const properties = Object.assign([], breakingChange.output.newOutputProperties);
|
|
1625
1792
|
properties.forEach((element, index) => properties[index] = '"' + element + '"');
|
|
1626
|
-
parameters.push(`NewOutputProperties=new string[] {${properties.join(',')}}`);
|
|
1793
|
+
parameters.push(`NewOutputProperties = new string[] {${properties.join(',')} } `);
|
|
1627
1794
|
}
|
|
1628
1795
|
if (breakingChange.output.changeDescription)
|
|
1629
|
-
parameters.push(`ChangeDescription="${breakingChange.output.changeDescription}"`);
|
|
1796
|
+
parameters.push(`ChangeDescription = "${breakingChange.output.changeDescription}"`);
|
|
1630
1797
|
this.add(new codegen_csharp_1.Attribute(exports_1.ClientRuntime.OutputBreakingChangeAttribute, { parameters: parameters }));
|
|
1631
1798
|
}
|
|
1632
1799
|
}
|