Skip to content

Commit 613a09e

Browse files
[SelfHelp] Add new API version 2024-03-01-preview support for AzSelfHelp cmdlets for Help Resource Provider (#24547)
* initial commit for SelfHelp new version * Adding files generated by build-module powershell file * Updating Test files * Added unit tests * Adding examples * Updating DiscoverySolutions examples * Updating examples * Added LiveOnly tag to tests
1 parent fbe3792 commit 613a09e

File tree

80 files changed

+3509
-950
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+3509
-950
lines changed

src/SelfHelp/SelfHelp.Autorest/Az.SelfHelp.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
DotNetFrameworkVersion = '4.7.2'
1212
RequiredAssemblies = './bin/Az.SelfHelp.private.dll'
1313
FormatsToProcess = './Az.SelfHelp.format.ps1xml'
14-
FunctionsToExport = 'Get-AzSelfHelpDiagnostic', 'Get-AzSelfHelpDiscoverySolution', 'Get-AzSelfHelpSolution', 'Get-AzSelfHelpTroubleshooter', 'Invoke-AzSelfHelpCheckNameAvailability', 'Invoke-AzSelfHelpContinueTroubleshooter', 'New-AzSelfHelpDiagnostic', 'New-AzSelfHelpSolution', 'New-AzSelfHelpTroubleshooter', 'Restart-AzSelfHelpTroubleshooter', 'Stop-AzSelfHelpTroubleshooter', 'Update-AzSelfHelpSolution', '*'
14+
FunctionsToExport = 'Get-AzSelfHelpDiagnostic', 'Get-AzSelfHelpDiscoverySolution', 'Get-AzSelfHelpSimplifiedSolution', 'Get-AzSelfHelpSolution', 'Get-AzSelfHelpSolutionSelfHelp', 'Get-AzSelfHelpTroubleshooter', 'Invoke-AzSelfHelpCheckNameAvailability', 'Invoke-AzSelfHelpContinueTroubleshooter', 'Invoke-AzSelfHelpDiscoverySolutionNlpSubscriptionScope', 'Invoke-AzSelfHelpDiscoverySolutionNlpTenantScope', 'Invoke-AzSelfHelpWarmSolutionUp', 'New-AzSelfHelpDiagnostic', 'New-AzSelfHelpSimplifiedSolution', 'New-AzSelfHelpSolution', 'New-AzSelfHelpTroubleshooter', 'Restart-AzSelfHelpTroubleshooter', 'Stop-AzSelfHelpTroubleshooter', 'Update-AzSelfHelpSolution', '*'
1515
AliasesToExport = '*'
1616
PrivateData = @{
1717
PSData = @{

src/SelfHelp/SelfHelp.Autorest/README.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
This directory contains the PowerShell module for the SelfHelp service.
44

55
---
6-
## Status
7-
[![Az.SelfHelp](https://img.shields.io/powershellgallery/v/Az.SelfHelp.svg?style=flat-square&label=Az.SelfHelp "Az.SelfHelp")](https://www.powershellgallery.com/packages/Az.SelfHelp/)
8-
96
## Info
107
- Modifiable: yes
118
- Generated: all
@@ -32,7 +29,7 @@ For information on how to develop for `Az.SelfHelp`, see [how-to.md](how-to.md).
3229
3330
```yaml
3431
# pin the swagger version by using the commit id instead of branch name
35-
commit: 270eeb7a7883e0ad4e183e809fb67c6551d0eaa0
32+
commit: 1145a0df0f91b5f0f1f5ab66667899a61eda5e2b
3633
require:
3734
# readme.azure.noprofile.md is the common configuration file
3835
- $(this-folder)/../../readme.azure.noprofile.md

src/SelfHelp/SelfHelp.Autorest/UX/Microsoft.Help/diagnostics.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"resourceType": "diagnostics",
3-
"apiVersion": "2023-06-01",
3+
"apiVersion": "2024-03-01-preview",
44
"learnMore": {
55
"url": "https://learn.microsoft.com/powershell/module/az.selfhelp"
66
},
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"resourceType": "selfHelp",
3+
"apiVersion": "2024-03-01-preview",
4+
"learnMore": {
5+
"url": "https://learn.microsoft.com/powershell/module/az.selfhelp"
6+
},
7+
"commands": [
8+
{
9+
"name": "Get-AzSelfHelpSolutionSelfHelp",
10+
"description": "Finds and Executes a Self Help Solution based on the Solution Id.\nThese are static self help content to help users troubleshoot their issues.",
11+
"path": "/providers/Microsoft.Help/selfHelp/{solutionId}",
12+
"help": {
13+
"learnMore": {
14+
"url": "https://learn.microsoft.com/powershell/module/az.selfhelp/get-azselfhelpsolutionselfhelp"
15+
},
16+
"parameterSets": [
17+
{
18+
"parameters": [
19+
"-SolutionId <String>"
20+
]
21+
}
22+
]
23+
},
24+
"examples": [
25+
{
26+
"description": "Finds and Executes a Self Help Solution based on the Solution Id. These are static self help content to help users troubleshoot their issues.",
27+
"parameters": [
28+
{
29+
"name": "-SolutionId",
30+
"value": "[Path.solutionId]"
31+
}
32+
]
33+
}
34+
]
35+
}
36+
]
37+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"resourceType": "simplifiedSolutions",
3+
"apiVersion": "2024-03-01-preview",
4+
"learnMore": {
5+
"url": "https://learn.microsoft.com/powershell/module/az.selfhelp"
6+
},
7+
"commands": [
8+
{
9+
"name": "Get-AzSelfHelpSimplifiedSolution",
10+
"description": "Get the simplified Solutions using the applicable solutionResourceName while creating the simplified Solutions.",
11+
"path": "/{scope}/providers/Microsoft.Help/simplifiedSolutions/{simplifiedSolutionsResourceName}",
12+
"help": {
13+
"learnMore": {
14+
"url": "https://learn.microsoft.com/powershell/module/az.selfhelp/get-azselfhelpsimplifiedsolution"
15+
},
16+
"parameterSets": [
17+
{
18+
"parameters": [
19+
"-SResourceName <String>",
20+
"-Scope <String>"
21+
]
22+
}
23+
]
24+
},
25+
"examples": [
26+
{
27+
"description": "Get the simplified Solutions using the applicable solutionResourceName while creating the simplified Solutions.",
28+
"parameters": [
29+
{
30+
"name": "-SResourceName",
31+
"value": "[Path.simplifiedSolutionsResourceName]"
32+
},
33+
{
34+
"name": "-Scope",
35+
"value": "[Path.scope]"
36+
}
37+
]
38+
}
39+
]
40+
}
41+
]
42+
}
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
{
2+
"resourceType": "solutions",
3+
"apiVersion": "2024-03-01-preview",
4+
"learnMore": {
5+
"url": "https://learn.microsoft.com/powershell/module/az.selfhelp"
6+
},
7+
"commands": [
8+
{
9+
"name": "Get-AzSelfHelpSolution",
10+
"description": "Get the solution using the applicable solutionResourceName while creating the solution.",
11+
"path": "/{scope}/providers/Microsoft.Help/solutions/{solutionResourceName}",
12+
"help": {
13+
"learnMore": {
14+
"url": "https://learn.microsoft.com/powershell/module/az.selfhelp/get-azselfhelpsolution"
15+
},
16+
"parameterSets": [
17+
{
18+
"parameters": [
19+
"-ResourceName <String>",
20+
"-Scope <String>"
21+
]
22+
}
23+
]
24+
},
25+
"examples": [
26+
{
27+
"description": "Get the solution using the applicable solutionResourceName while creating the solution.",
28+
"parameters": [
29+
{
30+
"name": "-ResourceName",
31+
"value": "[Path.solutionResourceName]"
32+
},
33+
{
34+
"name": "-Scope",
35+
"value": "[Path.scope]"
36+
}
37+
]
38+
}
39+
]
40+
},
41+
{
42+
"name": "Invoke-AzSelfHelpWarmSolutionUp",
43+
"description": "Warm up the solution resource by preloading asynchronous diagnostics results into cache",
44+
"path": "/{scope}/providers/Microsoft.Help/solutions/{solutionResourceName}/warmup",
45+
"help": {
46+
"learnMore": {
47+
"url": "https://learn.microsoft.com/powershell/module/az.selfhelp/invoke-azselfhelpwarmsolutionup"
48+
},
49+
"parameterSets": [
50+
{
51+
"parameters": [
52+
"-Scope <String>",
53+
"-SolutionResourceName <String>"
54+
]
55+
}
56+
]
57+
},
58+
"examples": [
59+
{
60+
"description": "Warm up the solution resource by preloading asynchronous diagnostics results into cache",
61+
"parameters": [
62+
{
63+
"name": "-Scope",
64+
"value": "[Path.scope]"
65+
},
66+
{
67+
"name": "-SolutionResourceName",
68+
"value": "[Path.solutionResourceName]"
69+
}
70+
]
71+
}
72+
]
73+
}
74+
]
75+
}
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
{
2+
"resourceType": "troubleshooters",
3+
"apiVersion": "2024-03-01-preview",
4+
"learnMore": {
5+
"url": "https://learn.microsoft.com/powershell/module/az.selfhelp"
6+
},
7+
"commands": [
8+
{
9+
"name": "Get-AzSelfHelpTroubleshooter",
10+
"description": "Gets troubleshooter instance result which includes the step status/result of the troubleshooter resource name that is being executed.<br/> Get API is used to retrieve the result of a Troubleshooter instance, which includes the status and result of each step in the Troubleshooter workflow.\nThis API requires the Troubleshooter resource name that was created using the Create API.",
11+
"path": "/{scope}/providers/Microsoft.Help/troubleshooters/{troubleshooterName}",
12+
"help": {
13+
"learnMore": {
14+
"url": "https://learn.microsoft.com/powershell/module/az.selfhelp/get-azselfhelptroubleshooter"
15+
},
16+
"parameterSets": [
17+
{
18+
"parameters": [
19+
"-Name <String>",
20+
"-Scope <String>"
21+
]
22+
}
23+
]
24+
},
25+
"examples": [
26+
{
27+
"description": "Gets troubleshooter instance result which includes the step status/result of the troubleshooter resource name that is being executed.<br/> Get API is used to retrieve the result of a Troubleshooter instance, which includes the status and result of each step in the Troubleshooter workflow. This API requires the Troubleshooter resource name that was created using the Create API.",
28+
"parameters": [
29+
{
30+
"name": "-Name",
31+
"value": "[Path.troubleshooterName]"
32+
},
33+
{
34+
"name": "-Scope",
35+
"value": "[Path.scope]"
36+
}
37+
]
38+
}
39+
]
40+
},
41+
{
42+
"name": "Invoke-AzSelfHelpContinueTroubleshooter",
43+
"description": "Uses ‘stepId’ and ‘responses’ as the trigger to continue the troubleshooting steps for the respective troubleshooter resource name.\n<br/>Continue API is used to provide inputs that are required for the specific troubleshooter to progress into the next step in the process.\nThis API is used after the Troubleshooter has been created using the Create API.",
44+
"path": "/{scope}/providers/Microsoft.Help/troubleshooters/{troubleshooterName}/continue",
45+
"help": {
46+
"learnMore": {
47+
"url": "https://learn.microsoft.com/powershell/module/az.selfhelp/invoke-azselfhelpcontinuetroubleshooter"
48+
},
49+
"parameterSets": [
50+
{
51+
"parameters": [
52+
"-Scope <String>",
53+
"-TroubleshooterName <String>"
54+
]
55+
}
56+
]
57+
},
58+
"examples": [
59+
{
60+
"description": "Uses ‘stepId’ and ‘responses’ as the trigger to continue the troubleshooting steps for the respective troubleshooter resource name. <br/>Continue API is used to provide inputs that are required for the specific troubleshooter to progress into the next step in the process. This API is used after the Troubleshooter has been created using the Create API.",
61+
"parameters": [
62+
{
63+
"name": "-Scope",
64+
"value": "[Path.scope]"
65+
},
66+
{
67+
"name": "-TroubleshooterName",
68+
"value": "[Path.troubleshooterName]"
69+
}
70+
]
71+
}
72+
]
73+
},
74+
{
75+
"name": "Restart-AzSelfHelpTroubleshooter",
76+
"description": "Restarts the troubleshooter API using applicable troubleshooter resource name as the input.<br/> It returns new resource name which should be used in subsequent request.\nThe old resource name is obsolete after this API is invoked.",
77+
"path": "/{scope}/providers/Microsoft.Help/troubleshooters/{troubleshooterName}/restart",
78+
"help": {
79+
"learnMore": {
80+
"url": "https://learn.microsoft.com/powershell/module/az.selfhelp/restart-azselfhelptroubleshooter"
81+
},
82+
"parameterSets": [
83+
{
84+
"parameters": [
85+
"-Name <String>",
86+
"-Scope <String>"
87+
]
88+
}
89+
]
90+
},
91+
"examples": [
92+
{
93+
"description": "Restarts the troubleshooter API using applicable troubleshooter resource name as the input.<br/> It returns new resource name which should be used in subsequent request. The old resource name is obsolete after this API is invoked.",
94+
"parameters": [
95+
{
96+
"name": "-Name",
97+
"value": "[Path.troubleshooterName]"
98+
},
99+
{
100+
"name": "-Scope",
101+
"value": "[Path.scope]"
102+
}
103+
]
104+
}
105+
]
106+
},
107+
{
108+
"name": "Stop-AzSelfHelpTroubleshooter",
109+
"description": "Ends the troubleshooter action",
110+
"path": "/{scope}/providers/Microsoft.Help/troubleshooters/{troubleshooterName}/end",
111+
"help": {
112+
"learnMore": {
113+
"url": "https://learn.microsoft.com/powershell/module/az.selfhelp/stop-azselfhelptroubleshooter"
114+
},
115+
"parameterSets": [
116+
{
117+
"parameters": [
118+
"-Name <String>",
119+
"-Scope <String>"
120+
]
121+
}
122+
]
123+
},
124+
"examples": [
125+
{
126+
"description": "Ends the troubleshooter action",
127+
"parameters": [
128+
{
129+
"name": "-Name",
130+
"value": "[Path.troubleshooterName]"
131+
},
132+
{
133+
"name": "-Scope",
134+
"value": "[Path.scope]"
135+
}
136+
]
137+
}
138+
]
139+
}
140+
]
141+
}

src/SelfHelp/SelfHelp.Autorest/custom/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Custom
2-
This directory contains custom implementation for non-generated cmdlets for the `Az.SelfHelp` module. Both scripts (`.ps1`) and C# files (`.cs`) can be implemented here. They will be used during the build process in `build-module.ps1`, and create cmdlets into the `..\exports` folder. The only generated file into this folder is the `Az.SelfHelp.custom.psm1`. This file should not be modified.
2+
This directory contains custom implementation for non-generated cmdlets for the `Az.SelfHelp` module. Both scripts (`.ps1`) and C# files (`.cs`) can be implemented here. They will be used during the build process in `build-module.ps1`, and create cmdlets into the `../exports` folder. The only generated file into this folder is the `Az.SelfHelp.custom.psm1`. This file should not be modified.
33

44
## Info
55
- Modifiable: yes
@@ -15,10 +15,10 @@ For C# cmdlets, they are compiled with the rest of the generated low-level cmdle
1515
For script cmdlets, these are loaded via the `Az.SelfHelp.custom.psm1`. Then, during the build process, this module is loaded and processed in the same manner as the C# cmdlets. The fundamental difference is the script cmdlets use the `ParameterSetName` attribute and C# cmdlets do not. To create a script cmdlet variant of a generated cmdlet, simply decorate all parameters in the script with the new `ParameterSetName` in the `Parameter` attribute. This will appropriately treat each parameter set as a separate variant when processed to be exported during the build.
1616

1717
## Purpose
18-
This allows the modules to have cmdlets that were not defined in the REST specification. It also allows combining logic using generated cmdlets. This is a level of customization beyond what can be done using the [readme configuration options](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md) that are currently available. These custom cmdlets are then referenced by the cmdlets created at build-time in the `..\exports` folder.
18+
This allows the modules to have cmdlets that were not defined in the REST specification. It also allows combining logic using generated cmdlets. This is a level of customization beyond what can be done using the [readme configuration options](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md) that are currently available. These custom cmdlets are then referenced by the cmdlets created at build-time in the `../exports` folder.
1919

2020
## Usage
21-
The easiest way currently to start developing custom cmdlets is to copy an existing cmdlet. For C# cmdlets, copy one from the `generated/cmdlets` folder. For script cmdlets, build the project using `build-module.ps1` and copy one of the scripts from the `..\exports` folder. After that, if you want to add new parameter sets, follow the guidelines in the `Details` section above. For implementing a new cmdlets, at minimum, please keep these parameters:
21+
The easiest way currently to start developing custom cmdlets is to copy an existing cmdlet. For C# cmdlets, copy one from the `generated/cmdlets` folder. For script cmdlets, build the project using `build-module.ps1` and copy one of the scripts from the `../exports` folder. After that, if you want to add new parameter sets, follow the guidelines in the `Details` section above. For implementing a new cmdlets, at minimum, please keep these parameters:
2222
- Break
2323
- DefaultProfile
2424
- HttpPipelineAppend
@@ -36,6 +36,6 @@ For processing the cmdlets, we've created some additional attributes:
3636
- `Microsoft.Azure.PowerShell.Cmdlets.SelfHelp.DoNotExportAttribute`
3737
- Used in C# and script cmdlets to suppress creating an exported cmdlet at build-time. These cmdlets will *not be exposed* by `Az.SelfHelp`.
3838
- `Microsoft.Azure.PowerShell.Cmdlets.SelfHelp.InternalExportAttribute`
39-
- Used in C# cmdlets to route exported cmdlets to the `..\internal`, which are *not exposed* by `Az.SelfHelp`. For more information, see [README.md](..\internal/README.md) in the `..\internal` folder.
39+
- Used in C# cmdlets to route exported cmdlets to the `../internal`, which are *not exposed* by `Az.SelfHelp`. For more information, see [README.md](../internal/README.md) in the `../internal` folder.
4040
- `Microsoft.Azure.PowerShell.Cmdlets.SelfHelp.ProfileAttribute`
4141
- Used in C# and script cmdlets to define which Azure profiles the cmdlet supports. This is only supported for Azure (`--azure`) modules.

0 commit comments

Comments
 (0)