Skip to content

Commit 082924d

Browse files
committed
draft migrate PostgreSQL to autorest v4
1 parent 1b48e22 commit 082924d

File tree

110 files changed

+1540
-388
lines changed

Some content is hidden

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

110 files changed

+1540
-388
lines changed

src/PostgreSql/PostgreSql.Autorest/Properties/AssemblyInfo.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
[assembly: System.Reflection.AssemblyCopyrightAttribute("Copyright © Microsoft")]
2121
[assembly: System.Reflection.AssemblyProductAttribute("Microsoft Azure PowerShell")]
2222
[assembly: System.Reflection.AssemblyTitleAttribute("Microsoft Azure PowerShell - PostgreSql")]
23-
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.3.0")]
24-
[assembly: System.Reflection.AssemblyVersionAttribute("1.3.0")]
23+
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.4.0")]
24+
[assembly: System.Reflection.AssemblyVersionAttribute("1.4.0")]
2525
[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)]
2626
[assembly: System.CLSCompliantAttribute(false)]
27+

src/PostgreSql/PostgreSql.Autorest/README.md

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,7 @@ input-file:
5555
module-version: 0.1.0
5656
title: PostgreSQL
5757
subject-prefix: 'PostgreSQL'
58-
59-
# For new modules, please avoid setting 3.x using the use-extension method and instead, use 4.x as the default option
60-
use-extension:
61-
"@autorest/powershell": "3.x"
58+
disable-transform-identity-type: true
6259

6360
directive:
6461
- from: swagger-document
@@ -229,12 +226,6 @@ directive:
229226
subject: Server
230227
set:
231228
parameter-description: Backup retention days for the server. Day count is between 7 and 35.
232-
- from: source-file-csharp
233-
where: $
234-
transform: $ = $.replace(/OperationOrigin System/, 'OperationOrigin System1');
235-
- from: source-file-csharp
236-
where: $
237-
transform: $ = $.replace('internal Microsoft.Azure.PowerShell.Cmdlets.PostgreSql.Models.Api20171201.IServerPropertiesForCreate Property', 'public Microsoft.Azure.PowerShell.Cmdlets.PostgreSql.Models.Api20171201.IServerPropertiesForCreate Property');
238229
- from: source-file-csharp
239230
where: $
240231
transform: $ = $.replace('public int StorageProfileBackupRetentionDay', '[System.Management.Automation.ValidateRangeAttribute(7,35)]\n public int StorageProfileBackupRetentionDay');

src/PostgreSql/PostgreSql.Autorest/UX/Microsoft.DBforPostgreSQL/flexibleServers.json

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -81,44 +81,6 @@
8181
}
8282
]
8383
},
84-
{
85-
"name": "Restart-AzPostgreSqlFlexibleServer",
86-
"description": "Restarts a server.",
87-
"path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/restart",
88-
"help": {
89-
"learnMore": {
90-
"url": "https://learn.microsoft.com/powershell/module/az.postgresql/restart-azpostgresqlflexibleserver"
91-
},
92-
"parameterSets": [
93-
{
94-
"parameters": [
95-
"-Name <String>",
96-
"-ResourceGroupName <String>",
97-
"[-SubscriptionId <String>]"
98-
]
99-
}
100-
]
101-
},
102-
"examples": [
103-
{
104-
"description": "Restarts a server.",
105-
"parameters": [
106-
{
107-
"name": "-Name",
108-
"value": "[Path.serverName]"
109-
},
110-
{
111-
"name": "-ResourceGroupName",
112-
"value": "[Path.resourceGroupName]"
113-
},
114-
{
115-
"name": "-SubscriptionId",
116-
"value": "[Path.subscriptionId]"
117-
}
118-
]
119-
}
120-
]
121-
},
12284
{
12385
"name": "Start-AzPostgreSqlFlexibleServer",
12486
"description": "Starts a server.",

src/PostgreSql/PostgreSql.Autorest/custom/FlexibleServer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace Microsoft.Azure.PowerShell.Cmdlets.PostgreSql.Models.Api20210601
1+
namespace Microsoft.Azure.PowerShell.Cmdlets.PostgreSql.Models
22
{
33
using static Microsoft.Azure.PowerShell.Cmdlets.PostgreSql.Runtime.Extensions;
44
using System.Security;

src/PostgreSql/PostgreSql.Autorest/custom/Get-AzPostgreSqlConnectionString.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function Get-AzPostgreSqlConnectionString {
3636

3737
[Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline, HelpMessage = 'The server for the connection string')]
3838
[Microsoft.Azure.PowerShell.Cmdlets.PostgreSql.Category('Body')]
39-
[Microsoft.Azure.PowerShell.Cmdlets.PostgreSql.Models.Api20171201.IServer]
39+
[Microsoft.Azure.PowerShell.Cmdlets.PostgreSql.Models.IServer]
4040
${InputObject},
4141

4242
[Parameter(Mandatory, HelpMessage = 'Client connection provider.')]

src/PostgreSql/PostgreSql.Autorest/custom/Get-AzPostgreSqlFlexibleServerConnectionString.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ function Get-AzPostgreSqlFlexibleServerConnectionString {
4848

4949
[Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline, HelpMessage = 'The server for the connection string')]
5050
[Microsoft.Azure.PowerShell.Cmdlets.PostgreSql.Category('Body')]
51-
[Microsoft.Azure.PowerShell.Cmdlets.PostgreSql.Models.Api20210601.IServerAutoGenerated]
51+
[Microsoft.Azure.PowerShell.Cmdlets.PostgreSql.Models.IServerAutoGenerated]
5252
${InputObject},
5353

5454
[Parameter(HelpMessage = 'The credentials, account, tenant, and subscription used for communication with Azure.')]

src/PostgreSql/PostgreSql.Autorest/custom/Get-AzPostgreSqlFlexibleServerLocationBasedCapability.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Get the available SKU information for the location
2020
#>
2121

2222
function Get-AzPostgreSqlFlexibleServerLocationBasedCapability {
23-
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.PostgreSql.Models.Api20210601.ICapabilityProperties])]
23+
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.PostgreSql.Models.ICapabilityProperties])]
2424
[CmdletBinding(DefaultParameterSetName='Get', PositionalBinding=$false)]
2525
param(
2626
[Parameter(ParameterSetName='Get', Mandatory)]

src/PostgreSql/PostgreSql.Autorest/custom/New-AzPostgreSqlFirewallRule.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Creates a new firewall rule or updates an existing firewall rule.
2020
Creates a new firewall rule or updates an existing firewall rule.
2121
#>
2222
function New-AzPostgreSqlFirewallRule {
23-
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.PostgreSql.Models.Api20171201.IFirewallRule])]
23+
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.PostgreSql.Models.IFirewallRule])]
2424
[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
2525
param(
2626
[Parameter()]

src/PostgreSql/PostgreSql.Autorest/custom/New-AzPostgreSqlFlexibleServer.ps1

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ $DEFAULT_SUBNET_PREFIX = '10.0.0.0/24'
2525
$AZURE_ARMNAME = '^[^<>%&:\\?/]{1,260}$'
2626

2727
function New-AzPostgreSqlFlexibleServer {
28-
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.PostgreSql.Models.Api20210601.IServerAutoGenerated])]
28+
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.PostgreSql.Models.IServerAutoGenerated])]
2929
[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
3030
[Microsoft.Azure.PowerShell.Cmdlets.PostgreSql.Description('Creates a new server.')]
3131
param(
@@ -97,14 +97,14 @@ function New-AzPostgreSqlFlexibleServer {
9797

9898
[Parameter(HelpMessage = 'Application-specific metadata in the form of key-value pairs.')]
9999
[Microsoft.Azure.PowerShell.Cmdlets.PostgreSql.Category('Body')]
100-
[Microsoft.Azure.PowerShell.Cmdlets.PostgreSql.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.PostgreSql.Models.Api20171201.IServerForCreateTags]))]
100+
[Microsoft.Azure.PowerShell.Cmdlets.PostgreSql.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.PostgreSql.Models.IServerForCreateTags]))]
101101
[System.Collections.Hashtable]
102102
${Tag},
103103

104104
[Parameter(HelpMessage = 'Server version.')]
105-
[ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.PostgreSql.Support.ServerVersion])]
105+
[Microsoft.Azure.PowerShell.Cmdlets.PostgreSql.PSArgumentCompleterAttribute("9.5", "9.6", "10", "10.0", "10.2", "11", "13", "12")]
106106
[Microsoft.Azure.PowerShell.Cmdlets.PostgreSql.Category('Body')]
107-
[Microsoft.Azure.PowerShell.Cmdlets.PostgreSql.Support.ServerVersion]
107+
[System.String]
108108
${Version},
109109

110110
[Parameter(HelpMessage = 'The id of an existing private dns zone. You can use the
@@ -289,17 +289,17 @@ function New-AzPostgreSqlFlexibleServer {
289289

290290
if ($PSBoundParameters.ContainsKey('HaEnabled')){
291291
if ($PSBoundParameters["HaEnabled"] -eq "Enabled"){
292-
$PSBoundParameters.HighAvailabilityMode = [Microsoft.Azure.PowerShell.Cmdlets.PostgreSql.Support.HighAvailabilityMode]::ZoneRedundant
292+
$PSBoundParameters.HighAvailabilityMode = 'ZoneRedundant'
293293
}
294294
else {
295-
$PSBoundParameters.HighAvailabilityMode = [Microsoft.Azure.PowerShell.Cmdlets.PostgreSql.Support.HighAvailabilityMode]::Disabled
295+
$PSBoundParameters.HighAvailabilityMode = 'Disabled'
296296
}
297297
$null = $PSBoundParameters.Remove('HaEnabled')
298298
}
299299

300300

301301

302-
$PSBoundParameters.CreateMode = [Microsoft.Azure.PowerShell.Cmdlets.PostgreSql.Support.CreateMode]::Default
302+
$PSBoundParameters.CreateMode = 'Default'
303303

304304
# Handling Vnet & Subnet
305305
$NetworkKeys = 'PublicAccess', 'Subnet', 'Vnet', 'SubnetPrefix', 'VnetPrefix', 'PrivateDnsZone'

src/PostgreSql/PostgreSql.Autorest/custom/New-AzPostgreSqlFlexibleServerFirewallRule.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Creates a new firewall rule or updates an existing firewall rule.
2020
Creates a new firewall rule or updates an existing firewall rule.
2121
#>
2222
function New-AzPostgreSqlFlexibleServerFirewallRule {
23-
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.PostgreSql.Models.Api20171201.IFirewallRule])]
23+
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.PostgreSql.Models.IFirewallRule])]
2424
[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
2525
param(
2626
[Parameter()]

0 commit comments

Comments
 (0)