-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Migrate PostgreSql to TypeSpec #36556
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
mcgallan
wants to merge
35
commits into
Azure:main
Choose a base branch
from
mcgallan:convert-dbforpostgressql
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 27 commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
b675ffe
convert
mcgallan b241f30
compile
mcgallan 3503187
diff
mcgallan 4344680
update
mcgallan 00e11dc
Merge remote-tracking branch 'upstream/main' into convert-dbforpostgr…
mcgallan 62a8f6d
update
mcgallan 2a4aff0
update
mcgallan dbbf5e3
Merge remote-tracking branch 'upstream/main' into convert-dbforpostgr…
mcgallan 0d7e561
Merge remote-tracking branch 'upstream/main' into convert-dbforpostgr…
mcgallan a7a2bfa
update
mcgallan 4d1759f
update
mcgallan b56652a
foramt update
mcgallan 14e5f5b
update spell check
mcgallan f60e2ab
Merge remote-tracking branch 'upstream/main' into convert-dbforpostgr…
mcgallan c8feeaa
update
mcgallan 553655f
delete operationid
mcgallan adfe878
delete diff folder
mcgallan 9f91a9f
update tspconfig
mcgallan 038be54
update
mcgallan 5842903
update readme
mcgallan 5534cd5
Merge branch 'main' into convert-dbforpostgressql
mcgallan 36332ae
remove consumes
mcgallan 85dd257
fix empty files
mcgallan ffd460b
Merge remote-tracking branch 'upstream/main' into convert-dbforpostgr…
mcgallan f76048e
update
mcgallan b3521dc
Merge branch 'main' into convert-dbforpostgressql
mcgallan 8571851
update PrivateEndpointConnection.tsp
mcgallan 8a22137
Merge branch 'main' into convert-dbforpostgressql
mcgallan 70f5ef6
remove Foundations.ArmCreateOperation in AdministratorMicrosoftEntra
mcgallan 0b5d994
remove legacy.tsp
mcgallan c3adb5f
fix
mcgallan 72a2dfe
update tspconfig
mcgallan 37a0c23
fix description and headers
mcgallan fbcb2a4
delete
mcgallan 300668a
remove private decorator
mcgallan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
77 changes: 77 additions & 0 deletions
77
specification/postgresql/DBforPostgreSQL.Management/AdministratorMicrosoftEntra.tsp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import "@azure-tools/typespec-azure-core"; | ||
import "@azure-tools/typespec-azure-resource-manager"; | ||
import "@typespec/openapi"; | ||
import "@typespec/rest"; | ||
import "./models.tsp"; | ||
import "./Server.tsp"; | ||
|
||
using TypeSpec.Rest; | ||
using Azure.ResourceManager; | ||
using TypeSpec.Http; | ||
using TypeSpec.OpenAPI; | ||
|
||
namespace Microsoft.DBforPostgreSQL; | ||
/** | ||
* Server administrator associated to a Microsoft Entra principal. | ||
*/ | ||
@parentResource(Server) | ||
model AdministratorMicrosoftEntra | ||
is Azure.ResourceManager.ProxyResource< | ||
AdministratorMicrosoftEntraProperties, | ||
false | ||
> { | ||
...ResourceNameParameter< | ||
Resource = AdministratorMicrosoftEntra, | ||
KeyName = "objectId", | ||
SegmentName = "administrators", | ||
NamePattern = "" | ||
>; | ||
} | ||
|
||
@armResourceOperations | ||
interface AdministratorMicrosoftEntras { | ||
/** | ||
* Gets information about a server administrator associated to a Microsoft Entra principal. | ||
*/ | ||
get is ArmResourceRead<AdministratorMicrosoftEntra>; | ||
|
||
/** | ||
* Creates a new server administrator associated to a Microsoft Entra principal. | ||
*/ | ||
@Azure.Core.useFinalStateVia("azure-async-operation") | ||
@put | ||
createOrUpdate is Azure.ResourceManager.Foundations.ArmCreateOperation< | ||
ResourceInstanceParameters< | ||
AdministratorMicrosoftEntra, | ||
Azure.ResourceManager.Foundations.DefaultBaseParameters<AdministratorMicrosoftEntra> | ||
>, | ||
AdministratorMicrosoftEntraAdd, | ||
Response = ArmAcceptedLroResponse<LroHeaders = ArmAsyncOperationHeader & | ||
ArmLroLocationHeader & | ||
Azure.Core.Foundations.RetryAfterHeader>, | ||
ErrorResponse = ErrorResponse | ||
>; | ||
|
||
/** | ||
* Deletes an existing server administrator associated to a Microsoft Entra principal. | ||
*/ | ||
delete is ArmResourceDeleteWithoutOkAsync<AdministratorMicrosoftEntra>; | ||
|
||
/** | ||
* List all server administrators associated to a Microsoft Entra principal. | ||
*/ | ||
listByServer is ArmResourceListByParent< | ||
AdministratorMicrosoftEntra, | ||
Response = ArmResponse<AdministratorMicrosoftEntraList> | ||
>; | ||
} | ||
|
||
@@doc(AdministratorMicrosoftEntra.name, | ||
"Object identifier of the Microsoft Entra principal." | ||
); | ||
@@doc(AdministratorMicrosoftEntra.properties, | ||
"Properties of a server administrator associated to a Microsoft Entra principal." | ||
); | ||
@@doc(AdministratorMicrosoftEntras.createOrUpdate::parameters.resource, | ||
"Required parameters for adding a server administrator associated to a Microsoft Entra principal." | ||
); |
66 changes: 66 additions & 0 deletions
66
...ification/postgresql/DBforPostgreSQL.Management/AdvancedThreatProtectionSettingsModel.tsp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import "@azure-tools/typespec-azure-core"; | ||
import "@azure-tools/typespec-azure-resource-manager"; | ||
import "@typespec/openapi"; | ||
import "@typespec/rest"; | ||
import "./models.tsp"; | ||
import "./Server.tsp"; | ||
|
||
using TypeSpec.Rest; | ||
using Azure.ResourceManager; | ||
using TypeSpec.Http; | ||
using TypeSpec.OpenAPI; | ||
|
||
namespace Microsoft.DBforPostgreSQL; | ||
/** | ||
* Advanced threat protection settings of the server. | ||
*/ | ||
@parentResource(Server) | ||
model AdvancedThreatProtectionSettingsModel | ||
is Azure.ResourceManager.ProxyResource<AdvancedThreatProtectionSettingsProperties> { | ||
...ResourceNameParameter< | ||
Resource = AdvancedThreatProtectionSettingsModel, | ||
KeyName = "threatProtectionName", | ||
SegmentName = "advancedThreatProtectionSettings", | ||
NamePattern = "", | ||
Type = ThreatProtectionName | ||
>; | ||
} | ||
|
||
#suppress "@azure-tools/typespec-azure-resource-manager/no-resource-delete-operation" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
@armResourceOperations | ||
interface AdvancedThreatProtectionSettingsModels { | ||
/** | ||
* Gets state of advanced threat protection settings for a server. | ||
*/ | ||
get is ArmResourceRead<AdvancedThreatProtectionSettingsModel>; | ||
|
||
/** | ||
* Creates or updates a server's Advanced Threat Protection settings. | ||
*/ | ||
#suppress "@azure-tools/typespec-azure-resource-manager/arm-put-operation-response-codes" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
@Azure.Core.useFinalStateVia("azure-async-operation") | ||
createOrUpdate is ArmResourceCreateOrReplaceAsync< | ||
AdvancedThreatProtectionSettingsModel, | ||
Response = ArmAcceptedLroResponse<LroHeaders = ArmAsyncOperationHeader & | ||
ArmLroLocationHeader & | ||
Azure.Core.Foundations.RetryAfterHeader> | ||
>; | ||
|
||
/** | ||
* Lists state of advanced threat protection settings for a server. | ||
*/ | ||
listByServer is ArmResourceListByParent< | ||
AdvancedThreatProtectionSettingsModel, | ||
Response = ArmResponse<AdvancedThreatProtectionSettingsList> | ||
>; | ||
} | ||
|
||
@@doc(AdvancedThreatProtectionSettingsModel.name, | ||
"Name of the advanced threat protection settings." | ||
); | ||
@@doc(AdvancedThreatProtectionSettingsModel.properties, | ||
"Advanced threat protection properties." | ||
); | ||
@@doc(AdvancedThreatProtectionSettingsModels.createOrUpdate::parameters.resource, | ||
"The Advanced Threat Protection state for the server." | ||
); |
66 changes: 66 additions & 0 deletions
66
specification/postgresql/DBforPostgreSQL.Management/BackupAutomaticAndOnDemand.tsp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import "@azure-tools/typespec-azure-core"; | ||
import "@azure-tools/typespec-azure-resource-manager"; | ||
import "@typespec/openapi"; | ||
import "@typespec/rest"; | ||
import "./models.tsp"; | ||
import "./Server.tsp"; | ||
import "./legacy.tsp"; | ||
|
||
using TypeSpec.Rest; | ||
using Azure.ResourceManager; | ||
using TypeSpec.Http; | ||
using TypeSpec.OpenAPI; | ||
|
||
namespace Microsoft.DBforPostgreSQL; | ||
/** | ||
* Properties of a backup. | ||
*/ | ||
@parentResource(Server) | ||
model BackupAutomaticAndOnDemand | ||
is Azure.ResourceManager.ProxyResource<BackupAutomaticAndOnDemandProperties> { | ||
...ResourceNameParameter< | ||
Resource = BackupAutomaticAndOnDemand, | ||
KeyName = "backupName", | ||
SegmentName = "backups", | ||
NamePattern = "^[-\\w\\._]+$" | ||
>; | ||
} | ||
|
||
@armResourceOperations | ||
interface BackupAutomaticAndOnDemands { | ||
/** | ||
* Gets information of an on demand backup, given its name. | ||
*/ | ||
get is ArmResourceRead<BackupAutomaticAndOnDemand>; | ||
|
||
// FIXME: (ArmResourceCreateOrReplace): ArmResourceCreateOrReplaceAsync/ArmResourceCreateOrReplaceSync should have a body parameter. | ||
/** | ||
* Creates an on demand backup of a server. | ||
*/ | ||
#suppress "@azure-tools/typespec-azure-resource-manager/arm-put-operation-response-codes" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
@Azure.Core.useFinalStateVia("azure-async-operation") | ||
create is CustomArmResourceCreateOrReplaceAsync< | ||
mcgallan marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
BackupAutomaticAndOnDemand, | ||
Response = ArmAcceptedLroResponse<LroHeaders = ArmAsyncOperationHeader & | ||
ArmLroLocationHeader & | ||
Azure.Core.Foundations.RetryAfterHeader> | ||
>; | ||
|
||
/** | ||
* Deletes a specific backup, given its name. | ||
*/ | ||
delete is ArmResourceDeleteWithoutOkAsync<BackupAutomaticAndOnDemand>; | ||
|
||
/** | ||
* Lists all available backups of a server. | ||
*/ | ||
listByServer is ArmResourceListByParent< | ||
BackupAutomaticAndOnDemand, | ||
Response = ArmResponse<BackupAutomaticAndOnDemandList> | ||
>; | ||
} | ||
|
||
@@maxLength(BackupAutomaticAndOnDemand.name, 128); | ||
@@minLength(BackupAutomaticAndOnDemand.name, 1); | ||
@@doc(BackupAutomaticAndOnDemand.name, "Name of the backup."); | ||
@@doc(BackupAutomaticAndOnDemand.properties, "Properties of a backup."); |
49 changes: 49 additions & 0 deletions
49
specification/postgresql/DBforPostgreSQL.Management/BackupsLongTermRetentionOperation.tsp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import "@azure-tools/typespec-azure-core"; | ||
import "@azure-tools/typespec-azure-resource-manager"; | ||
import "@typespec/openapi"; | ||
import "@typespec/rest"; | ||
import "./models.tsp"; | ||
import "./Server.tsp"; | ||
|
||
using TypeSpec.Rest; | ||
using Azure.ResourceManager; | ||
using TypeSpec.Http; | ||
using TypeSpec.OpenAPI; | ||
|
||
namespace Microsoft.DBforPostgreSQL; | ||
/** | ||
* Response for the LTR backup Operation API call | ||
*/ | ||
@parentResource(Server) | ||
model BackupsLongTermRetentionOperation | ||
is Azure.ResourceManager.ProxyResource<LtrBackupOperationResponseProperties> { | ||
...ResourceNameParameter< | ||
Resource = BackupsLongTermRetentionOperation, | ||
KeyName = "backupName", | ||
SegmentName = "ltrBackupOperations", | ||
NamePattern = "^[-\\w\\._]+$" | ||
>; | ||
} | ||
|
||
@armResourceOperations | ||
interface BackupsLongTermRetentionOperations { | ||
/** | ||
* Gets the results of a long retention backup operation for a server. | ||
*/ | ||
get is ArmResourceRead<BackupsLongTermRetentionOperation>; | ||
|
||
/** | ||
* Lists the results of the long term retention backup operations for a server. | ||
*/ | ||
listByServer is ArmResourceListByParent< | ||
BackupsLongTermRetentionOperation, | ||
Response = ArmResponse<LtrServerBackupOperationList> | ||
>; | ||
} | ||
|
||
@@doc(BackupsLongTermRetentionOperation.name, "The name of the backup."); | ||
@@doc(BackupsLongTermRetentionOperation.properties, | ||
"Long Term Retention Backup Operation Resource Properties" | ||
); | ||
@@minLength(BackupsLongTermRetentionOperation.name, 1); | ||
@@maxLength(BackupsLongTermRetentionOperation.name, 128); |
89 changes: 89 additions & 0 deletions
89
specification/postgresql/DBforPostgreSQL.Management/Configuration.tsp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
import "@azure-tools/typespec-azure-core"; | ||
import "@azure-tools/typespec-azure-resource-manager"; | ||
import "@typespec/openapi"; | ||
import "@typespec/rest"; | ||
import "./models.tsp"; | ||
import "./Server.tsp"; | ||
|
||
using TypeSpec.Rest; | ||
using Azure.ResourceManager; | ||
using TypeSpec.Http; | ||
using TypeSpec.OpenAPI; | ||
using Azure.Core; | ||
|
||
namespace Microsoft.DBforPostgreSQL; | ||
/** | ||
* Configuration (also known as server parameter). | ||
*/ | ||
@parentResource(Server) | ||
model Configuration | ||
is Azure.ResourceManager.ProxyResource<ConfigurationProperties> { | ||
...ResourceNameParameter< | ||
Resource = Configuration, | ||
KeyName = "configurationName", | ||
SegmentName = "configurations", | ||
NamePattern = "^[-\\w\\._]+$" | ||
>; | ||
} | ||
|
||
@armResourceOperations | ||
interface Configurations { | ||
/** | ||
* Gets information about a specific configuration (also known as server parameter) of a server. | ||
*/ | ||
get is ArmResourceRead<Configuration>; | ||
|
||
/** | ||
* Updates, using Put verb, the value assigned to a specific modifiable configuration (also known as server parameter) of a server. | ||
*/ | ||
#suppress "@azure-tools/typespec-azure-resource-manager/arm-put-operation-response-codes" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
@useFinalStateVia("azure-async-operation") | ||
@put | ||
put is Azure.ResourceManager.Foundations.ArmCreateOperation< | ||
mcgallan marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
ResourceInstanceParameters< | ||
Configuration, | ||
Azure.ResourceManager.Foundations.DefaultBaseParameters<Configuration> | ||
>, | ||
ConfigurationForUpdate, | ||
Response = ArmAcceptedLroResponse<LroHeaders = ArmAsyncOperationHeader & | ||
ArmLroLocationHeader & | ||
Azure.Core.Foundations.RetryAfterHeader>, | ||
ErrorResponse = ErrorResponse | ||
>; | ||
|
||
/** | ||
* Updates the value assigned to a specific modifiable configuration (also known as server parameter) of a server. | ||
*/ | ||
@patch(#{ implicitOptionality: false }) | ||
@useFinalStateVia("azure-async-operation") | ||
update is ArmCustomPatchAsync< | ||
Configuration, | ||
PatchModel = ConfigurationForUpdate, | ||
Response = ArmAcceptedLroResponse<LroHeaders = ArmAsyncOperationHeader & | ||
ArmLroLocationHeader & | ||
Azure.Core.Foundations.RetryAfterHeader> | ||
>; | ||
|
||
/** | ||
* Lists all configurations (also known as server parameters) of a server. | ||
*/ | ||
listByServer is ArmResourceListByParent< | ||
Configuration, | ||
Response = ArmResponse<ConfigurationList> | ||
>; | ||
} | ||
|
||
@@maxLength(Configuration.name, 256); | ||
@@minLength(Configuration.name, 1); | ||
@@doc(Configuration.name, | ||
"Name of the configuration (also known as server parameter)." | ||
); | ||
@@doc(Configuration.properties, | ||
"Properties of a configuration (also known as server parameter)." | ||
); | ||
@@doc(Configurations.put::parameters.resource, | ||
"Parameters required to update the value of a specific modifiable configuration (also known as server parameter)." | ||
); | ||
@@doc(Configurations.update::parameters.properties, | ||
"Parameters required to update the value of a specific modifiable configuration (also known as server parameter)." | ||
); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.