@autorest/powershell 3.0.504 → 4.0.0-dev.10
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 +95 -61
- package/.rush/temp/shrinkwrap-deps.json +249 -193
- package/autorest-configuration-for-sdk.md +122 -0
- package/autorest-configuration.md +2 -1
- package/dist/cmdlets/class.d.ts +1 -0
- package/dist/cmdlets/class.d.ts.map +1 -1
- package/dist/cmdlets/class.js +220 -90
- package/dist/cmdlets/class.js.map +1 -1
- package/dist/cmdlets/namespace.d.ts.map +1 -1
- package/dist/cmdlets/namespace.js +3 -1
- package/dist/cmdlets/namespace.js.map +1 -1
- package/dist/cmdlets/parameter.js +1 -0
- package/dist/cmdlets/parameter.js.map +1 -1
- package/dist/enums/namespace.js +2 -1
- package/dist/enums/namespace.js.map +1 -1
- package/dist/file-formats/md-file.js +1 -0
- package/dist/file-formats/md-file.js.map +1 -1
- package/dist/file-formats/psd-file.js +1 -0
- package/dist/file-formats/psd-file.js.map +1 -1
- package/dist/file-formats/psscript-file.js +1 -0
- package/dist/file-formats/psscript-file.js.map +1 -1
- package/dist/generators/csproj.js +1 -0
- package/dist/generators/csproj.js.map +1 -1
- package/dist/generators/gitattributes.js +1 -0
- package/dist/generators/gitattributes.js.map +1 -1
- package/dist/generators/gitignore.js +1 -0
- package/dist/generators/gitignore.js.map +1 -1
- package/dist/generators/inputhandler.custom.d.ts +3 -0
- package/dist/generators/inputhandler.custom.d.ts.map +1 -0
- package/dist/generators/inputhandler.custom.js +33 -0
- package/dist/generators/inputhandler.custom.js.map +1 -0
- package/dist/generators/nuspec.js +1 -0
- package/dist/generators/nuspec.js.map +1 -1
- package/dist/generators/psm1.custom.js +1 -0
- package/dist/generators/psm1.custom.js.map +1 -1
- package/dist/generators/psm1.internal.js +1 -0
- package/dist/generators/psm1.internal.js.map +1 -1
- package/dist/generators/psm1.js +2 -1
- package/dist/generators/psm1.js.map +1 -1
- package/dist/generators/readme.js +1 -0
- package/dist/generators/readme.js.map +1 -1
- package/dist/generators/script-cmdlet.js +3 -2
- package/dist/generators/script-cmdlet.js.map +1 -1
- package/dist/internal/name-inferrer.js +1 -0
- package/dist/internal/name-inferrer.js.map +1 -1
- package/dist/internal/powershell-declarations.d.ts +3 -0
- package/dist/internal/powershell-declarations.d.ts.map +1 -1
- package/dist/internal/powershell-declarations.js +3 -0
- package/dist/internal/powershell-declarations.js.map +1 -1
- package/dist/internal/project.d.ts +11 -9
- package/dist/internal/project.d.ts.map +1 -1
- package/dist/internal/project.js +30 -12
- package/dist/internal/project.js.map +1 -1
- package/dist/internal/state.js +1 -0
- package/dist/internal/state.js.map +1 -1
- package/dist/internal/verbs.js +1 -0
- package/dist/internal/verbs.js.map +1 -1
- package/dist/llcsharp/clientruntime.d.ts +7 -1
- package/dist/llcsharp/clientruntime.d.ts.map +1 -1
- package/dist/llcsharp/clientruntime.js +8 -1
- package/dist/llcsharp/clientruntime.js.map +1 -1
- package/dist/llcsharp/code-model.d.ts +1 -0
- package/dist/llcsharp/code-model.d.ts.map +1 -1
- package/dist/llcsharp/csharp-declarations.js +1 -0
- package/dist/llcsharp/csharp-declarations.js.map +1 -1
- package/dist/llcsharp/enums/enum.js +2 -1
- package/dist/llcsharp/enums/enum.js.map +1 -1
- package/dist/llcsharp/enums/namespace.js +1 -0
- package/dist/llcsharp/enums/namespace.js.map +1 -1
- package/dist/llcsharp/exports.js +23 -13
- package/dist/llcsharp/exports.js.map +1 -1
- package/dist/llcsharp/generator.js +1 -0
- package/dist/llcsharp/generator.js.map +1 -1
- package/dist/llcsharp/messages.js +1 -0
- package/dist/llcsharp/messages.js.map +1 -1
- package/dist/llcsharp/model/idictionary.js +1 -0
- package/dist/llcsharp/model/idictionary.js.map +1 -1
- package/dist/llcsharp/model/interface.d.ts +3 -2
- package/dist/llcsharp/model/interface.d.ts.map +1 -1
- package/dist/llcsharp/model/interface.js +14 -8
- package/dist/llcsharp/model/interface.js.map +1 -1
- package/dist/llcsharp/model/model-class-dictionary.js +1 -0
- package/dist/llcsharp/model/model-class-dictionary.js.map +1 -1
- package/dist/llcsharp/model/model-class-json.d.ts.map +1 -1
- package/dist/llcsharp/model/model-class-json.js +25 -3
- package/dist/llcsharp/model/model-class-json.js.map +1 -1
- package/dist/llcsharp/model/model-class-serializer.js +1 -0
- package/dist/llcsharp/model/model-class-serializer.js.map +1 -1
- package/dist/llcsharp/model/model-class.js +10 -9
- package/dist/llcsharp/model/model-class.js.map +1 -1
- package/dist/llcsharp/model/namespace.js +1 -0
- package/dist/llcsharp/model/namespace.js.map +1 -1
- package/dist/llcsharp/model/property.js +1 -0
- package/dist/llcsharp/model/property.js.map +1 -1
- package/dist/llcsharp/operation/api-class.js +1 -0
- package/dist/llcsharp/operation/api-class.js.map +1 -1
- package/dist/llcsharp/operation/method.d.ts +3 -1
- package/dist/llcsharp/operation/method.d.ts.map +1 -1
- package/dist/llcsharp/operation/method.js +30 -28
- package/dist/llcsharp/operation/method.js.map +1 -1
- package/dist/llcsharp/operation/namespace.js +1 -0
- package/dist/llcsharp/operation/namespace.js.map +1 -1
- package/dist/llcsharp/operation/parameter.js +1 -0
- package/dist/llcsharp/operation/parameter.js.map +1 -1
- package/dist/llcsharp/project.d.ts.map +1 -1
- package/dist/llcsharp/project.js +3 -1
- package/dist/llcsharp/project.js.map +1 -1
- package/dist/llcsharp/schema/Uuid.js +1 -0
- package/dist/llcsharp/schema/Uuid.js.map +1 -1
- package/dist/llcsharp/schema/array.js +1 -0
- package/dist/llcsharp/schema/array.js.map +1 -1
- package/dist/llcsharp/schema/binary.js +1 -0
- package/dist/llcsharp/schema/binary.js.map +1 -1
- package/dist/llcsharp/schema/boolean.js +1 -0
- package/dist/llcsharp/schema/boolean.js.map +1 -1
- package/dist/llcsharp/schema/byte-array.js +1 -0
- package/dist/llcsharp/schema/byte-array.js.map +1 -1
- package/dist/llcsharp/schema/char.js +1 -0
- package/dist/llcsharp/schema/char.js.map +1 -1
- package/dist/llcsharp/schema/date-time.d.ts.map +1 -1
- package/dist/llcsharp/schema/date-time.js +1 -0
- package/dist/llcsharp/schema/date-time.js.map +1 -1
- package/dist/llcsharp/schema/date.js +1 -0
- package/dist/llcsharp/schema/date.js.map +1 -1
- package/dist/llcsharp/schema/duration.js +1 -0
- package/dist/llcsharp/schema/duration.js.map +1 -1
- package/dist/llcsharp/schema/enum.d.ts +1 -5
- package/dist/llcsharp/schema/enum.d.ts.map +1 -1
- package/dist/llcsharp/schema/enum.js +1 -9
- package/dist/llcsharp/schema/enum.js.map +1 -1
- package/dist/llcsharp/schema/integer.js +1 -0
- package/dist/llcsharp/schema/integer.js.map +1 -1
- package/dist/llcsharp/schema/object.js +2 -1
- package/dist/llcsharp/schema/object.js.map +1 -1
- package/dist/llcsharp/schema/password.js +2 -1
- package/dist/llcsharp/schema/password.js.map +1 -1
- package/dist/llcsharp/schema/primitive.js +1 -0
- package/dist/llcsharp/schema/primitive.js.map +1 -1
- package/dist/llcsharp/schema/schema-resolver.d.ts +2 -3
- package/dist/llcsharp/schema/schema-resolver.d.ts.map +1 -1
- package/dist/llcsharp/schema/schema-resolver.js +4 -0
- package/dist/llcsharp/schema/schema-resolver.js.map +1 -1
- package/dist/llcsharp/schema/string.d.ts.map +1 -1
- package/dist/llcsharp/schema/string.js +1 -0
- package/dist/llcsharp/schema/string.js.map +1 -1
- package/dist/llcsharp/schema/uri.d.ts +10 -0
- package/dist/llcsharp/schema/uri.d.ts.map +1 -0
- package/dist/llcsharp/schema/uri.js +25 -0
- package/dist/llcsharp/schema/uri.js.map +1 -0
- package/dist/llcsharp/validations.js +1 -0
- package/dist/llcsharp/validations.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +11 -0
- package/dist/main.js.map +1 -1
- package/dist/models/model-extensions.js +7 -6
- package/dist/models/model-extensions.js.map +1 -1
- package/dist/module/module-class.js +2 -1
- package/dist/module/module-class.js.map +1 -1
- package/dist/module/module-namespace.js +1 -0
- package/dist/module/module-namespace.js.map +1 -1
- package/dist/plugins/add-azure-completers-v2.js +1 -0
- package/dist/plugins/add-azure-completers-v2.js.map +1 -1
- package/dist/plugins/create-commands-v2.d.ts.map +1 -1
- package/dist/plugins/create-commands-v2.js +18 -21
- 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 +9 -3
- package/dist/plugins/cs-namer-v2.js.map +1 -1
- package/dist/plugins/llcsharp-v2.js +1 -0
- package/dist/plugins/llcsharp-v2.js.map +1 -1
- package/dist/plugins/modifiers-v2.d.ts +4 -0
- package/dist/plugins/modifiers-v2.d.ts.map +1 -1
- package/dist/plugins/modifiers-v2.js +69 -13
- package/dist/plugins/modifiers-v2.js.map +1 -1
- package/dist/plugins/plugin-create-inline-properties.d.ts.map +1 -1
- package/dist/plugins/plugin-create-inline-properties.js +51 -4
- package/dist/plugins/plugin-create-inline-properties.js.map +1 -1
- package/dist/plugins/plugin-tweak-m4-model.js +4 -3
- package/dist/plugins/plugin-tweak-m4-model.js.map +1 -1
- package/dist/plugins/plugin-tweak-model-azure-v2.js +4 -3
- package/dist/plugins/plugin-tweak-model-azure-v2.js.map +1 -1
- package/dist/plugins/plugin-tweak-model.js +15 -14
- package/dist/plugins/plugin-tweak-model.js.map +1 -1
- package/dist/plugins/powershell-v2.d.ts.map +1 -1
- package/dist/plugins/powershell-v2.js +7 -2
- package/dist/plugins/powershell-v2.js.map +1 -1
- package/dist/plugins/ps-namer-v2.js +1 -0
- package/dist/plugins/ps-namer-v2.js.map +1 -1
- package/dist/plugins/sdk-create-inline-properties.d.ts +4 -0
- package/dist/plugins/sdk-create-inline-properties.d.ts.map +1 -0
- package/dist/plugins/sdk-create-inline-properties.js +552 -0
- package/dist/plugins/sdk-create-inline-properties.js.map +1 -0
- package/dist/plugins/sdk-cs-namer.d.ts +3 -0
- package/dist/plugins/sdk-cs-namer.d.ts.map +1 -0
- package/dist/plugins/sdk-cs-namer.js +385 -0
- package/dist/plugins/sdk-cs-namer.js.map +1 -0
- package/dist/plugins/sdk-cs-simplifier.d.ts +3 -0
- package/dist/plugins/sdk-cs-simplifier.d.ts.map +1 -0
- package/dist/plugins/sdk-cs-simplifier.js +154 -0
- package/dist/plugins/sdk-cs-simplifier.js.map +1 -0
- package/dist/plugins/sdk-generate.d.ts +3 -0
- package/dist/plugins/sdk-generate.d.ts.map +1 -0
- package/dist/plugins/sdk-generate.js +106 -0
- package/dist/plugins/sdk-generate.js.map +1 -0
- package/dist/plugins/sdk-tweak-model.d.ts +3 -0
- package/dist/plugins/sdk-tweak-model.d.ts.map +1 -0
- package/dist/plugins/sdk-tweak-model.js +357 -0
- package/dist/plugins/sdk-tweak-model.js.map +1 -0
- package/dist/sdk/project.d.ts +45 -0
- package/dist/sdk/project.d.ts.map +1 -0
- package/dist/sdk/project.js +56 -0
- package/dist/sdk/project.js.map +1 -0
- package/dist/sdk/state.d.ts +23 -0
- package/dist/sdk/state.d.ts.map +1 -0
- package/dist/sdk/state.js +28 -0
- package/dist/sdk/state.js.map +1 -0
- package/dist/sdk/utility.d.ts +32 -0
- package/dist/sdk/utility.d.ts.map +1 -0
- package/dist/sdk/utility.js +414 -0
- package/dist/sdk/utility.js.map +1 -0
- package/dist/utils/PwshModel.js +1 -0
- package/dist/utils/PwshModel.js.map +1 -1
- package/dist/utils/SdkModel.d.ts +7 -0
- package/dist/utils/SdkModel.d.ts.map +1 -0
- package/dist/utils/SdkModel.js +17 -0
- package/dist/utils/SdkModel.js.map +1 -0
- package/dist/utils/TrieNode.d.ts +10 -0
- package/dist/utils/TrieNode.d.ts.map +1 -0
- package/dist/utils/TrieNode.js +45 -0
- package/dist/utils/TrieNode.js.map +1 -0
- package/dist/utils/WrapComments.d.ts +2 -0
- package/dist/utils/WrapComments.d.ts.map +1 -0
- package/dist/utils/WrapComments.js +46 -0
- package/dist/utils/WrapComments.js.map +1 -0
- package/dist/utils/code-namer.d.ts +3 -0
- package/dist/utils/code-namer.d.ts.map +1 -0
- package/dist/utils/code-namer.js +38 -0
- package/dist/utils/code-namer.js.map +1 -0
- package/dist/utils/command-operation.d.ts +7 -0
- package/dist/utils/command-operation.d.ts.map +1 -1
- package/dist/utils/command-operation.js +8 -2
- package/dist/utils/command-operation.js.map +1 -1
- package/dist/utils/components.d.ts +2 -0
- package/dist/utils/components.d.ts.map +1 -1
- package/dist/utils/components.js +1 -0
- package/dist/utils/components.js.map +1 -1
- package/dist/utils/extensions.js +1 -0
- package/dist/utils/extensions.js.map +1 -1
- package/dist/utils/http-definitions.js +1 -0
- package/dist/utils/http-definitions.js.map +1 -1
- package/dist/utils/http-operation.js +1 -0
- package/dist/utils/http-operation.js.map +1 -1
- package/dist/utils/info.js +1 -0
- package/dist/utils/info.js.map +1 -1
- package/dist/utils/model-state.js +1 -0
- package/dist/utils/model-state.js.map +1 -1
- package/dist/utils/powershell-comment.js +11 -10
- package/dist/utils/powershell-comment.js.map +1 -1
- package/dist/utils/programatic-operation.js +2 -2
- package/dist/utils/programatic-operation.js.map +1 -1
- package/dist/utils/resolve-conflicts.js +1 -0
- package/dist/utils/resolve-conflicts.js.map +1 -1
- package/dist/utils/schema.d.ts +13 -0
- package/dist/utils/schema.d.ts.map +1 -1
- package/dist/utils/schema.js +39 -0
- package/dist/utils/schema.js.map +1 -1
- package/dist/utils/security-scheme.js +1 -0
- package/dist/utils/security-scheme.js.map +1 -1
- package/dist/utils/uid.js +1 -0
- package/dist/utils/uid.js.map +1 -1
- package/package.json +8 -7
- package/readme.md +5 -1
- package/resources/assets/build-module.ps1 +9 -5
- package/resources/assets/create-model-cmdlets.ps1 +14 -2
- package/resources/assets/generate-portal-ux.ps1 +379 -0
- package/resources/assets/tools/Resources/custom/New-AzDeployment.ps1 +2 -2
- package/resources/psruntime/Attributes/ExternalDocsAttribute.cs +30 -0
- package/resources/psruntime/BuildTime/Cmdlets/ExportPsd1.cs +1 -1
- package/resources/psruntime/BuildTime/Models/PsMarkdownTypes.cs +39 -4
- package/resources/psruntime/BuildTime/Models/PsProxyOutputs.cs +10 -4
- package/resources/psruntime/BuildTime/Models/PsProxyTypes.cs +6 -0
- package/resources/psruntime/BuildTime/PsAttributes.cs +7 -0
- package/resources/psruntime/BuildTime/PsHelpers.cs +1 -2
- package/resources/psruntime/MessageAttributeHelper.cs +1 -5
- package/resources/runtime/csharp/client/Context.cs +33 -0
- package/resources/runtime/csharp/client/InfoAttribute.cs +4 -0
- package/resources/runtime/csharp/client/InputHandler.cs +22 -0
- package/resources/runtime/csharp/client/SerializationMode.cs +5 -3
- package/resources/runtime/csharp/pipeline/Events.cs +2 -2
- package/resources/runtime/csharp/pipeline/PipelineMocking.cs +1 -1
- package/resources/runtime/csharp/xml/IXmlSerializable.cs +2 -2
- package/resources/templates/azureMethod.ejs +5 -0
- package/resources/templates/azureMethodGroup.ejs +46 -0
- package/resources/templates/azureServiceClient.ejs +80 -0
- package/resources/templates/enum.ejs +73 -0
- package/resources/templates/exception.ejs +52 -0
- package/resources/templates/extensionMethod.ejs +68 -0
- package/resources/templates/extensions.ejs +19 -0
- package/resources/templates/longRunningOperationMethod.ejs +43 -0
- package/resources/templates/method.ejs +65 -0
- package/resources/templates/methodBodyRestCall.ejs +317 -0
- package/resources/templates/methodGroupInterface.ejs +77 -0
- package/resources/templates/model.ejs +184 -0
- package/resources/templates/page.ejs +40 -0
- package/resources/templates/serviceClientBody.ejs +303 -0
- package/resources/templates/serviceClientInterface.ejs +55 -0
package/dist/cmdlets/class.js
CHANGED
|
@@ -4,8 +4,11 @@
|
|
|
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;
|
|
8
|
+
const ejs = require('ejs');
|
|
7
9
|
const codemodel_1 = require("@azure-tools/codemodel");
|
|
8
10
|
const codemodel_v3_1 = require("@azure-tools/codemodel-v3");
|
|
11
|
+
const command_operation_1 = require("../utils/command-operation");
|
|
9
12
|
const schema_1 = require("../utils/schema");
|
|
10
13
|
const codegen_1 = require("@azure-tools/codegen");
|
|
11
14
|
const linq_1 = require("@azure-tools/linq");
|
|
@@ -159,7 +162,7 @@ function NewAddCompleterInfo(targetProperty, parameter) {
|
|
|
159
162
|
exports.NewAddCompleterInfo = NewAddCompleterInfo;
|
|
160
163
|
function addParameterBreakingChange(targetProperty, parameter) {
|
|
161
164
|
if (parameter.breakingChange) {
|
|
162
|
-
|
|
165
|
+
const parameters = [];
|
|
163
166
|
parameters.push(`"${parameter.breakingChange.parameterName}"`);
|
|
164
167
|
if (parameter.breakingChange.deprecateByVersion) {
|
|
165
168
|
parameters.push(`"${parameter.breakingChange.deprecateByVersion}"`);
|
|
@@ -179,7 +182,7 @@ function addParameterBreakingChange(targetProperty, parameter) {
|
|
|
179
182
|
}
|
|
180
183
|
else {
|
|
181
184
|
// for primitive types, should use name, otherwise use fullname which contains namespace
|
|
182
|
-
parameters.push(`OldParamaterType="${parameter.schema.language.csharp.fullname.startsWith(
|
|
185
|
+
parameters.push(`OldParamaterType="${parameter.schema.language.csharp.fullname.startsWith('<') ? parameter.schema.language.csharp.name : parameter.schema.language.csharp.fullname}"`);
|
|
183
186
|
}
|
|
184
187
|
parameters.push(`NewParameterType="${parameter.breakingChange.newParameterType}"`);
|
|
185
188
|
}
|
|
@@ -201,7 +204,8 @@ function addDefaultInfo(targetProperty, parameter) {
|
|
|
201
204
|
parameters: [
|
|
202
205
|
new codegen_csharp_1.LiteralExpression(`\nName = ${new codegen_csharp_1.StringExpression(parameter.defaultInfo.name || '').value}`),
|
|
203
206
|
new codegen_csharp_1.LiteralExpression(`\nDescription =${new codegen_csharp_1.StringExpression(parameter.defaultInfo.description || '').value}`),
|
|
204
|
-
new codegen_csharp_1.LiteralExpression(`\nScript = ${new codegen_csharp_1.StringExpression(parameter.defaultInfo.script).value}`)
|
|
207
|
+
new codegen_csharp_1.LiteralExpression(`\nScript = ${new codegen_csharp_1.StringExpression(parameter.defaultInfo.script).value}`),
|
|
208
|
+
new codegen_csharp_1.LiteralExpression(`\nSetCondition = ${new codegen_csharp_1.StringExpression(parameter.defaultInfo['set-condition'] || '').value}`)
|
|
205
209
|
]
|
|
206
210
|
}));
|
|
207
211
|
}
|
|
@@ -321,6 +325,7 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
321
325
|
this.variantName = variantName;
|
|
322
326
|
this.hasStreamOutput = false;
|
|
323
327
|
this.interfaces.push(exports_1.ClientRuntime.IEventListener);
|
|
328
|
+
this.interfaces.push(exports_1.ClientRuntime.IContext);
|
|
324
329
|
this.eventListener = new exports_1.EventListener(new codegen_csharp_1.LiteralExpression(`((${exports_1.ClientRuntime.IEventListener})this)`), true);
|
|
325
330
|
this.isViaIdentity = variantName.indexOf('ViaIdentity') > 0;
|
|
326
331
|
this.clientsidePagination = !!operation.details.csharp.clientsidePagination && !!((_a = operation.callGraph[0].language.csharp) === null || _a === void 0 ? void 0 : _a.pageable);
|
|
@@ -337,7 +342,7 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
337
342
|
*body() {
|
|
338
343
|
if ($this.state.project.azure) {
|
|
339
344
|
yield `var telemetryId = ${$this.state.project.serviceNamespace.moduleClass.declaration}.Instance.GetTelemetryId.Invoke();`;
|
|
340
|
-
yield codegen_csharp_1.If('telemetryId != "" && telemetryId != "internal"',
|
|
345
|
+
yield codegen_csharp_1.If('telemetryId != "" && telemetryId != "internal"', '__correlationId = telemetryId;');
|
|
341
346
|
}
|
|
342
347
|
yield 'Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials);';
|
|
343
348
|
yield codegen_csharp_1.If($this.$('Break'), `${exports_1.ClientRuntime.AttachDebugger}.Break();`);
|
|
@@ -355,6 +360,8 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
355
360
|
this.NewAddPowershellParameters(this.operation);
|
|
356
361
|
// implement IEventListener
|
|
357
362
|
this.implementIEventListener();
|
|
363
|
+
// implement part of the IContext
|
|
364
|
+
this.implementIContext();
|
|
358
365
|
// add constructors
|
|
359
366
|
this.implementConstructors();
|
|
360
367
|
// processRecord
|
|
@@ -379,8 +386,8 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
379
386
|
if (!request) {
|
|
380
387
|
continue;
|
|
381
388
|
}
|
|
382
|
-
const httpMethod = (_c = (_b = request.protocol.http) === null || _b === void 0 ? void 0 : _b.method
|
|
383
|
-
const httpPath = (_e = (_d = request.protocol.http) === null || _d === void 0 ? void 0 : _d.path
|
|
389
|
+
const httpMethod = (_c = (_b = request.protocol.http) === null || _b === void 0 ? void 0 : _b.method) !== null && _c !== void 0 ? _c : '';
|
|
390
|
+
const httpPath = (_e = (_d = request.protocol.http) === null || _d === void 0 ? void 0 : _d.path) !== null && _e !== void 0 ? _e : '';
|
|
384
391
|
ops = `${ops}\n[OpenAPI] ${httpOperation.language.default.name}=>${httpMethod.toUpperCase()}:"${httpPath}"`;
|
|
385
392
|
if (this.debugMode) {
|
|
386
393
|
// x-ms-metadata seems no longer exists
|
|
@@ -410,7 +417,7 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
410
417
|
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 }));
|
|
411
418
|
}
|
|
412
419
|
// pipeline property
|
|
413
|
-
this.add(new codegen_csharp_1.Property('Pipeline', exports_1.ClientRuntime.HttpPipeline, { getAccess: codegen_csharp_1.Access.
|
|
420
|
+
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.` }));
|
|
414
421
|
// client API property (gs01: fill this in correctly)
|
|
415
422
|
const clientAPI = new codegen_csharp_1.ClassType((_a = this.state.model.language.csharp) === null || _a === void 0 ? void 0 : _a.namespace, ((_b = this.state.model.language.csharp) === null || _b === void 0 ? void 0 : _b.name) || '');
|
|
416
423
|
this.add(new codegen_csharp_1.LambdaProperty('Client', clientAPI, new codegen_csharp_1.LiteralExpression(`${this.state.project.serviceNamespace.moduleClass.declaration}.Instance.ClientAPI`), { description: 'The reference to the client API class.' }));
|
|
@@ -422,9 +429,6 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
422
429
|
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* () {
|
|
423
430
|
// gs01: remember what you were doing here to make it so these can be parallelized...
|
|
424
431
|
yield '';
|
|
425
|
-
if (!$this.state.project.azure) {
|
|
426
|
-
yield $this.eventListener.syncSignal(powershell_declarations_1.Events.CmdletEndProcessing);
|
|
427
|
-
}
|
|
428
432
|
});
|
|
429
433
|
// debugging
|
|
430
434
|
const brk = this.add(new codegen_csharp_1.Property('Break', powershell_declarations_1.SwitchParameter, { attributes: [], description: 'Wait for .NET debugger to attach' }));
|
|
@@ -450,8 +454,8 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
450
454
|
proxyUri.add(new codegen_csharp_1.Attribute(powershell_declarations_1.ParameterAttribute, { parameters: ['Mandatory = false', 'DontShow = true', 'HelpMessage = "The URI for the proxy server to use"'] }));
|
|
451
455
|
proxyUri.add(new codegen_csharp_1.Attribute(powershell_declarations_1.CategoryAttribute, { parameters: [`${powershell_declarations_1.ParameterCategory}.Runtime`] }));
|
|
452
456
|
if (this.state.project.azure) {
|
|
453
|
-
this.defaultProfile = this.add(new codegen_csharp_1.Property('DefaultProfile', powershell_declarations_1.PSObject, { description: 'The
|
|
454
|
-
this.defaultProfile.add(new codegen_csharp_1.Attribute(powershell_declarations_1.ParameterAttribute, { parameters: ['Mandatory = false', 'HelpMessage = "The
|
|
457
|
+
this.defaultProfile = this.add(new codegen_csharp_1.Property('DefaultProfile', powershell_declarations_1.PSObject, { description: 'The credentials, account, tenant, and subscription used for communication with Azure' }));
|
|
458
|
+
this.defaultProfile.add(new codegen_csharp_1.Attribute(powershell_declarations_1.ParameterAttribute, { parameters: ['Mandatory = false', 'HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure."'] }));
|
|
455
459
|
this.defaultProfile.add(new codegen_csharp_1.Attribute(powershell_declarations_1.ValidateNotNull));
|
|
456
460
|
this.defaultProfile.add(new codegen_csharp_1.Attribute(powershell_declarations_1.Alias, { parameters: ['"AzureRMContext"', '"AzureCredential"'] }));
|
|
457
461
|
this.defaultProfile.add(new codegen_csharp_1.Attribute(powershell_declarations_1.CategoryAttribute, { parameters: [`${powershell_declarations_1.ParameterCategory}.Azure`] }));
|
|
@@ -562,20 +566,40 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
562
566
|
yield `${exports_1.ClientRuntime}.DictionaryExtensions.HashTableToDictionary<${vt}>(${$this.apProp.value},${$this.bodyParameter}.AdditionalProperties);`;
|
|
563
567
|
}
|
|
564
568
|
// construct the call to the operation
|
|
565
|
-
if (!$this.state.project.azure) {
|
|
566
|
-
yield $this.eventListener.signal(powershell_declarations_1.Events.CmdletProcessRecordAsyncStart);
|
|
567
|
-
}
|
|
568
569
|
yield $this.eventListener.signal(powershell_declarations_1.Events.CmdletGetPipeline);
|
|
569
570
|
const pipeline = $this.$('Pipeline');
|
|
570
571
|
if ($this.state.project.azure) {
|
|
571
|
-
yield pipeline.assign(new codegen_csharp_1.LiteralExpression(`${$this.state.project.serviceNamespace.moduleClass.declaration}.Instance.CreatePipeline(${$this.invocationInfo}, ${$this.correlationId}, ${$this.processRecordId}, this.ParameterSetName)`));
|
|
572
|
+
yield pipeline.assign(new codegen_csharp_1.LiteralExpression(`${$this.state.project.serviceNamespace.moduleClass.declaration}.Instance.CreatePipeline(${$this.invocationInfo}, ${$this.correlationId}, ${$this.processRecordId}, this.ParameterSetName, this.ExtensibleParameters)`));
|
|
572
573
|
}
|
|
573
574
|
else {
|
|
574
|
-
yield pipeline.assign(new codegen_csharp_1.LiteralExpression(`${$this.state.project.serviceNamespace.moduleClass.declaration}.Instance.CreatePipeline(${$this.invocationInfo}, this.ParameterSetName)`));
|
|
575
|
+
yield pipeline.assign(new codegen_csharp_1.LiteralExpression(`${$this.state.project.serviceNamespace.moduleClass.declaration}.Instance.CreatePipeline(${$this.invocationInfo}, this.ParameterSetName, this.ExtensibleParameters)`));
|
|
575
576
|
}
|
|
576
577
|
yield codegen_csharp_1.If(codegen_csharp_1.IsNotNull($this.$('HttpPipelinePrepend')), pipeline.invokeMethod('Prepend', codegen_csharp_1.toExpression(`(this.CommandRuntime as Microsoft.Rest.ClientRuntime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(${$this.$('HttpPipelinePrepend')}) ?? ${$this.$('HttpPipelinePrepend')}`)));
|
|
577
578
|
yield codegen_csharp_1.If(codegen_csharp_1.IsNotNull($this.$('HttpPipelineAppend')), pipeline.invokeMethod('Append', codegen_csharp_1.toExpression(`(this.CommandRuntime as Microsoft.Rest.ClientRuntime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(${$this.$('HttpPipelineAppend')}) ?? ${$this.$('HttpPipelineAppend')}`)));
|
|
578
579
|
yield '// get the client instance';
|
|
580
|
+
// Add input pipeline if it is configured by developers.
|
|
581
|
+
if ($this.operation.extensions.inputPipe) {
|
|
582
|
+
const handlers = $this.operation.extensions.inputPipe;
|
|
583
|
+
// default priority is 100
|
|
584
|
+
handlers.sort((a, b) => { return (a.priority || 100) - (b.priority || 100); });
|
|
585
|
+
for (const { index, handler } of handlers.map((handler, index) => ({ index, handler }))) {
|
|
586
|
+
yield `var handler_${index} = new ${handler.name}();`;
|
|
587
|
+
if (index > 0) {
|
|
588
|
+
yield `handler_${index - 1}.SetNextHandler(handler_${index});`;
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
yield 'handler_0.Process(this);';
|
|
592
|
+
}
|
|
593
|
+
const vps = $this.operation.details.csharp.virtualParameters || {
|
|
594
|
+
body: [],
|
|
595
|
+
operation: [],
|
|
596
|
+
};
|
|
597
|
+
for (const vParam of [...vps.body, ...vps.operation]) {
|
|
598
|
+
if (vParam.hidden) {
|
|
599
|
+
const td = $this.state.project.schemaDefinitionResolver.resolveTypeDeclaration(vParam.schema, true, $this.state);
|
|
600
|
+
yield codegen_csharp_1.If(`true == this.MyInvocation?.BoundParameters?.ContainsKey("${vParam.name}")`, `${vParam.name} = (${td.declaration})this.MyInvocation.BoundParameters["${vParam.name}"];`);
|
|
601
|
+
}
|
|
602
|
+
}
|
|
579
603
|
const apiCall = operation.callGraph[0];
|
|
580
604
|
// find each parameter to the method, and find out where the value is going to come from.
|
|
581
605
|
const operationParameters = linq_1.values(apiCall.parameters).
|
|
@@ -631,7 +655,7 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
631
655
|
parameters.push(new codegen_csharp_1.Parameter('headers', codegen_csharp_1.System.Threading.Tasks.Task({ declaration: each.language.csharp.headerType }), { description: `the header result as a <see cref="${each.language.csharp.headerType}" /> from the remote call` }));
|
|
632
656
|
}
|
|
633
657
|
if (isBinary) {
|
|
634
|
-
parameters.push(new codegen_csharp_1.Parameter('response', codegen_csharp_1.System.Threading.Tasks.Task({ declaration: 'global::System.IO.Stream' }), { description:
|
|
658
|
+
parameters.push(new codegen_csharp_1.Parameter('response', codegen_csharp_1.System.Threading.Tasks.Task({ declaration: 'global::System.IO.Stream' }), { description: 'the body result as a <see cref="global::System.IO.Stream" /> from the remote call' }));
|
|
635
659
|
}
|
|
636
660
|
const override = `override${codegen_1.pascalCase(((_f = each.language.csharp) === null || _f === void 0 ? void 0 : _f.name) || '')}`;
|
|
637
661
|
const returnNow = new codegen_csharp_1.Parameter('returnNow', codegen_csharp_1.System.Threading.Tasks.Task(codegen_csharp_1.dotnet.Bool), { modifier: codegen_csharp_2.ParameterModifier.Ref, description: `/// Determines if the rest of the ${(_g = each.language.csharp) === null || _g === void 0 ? void 0 : _g.name} method should be processed, or if the method should return immediately (set to true to skip further processing )` });
|
|
@@ -733,15 +757,15 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
733
757
|
const vp = schema_1.getVirtualPropertyFromPropertyName((_m = schema.language.csharp) === null || _m === void 0 ? void 0 : _m.virtualProperties, valueProperty.serializedName);
|
|
734
758
|
if (vp) {
|
|
735
759
|
if ($this.clientsidePagination) {
|
|
736
|
-
yield (codegen_csharp_1.If(
|
|
737
|
-
yield (
|
|
760
|
+
yield (codegen_csharp_1.If('(ulong)result.Value.Length <= this.PagingParameters.Skip', function* () {
|
|
761
|
+
yield ('this.PagingParameters.Skip = this.PagingParameters.Skip - (ulong)result.Value.Length;');
|
|
738
762
|
}));
|
|
739
763
|
yield codegen_csharp_1.Else(function* () {
|
|
740
|
-
yield (
|
|
741
|
-
yield (
|
|
742
|
-
yield (
|
|
743
|
-
yield (
|
|
744
|
-
yield (
|
|
764
|
+
yield ('ulong toRead = Math.Min(this.PagingParameters.First, (ulong)result.Value.Length - this.PagingParameters.Skip);');
|
|
765
|
+
yield ('var requiredResult = result.Value.SubArray((int)this.PagingParameters.Skip, (int)toRead);');
|
|
766
|
+
yield ('WriteObject(requiredResult, true);');
|
|
767
|
+
yield ('this.PagingParameters.Skip = 0;');
|
|
768
|
+
yield ('this.PagingParameters.First = this.PagingParameters.First <= toRead ? 0 : this.PagingParameters.First - toRead;');
|
|
745
769
|
});
|
|
746
770
|
}
|
|
747
771
|
else {
|
|
@@ -752,18 +776,18 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
752
776
|
if (nl) {
|
|
753
777
|
$this.add(new codegen_csharp_1.Field('_isFirst', codegen_csharp_1.dotnet.Bool, {
|
|
754
778
|
access: codegen_csharp_1.Access.Private,
|
|
755
|
-
initialValue: new codegen_csharp_1.LiteralExpression(
|
|
756
|
-
description:
|
|
779
|
+
initialValue: new codegen_csharp_1.LiteralExpression('true'),
|
|
780
|
+
description: 'A flag to tell whether it is the first onOK call.'
|
|
757
781
|
}));
|
|
758
782
|
$this.add(new codegen_csharp_1.Field('_nextLink', codegen_csharp_1.dotnet.String, {
|
|
759
783
|
access: codegen_csharp_1.Access.Private,
|
|
760
|
-
description:
|
|
784
|
+
description: 'Link to retrieve next page.'
|
|
761
785
|
}));
|
|
762
786
|
const nextLinkName = `${result.value}.${nl.name}`;
|
|
763
787
|
yield `_nextLink = ${nextLinkName};`;
|
|
764
|
-
|
|
765
|
-
yield (codegen_csharp_1.If(
|
|
766
|
-
yield
|
|
788
|
+
const nextLinkCondition = $this.clientsidePagination ? '_nextLink != null && this.PagingParameters.First > 0' : '_nextLink != null';
|
|
789
|
+
yield (codegen_csharp_1.If('_isFirst', function* () {
|
|
790
|
+
yield '_isFirst = false;';
|
|
767
791
|
yield (codegen_csharp_1.While(nextLinkCondition, codegen_csharp_1.If('responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ', function* () {
|
|
768
792
|
var _a;
|
|
769
793
|
yield `requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),${exports_1.ClientRuntime.Method.Get} );`;
|
|
@@ -829,21 +853,21 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
829
853
|
}
|
|
830
854
|
// in m4, there will be no schema deinfed for the binary response, instead, we will have a field called binary with value true.
|
|
831
855
|
if ('binary' in each) {
|
|
832
|
-
yield
|
|
856
|
+
yield '// (await response) // should be global::System.IO.Stream';
|
|
833
857
|
if ($this.hasStreamOutput && $this.outFileParameter) {
|
|
834
858
|
const outfile = $this.outFileParameter;
|
|
835
859
|
const provider = codegen_csharp_2.Local('provider');
|
|
836
860
|
provider.initializer = undefined;
|
|
837
|
-
const paths = codegen_csharp_2.Local('paths',
|
|
861
|
+
const paths = codegen_csharp_2.Local('paths', 'new global::System.Collections.ObjectModel.Collection<global::System.String>()');
|
|
838
862
|
yield paths.declarationStatement;
|
|
839
863
|
yield codegen_csharp_1.Try(function* () {
|
|
840
864
|
yield `${paths.value} = this.SessionState.Path.GetResolvedProviderPathFromPSPath(${outfile.value}, out ${provider.declarationExpression});`;
|
|
841
865
|
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}) );`);
|
|
842
866
|
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}) );`);
|
|
843
867
|
});
|
|
844
|
-
const notfound = new codegen_csharp_1.Parameter('', { declaration:
|
|
868
|
+
const notfound = new codegen_csharp_1.Parameter('', { declaration: 'global::System.Management.Automation.ItemNotFoundException' });
|
|
845
869
|
yield codegen_csharp_1.Catch(notfound, function* () {
|
|
846
|
-
yield
|
|
870
|
+
yield '// If the file does not exist, we will try to create it';
|
|
847
871
|
yield `${paths.value}.Add(${outfile.value});`;
|
|
848
872
|
});
|
|
849
873
|
// this is a stream output. write to outfile
|
|
@@ -873,6 +897,15 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
873
897
|
yield $this.eventListener.signal(powershell_declarations_1.Events.CmdletBeforeAPICall);
|
|
874
898
|
const idOpParams = operationParameters.filter(each => !each.isPathParam);
|
|
875
899
|
const idschema = linq_1.values($this.state.project.model.schemas.objects).first(each => each.language.default.uid === 'universal-parameter-type');
|
|
900
|
+
let serializationMode = null;
|
|
901
|
+
if ($this.bodyParameter) {
|
|
902
|
+
if ($this.operation.operationType === command_operation_1.OperationType.Create) {
|
|
903
|
+
serializationMode = exports_1.ClientRuntime.SerializationMode.IncludeCreate;
|
|
904
|
+
}
|
|
905
|
+
else if ($this.operation.operationType === command_operation_1.OperationType.Update) {
|
|
906
|
+
serializationMode = exports_1.ClientRuntime.SerializationMode.IncludeUpdate;
|
|
907
|
+
}
|
|
908
|
+
}
|
|
876
909
|
if ($this.isViaIdentity) {
|
|
877
910
|
const identityFromPathParams = function* () {
|
|
878
911
|
var _a, _b;
|
|
@@ -901,10 +934,10 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
901
934
|
};
|
|
902
935
|
}
|
|
903
936
|
// fall back!
|
|
904
|
-
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
|
|
937
|
+
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 : '')}').`);
|
|
905
938
|
return {
|
|
906
|
-
name: `InputObject.${codegen_1.pascalCase((_d = (_c = match.language.csharp) === null || _c === void 0 ? void 0 : _c.name
|
|
907
|
-
value: `InputObject.${codegen_1.pascalCase((_f = (_e = match.language.csharp) === null || _e === void 0 ? void 0 : _e.name
|
|
939
|
+
name: `InputObject.${codegen_1.pascalCase((_d = (_c = match.language.csharp) === null || _c === void 0 ? void 0 : _c.name) !== null && _d !== void 0 ? _d : '')}`,
|
|
940
|
+
value: `InputObject.${codegen_1.pascalCase((_f = (_e = match.language.csharp) === null || _e === void 0 ? void 0 : _e.name) !== null && _f !== void 0 ? _f : '')} ?? ${defaultOfType}`
|
|
908
941
|
};
|
|
909
942
|
}
|
|
910
943
|
console.error(`Unable to match idenity parameter '${each.name}' member to appropriate virtual parameter. (Guessing '${pascalName}')`);
|
|
@@ -922,7 +955,11 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
922
955
|
}
|
|
923
956
|
};
|
|
924
957
|
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'; })) {
|
|
925
|
-
|
|
958
|
+
const parameters = [codegen_csharp_1.toExpression('InputObject.Id'), ...idOpParams.map(each => each.expression), ...callbackMethods, codegen_csharp_1.dotnet.This, pipeline];
|
|
959
|
+
if (serializationMode) {
|
|
960
|
+
parameters.push(serializationMode);
|
|
961
|
+
}
|
|
962
|
+
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}`);
|
|
926
963
|
yield codegen_csharp_1.Else(identityFromPathParams);
|
|
927
964
|
}
|
|
928
965
|
else {
|
|
@@ -930,7 +967,11 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
930
967
|
}
|
|
931
968
|
}
|
|
932
969
|
else {
|
|
933
|
-
|
|
970
|
+
const parameters = [...operationParameters.map(each => each.expression), ...callbackMethods, codegen_csharp_1.dotnet.This, pipeline];
|
|
971
|
+
if (serializationMode) {
|
|
972
|
+
parameters.push(serializationMode);
|
|
973
|
+
}
|
|
974
|
+
yield `await this.${$this.$('Client').invokeMethod(`${(_b = apiCall.language.csharp) === null || _b === void 0 ? void 0 : _b.name}`, ...parameters).implementation}`;
|
|
934
975
|
}
|
|
935
976
|
yield $this.eventListener.signal(powershell_declarations_1.Events.CmdletAfterAPICall);
|
|
936
977
|
};
|
|
@@ -990,6 +1031,16 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
990
1031
|
// default constructor
|
|
991
1032
|
this.add(new codegen_csharp_1.Constructor(this, { description: `Intializes a new instance of the <see cref="${this.name}" /> cmdlet class.` }));
|
|
992
1033
|
}
|
|
1034
|
+
implementIContext() {
|
|
1035
|
+
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), {
|
|
1036
|
+
access: codegen_csharp_1.Access.Private,
|
|
1037
|
+
initialValue: new codegen_csharp_1.LiteralExpression('new System.Collections.Generic.Dictionary<string, object>()'),
|
|
1038
|
+
description: 'A dictionary to carry over additional data for pipeline.'
|
|
1039
|
+
}));
|
|
1040
|
+
const extensibleParametersProp = new codegen_csharp_1.Property('ExtensibleParameters', codegen_csharp_1.System.Collections.Generic.IDictionary(codegen_csharp_1.System.String, codegen_csharp_1.System.Object), { description: 'Accessor for extensibleParameters.' });
|
|
1041
|
+
extensibleParametersProp.get = codegen_csharp_1.toExpression(`${extensibleParameters.value} `);
|
|
1042
|
+
this.add(extensibleParametersProp);
|
|
1043
|
+
}
|
|
993
1044
|
implementIEventListener() {
|
|
994
1045
|
const $this = this;
|
|
995
1046
|
const cts = this.add(new codegen_csharp_1.Field('_cancellationTokenSource', codegen_csharp_1.System.Threading.CancellationTokenSource, {
|
|
@@ -997,6 +1048,10 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
997
1048
|
initialValue: new codegen_csharp_1.LiteralExpression(`new ${codegen_csharp_1.System.Threading.CancellationTokenSource.declaration}()`),
|
|
998
1049
|
description: `The <see cref="${codegen_csharp_1.System.Threading.CancellationTokenSource}" /> for this operation.`
|
|
999
1050
|
}));
|
|
1051
|
+
const cancellationTokenSource = new codegen_csharp_1.Property('CancellationTokenSource', codegen_csharp_1.System.Threading.CancellationTokenSource, { description: 'Accessor for cancellationTokenSource.' });
|
|
1052
|
+
cancellationTokenSource.get = codegen_csharp_1.toExpression(`${cts.value} `);
|
|
1053
|
+
cancellationTokenSource.set = new codegen_csharp_1.Statements(cts.assign('value'));
|
|
1054
|
+
this.add(cancellationTokenSource);
|
|
1000
1055
|
this.add(new codegen_csharp_1.LambdaProperty(`${exports_1.ClientRuntime.IEventListener}.Token`, codegen_csharp_1.System.Threading.CancellationToken, new codegen_csharp_1.LiteralExpression(`${cts.value}.Token`), { getAccess: codegen_csharp_1.Access.Default, setAccess: codegen_csharp_1.Access.Default, description: `<see cref="${exports_1.ClientRuntime}.IEventListener" /> cancellation token.` }));
|
|
1001
1056
|
this.cancellationToken = codegen_csharp_1.toExpression(`((${exports_1.ClientRuntime.IEventListener})this).Token`);
|
|
1002
1057
|
this.add(new codegen_csharp_1.LambdaProperty(`${exports_1.ClientRuntime.IEventListener}.Cancel`, codegen_csharp_1.System.Action(), new codegen_csharp_1.LiteralExpression(`${cts.value}.Cancel`), { getAccess: codegen_csharp_1.Access.Default, setAccess: codegen_csharp_1.Access.Default, description: `<see cref="${exports_1.ClientRuntime}.IEventListener" /> cancellation delegate. Stops the cmdlet when called.` }));
|
|
@@ -1043,12 +1098,37 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
1043
1098
|
yield 'WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) );';
|
|
1044
1099
|
yield codegen_csharp_1.Return();
|
|
1045
1100
|
}),
|
|
1101
|
+
codegen_csharp_1.TerminalCase(powershell_declarations_1.Events.Progress.value, function* () {
|
|
1102
|
+
yield 'var data = messageData();';
|
|
1103
|
+
yield 'int progress = (int)data.Value;';
|
|
1104
|
+
yield 'string activityMessage, statusDescription;';
|
|
1105
|
+
yield 'global::System.Management.Automation.ProgressRecordType recordType;';
|
|
1106
|
+
yield 'if (progress < 100)';
|
|
1107
|
+
yield '{';
|
|
1108
|
+
yield ' activityMessage = "In progress";';
|
|
1109
|
+
yield ' statusDescription = "Checking operation status";';
|
|
1110
|
+
yield ' recordType = System.Management.Automation.ProgressRecordType.Processing;';
|
|
1111
|
+
yield '}';
|
|
1112
|
+
yield 'else';
|
|
1113
|
+
yield '{';
|
|
1114
|
+
yield ' activityMessage = "Completed";';
|
|
1115
|
+
yield ' statusDescription = "Completed";';
|
|
1116
|
+
yield ' recordType = System.Management.Automation.ProgressRecordType.Completed;';
|
|
1117
|
+
yield '}';
|
|
1118
|
+
// hardcode id = 1 because there is no need for nested progress bar
|
|
1119
|
+
yield 'WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription)';
|
|
1120
|
+
yield '{';
|
|
1121
|
+
yield ' PercentComplete = progress,';
|
|
1122
|
+
yield 'RecordType = recordType';
|
|
1123
|
+
yield '});';
|
|
1124
|
+
yield codegen_csharp_1.Return();
|
|
1125
|
+
}),
|
|
1046
1126
|
]);
|
|
1047
1127
|
if ($this.operation.asjob) {
|
|
1048
1128
|
// if we support -AsJob, we support -NoWait
|
|
1049
1129
|
sw.add(codegen_csharp_1.Case(powershell_declarations_1.Events.DelayBeforePolling.value, function* () {
|
|
1130
|
+
yield 'var data = messageData();';
|
|
1050
1131
|
yield codegen_csharp_1.If('true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")', function* () {
|
|
1051
|
-
yield 'var data = messageData();';
|
|
1052
1132
|
yield 'if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response)';
|
|
1053
1133
|
yield '{';
|
|
1054
1134
|
yield ' var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation");';
|
|
@@ -1060,6 +1140,22 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
1060
1140
|
yield ' return;';
|
|
1061
1141
|
yield '}';
|
|
1062
1142
|
});
|
|
1143
|
+
yield codegen_csharp_1.Else(function* () {
|
|
1144
|
+
yield 'if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response)';
|
|
1145
|
+
yield '{';
|
|
1146
|
+
yield ' int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30);';
|
|
1147
|
+
yield ' WriteDebug($"Delaying {delay} seconds before polling.");';
|
|
1148
|
+
yield ' for (var now = 0; now < delay; ++now)';
|
|
1149
|
+
yield ' {';
|
|
1150
|
+
// hardcode id = 1 because there is no need for nested progress bar
|
|
1151
|
+
yield ' WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status")';
|
|
1152
|
+
yield ' {';
|
|
1153
|
+
yield ' PercentComplete = now * 100 / delay';
|
|
1154
|
+
yield ' });';
|
|
1155
|
+
yield ` await global::System.Threading.Tasks.Task.Delay(1000, ${token.use});`;
|
|
1156
|
+
yield ' }';
|
|
1157
|
+
yield '}';
|
|
1158
|
+
});
|
|
1063
1159
|
}));
|
|
1064
1160
|
}
|
|
1065
1161
|
// the whole switch statement
|
|
@@ -1130,7 +1226,7 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
1130
1226
|
}
|
|
1131
1227
|
if (this.dropBodyParameter && parameter.details.csharp.isBodyParameter) {
|
|
1132
1228
|
// we're supposed to use parameters for the body parameter instead of a big object
|
|
1133
|
-
const expandedBodyParameter = this.add(new codegen_csharp_1.Field(
|
|
1229
|
+
const expandedBodyParameter = this.add(new codegen_csharp_1.Field('_' + codegen_1.camelCase(parameter.details.csharp.name), td, {
|
|
1134
1230
|
description: parameter.details.csharp.description,
|
|
1135
1231
|
initialValue: (parameter.schema.type === codemodel_1.SchemaType.Array) ? codegen_csharp_1.dotnet.Null : `new ${(_a = parameter.schema.language.csharp) === null || _a === void 0 ? void 0 : _a.fullname}()`,
|
|
1136
1232
|
access: codegen_csharp_1.Access.Private
|
|
@@ -1216,7 +1312,6 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
1216
1312
|
this.addDoNotExport(cmdletParameter, vParam);
|
|
1217
1313
|
}
|
|
1218
1314
|
const isEnum = propertyType instanceof exports_1.EnumImplementation;
|
|
1219
|
-
;
|
|
1220
1315
|
const hasEnum = propertyType instanceof exports_1.ArrayOf && propertyType.elementType instanceof exports_1.EnumImplementation;
|
|
1221
1316
|
if (isEnum || hasEnum) {
|
|
1222
1317
|
cmdletParameter.add(new codegen_csharp_1.Attribute(powershell_declarations_1.ArgumentCompleterAttribute, { parameters: [`typeof(${hasEnum ? propertyType.elementType.declaration : propertyType.declaration})`] }));
|
|
@@ -1274,52 +1369,65 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
1274
1369
|
// skip 'Host'
|
|
1275
1370
|
continue;
|
|
1276
1371
|
}
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
//
|
|
1282
|
-
this.add(new codegen_csharp_1.BackedProperty(vParam.name, codegen_csharp_1.
|
|
1283
|
-
metadata: {
|
|
1284
|
-
parameterDefinition: origin.details.csharp.httpParameter
|
|
1285
|
-
},
|
|
1286
|
-
description: vParam.description
|
|
1287
|
-
})) :
|
|
1288
|
-
// everything else
|
|
1289
|
-
this.add(new codegen_csharp_1.BackedProperty(vParam.name, propertyType, {
|
|
1290
|
-
metadata: {
|
|
1291
|
-
parameterDefinition: origin.details.csharp.httpParameter
|
|
1292
|
-
},
|
|
1372
|
+
let regularCmdletParameter;
|
|
1373
|
+
let origin = null;
|
|
1374
|
+
let propertyType = null;
|
|
1375
|
+
if (vParam.type) {
|
|
1376
|
+
// Handle parameters added through directives
|
|
1377
|
+
regularCmdletParameter = this.add(new codegen_csharp_1.BackedProperty(vParam.name, new codegen_csharp_1.ClassType('', vParam.type), {
|
|
1293
1378
|
description: vParam.description
|
|
1294
1379
|
}));
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1380
|
+
}
|
|
1381
|
+
else {
|
|
1382
|
+
const vSchema = vParam.schema;
|
|
1383
|
+
propertyType = this.state.project.schemaDefinitionResolver.resolveTypeDeclaration(vSchema, true, this.state);
|
|
1384
|
+
origin = vParam.origin;
|
|
1385
|
+
regularCmdletParameter = (this.state.project.azure && vParam.name === 'SubscriptionId' && operation.details.csharp.verb.toLowerCase() === 'get') ?
|
|
1386
|
+
// special case for subscription id
|
|
1387
|
+
this.add(new codegen_csharp_1.BackedProperty(vParam.name, codegen_csharp_1.dotnet.StringArray, {
|
|
1388
|
+
metadata: {
|
|
1389
|
+
parameterDefinition: origin.details.csharp.httpParameter
|
|
1390
|
+
},
|
|
1391
|
+
description: vParam.description
|
|
1392
|
+
})) :
|
|
1393
|
+
// everything else
|
|
1394
|
+
this.add(new codegen_csharp_1.BackedProperty(vParam.name, propertyType, {
|
|
1395
|
+
metadata: {
|
|
1396
|
+
parameterDefinition: origin.details.csharp.httpParameter
|
|
1397
|
+
},
|
|
1398
|
+
description: vParam.description
|
|
1399
|
+
}));
|
|
1400
|
+
const dictSchema = vSchema.type === codemodel_1.SchemaType.Dictionary ? vSchema :
|
|
1401
|
+
vSchema.type === codemodel_1.SchemaType.Object ? (_j = (_h = vSchema.parents) === null || _h === void 0 ? void 0 : _h.immediate) === null || _j === void 0 ? void 0 : _j.find((s) => s.type === codemodel_1.SchemaType.Dictionary) :
|
|
1402
|
+
undefined;
|
|
1403
|
+
if (dictSchema) {
|
|
1404
|
+
// we have to figure out if this is a standalone dictionary or a hybrid object/dictionary.
|
|
1405
|
+
// if it's a hybrid, we have to create another parameter like -<XXX>AdditionalProperties and have that dump the contents into the dictionary
|
|
1406
|
+
// if it's a standalone dictionary, we can just use hashtable instead
|
|
1407
|
+
if (linq_1.length(vSchema.properties) === 0) {
|
|
1408
|
+
// it's a pure dictionary
|
|
1409
|
+
// change the property type to hashtable.
|
|
1410
|
+
// add an attribute to change the exported type.
|
|
1411
|
+
regularCmdletParameter.add(new codegen_csharp_1.Attribute(powershell_declarations_1.ExportAsAttribute, { parameters: [`typeof(${codegen_csharp_1.System.Collections.Hashtable})`] }));
|
|
1412
|
+
}
|
|
1413
|
+
else {
|
|
1414
|
+
// it's a hybrid. We need to add an additional property that puts its items into the target container
|
|
1415
|
+
}
|
|
1310
1416
|
}
|
|
1311
1417
|
}
|
|
1312
1418
|
this.thingsToSerialize.push(regularCmdletParameter);
|
|
1313
1419
|
const parameters = [new codegen_csharp_1.LiteralExpression(`Mandatory = ${vParam.required ? 'true' : 'false'}`), new codegen_csharp_1.LiteralExpression(`HelpMessage = "${codegen_1.escapeString(vParam.description) || '.'}"`)];
|
|
1314
|
-
if (origin.details.csharp.isBodyParameter) {
|
|
1420
|
+
if (!!origin && origin.details.csharp.isBodyParameter) {
|
|
1315
1421
|
parameters.push(new codegen_csharp_1.LiteralExpression('ValueFromPipeline = true'));
|
|
1316
1422
|
this.bodyParameter = regularCmdletParameter;
|
|
1317
1423
|
}
|
|
1318
1424
|
regularCmdletParameter.add(new codegen_csharp_1.Attribute(powershell_declarations_1.ParameterAttribute, { parameters }));
|
|
1319
|
-
if (vParam.schema.type === codemodel_1.SchemaType.Array) {
|
|
1425
|
+
if (!vParam.type && vParam.schema.type === codemodel_1.SchemaType.Array) {
|
|
1320
1426
|
regularCmdletParameter.add(new codegen_csharp_1.Attribute(powershell_declarations_1.AllowEmptyCollectionAttribute));
|
|
1321
1427
|
}
|
|
1322
|
-
|
|
1428
|
+
if (!!origin && !!propertyType) {
|
|
1429
|
+
NewAddInfoAttribute(regularCmdletParameter, propertyType, (_k = vParam.required) !== null && _k !== void 0 ? _k : false, false, vParam.description, origin.name);
|
|
1430
|
+
}
|
|
1323
1431
|
NewAddCompleterInfo(regularCmdletParameter, vParam);
|
|
1324
1432
|
addParameterBreakingChange(regularCmdletParameter, vParam);
|
|
1325
1433
|
addPreviewMessage(regularCmdletParameter, vParam);
|
|
@@ -1329,7 +1437,7 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
1329
1437
|
if (linq_1.length(vParam.alias) > 0) {
|
|
1330
1438
|
regularCmdletParameter.add(new codegen_csharp_1.Attribute(powershell_declarations_1.Alias, { parameters: vParam.alias.map(x => '"' + x + '"') }));
|
|
1331
1439
|
}
|
|
1332
|
-
const httpParam = origin.details.csharp.httpParameter;
|
|
1440
|
+
const httpParam = origin ? origin.details.csharp.httpParameter : null;
|
|
1333
1441
|
//const uid = httpParam ? httpParam.details.csharp.uid : 'no-parameter';
|
|
1334
1442
|
if (httpParam) {
|
|
1335
1443
|
// xichen: Is it safe to compare by csharp serializedName? Because we no longer have uid
|
|
@@ -1338,13 +1446,17 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
1338
1446
|
regularCmdletParameter.add(new codegen_csharp_1.Attribute(powershell_declarations_1.CategoryAttribute, { parameters: [`${powershell_declarations_1.ParameterCategory}.${codegen_1.pascalCase(((_m = cat.protocol.http) === null || _m === void 0 ? void 0 : _m.in))}`] }));
|
|
1339
1447
|
}
|
|
1340
1448
|
}
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1449
|
+
else {
|
|
1450
|
+
const isBodyParameter = origin ? origin.details.csharp.isBodyParameter : false;
|
|
1451
|
+
if (isBodyParameter) {
|
|
1452
|
+
regularCmdletParameter.add(new codegen_csharp_1.Attribute(powershell_declarations_1.CategoryAttribute, {
|
|
1453
|
+
parameters: [`${powershell_declarations_1.ParameterCategory}.Body`],
|
|
1454
|
+
}));
|
|
1455
|
+
}
|
|
1344
1456
|
}
|
|
1345
1457
|
const isEnum = propertyType instanceof exports_1.EnumImplementation;
|
|
1346
1458
|
const hasEnum = propertyType instanceof exports_1.ArrayOf && propertyType.elementType instanceof exports_1.EnumImplementation;
|
|
1347
|
-
if (isEnum || hasEnum) {
|
|
1459
|
+
if (propertyType && (isEnum || hasEnum)) {
|
|
1348
1460
|
regularCmdletParameter.add(new codegen_csharp_1.Attribute(powershell_declarations_1.ArgumentCompleterAttribute, { parameters: [`typeof(${hasEnum ? propertyType.elementType.declaration : propertyType.declaration})`] }));
|
|
1349
1461
|
}
|
|
1350
1462
|
}
|
|
@@ -1369,7 +1481,7 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
1369
1481
|
}
|
|
1370
1482
|
}
|
|
1371
1483
|
NewAddClassAttributes(operation, variantName) {
|
|
1372
|
-
var _a, _b, _c, _d;
|
|
1484
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1373
1485
|
const cmdletAttribParams = [
|
|
1374
1486
|
category[operation.details.csharp.verb] ? powershell_declarations_1.verbEnum(category[operation.details.csharp.verb], operation.details.csharp.verb) : `"${operation.details.csharp.verb}"`,
|
|
1375
1487
|
new codegen_csharp_1.StringExpression(variantName)
|
|
@@ -1461,9 +1573,9 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
1461
1573
|
}
|
|
1462
1574
|
//add breaking change attributes for cmdlet, variant, output type
|
|
1463
1575
|
if (operation.details.csharp.breakingChange) {
|
|
1464
|
-
|
|
1576
|
+
const breakingChange = operation.details.csharp.breakingChange;
|
|
1465
1577
|
if (breakingChange.cmdlet) {
|
|
1466
|
-
|
|
1578
|
+
const parameters = [];
|
|
1467
1579
|
if (breakingChange.cmdlet.deprecateByVersion) {
|
|
1468
1580
|
parameters.push(`"${breakingChange.cmdlet.deprecateByVersion}"`);
|
|
1469
1581
|
if (breakingChange.cmdlet.changeInEfectByDate)
|
|
@@ -1476,7 +1588,7 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
1476
1588
|
this.add(new codegen_csharp_1.Attribute(exports_1.ClientRuntime.CmdletBreakingChangeAttribute, { parameters: parameters }));
|
|
1477
1589
|
}
|
|
1478
1590
|
if (breakingChange.variant) {
|
|
1479
|
-
|
|
1591
|
+
const parameters = [];
|
|
1480
1592
|
parameters.push(`new string[] {"${breakingChange.variant.name}"}`);
|
|
1481
1593
|
if (breakingChange.variant.deprecateByVersion) {
|
|
1482
1594
|
parameters.push(`"${breakingChange.variant.deprecateByVersion}"`);
|
|
@@ -1488,13 +1600,13 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
1488
1600
|
this.add(new codegen_csharp_1.Attribute(exports_1.ClientRuntime.ParameterSetBreakingChangeAttribute, { parameters: parameters }));
|
|
1489
1601
|
}
|
|
1490
1602
|
if (breakingChange.output) {
|
|
1491
|
-
|
|
1603
|
+
const parameters = [];
|
|
1492
1604
|
// if deprecated output types are set in directive, use it
|
|
1493
1605
|
if (breakingChange.output.deprecatedCmdLetOutputType) {
|
|
1494
1606
|
parameters.push(`"${breakingChange.output.deprecatedCmdLetOutputType}"`);
|
|
1495
1607
|
}
|
|
1496
1608
|
else {
|
|
1497
|
-
parameters.push(`"${outputTypes.values().next().value.replace(/typeof\((.*)\)/,
|
|
1609
|
+
parameters.push(`"${outputTypes.values().next().value.replace(/typeof\((.*)\)/, '$1')}"`);
|
|
1498
1610
|
}
|
|
1499
1611
|
if (breakingChange.output.deprecateByVersion) {
|
|
1500
1612
|
parameters.push(`"${breakingChange.output.deprecateByVersion}"`);
|
|
@@ -1504,12 +1616,12 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
1504
1616
|
if (breakingChange.output.replacement)
|
|
1505
1617
|
parameters.push(`ReplacementCmdletOutputType="${breakingChange.output.replacement}"`);
|
|
1506
1618
|
if (breakingChange.output.deprecatedOutputProperties) {
|
|
1507
|
-
|
|
1619
|
+
const properties = Object.assign([], breakingChange.output.deprecatedOutputProperties);
|
|
1508
1620
|
properties.forEach((element, index) => properties[index] = '"' + element + '"');
|
|
1509
1621
|
parameters.push(`DeprecatedOutputProperties=new string[] {${properties.join(',')}}`);
|
|
1510
1622
|
}
|
|
1511
1623
|
if (breakingChange.output.newOutputProperties) {
|
|
1512
|
-
|
|
1624
|
+
const properties = Object.assign([], breakingChange.output.newOutputProperties);
|
|
1513
1625
|
properties.forEach((element, index) => properties[index] = '"' + element + '"');
|
|
1514
1626
|
parameters.push(`NewOutputProperties=new string[] {${properties.join(',')}}`);
|
|
1515
1627
|
}
|
|
@@ -1529,6 +1641,13 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
1529
1641
|
passThru.add(new codegen_csharp_1.Attribute(powershell_declarations_1.CategoryAttribute, { parameters: [`${powershell_declarations_1.ParameterCategory}.Runtime`] }));
|
|
1530
1642
|
}
|
|
1531
1643
|
this.add(new codegen_csharp_1.Attribute(powershell_declarations_1.DescriptionAttribute, { parameters: [new codegen_csharp_1.StringExpression(this.description)] }));
|
|
1644
|
+
// If defines externalDocs for operation
|
|
1645
|
+
if (operation.details.default.externalDocs) {
|
|
1646
|
+
this.add(new codegen_csharp_1.Attribute(powershell_declarations_1.ExternalDocsAttribute, {
|
|
1647
|
+
parameters: [`${new codegen_csharp_1.StringExpression((_f = (_e = this.operation.details.default.externalDocs) === null || _e === void 0 ? void 0 : _e.url) !== null && _f !== void 0 ? _f : '')}`,
|
|
1648
|
+
`${new codegen_csharp_1.StringExpression((_h = (_g = this.operation.details.default.externalDocs) === null || _g === void 0 ? void 0 : _g.description) !== null && _h !== void 0 ? _h : '')}`]
|
|
1649
|
+
}));
|
|
1650
|
+
}
|
|
1532
1651
|
this.add(new codegen_csharp_1.Attribute(powershell_declarations_1.GeneratedAttribute));
|
|
1533
1652
|
if (operation.extensions && operation.extensions['x-ms-metadata'] && operation.extensions['x-ms-metadata'].profiles) {
|
|
1534
1653
|
const profileNames = Object.keys(operation.extensions && operation.extensions['x-ms-metadata'].profiles);
|
|
@@ -1538,6 +1657,17 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
1538
1657
|
});
|
|
1539
1658
|
this.add(new codegen_csharp_1.Attribute(powershell_declarations_1.ProfileAttribute, { parameters: [...profileNames] }));
|
|
1540
1659
|
}
|
|
1660
|
+
this.operation.callGraph.forEach((operationInfo) => {
|
|
1661
|
+
var _a;
|
|
1662
|
+
let apiVersion = 'null';
|
|
1663
|
+
if (operationInfo.apiVersions) {
|
|
1664
|
+
apiVersion = operationInfo.apiVersions[0].version;
|
|
1665
|
+
}
|
|
1666
|
+
(_a = operationInfo.requests) === null || _a === void 0 ? void 0 : _a.forEach((request) => {
|
|
1667
|
+
var _a, _b;
|
|
1668
|
+
this.add(new codegen_csharp_1.Attribute(powershell_declarations_1.HttpPathAttribute, { parameters: [`Path = "${(_b = (_a = request.protocol) === null || _a === void 0 ? void 0 : _a.http) === null || _b === void 0 ? void 0 : _b.path}"`, `ApiVersion = "${apiVersion}"`] }));
|
|
1669
|
+
});
|
|
1670
|
+
});
|
|
1541
1671
|
}
|
|
1542
1672
|
}
|
|
1543
1673
|
exports.CmdletClass = CmdletClass;
|