-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Migrate Storage from swagger to TypeSpec #35403
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
Merged
Merged
Changes from 99 commits
Commits
Show all changes
131 commits
Select commit
Hold shift + click to select a range
83b718b
converted
welovej 2a81dd8
update
welovej 4e73469
update
welovej b923d8e
run prettier
welovej 2980314
update
welovej 3239241
Merge remote-tracking branch 'upstream/main' into TspMig-storage
welovej 325f093
remove old example files
welovej 9ec95a5
include new example files in TSP directory
welovej cf387fa
update
welovej 42578ba
update
welovej 72449b3
update
welovej 8e9aca1
Update models.tsp
welovej 3ee84f0
recover readme.md
welovej 1b9c595
array element length constraint
welovej ff1b74e
recovery of previous spec files
welovej 3615493
Update tspconfig.yaml
welovej b281c73
Merge remote-tracking branch 'upstream/main' into TspMig-storage
welovej fc7d52c
update
welovej 68ec631
update
welovej 5e9079e
update for {subscription-id} to 00000000-0000-0000-0000-000000000000
welovej 4c4b6f5
update
welovej 3314ce6
update
welovej 1af72b1
etag mv fix
welovej 227f1eb
Update BlobContainersList.json
welovej c931ac2
Update BlobContainersList.json
welovej af69d22
format uri fix
welovej 58e1112
update
welovej ff20b07
update
welovej 283bcc8
fix etag not eTag
welovej 78f3a4e
fix optional body
welovej 77d944e
update
welovej 53fa1a4
update
welovej fd42a47
Merge remote-tracking branch 'upstream/main' into TspMig-storage
welovej 46be581
fix for ProvisioningState
welovej 6ac1ec6
update
welovej 5ab4dbd
update
welovej 48766dc
adopt the ErrorResponse with the local defined one.
welovej d6585ef
update
7cbf7a1
fix AAO and location header for StorageTaskAssignments_Delete / Stor…
welovej 1e9dd49
fix for OverrideErrorType
welovej 665d78b
fix optional body
welovej 733f679
Update ImmutabilityPolicy.tsp
welovej 01321cb
Update tspconfig.yaml
weidongxu-microsoft b43b6aa
Merge branch 'main' into TspMig-storage
welovej 09992b9
Update ImmutabilityPolicy.tsp
welovej 5ca9464
update
welovej 48a5ae8
update
welovej f59f761
remove @operationId decorate
welovej a843019
update
welovej f42aa8f
fix warning for clientLocation
welovej 7c74dd3
update
d023fbd
Update client.tsp
welovej e41752f
Update main.tsp
welovej 28f48ca
fix
welovej a293e1d
Merge remote-tracking branch 'upstream/main' into TspMig-storage
welovej c6546c2
deleted in the fix #36084
welovej 1cc6fcc
fix
welovej 3e928dc
addted example files
welovej 4f08275
update
welovej ebb0d4d
formatted
welovej be77fc7
update
welovej 262bc5a
update
welovej 2ff69af
update
welovej c9a74f5
update
welovej 5451951
Update Java service-dir after package split
XiaofeiCao 70715f3
fix as new pagination way
welovej 0e60be2
Merge remote-tracking branch 'upstream/main' into TspMig-storage
welovej ebab090
Fix: "x-ms-external": true
welovej b0d15e2
update
welovej af8700b
update
welovej de5beed
Revert "update"
welovej 438b4eb
Revert "update"
welovej acc5149
Merge remote-tracking branch 'upstream/main' into TspMig-storage
welovej 42585ad
Merge branch 'main' into TspMig-storage
welovej 49669f3
Fix Request model
welovej cbc28e7
update for PR #36668
welovej eff0ee4
update
welovej 457fff2
resolve breaking
v-jiaodi 5ab9601
Merge branch 'TspMig-storage' of https://github.com/welovej/azure-res…
v-jiaodi 90b16fa
fix go
08e173c
fix go
014cc49
update
welovej 6b23c47
update
welovej 2006c87
Merge branch 'main' into TspMig-storage
tadelesh ac1a21e
Update back-compatible.tsp
welovej f4e3e5b
Merge branch 'TspMig-storage' of https://github.com/welovej/azure-res…
welovej 16a9b32
Update tspconfig.yaml
welovej fa94674
Update models.tsp
welovej 55643f5
java configurations
XiaofeiCao a865956
update
welovej fdb823f
Merge remote-tracking branch 'upstream/main' into TspMig-storage
welovej 3d5119b
update
welovej 4925117
Update client.tsp
welovej 99e8e15
Update tspconfig.yaml
welovej 5d5bf11
update
welovej 0be552c
etag for java
XiaofeiCao e518019
update client name for python
msyyc 062408e
override for java
XiaofeiCao bd46040
format
XiaofeiCao 5b812a2
update
welovej cdf4f20
Update client.tsp
tadelesh 2bbcc9a
Update tspconfig.yaml
welovej 8846c24
Update tspconfig.yaml
welovej 8ced32f
Merge remote-tracking branch 'upstream/main' into TspMig-storage
welovej cf461c7
recovery of version 2025-01-01
welovej 6c06934
update
welovej 5c8fd97
delete examples of xx.Management of 2025-01-01
welovej 905582c
add examples to Tsp of 2025-06-01
welovej 2a581e8
examples of swagger after run tsp compile .
welovej 84f7a1c
Update models.tsp
welovej af9a540
Update openapi.json
welovej db26fcc
resolve warnings
welovej fe53093
fix customAzureResource
welovej c2f5ce7
update
welovej e5231fa
rename common type Resource
v-jiaodi 3bcf47e
update
v-jiaodi 2f9afb9
update
v-jiaodi 1e81a27
update
v-jiaodi 632da2f
update IntervalUnit
v-jiaodi e6dc138
Revert "update IntervalUnit"
v-jiaodi 1daaef0
Merge branch 'main' into TspMig-storage
msyyc 8fc0807
Add Python to clientName for DeletedAccounts
msyyc f9c5bb9
fix: IntervalUnit
welovej 4a7b6b0
Merge branch 'TspMig-storage' of https://github.com/welovej/azure-res…
welovej 7d7b758
Update client.tsp
welovej 798219e
Update StorageTaskAssignment.tsp
welovej fee759f
add config for python
msyyc bcd2c8f
add config for python
msyyc bee96eb
add config for python
msyyc 32f8ca6
Merge branch 'main' into TspMig-storage
pshao25 294bc28
Update back-compatible.tsp
welovej File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
129 changes: 129 additions & 0 deletions
129
specification/storage/Storage.Management/BlobContainer.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,129 @@ | ||
| import "@azure-tools/typespec-azure-core"; | ||
| import "@azure-tools/typespec-azure-resource-manager"; | ||
| import "@typespec/openapi"; | ||
| import "@typespec/rest"; | ||
| import "./models.tsp"; | ||
| import "./BlobServiceProperties.tsp"; | ||
|
|
||
| using TypeSpec.Rest; | ||
| using Azure.ResourceManager; | ||
| using TypeSpec.Http; | ||
| using TypeSpec.OpenAPI; | ||
|
|
||
| namespace Microsoft.Storage; | ||
| /** | ||
| * Properties of the blob container, including Id, resource name, resource type, Etag. | ||
| */ | ||
| @parentResource(BlobServiceProperties) | ||
| model BlobContainer | ||
| is Azure.ResourceManager.ProxyResource<ContainerProperties> { | ||
| ...ResourceNameParameter< | ||
| Resource = BlobContainer, | ||
| KeyName = "containerName", | ||
| SegmentName = "containers", | ||
| NamePattern = "" | ||
| >; | ||
|
|
||
| /** | ||
| * Resource Etag. | ||
| */ | ||
| #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
| @visibility(Lifecycle.Read) | ||
| etag?: string; | ||
| } | ||
|
|
||
| @armResourceOperations | ||
| interface BlobContainers { | ||
| /** | ||
| * Gets properties of a specified container. | ||
| */ | ||
| get is ArmResourceRead<BlobContainer, Error = ErrorResponse>; | ||
|
|
||
| /** | ||
| * Creates a new container under the specified account as described by request body. The container resource includes metadata and properties for that container. It does not include a list of the blobs contained by the container. | ||
| */ | ||
| create is ArmResourceCreateOrReplaceSync< | ||
| BlobContainer, | ||
| Error = ErrorResponse | ||
| >; | ||
|
|
||
| /** | ||
| * Updates container properties as specified in request body. Properties not mentioned in the request will be unchanged. Update fails if the specified container doesn't already exist. | ||
| */ | ||
| @patch(#{ implicitOptionality: false }) | ||
| update is ArmCustomPatchSync< | ||
| BlobContainer, | ||
| PatchModel = BlobContainer, | ||
| Error = ErrorResponse | ||
| >; | ||
|
|
||
| /** | ||
| * Deletes specified container under its account. | ||
| */ | ||
| delete is ArmResourceDeleteSync<BlobContainer, Error = ErrorResponse>; | ||
|
|
||
| /** | ||
| * Sets legal hold tags. Setting the same tag results in an idempotent operation. SetLegalHold follows an append pattern and does not clear out the existing tags that are not specified in the request. | ||
| */ | ||
| setLegalHold is ArmResourceActionSync< | ||
| BlobContainer, | ||
| LegalHold, | ||
| ArmResponse<LegalHold>, | ||
| Error = ErrorResponse | ||
| >; | ||
|
|
||
| /** | ||
| * Clears legal hold tags. Clearing the same or non-existent tag results in an idempotent operation. ClearLegalHold clears out only the specified tags in the request. | ||
| */ | ||
| clearLegalHold is ArmResourceActionSync< | ||
| BlobContainer, | ||
| LegalHold, | ||
| ArmResponse<LegalHold>, | ||
| Error = ErrorResponse | ||
| >; | ||
|
|
||
| /** | ||
| * The Lease Container operation establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. | ||
| */ | ||
| lease is ArmResourceActionSync< | ||
| BlobContainer, | ||
| LeaseContainerRequest, | ||
| ArmResponse<LeaseContainerResponse>, | ||
| Error = ErrorResponse, | ||
| OptionalRequestBody = true | ||
| >; | ||
|
|
||
| /** | ||
| * This operation migrates a blob container from container level WORM to object level immutability enabled container. Prerequisites require a container level immutability policy either in locked or unlocked state, Account level versioning must be enabled and there should be no Legal hold on the container. | ||
| */ | ||
| @action("migrate") | ||
| objectLevelWorm is ArmResourceActionAsync< | ||
| BlobContainer, | ||
| void, | ||
| { | ||
| @body body: void; | ||
| }, | ||
| Error = CloudError, | ||
| LroHeaders = Azure.Core.Foundations.RetryAfterHeader & | ||
| ArmLroLocationHeader<FinalResult = void> | ||
| >; | ||
| } | ||
|
|
||
| @@maxLength(BlobContainer.name, 63); | ||
| @@minLength(BlobContainer.name, 3); | ||
| @@doc(BlobContainer.name, | ||
| "The name of the blob container within the specified storage account. Blob container names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number." | ||
| ); | ||
| @@doc(BlobContainer.properties, "Properties of the blob container."); | ||
| @@doc(BlobContainers.create::parameters.resource, | ||
| "Properties of the blob container to create." | ||
| ); | ||
| @@doc(BlobContainers.update::parameters.properties, | ||
| "Properties to update for the blob container." | ||
| ); | ||
| @@doc(BlobContainers.setLegalHold::parameters.body, | ||
| "The LegalHold property that will be set to a blob container." | ||
| ); | ||
| @@doc(BlobContainers.clearLegalHold::parameters.body, | ||
| "The LegalHold property that will be clear from a blob container." | ||
| ); | ||
69 changes: 69 additions & 0 deletions
69
specification/storage/Storage.Management/BlobInventoryPolicy.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,69 @@ | ||
| import "@azure-tools/typespec-azure-core"; | ||
| import "@azure-tools/typespec-azure-resource-manager"; | ||
| import "@typespec/openapi"; | ||
| import "@typespec/rest"; | ||
| import "./models.tsp"; | ||
| import "./StorageAccount.tsp"; | ||
|
|
||
| using TypeSpec.Rest; | ||
| using Azure.ResourceManager; | ||
| using TypeSpec.Http; | ||
| using TypeSpec.OpenAPI; | ||
|
|
||
| namespace Microsoft.Storage; | ||
| /** | ||
| * The storage account blob inventory policy. | ||
| */ | ||
| @parentResource(StorageAccount) | ||
| model BlobInventoryPolicy | ||
| is Azure.ResourceManager.ProxyResource<BlobInventoryPolicyProperties> { | ||
| ...ResourceNameParameter< | ||
| Resource = BlobInventoryPolicy, | ||
| KeyName = "blobInventoryPolicyName", | ||
| SegmentName = "inventoryPolicies", | ||
| NamePattern = "", | ||
| Type = BlobInventoryPolicyName | ||
| >; | ||
| } | ||
|
|
||
| @armResourceOperations | ||
| interface BlobInventoryPolicies { | ||
| /** | ||
| * Gets the blob inventory policy associated with the specified storage account. | ||
| */ | ||
| get is ArmResourceRead<BlobInventoryPolicy, Error = CloudError>; | ||
|
|
||
| /** | ||
| * Sets the blob inventory policy to the specified storage account. | ||
| */ | ||
| #suppress "@azure-tools/typespec-azure-resource-manager/arm-put-operation-response-codes" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
| createOrUpdate is ArmResourceCreateOrReplaceSync< | ||
| BlobInventoryPolicy, | ||
| Response = ArmResourceUpdatedResponse<BlobInventoryPolicy>, | ||
| Error = CloudError | ||
| >; | ||
|
|
||
| /** | ||
| * Deletes the blob inventory policy associated with the specified storage account. | ||
| */ | ||
| delete is ArmResourceDeleteSync<BlobInventoryPolicy, Error = CloudError>; | ||
|
|
||
| /** | ||
| * Gets the blob inventory policy associated with the specified storage account. | ||
| */ | ||
| list is ArmResourceListByParent< | ||
| BlobInventoryPolicy, | ||
| Response = ArmResponse<ListBlobInventoryPolicy>, | ||
| Error = ErrorResponse | ||
| >; | ||
| } | ||
|
|
||
| @@doc(BlobInventoryPolicy.name, | ||
| "The name of the storage account blob inventory policy. It should always be 'default'" | ||
| ); | ||
| @@doc(BlobInventoryPolicy.properties, | ||
| "Returns the storage account blob inventory policy rules." | ||
| ); | ||
| @@doc(BlobInventoryPolicies.createOrUpdate::parameters.resource, | ||
| "The blob inventory policy set to a storage account." | ||
| ); |
105 changes: 105 additions & 0 deletions
105
specification/storage/Storage.Management/BlobServiceProperties.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,105 @@ | ||
| import "@azure-tools/typespec-azure-core"; | ||
| import "@azure-tools/typespec-azure-resource-manager"; | ||
| import "@typespec/openapi"; | ||
| import "@typespec/rest"; | ||
| import "./models.tsp"; | ||
| import "./StorageAccount.tsp"; | ||
|
|
||
| using TypeSpec.Rest; | ||
| using Azure.ResourceManager; | ||
| using TypeSpec.Http; | ||
| using TypeSpec.OpenAPI; | ||
|
|
||
| namespace Microsoft.Storage; | ||
| /** | ||
| * The properties of a storage account’s Blob service. | ||
| */ | ||
| @singleton("default") | ||
| @parentResource(StorageAccount) | ||
| model BlobServiceProperties | ||
| is Azure.ResourceManager.ProxyResource<BlobServicePropertiesProperties> { | ||
| ...ResourceNameParameter< | ||
| Resource = BlobServiceProperties, | ||
| KeyName = "blobService", | ||
| SegmentName = "blobServices", | ||
| NamePattern = "" | ||
| >; | ||
|
|
||
| /** | ||
| * Sku name and tier. | ||
| */ | ||
| #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
| @visibility(Lifecycle.Read) | ||
| sku?: Sku; | ||
| } | ||
|
|
||
| #suppress "@azure-tools/typespec-azure-resource-manager/no-resource-delete-operation" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
| @armResourceOperations | ||
| interface BlobServices { | ||
| /** | ||
| * Gets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. | ||
| */ | ||
| getServiceProperties is ArmResourceRead< | ||
| BlobServiceProperties, | ||
| Error = ErrorResponse | ||
| >; | ||
|
|
||
| /** | ||
| * Sets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. | ||
| */ | ||
| #suppress "@azure-tools/typespec-azure-resource-manager/arm-put-operation-response-codes" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
| setServiceProperties is ArmResourceCreateOrReplaceSync< | ||
| BlobServiceProperties, | ||
| Response = ArmResourceUpdatedResponse<BlobServiceProperties>, | ||
| Error = ErrorResponse | ||
| >; | ||
|
|
||
| /** | ||
| * List blob services of storage account. It returns a collection of one object named default. | ||
| */ | ||
| list is ArmResourceListByParent< | ||
| BlobServiceProperties, | ||
| Response = ArmResponse<BlobServiceItems>, | ||
| Error = ErrorResponse | ||
| >; | ||
|
|
||
| /** | ||
| * Lists all containers and does not support a prefix like data plane. Also SRP today does not return continuation token. | ||
| */ | ||
| @get | ||
| @list | ||
| @action("containers") | ||
| blobContainersList is ArmResourceActionSync< | ||
| BlobServiceProperties, | ||
| void, | ||
| ArmResponse<ListContainerItems>, | ||
| Parameters = { | ||
| /** | ||
| * Optional. Specified maximum number of containers that can be included in the list. | ||
| */ | ||
| @query("$maxpagesize") | ||
| $maxpagesize?: string; | ||
|
|
||
| /** | ||
| * Optional. When specified, only container names starting with the filter will be listed. | ||
| */ | ||
| @query("$filter") | ||
| $filter?: string; | ||
|
|
||
| /** | ||
| * Optional, used to include the properties for soft deleted blob containers. | ||
| */ | ||
| @query("$include") | ||
| $include?: ListContainersInclude; | ||
| }, | ||
| Error = ErrorResponse | ||
| >; | ||
| } | ||
|
|
||
| @@doc(BlobServiceProperties.name, ""); | ||
| @@doc(BlobServiceProperties.properties, | ||
| "The properties of a storage account’s Blob service." | ||
| ); | ||
| @@doc(BlobServices.setServiceProperties::parameters.resource, | ||
| "The properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules." | ||
| ); |
43 changes: 43 additions & 0 deletions
43
specification/storage/Storage.Management/DeletedAccount.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,43 @@ | ||
| import "@azure-tools/typespec-azure-core"; | ||
| import "@azure-tools/typespec-azure-resource-manager"; | ||
| import "@typespec/openapi"; | ||
| import "@typespec/rest"; | ||
| import "./models.tsp"; | ||
|
|
||
| using TypeSpec.Rest; | ||
| using Azure.ResourceManager; | ||
| using TypeSpec.Http; | ||
| using TypeSpec.OpenAPI; | ||
|
|
||
| namespace Microsoft.Storage; | ||
| /** | ||
| * Deleted storage account | ||
| */ | ||
| @subscriptionResource | ||
| @parentResource(SubscriptionLocationResource) | ||
| model DeletedAccount | ||
| is Azure.ResourceManager.ProxyResource<DeletedAccountProperties> { | ||
| ...ResourceNameParameter< | ||
| Resource = DeletedAccount, | ||
| KeyName = "deletedAccountName", | ||
| SegmentName = "deletedAccounts", | ||
| NamePattern = "" | ||
| >; | ||
| } | ||
|
|
||
| @armResourceOperations | ||
| interface DeletedAccounts { | ||
| /** | ||
| * Get properties of specified deleted account resource. | ||
| */ | ||
| get is ArmResourceRead< | ||
| DeletedAccount, | ||
| BaseParameters = Azure.ResourceManager.Foundations.SubscriptionBaseParameters, | ||
| Error = ErrorResponse | ||
| >; | ||
|
XiaofeiCao marked this conversation as resolved.
|
||
| } | ||
|
|
||
| @@maxLength(DeletedAccount.name, 24); | ||
| @@minLength(DeletedAccount.name, 3); | ||
| @@doc(DeletedAccount.name, "Name of the deleted storage account."); | ||
| @@doc(DeletedAccount.properties, "Properties of the deleted account."); | ||
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.