Skip to content

Commit 863d218

Browse files
jaskisinPan-Qi
authored andcommitted
Migrate workloads monitor to autorest v4 (#28740)
1 parent 6897415 commit 863d218

File tree

81 files changed

+2760
-2259
lines changed

Some content is hidden

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

81 files changed

+2760
-2259
lines changed

src/Workloads/Monitors.Autorest/Properties/AssemblyInfo.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,6 @@
2424
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0")]
2525
[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)]
2626
[assembly: System.CLSCompliantAttribute(false)]
27+
28+
29+

src/Workloads/Monitors.Autorest/custom/Az.Monitors.custom.psm1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# region Generated
22
# Load the private module dll
3-
$null = Import-Module -PassThru -Name (Join-Path $PSScriptRoot '..\bin\Az.Monitors.private.dll')
3+
$null = Import-Module -PassThru -Name (Join-Path $PSScriptRoot '../bin/Az.Monitors.private.dll')
44

55
# Load the internal module
6-
$internalModulePath = Join-Path $PSScriptRoot '..\internal\Az.Monitors.internal.psm1'
6+
$internalModulePath = Join-Path $PSScriptRoot '../internal/Az.Monitors.internal.psm1'
77
if(Test-Path $internalModulePath) {
88
$null = Import-Module -Name $internalModulePath
99
}

src/Workloads/Monitors.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.Monitors` 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.Monitors.custom.psm1`. This file should not be modified.
2+
This directory contains custom implementation for non-generated cmdlets for the `Az.Monitors` 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.Monitors.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.Monitors.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.Workloads.Monitors.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.Monitors`.
3838
- `Microsoft.Azure.PowerShell.Cmdlets.Workloads.Monitors.InternalExportAttribute`
39-
- Used in C# cmdlets to route exported cmdlets to the `..\internal`, which are *not exposed* by `Az.Monitors`. 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.Monitors`. For more information, see [README.md](../internal/README.md) in the `../internal` folder.
4040
- `Microsoft.Azure.PowerShell.Cmdlets.Workloads.Monitors.ProfileAttribute`
4141
- Used in C# and script cmdlets to define which Azure profiles the cmdlet supports. This is only supported for Azure (`--azure`) modules.

src/Workloads/Monitors.Autorest/docs/Az.Monitors.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
Module Name: Az.Monitors
3-
Module Guid: c2b5aac3-3ae4-4fa4-9d6a-b7a7834ba0ba
3+
Module Guid: d805f2ff-7f5f-4e5c-aa61-59be1b0c5ad4
44
Download Help Link: https://learn.microsoft.com/powershell/module/az.monitors
55
Help Version: 1.0.0.0
66
Locale: en-US

src/Workloads/Monitors.Autorest/docs/New-AzWorkloadsProviderInstance.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ Create a provider instance for the specified subscription, resource group, SAP m
5050
### Example 1: Create a new provider
5151
```powershell
5252
$providerSetting = New-AzWorkloadsProviderSqlServerInstanceObject -Password '<password>' -Port 1433 -Username '<username>' -Hostname 10.1.14.5 -SapSid X00 -SslPreference Disabled
53-
$providerSetting.ProviderType | Should -Be "MsSqlServer"
54-
53+
5554
New-AzWorkloadsProviderInstance -MonitorName suha-0202-ams9 -Name sql-prov-1 -ResourceGroupName suha-0802-rg1 -SubscriptionId 49d64d54-e966-4c46-a868-1999802b762c -ProviderSetting $providerSetting
5655
```
5756

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Docs
2-
This directory contains the documentation of the cmdlets for the `Az.Monitors` module. To run documentation generation, use the `generate-help.ps1` script at the root module folder. Files in this folder will *always be overridden on regeneration*. To update documentation examples, please use the `..\examples` folder.
2+
This directory contains the documentation of the cmdlets for the `Az.Monitors` module. To run documentation generation, use the `generate-help.ps1` script at the root module folder. Files in this folder will *always be overridden on regeneration*. To update documentation examples, please use the `../examples` folder.
33

44
## Info
55
- Modifiable: no
@@ -8,4 +8,4 @@ This directory contains the documentation of the cmdlets for the `Az.Monitors` m
88
- Packaged: yes
99

1010
## Details
11-
The process of documentation generation loads `Az.Monitors` 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.
11+
The process of documentation generation loads `Az.Monitors` 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.

src/Workloads/Monitors.Autorest/docs/Update-AzWorkloadsMonitor.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ Accept wildcard characters: False
115115
Determines whether to enable a system-assigned identity for the resource.
116116
117117
```yaml
118-
Type: System.Nullable`1[[System.Boolean, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]
118+
Type: System.Nullable`1[[System.Boolean, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]
119119
Parameter Sets: (All)
120120
Aliases:
121121

src/Workloads/Monitors.Autorest/docs/Update-AzWorkloadsProviderInstance.md

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,27 +40,33 @@ Update a provider instance for the specified subscription, resource group, SAP m
4040

4141
## EXAMPLES
4242

43-
### Example 1: {{ Add title here }}
43+
### Example 1: Update an existing provider
4444
```powershell
45-
{{ Add code here }}
45+
$providerSetting = New-AzWorkloadsProviderSqlServerInstanceObject -Password '<password>' -Port 1433 -Username '<username>' -Hostname 10.1.14.5 -SapSid X00 -SslPreference Disabled
46+
47+
Update-AzWorkloadsProviderInstance -MonitorName sap-0202-ams9 -Name sql-prov-1 -ResourceGroupName sap-0802-rg1 -SubscriptionId 49d64d54-e966-4c46-a868-1999802b762c -ProviderSetting $providerSetting
4648
```
4749

4850
```output
49-
{{ Add output here (remove the output block if the example doesn't have an output) }}
51+
Name ResourceGroupName ProvisioningState IdentityType
52+
---- ----------------- ----------------- ------------
53+
sql-prov-1 sap-0802-rg1 Succeeded
5054
```
5155

52-
{{ Add description here }}
56+
Update an existing provider for a specific AMS instance
5357

54-
### Example 2: {{ Add title here }}
58+
### Example 2: Update an existing provider by Id
5559
```powershell
56-
{{ Add code here }}
60+
Update-AzWorkloadsProviderInstance -MonitorName sap-160323-ams4 -Name sap-sql-3 -ResourceGroupName sap-0802-rg1 -SubscriptionId 49d64d54-e966-4c46-a868-1999802b762c -ProviderSetting '{"sslPreference":"Disabled","providerType":"MsSqlServer","hostname":"10.1.14.5","sapSid":"X00","dbPort":"1433","dbUsername":"","dbPassword":""}'
5761
```
5862

5963
```output
60-
{{ Add output here (remove the output block if the example doesn't have an output) }}
64+
Name ResourceGroupName ProvisioningState IdentityType
65+
---- ----------------- ----------------- ------------
66+
sap-sql-3 sap-0802-rg1 Succeeded
6167
```
6268

63-
{{ Add description here }}
69+
Update an existing provider for a specific AMS instance by Arm Id
6470

6571
## PARAMETERS
6672

@@ -99,7 +105,7 @@ Accept wildcard characters: False
99105
Determines whether to enable a system-assigned identity for the resource.
100106
101107
```yaml
102-
Type: System.Nullable`1[[System.Boolean, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]
108+
Type: System.Nullable`1[[System.Boolean, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]
103109
Parameter Sets: (All)
104110
Aliases:
105111

src/Workloads/Monitors.Autorest/examples/New-AzWorkloadsProviderInstance.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
### Example 1: Create a new provider
22
```powershell
33
$providerSetting = New-AzWorkloadsProviderSqlServerInstanceObject -Password '<password>' -Port 1433 -Username '<username>' -Hostname 10.1.14.5 -SapSid X00 -SslPreference Disabled
4-
$providerSetting.ProviderType | Should -Be "MsSqlServer"
5-
4+
65
New-AzWorkloadsProviderInstance -MonitorName suha-0202-ams9 -Name sql-prov-1 -ResourceGroupName suha-0802-rg1 -SubscriptionId 49d64d54-e966-4c46-a868-1999802b762c -ProviderSetting $providerSetting
76
```
87

@@ -26,4 +25,3 @@ suha-sql-3 suha-0802-rg1 Succeeded
2625
```
2726

2827
Creates a new provider for a specific AMS instance by Arm Id
29-
Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,27 @@
1-
### Example 1: {{ Add title here }}
1+
### Example 1: Update an existing provider
22
```powershell
3-
{{ Add code here }}
3+
$providerSetting = New-AzWorkloadsProviderSqlServerInstanceObject -Password '<password>' -Port 1433 -Username '<username>' -Hostname 10.1.14.5 -SapSid X00 -SslPreference Disabled
4+
5+
Update-AzWorkloadsProviderInstance -MonitorName sap-0202-ams9 -Name sql-prov-1 -ResourceGroupName sap-0802-rg1 -SubscriptionId 49d64d54-e966-4c46-a868-1999802b762c -ProviderSetting $providerSetting
46
```
57

68
```output
7-
{{ Add output here (remove the output block if the example doesn't have an output) }}
9+
Name ResourceGroupName ProvisioningState IdentityType
10+
---- ----------------- ----------------- ------------
11+
sql-prov-1 sap-0802-rg1 Succeeded
812
```
913

10-
{{ Add description here }}
14+
Update an existing provider for a specific AMS instance
1115

12-
### Example 2: {{ Add title here }}
16+
### Example 2: Update an existing provider by Id
1317
```powershell
14-
{{ Add code here }}
18+
Update-AzWorkloadsProviderInstance -MonitorName sap-160323-ams4 -Name sap-sql-3 -ResourceGroupName sap-0802-rg1 -SubscriptionId 49d64d54-e966-4c46-a868-1999802b762c -ProviderSetting '{"sslPreference":"Disabled","providerType":"MsSqlServer","hostname":"10.1.14.5","sapSid":"X00","dbPort":"1433","dbUsername":"","dbPassword":""}'
1519
```
1620

1721
```output
18-
{{ Add output here (remove the output block if the example doesn't have an output) }}
22+
Name ResourceGroupName ProvisioningState IdentityType
23+
---- ----------------- ----------------- ------------
24+
sap-sql-3 sap-0802-rg1 Succeeded
1925
```
2026

21-
{{ Add description here }}
22-
27+
Update an existing provider for a specific AMS instance by Arm Id

0 commit comments

Comments
 (0)