@autorest/powershell 4.0.0-dev.1 → 4.0.0-dev.11
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 +94 -60
- package/.rush/temp/shrinkwrap-deps.json +22 -22
- package/autorest-configuration-for-sdk.md +122 -0
- package/autorest-configuration.md +4 -2
- package/dist/cmdlets/class.d.ts +1 -0
- package/dist/cmdlets/class.d.ts.map +1 -1
- package/dist/cmdlets/class.js +218 -82
- 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 +3 -2
- 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 +2 -1
- 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 +14 -9
- package/dist/internal/project.d.ts.map +1 -1
- package/dist/internal/project.js +34 -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 +3 -0
- package/dist/llcsharp/clientruntime.d.ts.map +1 -1
- package/dist/llcsharp/clientruntime.js +4 -0
- 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.map +1 -1
- package/dist/llcsharp/model/interface.js +2 -1
- 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 +12 -2
- 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 +11 -10
- 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.map +1 -1
- package/dist/llcsharp/operation/method.js +21 -27
- 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.js +1 -0
- 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 +1 -0
- 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 +6 -4
- package/dist/plugins/create-commands-v2.js.map +1 -1
- package/dist/plugins/cs-namer-v2.js +4 -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 +16 -1
- 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 +8 -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 +1 -0
- package/dist/utils/command-operation.d.ts.map +1 -1
- package/dist/utils/command-operation.js +2 -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 +4 -0
- package/dist/utils/schema.d.ts.map +1 -1
- package/dist/utils/schema.js +28 -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 +6 -5
- package/readme.md +5 -1
- package/resources/assets/build-module.ps1 +26 -2
- package/resources/assets/create-model-cmdlets.ps1 +8 -5
- package/resources/assets/custom/README.md +1 -1
- package/resources/assets/docs/README.md +1 -1
- package/resources/assets/exports/README.md +1 -1
- package/resources/assets/generate-portal-ux.ps1 +379 -0
- package/resources/assets/how-to.md +1 -1
- package/resources/assets/internal/README.md +1 -1
- package/resources/assets/tools/Resources/docs/README.md +1 -1
- package/resources/assets/tools/Resources/how-to.md +1 -1
- package/resources/modules/Az.Accounts/2.7.5/Az.Accounts.nuspec +1 -1
- package/resources/modules/Az.Accounts/2.7.5/Az.Accounts.psd1 +1 -1
- package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Cmdlets.Accounts.dll-Help.xml +34 -34
- package/resources/modules/Az.Accounts/2.7.5/en-US/about_az.help.txt +1 -1
- package/resources/modules/Az.Accounts/2.7.5/package/services/metadata/core-properties/1aa0749a068a4238881858013f1a5b7f.psmdcp +1 -1
- package/resources/psruntime/Attributes/ExternalDocsAttribute.cs +30 -0
- package/resources/psruntime/BuildTime/Models/PsMarkdownTypes.cs +39 -4
- package/resources/psruntime/BuildTime/Models/PsProxyOutputs.cs +8 -2
- package/resources/psruntime/BuildTime/Models/PsProxyTypes.cs +6 -0
- package/resources/psruntime/BuildTime/PsAttributes.cs +7 -0
- package/resources/runtime/csharp/client/Context.cs +33 -0
- package/resources/runtime/csharp/client/InfoAttribute.cs +1 -0
- package/resources/runtime/csharp/client/InputHandler.cs +22 -0
- package/resources/runtime/csharp/pipeline/Events.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
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
5
5
|
*--------------------------------------------------------------------------------------------*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.ClientCredentialsFlow = exports.AuthorizationCodeOAuthFlow = exports.PasswordOAuthFlow = exports.OpenIdConnectSecurityScheme = exports.OAuthFlows = exports.OAuth2SecurityScheme = exports.NonBearerHTTPSecurityScheme = exports.ImplicitOAuthFlow = exports.BearerHTTPSecurityScheme = exports.APIKeySecurityScheme = exports.SecurityType = exports.Scheme = void 0;
|
|
7
8
|
const extensions_1 = require("./extensions");
|
|
8
9
|
const linq_1 = require("@azure-tools/linq");
|
|
9
10
|
var Scheme;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"security-scheme.js","sourceRoot":"","sources":["../../utils/security-scheme.ts"],"names":[],"mappings":";AAAA;;;gGAGgG
|
|
1
|
+
{"version":3,"file":"security-scheme.js","sourceRoot":"","sources":["../../utils/security-scheme.ts"],"names":[],"mappings":"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"}
|
package/dist/utils/uid.js
CHANGED
package/dist/utils/uid.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uid.js","sourceRoot":"","sources":["../../utils/uid.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"uid.js","sourceRoot":"","sources":["../../utils/uid.ts"],"names":[],"mappings":";;;AAAA,IAAI,CAAC,GAAG,CAAC,CAAC;AAEV,SAAgB,GAAG;IACjB,OAAO,CAAC,EAAE,CAAC;AACb,CAAC;AAFD,kBAEC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@autorest/powershell",
|
|
3
|
-
"version": "4.0.0-dev.
|
|
3
|
+
"version": "4.0.0-dev.11",
|
|
4
4
|
"description": "AutoRest PowerShell Cmdlet Generator",
|
|
5
5
|
"main": "dist/exports.js",
|
|
6
6
|
"typings": "dist/exports.d.ts",
|
|
@@ -32,10 +32,10 @@
|
|
|
32
32
|
"@types/node": "12.7.2",
|
|
33
33
|
"mocha": "9.2.2",
|
|
34
34
|
"mocha-typescript": "1.1.17",
|
|
35
|
-
"typescript": "~3.
|
|
35
|
+
"typescript": "~4.3.0",
|
|
36
36
|
"@types/xmlbuilder": "0.0.34",
|
|
37
|
-
"@typescript-eslint/eslint-plugin": "~5.
|
|
38
|
-
"@typescript-eslint/parser": "~
|
|
37
|
+
"@typescript-eslint/eslint-plugin": "~5.29.0",
|
|
38
|
+
"@typescript-eslint/parser": "~5.29.0",
|
|
39
39
|
"@microsoft.azure/autorest.testserver": "~2.9.3",
|
|
40
40
|
"autorest": "~3.0.6118",
|
|
41
41
|
"eslint": "~8.12.0"
|
|
@@ -51,7 +51,8 @@
|
|
|
51
51
|
"@azure-tools/tasks": "~3.0.0",
|
|
52
52
|
"@azure-tools/async-io": "~3.0.0",
|
|
53
53
|
"source-map-support": "0.5.13",
|
|
54
|
-
"xmlbuilder": "10.1.1"
|
|
54
|
+
"xmlbuilder": "10.1.1",
|
|
55
|
+
"ejs": "~3.1.8"
|
|
55
56
|
},
|
|
56
57
|
"scripts": {
|
|
57
58
|
"start": "node --max_old_space_size=4096 ./dist/main.js",
|
package/readme.md
CHANGED
|
@@ -25,8 +25,12 @@ AutoRest needs the below config to pick this up as a plug-in - see https://githu
|
|
|
25
25
|
|
|
26
26
|
> AutoRest configuration is stored in the 'autorest-configuation.md' file.
|
|
27
27
|
|
|
28
|
-
``` yaml
|
|
28
|
+
``` yaml !$(isSdkGenerator)
|
|
29
29
|
pipeline-model: v3
|
|
30
30
|
require: $(this-folder)/autorest-configuration.md
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
+
``` yaml $(isSdkGenerator)
|
|
34
|
+
pipeline-model: v3
|
|
35
|
+
require: $(this-folder)/autorest-configuration-for-sdk.md
|
|
36
|
+
```
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# ----------------------------------------------------------------------------------
|
|
2
2
|
${$project.pwshCommentHeader}
|
|
3
3
|
# ----------------------------------------------------------------------------------
|
|
4
|
-
param([switch]$
|
|
4
|
+
param([switch]$NotIsolated, [switch]$Run, [switch]$Test, [switch]$Docs, [switch]$Pack, [switch]$Code, [switch]$Release, [switch]$Debugger, [switch]$NoDocs, [switch]$UX, [Switch]$DisableAfterBuildTasks)
|
|
5
5
|
$ErrorActionPreference = 'Stop'
|
|
6
6
|
|
|
7
7
|
if($PSEdition -ne 'Core') {
|
|
@@ -34,6 +34,14 @@ if(-not $Isolated -and -not $Debugger) {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
if($UX) {
|
|
38
|
+
. (Join-Path $PSScriptRoot 'generate-portal-ux.ps1')
|
|
39
|
+
if($LastExitCode -ne 0) {
|
|
40
|
+
# UX generation failed. Don't attempt to run the module.
|
|
41
|
+
return
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
37
45
|
if($Pack) {
|
|
38
46
|
. (Join-Path $PSScriptRoot 'pack-module.ps1')
|
|
39
47
|
if($LastExitCode -ne 0) {
|
|
@@ -147,4 +155,20 @@ Export-TestStub -ModuleName $moduleName -ExportsFolder $exportsFolder -OutputFol
|
|
|
147
155
|
Write-Host -ForegroundColor Green 'Creating example stubs...'
|
|
148
156
|
Export-ExampleStub -ExportsFolder $exportsFolder -OutputFolder $examplesFolder
|
|
149
157
|
|
|
150
|
-
|
|
158
|
+
if (Test-Path (Join-Path $PSScriptRoot 'generate-portal-ux.ps1'))
|
|
159
|
+
{
|
|
160
|
+
Write-Host -ForegroundColor Green 'Creating ux metadata...'
|
|
161
|
+
. (Join-Path $PSScriptRoot 'generate-portal-ux.ps1')
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
if (-not $DisableAfterBuildTasks){
|
|
165
|
+
$afterBuildTasksPath = Join-Path $PSScriptRoot '${$project.afterBuildTasksPath}'
|
|
166
|
+
$afterBuildTasksArgs = ConvertFrom-Json '${$project.afterBuildTasksArgs}' -AsHashtable
|
|
167
|
+
if(Test-Path -Path $afterBuildTasksPath -PathType leaf){
|
|
168
|
+
Write-Host -ForegroundColor Green 'Running after build tasks...'
|
|
169
|
+
. $afterBuildTasksPath @afterBuildTasksArgs
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
Write-Host -ForegroundColor Green '-------------Done-------------'
|
|
@@ -12,10 +12,13 @@ function CreateModelCmdlet {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
$ModelCsPath = Join-Path (Join-Path $PSScriptRoot '${$lib.path.relative($project.baseFolder, $project.apiFolder)}') 'Models'
|
|
15
|
-
$ModuleName = '${$project.subjectPrefix}'
|
|
16
15
|
$OutputDir = Join-Path $PSScriptRoot '${$lib.path.relative($project.baseFolder, $project.modelCmdletFolder)}'
|
|
17
16
|
$null = New-Item -ItemType Directory -Force -Path $OutputDir
|
|
18
|
-
|
|
17
|
+
if ('${$project.rootModuleName}'.length -gt 0) {
|
|
18
|
+
$ModuleName = '${$project.rootModuleName}'
|
|
19
|
+
} else {
|
|
20
|
+
$ModuleName = '${$project.moduleName}'
|
|
21
|
+
}
|
|
19
22
|
$CsFiles = Get-ChildItem -Path $ModelCsPath -Recurse -Filter *.cs
|
|
20
23
|
$Content = ''
|
|
21
24
|
$null = $CsFiles | ForEach-Object -Process { if ($_.Name.Split('.').count -eq 2 )
|
|
@@ -53,10 +56,10 @@ function CreateModelCmdlet {
|
|
|
53
56
|
$ObjectType = $Model
|
|
54
57
|
$ObjectTypeWithNamespace = "${Namespace}.${ObjectType}"
|
|
55
58
|
# remove duplicated module name
|
|
56
|
-
if ($ObjectType.StartsWith($
|
|
59
|
+
if ($ObjectType.StartsWith('${$project.subjectPrefix}')) {
|
|
57
60
|
$ModulePrefix = ''
|
|
58
61
|
} else {
|
|
59
|
-
$ModulePrefix = $
|
|
62
|
+
$ModulePrefix = '${$project.subjectPrefix}'
|
|
60
63
|
}
|
|
61
64
|
$OutputPath = Join-Path -ChildPath "New-Az${ModulePrefix}${ObjectType}Object.ps1" -Path $OutputDir
|
|
62
65
|
|
|
@@ -149,7 +152,7 @@ Create an in-memory object for ${ObjectType}.
|
|
|
149
152
|
.Outputs
|
|
150
153
|
${ObjectTypeWithNamespace}
|
|
151
154
|
.Link
|
|
152
|
-
${$project.helpLinkPrefix}
|
|
155
|
+
${$project.helpLinkPrefix}${ModuleName}/new-Az${ModulePrefix}${ObjectType}Object
|
|
153
156
|
#>
|
|
154
157
|
function New-Az${ModulePrefix}${ObjectType}Object {
|
|
155
158
|
[OutputType('${ObjectTypeWithNamespace}')]
|
|
@@ -32,7 +32,7 @@ These provide functionality to our HTTP pipeline and other useful features. In s
|
|
|
32
32
|
### Attributes
|
|
33
33
|
For processing the cmdlets, we've created some additional attributes:
|
|
34
34
|
- `${$project.serviceNamespace.fullName}.DescriptionAttribute`
|
|
35
|
-
- Used in C# cmdlets to provide a high-level description of the cmdlet. This is propagated to reference documentation via [help comments](https://
|
|
35
|
+
- Used in C# cmdlets to provide a high-level description of the cmdlet. This is propagated to reference documentation via [help comments](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_comment_based_help) in the exported scripts.
|
|
36
36
|
- `${$project.serviceNamespace.fullName}.DoNotExportAttribute`
|
|
37
37
|
- Used in C# and script cmdlets to suppress creating an exported cmdlet at build-time. These cmdlets will *not be exposed* by `${$project.moduleName}`.
|
|
38
38
|
- `${$project.serviceNamespace.fullName}.InternalExportAttribute`
|
|
@@ -8,4 +8,4 @@ This directory contains the documentation of the cmdlets for the `${$project.mod
|
|
|
8
8
|
- Packaged: yes
|
|
9
9
|
|
|
10
10
|
## Details
|
|
11
|
-
The process of documentation generation loads `${$project.moduleName}` and analyzes the exported cmdlets from the module. It recognizes the [help comments](https://
|
|
11
|
+
The process of documentation generation loads `${$project.moduleName}` and analyzes the exported cmdlets from the module. It recognizes the [help comments](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_comment_based_help) that are generated into the scripts in the `${$lib.path.relative($project.docsFolder, $project.exportsFolder)}` folder. Additionally, when writing custom cmdlets in the `${$lib.path.relative($project.docsFolder, $project.customFolder)}` folder, you can use the help comments syntax, which decorate the exported scripts at build-time. The documentation examples are taken from the `${$lib.path.relative($project.docsFolder, $project.examplesFolder)}` folder.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Exports
|
|
2
|
-
This directory contains the cmdlets *exported by* `${$project.moduleName}`. No other cmdlets in this repository are directly exported. What that means is the `${$project.moduleName}` module will run [Export-ModuleMember](https://
|
|
2
|
+
This directory contains the cmdlets *exported by* `${$project.moduleName}`. No other cmdlets in this repository are directly exported. What that means is the `${$project.moduleName}` module will run [Export-ModuleMember](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/export-modulemember) on the cmldets in this directory. The cmdlets in this directory are generated at **build-time**. Do not put any custom code, files, cmdlets, etc. into this directory. Please use `${$lib.path.relative($project.exportsFolder, $project.customFolder)}` for all custom implementation.
|
|
3
3
|
|
|
4
4
|
## Info
|
|
5
5
|
- Modifiable: no
|
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
# ----------------------------------------------------------------------------------
|
|
2
|
+
${$project.pwshCommentHeader}
|
|
3
|
+
# ----------------------------------------------------------------------------------
|
|
4
|
+
param([switch]$Isolated)
|
|
5
|
+
$ErrorActionPreference = 'Stop'
|
|
6
|
+
|
|
7
|
+
$pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path
|
|
8
|
+
if(-not $Isolated) {
|
|
9
|
+
Write-Host -ForegroundColor Green 'Creating isolated process...'
|
|
10
|
+
& "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -Isolated
|
|
11
|
+
return
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
$exportsFolder = Join-Path $PSScriptRoot '${$lib.path.relative($project.baseFolder, $project.exportsFolder)}'
|
|
15
|
+
if(-not (Test-Path $exportsFolder)) {
|
|
16
|
+
Write-Error "Exports folder '$exportsFolder' was not found."
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
$directories = Get-ChildItem -Directory -Path $exportsFolder
|
|
20
|
+
$hasProfiles = ($directories | Measure-Object).Count -gt 0
|
|
21
|
+
if(-not $hasProfiles) {
|
|
22
|
+
$directories = Get-Item -Path $exportsFolder
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
$docsFolder = Join-Path $PSScriptRoot '${$lib.path.relative($project.baseFolder, $project.docsFolder)}'
|
|
26
|
+
if(Test-Path $docsFolder) {
|
|
27
|
+
$null = Get-ChildItem -Path $docsFolder -Recurse -Exclude 'README.md' | Remove-Item -Recurse -ErrorAction SilentlyContinue
|
|
28
|
+
}
|
|
29
|
+
$null = New-Item -ItemType Directory -Force -Path $docsFolder -ErrorAction SilentlyContinue
|
|
30
|
+
|
|
31
|
+
$moduleName = '${$project.moduleName}'
|
|
32
|
+
$rootModuleName = '${$project.rootModuleName}'
|
|
33
|
+
if ($rootModuleName -eq "")
|
|
34
|
+
{
|
|
35
|
+
$rootModuleName = $moduleName
|
|
36
|
+
}
|
|
37
|
+
$modulePsd1 = Get-Item -Path (Join-Path $PSScriptRoot "./$moduleName.psd1")
|
|
38
|
+
$modulePath = $modulePsd1.FullName
|
|
39
|
+
|
|
40
|
+
# Load DLL to use build-time cmdlets
|
|
41
|
+
Import-Module -Name $modulePath
|
|
42
|
+
Import-Module -Name (Join-Path $PSScriptRoot "./bin/$moduleName.private.dll")
|
|
43
|
+
$instance = [${$project.serviceNamespace.moduleClass.declaration}]::Instance
|
|
44
|
+
# Module info is shared per profile
|
|
45
|
+
$moduleInfo = Get-Module -Name $moduleName
|
|
46
|
+
$parameterSetsInfo = Get-Module -Name "$moduleName.private"
|
|
47
|
+
|
|
48
|
+
$buildinFunctions = @("Export-CmdletSurface", "Export-ExampleStub", "Export-FormatPs1xml", "Export-HelpMarkdown", "Export-ModelSurface", "Export-ProxyCmdlet", "Export-Psd1", "Export-TestStub", "Get-CommonParameter", "Get-ModuleGuid", "Get-ScriptCmdlet")
|
|
49
|
+
|
|
50
|
+
function Test-FunctionSupported()
|
|
51
|
+
{
|
|
52
|
+
[CmdletBinding()]
|
|
53
|
+
Param (
|
|
54
|
+
[Parameter()]
|
|
55
|
+
[string]
|
|
56
|
+
$FunctionName
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
If ($buildinfunctions.Contains($FunctionName)) {
|
|
60
|
+
return $false
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
$cmdletName, $parameterSetName = $FunctionName.Split("_")
|
|
64
|
+
If ($parameterSetName.Contains("List") -or $parameterSetName.Contains("ViaIdentity")) {
|
|
65
|
+
return $false
|
|
66
|
+
}
|
|
67
|
+
If ($cmdletName.StartsWith("New") -or $cmdletName.StartsWith("Set") -or $cmdletName.StartsWith("Update")) {
|
|
68
|
+
return $false
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
$parameterSetInfo = $parameterSetsInfo.ExportedCmdlets[$FunctionName]
|
|
72
|
+
foreach ($parameterInfo in $parameterSetInfo.Parameters.Values)
|
|
73
|
+
{
|
|
74
|
+
$category = (Get-ParameterAttribute -ParameterInfo $parameterInfo -AttributeName "CategoryAttribute").Categories
|
|
75
|
+
$invalideCategory = @('Query', 'Body')
|
|
76
|
+
if ($invalideCategory -contains $category)
|
|
77
|
+
{
|
|
78
|
+
return $false
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
$customFiles = Get-ChildItem -Path custom -Filter "$cmdletName.*"
|
|
83
|
+
if ($customFiles.Length -ne 0)
|
|
84
|
+
{
|
|
85
|
+
Write-Host -ForegroundColor Yellow "There are come custom files for $cmdletName, skip generate UX data for it."
|
|
86
|
+
return $false
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return $true
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function Get-MappedCmdletFromFunctionName()
|
|
93
|
+
{
|
|
94
|
+
[CmdletBinding()]
|
|
95
|
+
Param (
|
|
96
|
+
[Parameter()]
|
|
97
|
+
[string]
|
|
98
|
+
$FunctionName
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
$cmdletName, $parameterSetName = $FunctionName.Split("_")
|
|
102
|
+
|
|
103
|
+
return $cmdletName
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function Get-ParameterAttribute()
|
|
107
|
+
{
|
|
108
|
+
[CmdletBinding()]
|
|
109
|
+
Param (
|
|
110
|
+
[Parameter()]
|
|
111
|
+
[System.Management.Automation.ParameterMetadata]
|
|
112
|
+
$ParameterInfo,
|
|
113
|
+
[Parameter()]
|
|
114
|
+
[String]
|
|
115
|
+
$AttributeName
|
|
116
|
+
)
|
|
117
|
+
return $ParameterInfo.Attributes | Where-Object { $_.TypeId.Name -eq $AttributeName }
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function Get-CmdletAttribute()
|
|
121
|
+
{
|
|
122
|
+
[CmdletBinding()]
|
|
123
|
+
Param (
|
|
124
|
+
[Parameter()]
|
|
125
|
+
[System.Management.Automation.CommandInfo]
|
|
126
|
+
$CmdletInfo,
|
|
127
|
+
[Parameter()]
|
|
128
|
+
[String]
|
|
129
|
+
$AttributeName
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
return $CmdletInfo.ImplementingType.GetTypeInfo().GetCustomAttributes([System.object], $true) | Where-Object { $_.TypeId.Name -eq $AttributeName }
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function Get-CmdletDescription()
|
|
136
|
+
{
|
|
137
|
+
[CmdletBinding()]
|
|
138
|
+
Param (
|
|
139
|
+
[Parameter()]
|
|
140
|
+
[String]
|
|
141
|
+
$CmdletName
|
|
142
|
+
)
|
|
143
|
+
$helpInfo = Get-Help $CmdletName -Full
|
|
144
|
+
|
|
145
|
+
$description = $helpInfo.Description.Text
|
|
146
|
+
if ($null -eq $description)
|
|
147
|
+
{
|
|
148
|
+
return ""
|
|
149
|
+
}
|
|
150
|
+
return $description
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
# Test whether the parameter is from swagger http path
|
|
154
|
+
function Test-ParameterFromSwagger()
|
|
155
|
+
{
|
|
156
|
+
[CmdletBinding()]
|
|
157
|
+
Param (
|
|
158
|
+
[Parameter()]
|
|
159
|
+
[System.Management.Automation.ParameterMetadata]
|
|
160
|
+
$ParameterInfo
|
|
161
|
+
)
|
|
162
|
+
$category = (Get-ParameterAttribute -ParameterInfo $ParameterInfo -AttributeName "CategoryAttribute").Categories
|
|
163
|
+
$doNotExport = Get-ParameterAttribute -ParameterInfo $ParameterInfo -AttributeName "DoNotExportAttribute"
|
|
164
|
+
if ($null -ne $doNotExport)
|
|
165
|
+
{
|
|
166
|
+
return $false
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
$valideCategory = @('Path')
|
|
170
|
+
if ($valideCategory -contains $category)
|
|
171
|
+
{
|
|
172
|
+
return $true
|
|
173
|
+
}
|
|
174
|
+
return $false
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function New-ExampleForParameterSet()
|
|
178
|
+
{
|
|
179
|
+
[CmdletBinding()]
|
|
180
|
+
Param (
|
|
181
|
+
[Parameter()]
|
|
182
|
+
[System.Management.Automation.CommandInfo]
|
|
183
|
+
$ParameterSetInfo
|
|
184
|
+
)
|
|
185
|
+
$parameters = $ParameterSetInfo.Parameters.Values | Where-Object { Test-ParameterFromSwagger $_ }
|
|
186
|
+
$result = @()
|
|
187
|
+
foreach ($parameter in $parameters)
|
|
188
|
+
{
|
|
189
|
+
$category = (Get-ParameterAttribute -parameterInfo $parameter -AttributeName "CategoryAttribute").Categories
|
|
190
|
+
$sourceName = (Get-ParameterAttribute -parameterInfo $parameter -AttributeName "InfoAttribute").SerializedName
|
|
191
|
+
$name = $parameter.Name
|
|
192
|
+
$result += [ordered]@{
|
|
193
|
+
name = "-$Name"
|
|
194
|
+
value = "[$category.$sourceName]"
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
return $result
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
function New-ParameterArrayInParameterSet()
|
|
202
|
+
{
|
|
203
|
+
[CmdletBinding()]
|
|
204
|
+
Param (
|
|
205
|
+
[Parameter()]
|
|
206
|
+
[System.Management.Automation.CommandInfo]
|
|
207
|
+
$ParameterSetInfo
|
|
208
|
+
)
|
|
209
|
+
$parameters = $ParameterSetInfo.Parameters.Values | Where-Object { Test-ParameterFromSwagger $_ }
|
|
210
|
+
$result = @()
|
|
211
|
+
foreach ($parameter in $parameters)
|
|
212
|
+
{
|
|
213
|
+
$isMandatory = (Get-ParameterAttribute -parameterInfo $parameter -AttributeName "ParameterAttribute").Mandatory
|
|
214
|
+
$parameterName = $parameter.Name
|
|
215
|
+
$parameterType = $parameter.ParameterType.ToString().Split('.')[1]
|
|
216
|
+
if ($parameter.SwitchParameter)
|
|
217
|
+
{
|
|
218
|
+
$parameterSignature = "-$parameterName"
|
|
219
|
+
}
|
|
220
|
+
else
|
|
221
|
+
{
|
|
222
|
+
$parameterSignature = "-$parameterName <$parameterType>"
|
|
223
|
+
}
|
|
224
|
+
if ($parameterName -eq "SubscriptionId")
|
|
225
|
+
{
|
|
226
|
+
$isMandatory = $false
|
|
227
|
+
}
|
|
228
|
+
if (-not $isMandatory)
|
|
229
|
+
{
|
|
230
|
+
$parameterSignature = "[$parameterSignature]"
|
|
231
|
+
}
|
|
232
|
+
$result += $parameterSignature
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
return $result
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
function New-MetadataForParameterSet()
|
|
239
|
+
{
|
|
240
|
+
[CmdletBinding()]
|
|
241
|
+
Param (
|
|
242
|
+
[Parameter()]
|
|
243
|
+
[System.Management.Automation.CommandInfo]
|
|
244
|
+
$ParameterSetInfo
|
|
245
|
+
)
|
|
246
|
+
$httpAttribute = Get-CmdletAttribute -CmdletInfo $ParameterSetInfo -AttributeName "HttpPathAttribute"
|
|
247
|
+
$httpPath = $httpAttribute.Path
|
|
248
|
+
$apiVersion = $httpAttribute.ApiVersion
|
|
249
|
+
$provider = [System.Text.RegularExpressions.Regex]::New("/providers/([\w+\.]+)/").Match($httpPath).Groups[1].Value
|
|
250
|
+
$resourcePath = "/" + $httpPath.Split("$provider/")[1]
|
|
251
|
+
$resourceType = [System.Text.RegularExpressions.Regex]::New("/([\w]+)/\{\w+\}").Matches($resourcePath) | ForEach-Object {$_.groups[1].Value} | Join-String -Separator "/"
|
|
252
|
+
$cmdletName = Get-MappedCmdletFromFunctionName $ParameterSetInfo.Name
|
|
253
|
+
$description = (Get-CmdletAttribute -CmdletInfo $ParameterSetInfo -AttributeName "DescriptionAttribute").Description
|
|
254
|
+
[object[]]$example = New-ExampleForParameterSet $ParameterSetInfo
|
|
255
|
+
[string[]]$signature = New-ParameterArrayInParameterSet $ParameterSetInfo
|
|
256
|
+
|
|
257
|
+
return @{
|
|
258
|
+
Path = $httpPath
|
|
259
|
+
Provider = $provider
|
|
260
|
+
ResourceType = $resourceType
|
|
261
|
+
ApiVersion = $apiVersion
|
|
262
|
+
CmdletName = $cmdletName
|
|
263
|
+
Description = $description
|
|
264
|
+
Example = $example
|
|
265
|
+
Signature = @{
|
|
266
|
+
parameters = $signature
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
function Merge-WithExistCmdletMetadata()
|
|
272
|
+
{
|
|
273
|
+
[CmdletBinding()]
|
|
274
|
+
Param (
|
|
275
|
+
[Parameter()]
|
|
276
|
+
[System.Collections.Specialized.OrderedDictionary]
|
|
277
|
+
$ExistedCmdletInfo,
|
|
278
|
+
[Parameter()]
|
|
279
|
+
[Hashtable]
|
|
280
|
+
$ParameterSetMetadata
|
|
281
|
+
)
|
|
282
|
+
$ExistedCmdletInfo.help.parameterSets += $ParameterSetMetadata.Signature
|
|
283
|
+
$ExistedCmdletInfo.examples += [ordered]@{
|
|
284
|
+
description = $ParameterSetMetadata.Description
|
|
285
|
+
parameters = $ParameterSetMetadata.Example
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
return $ExistedCmdletInfo
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
function New-MetadataForCmdlet()
|
|
292
|
+
{
|
|
293
|
+
[CmdletBinding()]
|
|
294
|
+
Param (
|
|
295
|
+
[Parameter()]
|
|
296
|
+
[Hashtable]
|
|
297
|
+
$ParameterSetMetadata
|
|
298
|
+
)
|
|
299
|
+
$cmdletName = $ParameterSetMetadata.CmdletName
|
|
300
|
+
$description = Get-CmdletDescription $cmdletName
|
|
301
|
+
$result = [ordered]@{
|
|
302
|
+
name = $cmdletName
|
|
303
|
+
description = $description
|
|
304
|
+
path = $ParameterSetMetadata.Path
|
|
305
|
+
help = [ordered]@{
|
|
306
|
+
learnMore = [ordered]@{
|
|
307
|
+
url = "https://learn.microsoft.com/powershell/module/$rootModuleName/$cmdletName".ToLower()
|
|
308
|
+
}
|
|
309
|
+
parameterSets = @()
|
|
310
|
+
}
|
|
311
|
+
examples = @()
|
|
312
|
+
}
|
|
313
|
+
$result = Merge-WithExistCmdletMetadata -ExistedCmdletInfo $result -ParameterSetMetadata $ParameterSetMetadata
|
|
314
|
+
return $result
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
$parameterSets = $parameterSetsInfo.ExportedCmdlets.Keys | Where-Object { Test-functionSupported($_) }
|
|
318
|
+
$resourceTypes = @{}
|
|
319
|
+
foreach ($parameterSetName in $parameterSets)
|
|
320
|
+
{
|
|
321
|
+
$cmdletInfo = $parameterSetsInfo.ExportedCommands[$parameterSetName]
|
|
322
|
+
$parameterSetMetadata = New-MetadataForParameterSet -ParameterSetInfo $cmdletInfo
|
|
323
|
+
$cmdletName = $parameterSetMetadata.CmdletName
|
|
324
|
+
if (-not ($moduleInfo.ExportedCommands.ContainsKey($cmdletName)))
|
|
325
|
+
{
|
|
326
|
+
continue
|
|
327
|
+
}
|
|
328
|
+
if ($resourceTypes.ContainsKey($parameterSetMetadata.ResourceType))
|
|
329
|
+
{
|
|
330
|
+
$ExistedCmdletInfo = $resourceTypes[$parameterSetMetadata.ResourceType].commands | Where-Object { $_.name -eq $cmdletName }
|
|
331
|
+
if ($ExistedCmdletInfo)
|
|
332
|
+
{
|
|
333
|
+
$ExistedCmdletInfo = Merge-WithExistCmdletMetadata -ExistedCmdletInfo $ExistedCmdletInfo -ParameterSetMetadata $parameterSetMetadata
|
|
334
|
+
}
|
|
335
|
+
else
|
|
336
|
+
{
|
|
337
|
+
$cmdletInfo = New-MetadataForCmdlet -ParameterSetMetadata $parameterSetMetadata
|
|
338
|
+
$resourceTypes[$parameterSetMetadata.ResourceType].commands += $cmdletInfo
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
else
|
|
342
|
+
{
|
|
343
|
+
$cmdletInfo = New-MetadataForCmdlet -ParameterSetMetadata $parameterSetMetadata
|
|
344
|
+
$resourceTypes[$parameterSetMetadata.ResourceType] = [ordered]@{
|
|
345
|
+
resourceType = $parameterSetMetadata.ResourceType
|
|
346
|
+
apiVersion = $parameterSetMetadata.ApiVersion
|
|
347
|
+
learnMore = @{
|
|
348
|
+
url = "https://learn.microsoft.com/powershell/module/$rootModuleName".ToLower()
|
|
349
|
+
}
|
|
350
|
+
commands = @($cmdletInfo)
|
|
351
|
+
provider = $parameterSetMetadata.Provider
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
$UXFolder = '${$lib.path.relative($project.baseFolder, $project.uxFolder)}'
|
|
357
|
+
if (Test-Path $UXFolder)
|
|
358
|
+
{
|
|
359
|
+
Remove-Item -Path $UXFolder -Recurse
|
|
360
|
+
}
|
|
361
|
+
$null = New-Item -ItemType Directory -Path $UXFolder
|
|
362
|
+
|
|
363
|
+
foreach ($resourceType in $resourceTypes.Keys)
|
|
364
|
+
{
|
|
365
|
+
$resourceTypeFileName = $resourceType -replace "/", "-"
|
|
366
|
+
if ($resourceTypeFileName -eq "")
|
|
367
|
+
{
|
|
368
|
+
continue
|
|
369
|
+
}
|
|
370
|
+
$resourceTypeInfo = $resourceTypes[$resourceType]
|
|
371
|
+
$provider = $resourceTypeInfo.provider
|
|
372
|
+
$providerFolder = "$UXFolder/$provider"
|
|
373
|
+
if (-not (Test-Path $providerFolder))
|
|
374
|
+
{
|
|
375
|
+
$null = New-Item -ItemType Directory -Path $providerFolder
|
|
376
|
+
}
|
|
377
|
+
$resourceTypeInfo.Remove("provider")
|
|
378
|
+
$resourceTypeInfo | ConvertTo-Json -Depth 10 | Out-File "$providerFolder/$resourceTypeFileName.json"
|
|
379
|
+
}
|
|
@@ -14,7 +14,7 @@ To generate documentation, the process is now integrated into the `build-module.
|
|
|
14
14
|
To test the cmdlets, we use [Pester](https://github.com/pester/Pester). Tests scripts (`.ps1`) should be added to the `${$lib.path.relative($project.baseFolder, $project.testFolder)}` folder. To execute the Pester tests, run the `test-module.ps1` script. This will run all tests in `playback` mode within the `test` folder. To read more about testing cmdlets, look at the [README.md](${$lib.path.relative($project.baseFolder, $project.examplesFolder)}/README.md) in the `${$lib.path.relative($project.baseFolder, $project.examplesFolder)}` folder.
|
|
15
15
|
|
|
16
16
|
## Packing `${$project.moduleName}`
|
|
17
|
-
To pack `${$project.moduleName}` for distribution, run the `pack-module.ps1` script. This will take the contents of multiple directories and certain root-folder files to create a `.nupkg`. The structure of the `.nupkg` is created so it can be loaded part of a [PSRepository](https://
|
|
17
|
+
To pack `${$project.moduleName}` for distribution, run the `pack-module.ps1` script. This will take the contents of multiple directories and certain root-folder files to create a `.nupkg`. The structure of the `.nupkg` is created so it can be loaded part of a [PSRepository](https://learn.microsoft.com/powershell/module/powershellget/register-psrepository). Additionally, this package is in a format for distribution to the [PSGallery](https://www.powershellgallery.com/). For signing an Azure module, please contact the [Azure PowerShell](https://github.com/Azure/azure-powershell) team.
|
|
18
18
|
|
|
19
19
|
## Module Script Details
|
|
20
20
|
There are multiple scripts created for performing different actions for developing `${$project.moduleName}`.
|
|
@@ -8,7 +8,7 @@ This directory contains a module to handle *internal only* cmdlets. Cmdlets that
|
|
|
8
8
|
- Packaged: yes
|
|
9
9
|
|
|
10
10
|
## Details
|
|
11
|
-
The `${$lib.path.relative($project.internalFolder, $project.psm1Internal)}` file is generated to this folder. This module file handles the hidden cmdlets. These cmdlets will not be exported by `${$project.moduleName}`. Instead, this sub-module is imported by the `${$lib.path.relative($project.internalFolder, $project.psm1Custom)}` module, allowing you to use hidden cmdlets in your custom, exposed cmdlets. To call these cmdlets in your custom scripts, simply use [module-qualified calls](https://
|
|
11
|
+
The `${$lib.path.relative($project.internalFolder, $project.psm1Internal)}` file is generated to this folder. This module file handles the hidden cmdlets. These cmdlets will not be exported by `${$project.moduleName}`. Instead, this sub-module is imported by the `${$lib.path.relative($project.internalFolder, $project.psm1Custom)}` module, allowing you to use hidden cmdlets in your custom, exposed cmdlets. To call these cmdlets in your custom scripts, simply use [module-qualified calls](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_command_precedence?view=powershell-6#qualified-names). For example, `${$project.moduleName}.internal\Get-Example` would call an internal cmdlet named `Get-Example`.
|
|
12
12
|
|
|
13
13
|
## Purpose
|
|
14
14
|
This allows you to include REST specifications for services that you *do not wish to expose from your module*, but simply want to call within custom cmdlets. For example, if you want to make a custom cmdlet that uses `Storage` services, you could include a simplified `Storage` REST specification that has only the operations you need. When you run the generator and build this module, note the generated `Storage` cmdlets. Then, in your readme configuration, use [cmdlet hiding](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md#cmdlet-hiding-exportation-suppression) on the `Storage` cmdlets and they will *only be exposed to the custom cmdlets* you want to write, and not be exported as part of `${$project.moduleName}`.
|
|
@@ -8,4 +8,4 @@ This directory contains the documentation of the cmdlets for the `Az.Resources`
|
|
|
8
8
|
- Packaged: yes
|
|
9
9
|
|
|
10
10
|
## Details
|
|
11
|
-
The process of documentation generation loads `Az.Resources` and analyzes the exported cmdlets from the module. It recognizes the [help comments](https://
|
|
11
|
+
The process of documentation generation loads `Az.Resources` and analyzes the exported cmdlets from the module. It recognizes the [help comments](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_comment_based_help) that are generated into the scripts in the `..\exports` folder. Additionally, when writing custom cmdlets in the `..\custom` folder, you can use the help comments syntax, which decorate the exported scripts at build-time. The documentation examples are taken from the `..\examples` folder.
|
|
@@ -14,7 +14,7 @@ To generate documentation, the process is now integrated into the `build-module.
|
|
|
14
14
|
To test the cmdlets, we use [Pester](https://github.com/pester/Pester). Tests scripts (`.ps1`) should be added to the `test` folder. To execute the Pester tests, run the `test-module.ps1` script. This will run all tests in `playback` mode within the `test` folder. To read more about testing cmdlets, look at the [README.md](examples/README.md) in the `examples` folder.
|
|
15
15
|
|
|
16
16
|
## Packing `Az.Resources`
|
|
17
|
-
To pack `Az.Resources` for distribution, run the `pack-module.ps1` script. This will take the contents of multiple directories and certain root-folder files to create a `.nupkg`. The structure of the `.nupkg` is created so it can be loaded part of a [PSRepository](https://
|
|
17
|
+
To pack `Az.Resources` for distribution, run the `pack-module.ps1` script. This will take the contents of multiple directories and certain root-folder files to create a `.nupkg`. The structure of the `.nupkg` is created so it can be loaded part of a [PSRepository](https://learn.microsoft.com/powershell/module/powershellget/register-psrepository). Additionally, this package is in a format for distribution to the [PSGallery](https://www.powershellgallery.com/). For signing an Azure module, please contact the [Azure PowerShell](https://github.com/Azure/azure-powershell) team.
|
|
18
18
|
|
|
19
19
|
## Module Script Details
|
|
20
20
|
There are multiple scripts created for performing different actions for developing `Az.Resources`.
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<projectUrl>https://github.com/Azure/azure-powershell</projectUrl>
|
|
11
11
|
<description>Microsoft Azure PowerShell - Accounts credential management cmdlets for Azure Resource Manager in Windows PowerShell and PowerShell Core.
|
|
12
12
|
|
|
13
|
-
For more information on account credential management, please visit the following: https://
|
|
13
|
+
For more information on account credential management, please visit the following: https://learn.microsoft.com/powershell/azure/authenticate-azureps</description>
|
|
14
14
|
<releaseNotes>* Added 'SshCredentialFactory' to support get ssh credential of vm from msal.
|
|
15
15
|
* Fixed the bug of cmdlet fails when -DefaultProfile is set to service principal login context. [#16617]
|
|
16
16
|
* Fixed the issue that authorization does not work in Dogfood environment</releaseNotes>
|
|
@@ -32,7 +32,7 @@ Copyright = 'Microsoft Corporation. All rights reserved.'
|
|
|
32
32
|
# Description of the functionality provided by this module
|
|
33
33
|
Description = 'Microsoft Azure PowerShell - Accounts credential management cmdlets for Azure Resource Manager in Windows PowerShell and PowerShell Core.
|
|
34
34
|
|
|
35
|
-
For more information on account credential management, please visit the following: https://
|
|
35
|
+
For more information on account credential management, please visit the following: https://learn.microsoft.com/powershell/azure/authenticate-azureps'
|
|
36
36
|
|
|
37
37
|
# Minimum version of the PowerShell engine required by this module
|
|
38
38
|
PowerShellVersion = '5.1'
|