Skip to content

Commit bf149ab

Browse files
authored
[PS] migrate HanaOnAzure module to autorest v4 (Azure#27619)
1 parent 4e6fb06 commit bf149ab

29 files changed

+1381
-91
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the Apache License, Version 2.0 (the ""License"");
3+
// you may not use this file except in compliance with the License.
4+
// You may obtain a copy of the License at
5+
// http://www.apache.org/licenses/LICENSE-2.0
6+
// Unless required by applicable law or agreed to in writing, software
7+
// distributed under the License is distributed on an ""AS IS"" BASIS,
8+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9+
// See the License for the specific language governing permissions and
10+
// limitations under the License.
11+
// Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code
12+
// is regenerated.
13+
14+
using System;
15+
using System.Reflection;
16+
using System.Runtime.CompilerServices;
17+
using System.Runtime.InteropServices;
18+
19+
[assembly: System.Reflection.AssemblyCompanyAttribute("Microsoft")]
20+
[assembly: System.Reflection.AssemblyCopyrightAttribute("Copyright © Microsoft")]
21+
[assembly: System.Reflection.AssemblyProductAttribute("Microsoft Azure PowerShell")]
22+
[assembly: System.Reflection.AssemblyTitleAttribute("Microsoft Azure PowerShell - HanaOnAzure")]
23+
[assembly: System.Reflection.AssemblyFileVersionAttribute("0.3.3")]
24+
[assembly: System.Reflection.AssemblyVersionAttribute("0.3.3")]
25+
[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)]
26+
[assembly: System.CLSCompliantAttribute(false)]
27+
28+
29+
30+

src/HanaOnAzure/HanaOnAzure.Autorest/README.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,20 +59,15 @@ title: HanaOnAzure
5959
service-name: HanaOnAzure
6060
subject-prefix: SapMonitor
6161

62-
# If there are post APIs for some kinds of actions in the RP, you may need to
63-
# uncomment following line to support viaIdentity for these post APIs
64-
# identity-correction-for-post: true
65-
66-
# For new modules, please avoid setting 3.x using the use-extension method and instead, use 4.x as the default option
67-
use-extension:
68-
"@autorest/powershell": "3.x"
69-
7062
directive:
7163
# Following is two common directive which are normally required in all the RPs
7264
# 1. Remove the unexpanded parameter set
7365
# 2. For New-* cmdlets, ViaIdentity is not required, so CreateViaIdentityExpanded is removed as well
7466
- where:
75-
variant: ^Create$|^CreateViaIdentity$|^CreateViaIdentityExpanded$|^Update$|^UpdateViaIdentity$
67+
variant: ^(Create|Update)(?!.*?(Expanded|JsonFilePath|JsonString))
68+
remove: true
69+
- where:
70+
variant: ^CreateViaIdentityExpanded$
7671
remove: true
7772
# Remove the set-* cmdlet, update-* is enough
7873
- where:
@@ -115,6 +110,10 @@ directive:
115110
verb: New
116111
subject: ProviderInstance
117112
hide: true
113+
- where:
114+
subject: ProviderInstance
115+
variant: ^CreateVia(JsonFilePath|JsonString)$
116+
remove: true
118117

119118
# Table format
120119
- where:

src/HanaOnAzure/HanaOnAzure.Autorest/custom/New-AzSapMonitorProviderInstance.ps1

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11

22
# ----------------------------------------------------------------------------------
3-
#
4-
# Copyright Microsoft Corporation
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
54
# Licensed under the Apache License, Version 2.0 (the "License");
65
# you may not use this file except in compliance with the License.
76
# You may obtain a copy of the License at
@@ -18,9 +17,29 @@
1817
Creates a provider instance for the specified subscription, resource group, SapMonitor name, and resource name.
1918
.Description
2019
Creates a provider instance for the specified subscription, resource group, SapMonitor name, and resource name.
20+
.Example
21+
New-AzSapMonitorProviderInstance -ResourceGroupName nancyc-hn1 -Name ps-sapmonitorins-t01 -SapMonitorName yemingmonitor -ProviderType SapHana -HanaHostname 'hdb1-0' -HanaDatabaseName 'SYSTEMDB' -HanaDatabaseSqlPort 30015 -HanaDatabaseUsername SYSTEM -HanaDatabasePassword (ConvertTo-SecureString "Manager1" -AsPlainText -Force)
22+
.Example
23+
New-AzSapMonitorProviderInstance -ResourceGroupName nancyc-hn1 -SapMonitorName sapMonitor-vayh7q-test -ProviderType SapHana -HanaHostname 'hdb1-0' -HanaDatabaseName 'SYSTEMDB' -HanaDatabaseSqlPort 30015 -HanaDatabaseUsername SYSTEM -HanaDatabasePasswordSecretId https://kv-9gosjc-test.vault.azure.net/secrets/hanaPassword/bf516d1dfcc144138e5cf55114f3344b -HanaDatabasePasswordKeyVaultResourceId /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-8p50xe/providers/Microsoft.KeyVault/vaults/kv-9gosjc-test -Name sapins-kv-test
24+
.Example
25+
New-AzSapMonitorProviderInstance -ResourceGroupName donaliu-HN1 -Name dolauli-instance-promclt -SapMonitorName dolauli-test04 -ProviderType PrometheusHaCluster -InstanceProperty @{prometheusUrl='http://10.4.1.10:9664/metrics'}
26+
.Example
27+
New-AzSapMonitorProviderInstance -ResourceGroupName donaliu-HN1 -Name dolauli-instance-prom -SapMonitorName dolauli-test04 -ProviderType PrometheusOS -InstanceProperty @{prometheusUrl='http://10.3.1.6:9100/metrics'}
28+
.Example
29+
New-AzSapMonitorProviderInstance -ResourceGroupName donaliu-HN1 -Name dolauli-instance-ms -SapMonitorName dolauli-test04 -ProviderType MsSqlServer -InstanceProperty @{sqlHostname="10.4.8.90";sqlPort=1433;sqlUsername="AMFSS";sqlPassword="fakepassword"}
30+
.Example
31+
New-AzSapMonitorProviderInstance -ResourceGroupName donaliu-HN1 -Name dolauli-instance-hana -SapMonitorName dolauli-test04 -ProviderType SapHana -InstanceProperty @{hanaHostname="10.1.2.6";hanaDbName="SYSTEMDB";hanaDbSqlPort=30113;hanaDbUsername="SYSTEM"; hanaDbPassword="Manager1"}
32+
33+
.Outputs
34+
Microsoft.Azure.PowerShell.Cmdlets.HanaOnAzure.Models.IProviderInstance
35+
.Notes
36+
COMPLEX PARAMETER PROPERTIES
37+
38+
.Link
39+
https://learn.microsoft.com/powershell/module/az.hanaonazure/new-azsapmonitorproviderinstance
2140
#>
2241
function New-AzSapMonitorProviderInstance {
23-
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.HanaOnAzure.Models.Api20200207Preview.IProviderInstance])]
42+
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.HanaOnAzure.Models.IProviderInstance])]
2443
[CmdletBinding(DefaultParameterSetName = 'ByString', PositionalBinding = $false, SupportsShouldProcess, ConfirmImpact = 'Medium')]
2544
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', 'HanaDatabasePasswordKeyVaultResourceId', Justification = 'Not a password')]
2645
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', 'HanaDatabasePasswordSecretId', Justification = 'Not a password')]
@@ -127,7 +146,8 @@ function New-AzSapMonitorProviderInstance {
127146
[ValidateNotNull()]
128147
[Microsoft.Azure.PowerShell.Cmdlets.HanaOnAzure.Category('Azure')]
129148
[System.Management.Automation.PSObject]
130-
# The credentials, account, tenant, and subscription used for communication with Azure.
149+
# The DefaultProfile parameter is not functional.
150+
# Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.
131151
${DefaultProfile},
132152

133153
[Parameter()]

src/HanaOnAzure/HanaOnAzure.Autorest/docs/Az.HanaOnAzure.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
Module Name: Az.HanaOnAzure
3-
Module Guid: 79ad50da-e6b5-4703-885a-d36974a4d9b9
3+
Module Guid: 9567af20-a1e7-4bba-a73a-f1a4aace5ed1
44
Download Help Link: https://learn.microsoft.com/powershell/module/az.hanaonazure
55
Help Version: 1.0.0.0
66
Locale: en-US
@@ -18,7 +18,7 @@ Gets properties of a SAP monitor for the specified subscription, resource group,
1818
Gets properties of a provider instance for the specified subscription, resource group, SapMonitor name, and resource name.
1919

2020
### [New-AzSapMonitor](New-AzSapMonitor.md)
21-
Creates a SAP monitor for the specified subscription, resource group, and resource name.
21+
create a SAP monitor for the specified subscription, resource group, and resource name.
2222

2323
### [New-AzSapMonitorProviderInstance](New-AzSapMonitorProviderInstance.md)
2424
Creates a provider instance for the specified subscription, resource group, SapMonitor name, and resource name.
@@ -32,3 +32,6 @@ Deletes a provider instance for the specified subscription, resource group, SapM
3232
### [Update-AzSapMonitor](Update-AzSapMonitor.md)
3333
Patches the Tags field of a SAP monitor for the specified subscription, resource group, and monitor name.
3434

35+
### [Update-AzSapMonitorProviderInstance](Update-AzSapMonitorProviderInstance.md)
36+
update a provider instance for the specified subscription, resource group, SapMonitor name, and resource name.
37+

src/HanaOnAzure/HanaOnAzure.Autorest/docs/Get-AzSapMonitor.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ Accept wildcard characters: False
107107
108108
### -InputObject
109109
Identity Parameter
110-
To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
111110
112111
```yaml
113112
Type: Microsoft.Azure.PowerShell.Cmdlets.HanaOnAzure.Models.IHanaOnAzureIdentity
@@ -176,7 +175,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
176175
177176
## OUTPUTS
178177
179-
### Microsoft.Azure.PowerShell.Cmdlets.HanaOnAzure.Models.Api20200207Preview.ISapMonitor
178+
### Microsoft.Azure.PowerShell.Cmdlets.HanaOnAzure.Models.ISapMonitor
180179
181180
## NOTES
182181

src/HanaOnAzure/HanaOnAzure.Autorest/docs/Get-AzSapMonitorProviderInstance.md

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ Get-AzSapMonitorProviderInstance -InputObject <IHanaOnAzureIdentity> [-DefaultPr
3030
[<CommonParameters>]
3131
```
3232

33+
### GetViaIdentitySapMonitor
34+
```
35+
Get-AzSapMonitorProviderInstance -Name <String> -SapMonitorInputObject <IHanaOnAzureIdentity>
36+
[-DefaultProfile <PSObject>] [<CommonParameters>]
37+
```
38+
3339
## DESCRIPTION
3440
Gets properties of a provider instance for the specified subscription, resource group, SapMonitor name, and resource name.
3541

@@ -109,7 +115,6 @@ Accept wildcard characters: False
109115
110116
### -InputObject
111117
Identity Parameter
112-
To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
113118
114119
```yaml
115120
Type: Microsoft.Azure.PowerShell.Cmdlets.HanaOnAzure.Models.IHanaOnAzureIdentity
@@ -128,7 +133,7 @@ Name of the provider instance.
128133
129134
```yaml
130135
Type: System.String
131-
Parameter Sets: Get
136+
Parameter Sets: Get, GetViaIdentitySapMonitor
132137
Aliases: ProviderInstanceName
133138

134139
Required: True
@@ -153,6 +158,21 @@ Accept pipeline input: False
153158
Accept wildcard characters: False
154159
```
155160
161+
### -SapMonitorInputObject
162+
Identity Parameter
163+
164+
```yaml
165+
Type: Microsoft.Azure.PowerShell.Cmdlets.HanaOnAzure.Models.IHanaOnAzureIdentity
166+
Parameter Sets: GetViaIdentitySapMonitor
167+
Aliases:
168+
169+
Required: True
170+
Position: Named
171+
Default value: None
172+
Accept pipeline input: True (ByValue)
173+
Accept wildcard characters: False
174+
```
175+
156176
### -SapMonitorName
157177
Name of the SAP monitor resource.
158178
@@ -193,7 +213,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
193213
194214
## OUTPUTS
195215
196-
### Microsoft.Azure.PowerShell.Cmdlets.HanaOnAzure.Models.Api20200207Preview.IProviderInstance
216+
### Microsoft.Azure.PowerShell.Cmdlets.HanaOnAzure.Models.IProviderInstance
197217
198218
## NOTES
199219

src/HanaOnAzure/HanaOnAzure.Autorest/docs/New-AzSapMonitor.md

Lines changed: 53 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,32 @@ schema: 2.0.0
88
# New-AzSapMonitor
99

1010
## SYNOPSIS
11-
Creates a SAP monitor for the specified subscription, resource group, and resource name.
11+
create a SAP monitor for the specified subscription, resource group, and resource name.
1212

1313
## SYNTAX
1414

15+
### CreateExpanded (Default)
1516
```
1617
New-AzSapMonitor -Name <String> -ResourceGroupName <String> -Location <String> [-SubscriptionId <String>]
1718
[-EnableCustomerAnalytic] [-LogAnalyticsWorkspaceId <String>] [-LogAnalyticsWorkspaceResourceId <String>]
1819
[-LogAnalyticsWorkspaceSharedKey <String>] [-MonitorSubnetResourceId <String>] [-Tag <Hashtable>]
1920
[-DefaultProfile <PSObject>] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [<CommonParameters>]
2021
```
2122

23+
### CreateViaJsonFilePath
24+
```
25+
New-AzSapMonitor -Name <String> -ResourceGroupName <String> -JsonFilePath <String> [-SubscriptionId <String>]
26+
[-DefaultProfile <PSObject>] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [<CommonParameters>]
27+
```
28+
29+
### CreateViaJsonString
30+
```
31+
New-AzSapMonitor -Name <String> -ResourceGroupName <String> -JsonString <String> [-SubscriptionId <String>]
32+
[-DefaultProfile <PSObject>] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [<CommonParameters>]
33+
```
34+
2235
## DESCRIPTION
23-
Creates a SAP monitor for the specified subscription, resource group, and resource name.
36+
create a SAP monitor for the specified subscription, resource group, and resource name.
2437

2538
## EXAMPLES
2639

@@ -77,7 +90,7 @@ The value indicating whether to send analytics to Microsoft
7790
7891
```yaml
7992
Type: System.Management.Automation.SwitchParameter
80-
Parameter Sets: (All)
93+
Parameter Sets: CreateExpanded
8194
Aliases:
8295

8396
Required: False
@@ -87,12 +100,42 @@ Accept pipeline input: False
87100
Accept wildcard characters: False
88101
```
89102
103+
### -JsonFilePath
104+
Path of Json file supplied to the Create operation
105+
106+
```yaml
107+
Type: System.String
108+
Parameter Sets: CreateViaJsonFilePath
109+
Aliases:
110+
111+
Required: True
112+
Position: Named
113+
Default value: None
114+
Accept pipeline input: False
115+
Accept wildcard characters: False
116+
```
117+
118+
### -JsonString
119+
Json string supplied to the Create operation
120+
121+
```yaml
122+
Type: System.String
123+
Parameter Sets: CreateViaJsonString
124+
Aliases:
125+
126+
Required: True
127+
Position: Named
128+
Default value: None
129+
Accept pipeline input: False
130+
Accept wildcard characters: False
131+
```
132+
90133
### -Location
91134
The geo-location where the resource lives
92135
93136
```yaml
94137
Type: System.String
95-
Parameter Sets: (All)
138+
Parameter Sets: CreateExpanded
96139
Aliases:
97140

98141
Required: True
@@ -107,7 +150,7 @@ The workspace ID of the log analytics workspace to be used for monitoring
107150
108151
```yaml
109152
Type: System.String
110-
Parameter Sets: (All)
153+
Parameter Sets: CreateExpanded
111154
Aliases:
112155

113156
Required: False
@@ -122,7 +165,7 @@ The ARM ID of the Log Analytics Workspace that is used for monitoring
122165
123166
```yaml
124167
Type: System.String
125-
Parameter Sets: (All)
168+
Parameter Sets: CreateExpanded
126169
Aliases:
127170

128171
Required: False
@@ -137,7 +180,7 @@ The shared key of the log analytics workspace that is used for monitoring
137180
138181
```yaml
139182
Type: System.String
140-
Parameter Sets: (All)
183+
Parameter Sets: CreateExpanded
141184
Aliases:
142185

143186
Required: False
@@ -153,7 +196,7 @@ It should be the same subnet of HANA database.
153196
154197
```yaml
155198
Type: System.String
156-
Parameter Sets: (All)
199+
Parameter Sets: CreateExpanded
157200
Aliases:
158201

159202
Required: False
@@ -229,7 +272,7 @@ Resource tags.
229272
230273
```yaml
231274
Type: System.Collections.Hashtable
232-
Parameter Sets: (All)
275+
Parameter Sets: CreateExpanded
233276
Aliases:
234277

235278
Required: False
@@ -277,7 +320,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
277320
278321
## OUTPUTS
279322
280-
### Microsoft.Azure.PowerShell.Cmdlets.HanaOnAzure.Models.Api20200207Preview.ISapMonitor
323+
### Microsoft.Azure.PowerShell.Cmdlets.HanaOnAzure.Models.ISapMonitor
281324
282325
## NOTES
283326

src/HanaOnAzure/HanaOnAzure.Autorest/docs/New-AzSapMonitorProviderInstance.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ Creates a provider instance for the specified subscription, resource group, SapM
4444

4545
### Example 1: Create an instance of SAP monitor by string for HANA
4646
```powershell
47-
New-AzSapMonitorProviderInstance -ResourceGroupName nancyc-hn1 -Name ps-sapmonitorins-t01 -SapMonitorName yemingmonitor -ProviderType SapHana -HanaHostname 'hdb1-0' -HanaDatabaseName 'SYSTEMDB' -HanaDatabaseSqlPort 30015 -HanaDatabaseUsername SYSTEM -HanaDatabasePassword (ConvertTo-SecureString "Manager1" -AsPlainText -Force)
47+
$pwd = ConvertTo-SecureString -String "****" -AsPlainText -Force
48+
New-AzSapMonitorProviderInstance -ResourceGroupName nancyc-hn1 -Name ps-sapmonitorins-t01 -SapMonitorName yemingmonitor -ProviderType SapHana -HanaHostname 'hdb1-0' -HanaDatabaseName 'SYSTEMDB' -HanaDatabaseSqlPort 30015 -HanaDatabaseUsername SYSTEM -HanaDatabasePassword $pwd
4849
```
4950

5051
```output
@@ -57,7 +58,7 @@ This command creates an instance of SAP monitor by string for HANA.
5758

5859
### Example 2: Create an instance of SAP monitor by key vault for HANA
5960
```powershell
60-
New-AzSapMonitorProviderInstance -ResourceGroupName nancyc-hn1 -SapMonitorName sapMonitor-vayh7q-test -ProviderType SapHana -HanaHostname 'hdb1-0' -HanaDatabaseName 'SYSTEMDB' -HanaDatabaseSqlPort 30015 -HanaDatabaseUsername SYSTEM -HanaDatabasePasswordSecretId https://kv-9gosjc-test.vault.azure.net/secrets/hanaPassword/bf516d1dfcc144138e5cf55114f3344b -HanaDatabasePasswordKeyVaultResourceId /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-8p50xe/providers/Microsoft.KeyVault/vaults/kv-9gosjc-test -Name sapins-kv-test
61+
New-AzSapMonitorProviderInstance -ResourceGroupName nancyc-hn1 -SapMonitorName sapMonitor-vayh7q-test -ProviderType SapHana -HanaHostname 'hdb1-0' -HanaDatabaseName 'SYSTEMDB' -HanaDatabaseSqlPort 30015 -HanaDatabaseUsername SYSTEM -HanaDatabasePasswordSecretId https://kv-9gosjc-test.vault.azure.net/secrets/hanaPassword/************ -HanaDatabasePasswordKeyVaultResourceId /subscriptions/00001111-aaaa-2222-bbbb-3333cccc4444/resourceGroups/costmanagement-rg-8p50xe/providers/Microsoft.KeyVault/vaults/kv-9gosjc-test -Name sapins-kv-test
6162
```
6263

6364
```output
@@ -138,7 +139,8 @@ Accept wildcard characters: False
138139
```
139140
140141
### -DefaultProfile
141-
The credentials, account, tenant, and subscription used for communication with Azure.
142+
The DefaultProfile parameter is not functional.
143+
Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.
142144
143145
```yaml
144146
Type: System.Management.Automation.PSObject
@@ -417,7 +419,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
417419
418420
## OUTPUTS
419421
420-
### Microsoft.Azure.PowerShell.Cmdlets.HanaOnAzure.Models.Api20200207Preview.IProviderInstance
422+
### Microsoft.Azure.PowerShell.Cmdlets.HanaOnAzure.Models.IProviderInstance
421423
422424
## NOTES
423425

0 commit comments

Comments
 (0)