@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
|
@@ -163,7 +163,7 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
|
|
|
163
163
|
|
|
164
164
|
if (previewVersion != null)
|
|
165
165
|
{
|
|
166
|
-
sb.AppendLine($@"{Indent}{Indent}{Indent}Prerelease =
|
|
166
|
+
sb.AppendLine($@"{Indent}{Indent}{Indent}Prerelease = {previewVersion}");
|
|
167
167
|
}
|
|
168
168
|
sb.AppendLine($@"{Indent}{Indent}{Indent}Tags = {"${$project.metadata.tags}".Split(' ').ToPsList().NullIfEmpty() ?? "''"}");
|
|
169
169
|
sb.AppendLine($@"{Indent}{Indent}{Indent}LicenseUri = '{"${$project.metadata.licenseUri}"}'");
|
|
@@ -31,7 +31,7 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
|
|
|
31
31
|
public string[] Inputs { get; }
|
|
32
32
|
public string[] Outputs { get; }
|
|
33
33
|
public ComplexInterfaceInfo[] ComplexInterfaceInfos { get; }
|
|
34
|
-
public
|
|
34
|
+
public MarkdownRelatedLinkInfo[] RelatedLinks { get; }
|
|
35
35
|
|
|
36
36
|
public bool SupportsShouldProcess { get; }
|
|
37
37
|
public bool SupportsPaging { get; }
|
|
@@ -67,7 +67,11 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
|
|
|
67
67
|
|
|
68
68
|
ComplexInterfaceInfos = variantGroup.ComplexInterfaceInfos;
|
|
69
69
|
OnlineVersion = commentInfo.OnlineVersion;
|
|
70
|
-
|
|
70
|
+
|
|
71
|
+
var relatedLinkLists = new List<MarkdownRelatedLinkInfo>();
|
|
72
|
+
relatedLinkLists.AddRange(commentInfo.RelatedLinks?.Select(link => new MarkdownRelatedLinkInfo(link)));
|
|
73
|
+
relatedLinkLists.AddRange(variantGroup.Variants.SelectMany(v => v.Attributes).OfType<ExternalDocsAttribute>()?.Distinct()?.Select(link => new MarkdownRelatedLinkInfo(link.Url, link.Description)));
|
|
74
|
+
RelatedLinks = relatedLinkLists?.ToArray();
|
|
71
75
|
|
|
72
76
|
SupportsShouldProcess = variantGroup.SupportsShouldProcess;
|
|
73
77
|
SupportsPaging = variantGroup.SupportsPaging;
|
|
@@ -218,14 +222,45 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
|
|
|
218
222
|
}
|
|
219
223
|
}
|
|
220
224
|
|
|
225
|
+
internal class MarkdownRelatedLinkInfo
|
|
226
|
+
{
|
|
227
|
+
public string Url { get; }
|
|
228
|
+
public string Description { get; }
|
|
229
|
+
|
|
230
|
+
public MarkdownRelatedLinkInfo(string url)
|
|
231
|
+
{
|
|
232
|
+
Url = url;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
public MarkdownRelatedLinkInfo(string url, string description)
|
|
236
|
+
{
|
|
237
|
+
Url = url;
|
|
238
|
+
Description = description;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
public override string ToString()
|
|
242
|
+
{
|
|
243
|
+
if (string.IsNullOrEmpty(Description))
|
|
244
|
+
{
|
|
245
|
+
return Url;
|
|
246
|
+
}
|
|
247
|
+
else
|
|
248
|
+
{
|
|
249
|
+
return $@"[{Description}]({Url})";
|
|
250
|
+
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
221
256
|
internal static class MarkdownTypesExtensions
|
|
222
257
|
{
|
|
223
258
|
public static MarkdownExampleHelpInfo ToExampleHelpInfo(this PsHelpExampleInfo exampleInfo) => new MarkdownExampleHelpInfo(exampleInfo.Title, exampleInfo.Code, exampleInfo.Output, exampleInfo.Remarks);
|
|
224
259
|
|
|
225
260
|
public static MarkdownExampleHelpInfo[] DefaultExampleHelpInfos =
|
|
226
261
|
{
|
|
227
|
-
new MarkdownExampleHelpInfo("Example 1: {{ Add title here }}", $@"{{{{ Add code here }}}}", $@"{{{{ Add output here }}}}", @"{{ Add description here }}"),
|
|
228
|
-
new MarkdownExampleHelpInfo("Example 2: {{ Add title here }}", $@"{{{{ Add code here }}}}", $@"{{{{ Add output here }}}}", @"{{ Add description here }}"),
|
|
262
|
+
new MarkdownExampleHelpInfo("Example 1: {{ Add title here }}", $@"{{{{ Add code here }}}}", $@"{{{{ Add output here (remove the output block if the example doesn't have an output) }}}}", @"{{ Add description here }}"),
|
|
263
|
+
new MarkdownExampleHelpInfo("Example 2: {{ Add title here }}", $@"{{{{ Add code here }}}}", $@"{{{{ Add output here (remove the output block if the example doesn't have an output) }}}}", @"{{ Add description here }}"),
|
|
229
264
|
};
|
|
230
265
|
|
|
231
266
|
public static MarkdownParameterHelpInfo[] SupportsShouldProcessParameters =
|
|
@@ -199,7 +199,7 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
|
|
|
199
199
|
{
|
|
200
200
|
return $@"
|
|
201
201
|
{Indent}{Indent}if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) {{
|
|
202
|
-
{Indent}{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $
|
|
202
|
+
{Indent}{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString()
|
|
203
203
|
{Indent}{Indent}}}
|
|
204
204
|
{Indent}{Indent}$preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId
|
|
205
205
|
{Indent}{Indent}if ($preTelemetryId -eq '') {{
|
|
@@ -262,7 +262,11 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
|
|
|
262
262
|
var variantListString = defaultInfo.ParameterGroup.VariantNames.ToPsList();
|
|
263
263
|
var parameterName = defaultInfo.ParameterGroup.ParameterName;
|
|
264
264
|
sb.AppendLine();
|
|
265
|
-
|
|
265
|
+
var setCondition = " ";
|
|
266
|
+
if (!String.IsNullOrEmpty(defaultInfo.SetCondition)) {
|
|
267
|
+
setCondition = $" -and {defaultInfo.SetCondition}";
|
|
268
|
+
}
|
|
269
|
+
sb.AppendLine($"{Indent}{Indent}if (({variantListString}) -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('{parameterName}'){setCondition}) {{");
|
|
266
270
|
sb.AppendLine($"{Indent}{Indent}{Indent}$PSBoundParameters['{parameterName}'] = {defaultInfo.Script}");
|
|
267
271
|
sb.Append($"{Indent}{Indent}}}");
|
|
268
272
|
}
|
|
@@ -357,6 +361,8 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
|
|
|
357
361
|
var notesText = !String.IsNullOrEmpty(notes) ? $"{Environment.NewLine}.Notes{Environment.NewLine}{ComplexParameterHeader}{notes}" : String.Empty;
|
|
358
362
|
var relatedLinks = String.Join(Environment.NewLine, CommentInfo.RelatedLinks.Select(l => $".Link{Environment.NewLine}{l}"));
|
|
359
363
|
var relatedLinksText = !String.IsNullOrEmpty(relatedLinks) ? $"{Environment.NewLine}{relatedLinks}" : String.Empty;
|
|
364
|
+
var externalUrls = String.Join(Environment.NewLine, CommentInfo.ExternalUrls.Select(l => $".Link{Environment.NewLine}{l}"));
|
|
365
|
+
var externalUrlsText = !String.IsNullOrEmpty(externalUrls) ? $"{Environment.NewLine}{externalUrls}" : String.Empty;
|
|
360
366
|
var examples = "";
|
|
361
367
|
foreach (var example in VariantGroup.HelpInfo.Examples)
|
|
362
368
|
{
|
|
@@ -369,7 +375,7 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
|
|
|
369
375
|
{CommentInfo.Description.ToDescriptionFormat(false)}
|
|
370
376
|
{examples}{inputsText}{outputsText}{notesText}
|
|
371
377
|
.Link
|
|
372
|
-
{CommentInfo.OnlineVersion}{relatedLinksText}
|
|
378
|
+
{CommentInfo.OnlineVersion}{relatedLinksText}{externalUrlsText}
|
|
373
379
|
#>
|
|
374
380
|
";
|
|
375
381
|
}
|
|
@@ -604,7 +610,7 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
|
|
|
604
610
|
return ni.IsComplexInterface
|
|
605
611
|
? ni.ToNoteOutput(nestedIndent, includeDashes, includeBackticks, false)
|
|
606
612
|
: RenderProperty(ni, nestedIndent, includeDashes, includeBackticks);
|
|
607
|
-
}).Prepend(RenderProperty(complexInterfaceInfo, currentIndent, !isFirst && includeDashes, includeBackticks));
|
|
613
|
+
}).Prepend(RenderProperty(complexInterfaceInfo, currentIndent, !isFirst && includeDashes, !isFirst && includeBackticks));
|
|
608
614
|
return String.Join(Environment.NewLine, nested);
|
|
609
615
|
}
|
|
610
616
|
}
|
|
@@ -366,6 +366,7 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
|
|
|
366
366
|
|
|
367
367
|
public string OnlineVersion { get; }
|
|
368
368
|
public string[] RelatedLinks { get; }
|
|
369
|
+
public string[] ExternalUrls { get; }
|
|
369
370
|
|
|
370
371
|
private const string HelpLinkPrefix = @"${$project.helpLinkPrefix}";
|
|
371
372
|
|
|
@@ -391,6 +392,9 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
|
|
|
391
392
|
var moduleName = variantGroup.RootModuleName == "" ? variantGroup.ModuleName.ToLowerInvariant() : variantGroup.RootModuleName.ToLowerInvariant();
|
|
392
393
|
OnlineVersion = helpInfo.OnlineVersion?.Uri.NullIfEmpty() ?? $@"{HelpLinkPrefix}{moduleName}/{variantGroup.CmdletName.ToLowerInvariant()}";
|
|
393
394
|
RelatedLinks = helpInfo.RelatedLinks.Select(rl => rl.Text).ToArray();
|
|
395
|
+
|
|
396
|
+
// Get external urls from attribute
|
|
397
|
+
ExternalUrls = variantGroup.Variants.SelectMany(v => v.Attributes).OfType<ExternalDocsAttribute>()?.Select(e => e.Url)?.Distinct()?.ToArray();
|
|
394
398
|
}
|
|
395
399
|
}
|
|
396
400
|
|
|
@@ -425,6 +429,7 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
|
|
|
425
429
|
public string Name { get; }
|
|
426
430
|
public string Description { get; }
|
|
427
431
|
public string Script { get; }
|
|
432
|
+
public string SetCondition { get; }
|
|
428
433
|
public ParameterGroup ParameterGroup { get; }
|
|
429
434
|
|
|
430
435
|
public DefaultInfo(DefaultInfoAttribute infoAttribute, ParameterGroup parameterGroup)
|
|
@@ -432,6 +437,7 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
|
|
|
432
437
|
Name = infoAttribute.Name;
|
|
433
438
|
Description = infoAttribute.Description;
|
|
434
439
|
Script = infoAttribute.Script;
|
|
440
|
+
SetCondition = infoAttribute.SetCondition;
|
|
435
441
|
ParameterGroup = parameterGroup;
|
|
436
442
|
}
|
|
437
443
|
|
|
@@ -48,6 +48,13 @@ namespace Microsoft.Rest
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
[AttributeUsage(AttributeTargets.Class)]
|
|
52
|
+
public class HttpPathAttribute : Attribute
|
|
53
|
+
{
|
|
54
|
+
public string Path { get; set; }
|
|
55
|
+
public string ApiVersion { get; set; }
|
|
56
|
+
}
|
|
57
|
+
|
|
51
58
|
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
|
|
52
59
|
public class CategoryAttribute : Attribute
|
|
53
60
|
{
|
|
@@ -39,10 +39,9 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
|
|
|
39
39
|
public static IEnumerable<FunctionInfo> GetScriptCmdlets(PSCmdlet cmdlet, string scriptFolder)
|
|
40
40
|
{
|
|
41
41
|
// https://stackoverflow.com/a/40969712/294804
|
|
42
|
-
var wrappedFolder = scriptFolder.Contains("'") ? $@"""{scriptFolder}""" : $@"'{scriptFolder}'";
|
|
43
42
|
var getCmdletsCommand = $@"
|
|
44
43
|
$currentFunctions = Get-ChildItem function:
|
|
45
|
-
Get-ChildItem -Path {
|
|
44
|
+
Get-ChildItem -Path '{scriptFolder}' -Recurse -Include '*.ps1' -File | ForEach-Object {{ . $_.FullName }}
|
|
46
45
|
Get-ChildItem function: | Where-Object {{ ($currentFunctions -notcontains $_) -and $_.CmdletBinding }}
|
|
47
46
|
";
|
|
48
47
|
return cmdlet?.RunScript<FunctionInfo>(getCmdletsCommand) ?? RunScript<FunctionInfo>(getCmdletsCommand);
|
|
@@ -23,7 +23,6 @@ namespace Microsoft.Message.ClientRuntime
|
|
|
23
23
|
using System.Threading.Tasks;
|
|
24
24
|
public class MessageAttributeHelper
|
|
25
25
|
{
|
|
26
|
-
private static readonly bool IsAzure = Convert.ToBoolean(@"${$project.azure}");
|
|
27
26
|
public const string BREAKING_CHANGE_ATTRIBUTE_INFORMATION_LINK = "https://aka.ms/azps-changewarnings";
|
|
28
27
|
public const string SUPPRESS_ERROR_OR_WARNING_MESSAGE_ENV_VARIABLE_NAME = "SuppressAzurePowerShellBreakingChangeWarnings";
|
|
29
28
|
|
|
@@ -53,10 +52,7 @@ namespace Microsoft.Message.ClientRuntime
|
|
|
53
52
|
//Do not process the attributes at runtime... The env variable to override the warning messages is set
|
|
54
53
|
return;
|
|
55
54
|
}
|
|
56
|
-
|
|
57
|
-
{
|
|
58
|
-
psCmdlet.WriteWarning("The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.");
|
|
59
|
-
}
|
|
55
|
+
|
|
60
56
|
List<GenericBreakingChangeAttribute> attributes = new List<GenericBreakingChangeAttribute>(GetAllBreakingChangeAttributesInType(commandInfo, invocationInfo, parameterSet));
|
|
61
57
|
StringBuilder sb = new StringBuilder();
|
|
62
58
|
Action<string> appendBreakingChangeInfo = (string s) => sb.Append(s);
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
|
|
6
|
+
namespace Microsoft.Rest.ClientRuntime
|
|
7
|
+
{
|
|
8
|
+
|
|
9
|
+
using System;
|
|
10
|
+
using System.Linq;
|
|
11
|
+
using System.Collections;
|
|
12
|
+
using System.Collections.Generic;
|
|
13
|
+
using System.Net.Http;
|
|
14
|
+
using System.Threading;
|
|
15
|
+
using System.Threading.Tasks;
|
|
16
|
+
using GetEventData = System.Func<EventData>;
|
|
17
|
+
using static Microsoft.Rest.ClientRuntime.Extensions;
|
|
18
|
+
|
|
19
|
+
/// <summary>
|
|
20
|
+
/// The IContext Interface defines the communication mechanism for input customization.
|
|
21
|
+
/// </summary>
|
|
22
|
+
/// <remarks>
|
|
23
|
+
/// In the context, we will have client, pipeline, PSBoundParamters, default EventListener, Cancellation.
|
|
24
|
+
/// </remarks>
|
|
25
|
+
public interface IContext
|
|
26
|
+
{
|
|
27
|
+
System.Management.Automation.InvocationInfo InvocationInformation { get; set; }
|
|
28
|
+
System.Threading.CancellationTokenSource CancellationTokenSource { get; set; }
|
|
29
|
+
System.Collections.Generic.IDictionary<String, Object> ExtensibleParameters { get; }
|
|
30
|
+
HttpPipeline Pipeline { get; set; }
|
|
31
|
+
Microsoft.RestClient Client { get; }
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -11,6 +11,9 @@ namespace Microsoft.Rest.ClientRuntime
|
|
|
11
11
|
{
|
|
12
12
|
public bool Required { get; set; } = false;
|
|
13
13
|
public bool ReadOnly { get; set; } = false;
|
|
14
|
+
public bool Read { get; set; } = true;
|
|
15
|
+
public bool Create { get; set; } = true;
|
|
16
|
+
public bool Update { get; set; } = true;
|
|
14
17
|
public Type[] PossibleTypes { get; set; } = new Type[0];
|
|
15
18
|
public string Description { get; set; } = "";
|
|
16
19
|
public string SerializedName { get; set; } = "";
|
|
@@ -30,5 +33,6 @@ namespace Microsoft.Rest.ClientRuntime
|
|
|
30
33
|
public string Script { get; set; } = "";
|
|
31
34
|
public string Name { get; set; } = "";
|
|
32
35
|
public string Description { get; set; } = "";
|
|
36
|
+
public string SetCondition { get; set; } = "";
|
|
33
37
|
}
|
|
34
38
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
|
|
6
|
+
using System;
|
|
7
|
+
using System.Collections.Generic;
|
|
8
|
+
|
|
9
|
+
namespace Microsoft.Rest.ClientRuntime.Cmdlets
|
|
10
|
+
{
|
|
11
|
+
public abstract class InputHandler
|
|
12
|
+
{
|
|
13
|
+
protected InputHandler NextHandler = null;
|
|
14
|
+
|
|
15
|
+
public void SetNextHandler(InputHandler nextHandler)
|
|
16
|
+
{
|
|
17
|
+
this.NextHandler = nextHandler;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
public abstract void Process(Microsoft.Rest.ClientRuntime.IContext context);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -9,8 +9,10 @@ namespace Microsoft.Rest.ClientRuntime
|
|
|
9
9
|
{
|
|
10
10
|
None = 0,
|
|
11
11
|
IncludeHeaders = 1 << 0,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
IncludeRead = 1 << 1,
|
|
13
|
+
IncludeCreate = 1 << 2,
|
|
14
|
+
IncludeUpdate = 1 << 3,
|
|
15
|
+
IncludeAll = IncludeHeaders | IncludeRead | IncludeCreate | IncludeUpdate,
|
|
16
|
+
IncludeCreateOrUpdate = IncludeCreate | IncludeUpdate
|
|
15
17
|
}
|
|
16
18
|
}
|
|
@@ -22,6 +22,6 @@ namespace Microsoft.Rest.ClientRuntime
|
|
|
22
22
|
public const string FollowingNextLink = nameof(FollowingNextLink);
|
|
23
23
|
public const string DelayBeforePolling = nameof(DelayBeforePolling);
|
|
24
24
|
public const string Polling = nameof(Polling);
|
|
25
|
-
|
|
25
|
+
public const string Progress = nameof(Progress);
|
|
26
26
|
}
|
|
27
|
-
}
|
|
27
|
+
}
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
|
|
5
|
+
namespace Microsoft.Rest.ClientRuntime
|
|
6
6
|
{
|
|
7
7
|
public interface IXmlSerializable
|
|
8
8
|
{
|
|
9
|
-
System.Xml.Linq.XElement ToXml(System.Xml.Linq.XElement container = null, SerializationMode serializationMode = SerializationMode.
|
|
9
|
+
System.Xml.Linq.XElement ToXml(System.Xml.Linq.XElement container = null, SerializationMode serializationMode = SerializationMode.IncludeCreateOrUpdate);
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<%- project.commentHeader %>
|
|
2
|
+
<% var key = methodGroup.$key == 'Operations' ? '' : methodGroup.$key-%>
|
|
3
|
+
|
|
4
|
+
namespace <%- project.namespace %>
|
|
5
|
+
{
|
|
6
|
+
using System.Linq;
|
|
7
|
+
using Microsoft.Rest;
|
|
8
|
+
<% project.model.usings.forEach(function(using){ -%>
|
|
9
|
+
using <%- using %>;
|
|
10
|
+
<% }); -%>
|
|
11
|
+
|
|
12
|
+
<% var typeName = project.helper.PascalCase(key) + 'Operations' -%>
|
|
13
|
+
/// <summary>
|
|
14
|
+
/// <%- typeName %> operations.
|
|
15
|
+
/// </summary>
|
|
16
|
+
<% var client = project.model.info.title -%>
|
|
17
|
+
internal partial class <%- typeName %> : Microsoft.Rest.IServiceOperations<<%-client%>>, I<%- typeName%>
|
|
18
|
+
{
|
|
19
|
+
/// <summary>
|
|
20
|
+
/// Initializes a new instance of the <%- typeName%> class.
|
|
21
|
+
/// </summary>
|
|
22
|
+
/// <param name='client'>
|
|
23
|
+
/// Reference to the service client.
|
|
24
|
+
/// </param>
|
|
25
|
+
/// <exception cref="System.ArgumentNullException">
|
|
26
|
+
/// Thrown when a required parameter is null
|
|
27
|
+
/// </exception>
|
|
28
|
+
internal <%- typeName%> (<%-client%> client)
|
|
29
|
+
{
|
|
30
|
+
if (client == null)
|
|
31
|
+
{
|
|
32
|
+
throw new System.ArgumentNullException("client");
|
|
33
|
+
}
|
|
34
|
+
this.Client = client;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/// <summary>
|
|
38
|
+
/// Gets a reference to the <%-client%>
|
|
39
|
+
/// </summary>
|
|
40
|
+
public <%-client%> Client { get; private set; }
|
|
41
|
+
|
|
42
|
+
<% methodGroup.operations.forEach(function(method){ -%>
|
|
43
|
+
<%- include('azureMethod', {method: method}) -%>
|
|
44
|
+
<% }); -%>
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
<%- project.commentHeader %>
|
|
2
|
+
|
|
3
|
+
namespace <%- project.namespace %>
|
|
4
|
+
{
|
|
5
|
+
using System.Linq;
|
|
6
|
+
using Microsoft.Rest;
|
|
7
|
+
<% project.model.usings.forEach(function(using){ -%>
|
|
8
|
+
using <%- using %>;
|
|
9
|
+
<% }); -%>
|
|
10
|
+
|
|
11
|
+
<% if (project.model.info.description) { -%>
|
|
12
|
+
/// <summary>
|
|
13
|
+
/// <%- project.model.info.description %>
|
|
14
|
+
/// </summary>
|
|
15
|
+
<% } -%>
|
|
16
|
+
<% var client = project.model.info.title -%>
|
|
17
|
+
public partial class <%- client %> : Microsoft.Rest.ServiceClient<<%- client %>>, I<%- client %>, IAzureClient
|
|
18
|
+
{
|
|
19
|
+
<%# ToDo: add ServiceClientBodyTemplate -%>
|
|
20
|
+
<%- include('serviceClientBody', {project: project}) -%>
|
|
21
|
+
/// <summary>
|
|
22
|
+
/// An optional partial-method to perform custom initialization.
|
|
23
|
+
/// </summary>
|
|
24
|
+
partial void CustomInitialize();
|
|
25
|
+
|
|
26
|
+
/// <summary>
|
|
27
|
+
/// Initializes client properties.
|
|
28
|
+
/// </summary>
|
|
29
|
+
private void Initialize()
|
|
30
|
+
{
|
|
31
|
+
<% project.model.operationGroups.forEach(function(methodGroup){ -%>
|
|
32
|
+
<% var key = methodGroup.$key == 'Operations' ? '' : methodGroup.$key-%>
|
|
33
|
+
this.<%- project.helper.PascalCase(methodGroup.$key) %> = new <%- project.helper.PascalCase(key) %>Operations(this);
|
|
34
|
+
<% }); -%>
|
|
35
|
+
this.BaseUri = new System.Uri("https://management.azure.com");
|
|
36
|
+
<% (project.model.globalParameters || []).filter(p => p.language.default.name != '$host' && !!p.clientDefaultValue).forEach(function(parameter){ -%>
|
|
37
|
+
this.<%- parameter.language.default.name %> = <%- parameter.schema.type == 'string' || (parameter.schema.type == 'constant' && parameter.schema.valueType.type == 'string') ? `"${parameter.clientDefaultValue}"`: parameter.clientDefaultValue %>;
|
|
38
|
+
<%}); -%>
|
|
39
|
+
SerializationSettings = new Newtonsoft.Json.JsonSerializerSettings
|
|
40
|
+
{
|
|
41
|
+
Formatting = Newtonsoft.Json.Formatting.Indented,
|
|
42
|
+
DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
|
|
43
|
+
DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
|
|
44
|
+
NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
|
|
45
|
+
ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
|
|
46
|
+
ContractResolver = new Microsoft.Rest.Serialization.ReadOnlyJsonContractResolver(),
|
|
47
|
+
Converters = new System.Collections.Generic.List<Newtonsoft.Json.JsonConverter>
|
|
48
|
+
{
|
|
49
|
+
new Microsoft.Rest.Serialization.Iso8601TimeSpanConverter()
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
<% if(project.needsTransformationConverter()) {-%>
|
|
53
|
+
SerializationSettings.Converters.Add(new Microsoft.Rest.Serialization.TransformationJsonConverter());
|
|
54
|
+
<% } -%>
|
|
55
|
+
DeserializationSettings = new Newtonsoft.Json.JsonSerializerSettings
|
|
56
|
+
{
|
|
57
|
+
DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
|
|
58
|
+
DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
|
|
59
|
+
NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
|
|
60
|
+
ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
|
|
61
|
+
ContractResolver = new Microsoft.Rest.Serialization.ReadOnlyJsonContractResolver(),
|
|
62
|
+
Converters = new System.Collections.Generic.List<Newtonsoft.Json.JsonConverter>
|
|
63
|
+
{
|
|
64
|
+
new Microsoft.Rest.Serialization.Iso8601TimeSpanConverter()
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
<%# ToDo: need support for polymorphicType -%>
|
|
68
|
+
<%(project.model.schemas.objects||[]).filter(m => m.discriminator).forEach(function(m){-%>
|
|
69
|
+
SerializationSettings.Converters.Add(new Microsoft.Rest.Serialization.PolymorphicSerializeJsonConverter<<%-m.language.default.name%>>("<%-m.discriminator.property.serializedName%>"));
|
|
70
|
+
DeserializationSettings.Converters.Add(new Microsoft.Rest.Serialization.PolymorphicDeserializeJsonConverter<<%-m.language.default.name%>>("<%-m.discriminator.property.serializedName%>"));
|
|
71
|
+
<%});-%>
|
|
72
|
+
CustomInitialize();
|
|
73
|
+
<% if(project.needsTransformationConverter()) {-%>
|
|
74
|
+
DeserializationSettings.Converters.Add(new Microsoft.Rest.Serialization.TransformationJsonConverter());
|
|
75
|
+
<% } -%>
|
|
76
|
+
DeserializationSettings.Converters.Add(new Microsoft.Rest.Azure.CloudErrorJsonConverter());
|
|
77
|
+
<%# ToDo: Add method whose group is empty, and need to check in which case the group is empty.-%>
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
<%- project.commentHeader %>
|
|
2
|
+
|
|
3
|
+
namespace <%- project.namespace %>.Models
|
|
4
|
+
{
|
|
5
|
+
|
|
6
|
+
/// <summary>
|
|
7
|
+
/// Defines values for <%-model.language.default.name%>.
|
|
8
|
+
/// </summary>
|
|
9
|
+
<%#ToDo need to figure out when !Model.OldModelAsString is applied%>
|
|
10
|
+
<%#ToDo GetObsoleteAttribute%>
|
|
11
|
+
<% if (!model.extensions['x-ms-model-as-string']) { -%>
|
|
12
|
+
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
|
|
13
|
+
public enum <%-model.language.default.name%>
|
|
14
|
+
{
|
|
15
|
+
<% var last = model.choices[model.choices.length - 1]-%>
|
|
16
|
+
<% model.choices.forEach(function(item) {
|
|
17
|
+
if (item.language.default.description) {
|
|
18
|
+
-%>
|
|
19
|
+
/// <summary>
|
|
20
|
+
/// <%-item.language.default.description%>
|
|
21
|
+
/// </summary>
|
|
22
|
+
<% } -%>
|
|
23
|
+
[System.Runtime.Serialization.EnumMember(Value = "<%-item.value%>")]
|
|
24
|
+
<% if (item == last) {-%>
|
|
25
|
+
<%-item.language.default.name.replace(/\//g, '-')%>
|
|
26
|
+
<% } else {-%>
|
|
27
|
+
<%-item.language.default.name.replace(/\//g, '-')%>,
|
|
28
|
+
<% }-%>
|
|
29
|
+
<% });-%>
|
|
30
|
+
}
|
|
31
|
+
internal static class <%-model.language.default.name%>EnumExtension
|
|
32
|
+
{
|
|
33
|
+
internal static string ToSerializedValue(this <%-model.language.default.name%>? value)
|
|
34
|
+
{
|
|
35
|
+
return value == null ? null : ((<%-model.language.default.name%>)value).ToSerializedValue();
|
|
36
|
+
}
|
|
37
|
+
internal static string ToSerializedValue(this <%-model.language.default.name%> value)
|
|
38
|
+
{
|
|
39
|
+
switch( value )
|
|
40
|
+
{
|
|
41
|
+
<% for (var i = 0; i < model.choices.length; i++) {-%>
|
|
42
|
+
case <%-model.language.default.name%>.<%-model.choices[i].language.default.name.replace(/\//g, '-')%>:
|
|
43
|
+
return "<%-model.choices[i].value%>";
|
|
44
|
+
<% }-%>
|
|
45
|
+
}
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
internal static <%-model.language.default.name%>? Parse<%-model.language.default.name%>(this string value)
|
|
49
|
+
{
|
|
50
|
+
switch( value )
|
|
51
|
+
{
|
|
52
|
+
<% for (var i = 0; i < model.choices.length; i++) {-%>
|
|
53
|
+
case "<%-model.choices[i].value%>":
|
|
54
|
+
return <%-model.language.default.name%>.<%-model.choices[i].language.default.name.replace(/\//g, '-')%>;
|
|
55
|
+
<% }-%>
|
|
56
|
+
}
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
<%} else {-%>
|
|
61
|
+
public static class <%-model.language.default.name%>
|
|
62
|
+
{
|
|
63
|
+
<%model.choices.forEach(function(choice){-%>
|
|
64
|
+
<%if(choice.language.default.description){-%>
|
|
65
|
+
/// <summary>
|
|
66
|
+
/// <%-choice.language.default.description%>
|
|
67
|
+
/// </summary>
|
|
68
|
+
<%}-%>
|
|
69
|
+
public const string <%-choice.language.default.name%> = "<%-choice.value%>";
|
|
70
|
+
<%});-%>
|
|
71
|
+
}
|
|
72
|
+
<% } -%>
|
|
73
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<%- project.commentHeader %>
|
|
2
|
+
|
|
3
|
+
namespace <%- project.namespace %>.Models
|
|
4
|
+
{
|
|
5
|
+
|
|
6
|
+
/// <summary>
|
|
7
|
+
/// Exception thrown for an invalid response with <%-exception.schema.language.default.name%> information.
|
|
8
|
+
/// </summary>
|
|
9
|
+
public partial class <%-exception.schema.language.default.name%>Exception : Microsoft.Rest.RestException
|
|
10
|
+
{
|
|
11
|
+
/// <summary>
|
|
12
|
+
/// Gets information about the associated HTTP request.
|
|
13
|
+
/// </summary>
|
|
14
|
+
public Microsoft.Rest.HttpRequestMessageWrapper Request { get; set; }
|
|
15
|
+
|
|
16
|
+
/// <summary>
|
|
17
|
+
/// Gets information about the associated HTTP response.
|
|
18
|
+
/// </summary>
|
|
19
|
+
public Microsoft.Rest.HttpResponseMessageWrapper Response { get; set; }
|
|
20
|
+
|
|
21
|
+
/// <summary>
|
|
22
|
+
/// Gets or sets the body object.
|
|
23
|
+
/// </summary>
|
|
24
|
+
public <%-exception.schema.language.default.name%> Body { get; set; }
|
|
25
|
+
|
|
26
|
+
/// <summary>
|
|
27
|
+
/// Initializes a new instance of the <%-exception.schema.language.default.name%>Exception class.
|
|
28
|
+
/// </summary>
|
|
29
|
+
public <%-exception.schema.language.default.name%>Exception()
|
|
30
|
+
{
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/// <summary>
|
|
34
|
+
/// Initializes a new instance of the <%-exception.schema.language.default.name%> class.
|
|
35
|
+
/// </summary>
|
|
36
|
+
/// <param name="message">The exception message.</param>
|
|
37
|
+
public <%-exception.schema.language.default.name%>Exception(string message)
|
|
38
|
+
: this(message, null)
|
|
39
|
+
{
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/// <summary>
|
|
43
|
+
/// Initializes a new instance of the <%-exception.schema.language.default.name%> class.
|
|
44
|
+
/// </summary>
|
|
45
|
+
/// <param name="message">The exception message.</param>
|
|
46
|
+
/// <param name="innerException">Inner exception.</param>
|
|
47
|
+
public <%-exception.schema.language.default.name%>Exception(string message, System.Exception innerException)
|
|
48
|
+
: base(message, innerException)
|
|
49
|
+
{
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|