-
Notifications
You must be signed in to change notification settings - Fork 5.4k
[TSP Migration] Convert ElasticSan to TypeSpec #34078
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
+8,517
−2,805
Merged
Changes from all commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
0f7af6e
Convert ElsticSan to TypeSpec
6791f4d
update
f4418ed
Merge branch 'main' of https://github.com/Azure/azure-rest-api-specs …
8e86094
update
4b84071
update
27368ab
Fix properties order issue and fix pipeline error
melina5656 a508833
update
melina5656 e625c64
Merge branch 'main' into migration/elasticsan
melina5656 ff3a269
run prettier
melina5656 d35aa03
run prettier and compile
melina5656 06ca5f5
Merge branch 'main' into migration/elasticsan
melina5656 b316a4b
Merge branch 'main' of https://github.com/Azure/azure-rest-api-specs …
9459887
Update
a91b621
update
e143e2f
fix service-dir in tspconfig.yaml
XiaofeiCao ad8f172
Update tspconfig.yaml
kazrael2119 334edeb
update
dd563f6
Merge branch 'migration/elasticsan' of https://github.com/Azure/azure…
95e529b
Merge branch 'main' of https://github.com/Azure/azure-rest-api-specs …
fcc40fa
Delete conditionalClientFlatten
melina5656 653f00a
update
mcgallan 3833d5f
update
mcgallan a082654
update
mcgallan 8e68125
update examples
melina5656 44f44dc
Merge remote-tracking branch 'upstream/main' into migration/elasticsan
mcgallan 4d3858e
update
mcgallan 4297ffb
update
mcgallan dbe4242
Merge remote-tracking branch 'upstream/main' into migration/elasticsan
mcgallan acf885b
update
mcgallan 8fcbad5
update
mcgallan 8d5884d
update
69225b6
update
4cc897a
client tsp changes for csharp
ArcturusZhang 01e479d
add client changes for csharp
ArcturusZhang b887d55
format
ArcturusZhang 5e9b3a3
Merge branch 'main' into migration/elasticsan
ArcturusZhang f0d72db
Merge branch 'main' into migration/elasticsan
pshao25 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
90 changes: 90 additions & 0 deletions
90
specification/elasticsan/ElasticSan.Management/ElasticSan.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,90 @@ | ||
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.ElasticSan; | ||
/** | ||
* Response for ElasticSan request. | ||
*/ | ||
model ElasticSan | ||
is Azure.ResourceManager.TrackedResource<ElasticSanProperties, false> { | ||
...ResourceNameParameter< | ||
Resource = ElasticSan, | ||
KeyName = "elasticSanName", | ||
SegmentName = "elasticSans", | ||
NamePattern = "^[A-Za-z0-9]+((-|_)[a-z0-9A-Z]+)*$" | ||
>; | ||
} | ||
|
||
@armResourceOperations | ||
interface ElasticSans { | ||
/** | ||
* Get a ElasticSan. | ||
*/ | ||
get is ArmResourceRead<ElasticSan>; | ||
|
||
/** | ||
* Create ElasticSan. | ||
*/ | ||
create is ArmResourceCreateOrReplaceAsync< | ||
ElasticSan, | ||
LroHeaders = ArmLroLocationHeader<FinalResult = ElasticSan> & | ||
Azure.Core.Foundations.RetryAfterHeader | ||
>; | ||
|
||
/** | ||
* Update a Elastic San. | ||
*/ | ||
@patch(#{ implicitOptionality: false }) | ||
update is ArmCustomPatchAsync<ElasticSan, PatchModel = ElasticSanUpdate>; | ||
|
||
/** | ||
* Delete a Elastic San. | ||
*/ | ||
#suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
delete is ArmResourceDeleteWithoutOkAsync< | ||
ElasticSan, | ||
Response = ArmDeletedResponse | ArmDeleteAcceptedLroResponse | ArmDeletedNoContentResponse | ||
>; | ||
|
||
/** | ||
* Gets a list of ElasticSan in a resource group. | ||
*/ | ||
listByResourceGroup is ArmResourceListByParent< | ||
ElasticSan, | ||
Response = ArmResponse<ElasticSanList> | ||
>; | ||
|
||
/** | ||
* Gets a list of ElasticSans in a subscription | ||
*/ | ||
listBySubscription is ArmListBySubscription< | ||
ElasticSan, | ||
Response = ArmResponse<ElasticSanList> | ||
>; | ||
|
||
/** | ||
* Gets the private link resources that need to be created for a elastic San. | ||
*/ | ||
@get | ||
@action("privateLinkResources") | ||
listByElasticSan is ArmResourceActionSync< | ||
ElasticSan, | ||
void, | ||
ArmResponse<PrivateLinkResourceListResult> | ||
>; | ||
} | ||
|
||
@@maxLength(ElasticSan.name, 24); | ||
@@minLength(ElasticSan.name, 3); | ||
@@doc(ElasticSan.name, "The name of the ElasticSan."); | ||
@@doc(ElasticSan.properties, "Properties of ElasticSan."); | ||
@@doc(ElasticSans.create::parameters.resource, "Elastic San object."); | ||
@@doc(ElasticSans.update::parameters.properties, "Elastic San object."); |
70 changes: 70 additions & 0 deletions
70
specification/elasticsan/ElasticSan.Management/PrivateEndpointConnection.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,70 @@ | ||
import "@azure-tools/typespec-azure-core"; | ||
import "@azure-tools/typespec-azure-resource-manager"; | ||
import "@typespec/openapi"; | ||
import "@typespec/rest"; | ||
import "./models.tsp"; | ||
import "./ElasticSan.tsp"; | ||
|
||
using TypeSpec.Rest; | ||
using Azure.ResourceManager; | ||
using TypeSpec.Http; | ||
using TypeSpec.OpenAPI; | ||
|
||
namespace Microsoft.ElasticSan; | ||
/** | ||
* Response for PrivateEndpoint Connection object | ||
*/ | ||
@parentResource(ElasticSan) | ||
model PrivateEndpointConnection | ||
is Azure.ResourceManager.ProxyResource< | ||
PrivateEndpointConnectionProperties, | ||
false | ||
> { | ||
...ResourceNameParameter< | ||
Resource = PrivateEndpointConnection, | ||
KeyName = "privateEndpointConnectionName", | ||
SegmentName = "privateEndpointConnections", | ||
NamePattern = "" | ||
>; | ||
} | ||
|
||
@armResourceOperations | ||
interface PrivateEndpointConnections { | ||
/** | ||
* Gets the specified private endpoint connection associated with the Elastic San | ||
*/ | ||
get is ArmResourceRead<PrivateEndpointConnection>; | ||
|
||
/** | ||
* Update the state of specified private endpoint connection associated with the Elastic San | ||
*/ | ||
create is ArmResourceCreateOrReplaceAsync< | ||
PrivateEndpointConnection, | ||
LroHeaders = ArmLroLocationHeader<FinalResult = PrivateEndpointConnection> & | ||
Azure.Core.Foundations.RetryAfterHeader | ||
>; | ||
|
||
/** | ||
* Deletes the specified private endpoint connection associated with the Elastic San | ||
*/ | ||
#suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
delete is ArmResourceDeleteWithoutOkAsync< | ||
PrivateEndpointConnection, | ||
Response = ArmDeletedResponse | ArmDeleteAcceptedLroResponse | ArmDeletedNoContentResponse | ||
>; | ||
|
||
/** | ||
* List all Private Endpoint Connections associated with the Elastic San. | ||
*/ | ||
list is ArmResourceListByParent<PrivateEndpointConnection>; | ||
} | ||
|
||
@@doc(PrivateEndpointConnection.name, | ||
"The name of the Private Endpoint connection." | ||
); | ||
@@doc(PrivateEndpointConnection.properties, | ||
"Private Endpoint Connection Properties." | ||
); | ||
@@doc(PrivateEndpointConnections.create::parameters.resource, | ||
"Private Endpoint Connection Approval object." | ||
); |
75 changes: 75 additions & 0 deletions
75
specification/elasticsan/ElasticSan.Management/Snapshot.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,75 @@ | ||
import "@azure-tools/typespec-azure-core"; | ||
import "@azure-tools/typespec-azure-resource-manager"; | ||
import "@typespec/openapi"; | ||
import "@typespec/rest"; | ||
import "./models.tsp"; | ||
import "./VolumeGroup.tsp"; | ||
|
||
using TypeSpec.Rest; | ||
using Azure.ResourceManager; | ||
using TypeSpec.Http; | ||
using TypeSpec.OpenAPI; | ||
|
||
namespace Microsoft.ElasticSan; | ||
/** | ||
* Response for Volume Snapshot request. | ||
*/ | ||
@parentResource(VolumeGroup) | ||
model Snapshot | ||
is Azure.ResourceManager.ProxyResource<SnapshotProperties, false> { | ||
...ResourceNameParameter< | ||
Resource = Snapshot, | ||
KeyName = "snapshotName", | ||
SegmentName = "snapshots", | ||
NamePattern = "^[a-z0-9]+(?:[._-][a-z0-9]+)*$" | ||
>; | ||
} | ||
|
||
@armResourceOperations | ||
interface Snapshots { | ||
/** | ||
* Get a Volume Snapshot. | ||
*/ | ||
get is ArmResourceRead<Snapshot>; | ||
|
||
/** | ||
* Create a Volume Snapshot. | ||
*/ | ||
create is ArmResourceCreateOrReplaceAsync< | ||
Snapshot, | ||
LroHeaders = ArmLroLocationHeader<FinalResult = Snapshot> & | ||
Azure.Core.Foundations.RetryAfterHeader | ||
>; | ||
|
||
/** | ||
* Delete a Volume Snapshot. | ||
*/ | ||
#suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
delete is ArmResourceDeleteWithoutOkAsync< | ||
Snapshot, | ||
Response = ArmDeletedResponse | ArmDeleteAcceptedLroResponse | ArmDeletedNoContentResponse | ||
>; | ||
|
||
/** | ||
* List Snapshots in a VolumeGroup or List Snapshots by Volume (name) in a VolumeGroup using filter | ||
*/ | ||
listByVolumeGroup is ArmResourceListByParent< | ||
Snapshot, | ||
Parameters = { | ||
/** | ||
* Specify $filter='volumeName eq <volume name>' to filter on volume. | ||
*/ | ||
@query("$filter") | ||
$filter?: string; | ||
}, | ||
Response = ArmResponse<SnapshotList> | ||
>; | ||
} | ||
|
||
@@maxLength(Snapshot.name, 80); | ||
@@minLength(Snapshot.name, 1); | ||
@@doc(Snapshot.name, | ||
"The name of the volume snapshot within the given volume group." | ||
); | ||
@@doc(Snapshot.properties, "Properties of Volume Snapshot."); | ||
@@doc(Snapshots.create::parameters.resource, "Snapshot object."); |
112 changes: 112 additions & 0 deletions
112
specification/elasticsan/ElasticSan.Management/Volume.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,112 @@ | ||
import "@azure-tools/typespec-azure-core"; | ||
import "@azure-tools/typespec-azure-resource-manager"; | ||
import "@azure-tools/typespec-client-generator-core"; | ||
import "@typespec/openapi"; | ||
import "@typespec/rest"; | ||
import "./models.tsp"; | ||
import "./VolumeGroup.tsp"; | ||
|
||
using TypeSpec.Rest; | ||
using Azure.ResourceManager; | ||
using TypeSpec.Http; | ||
using Azure.ClientGenerator.Core; | ||
|
||
namespace Microsoft.ElasticSan; | ||
/** | ||
* Response for Volume request. | ||
*/ | ||
@parentResource(VolumeGroup) | ||
model Volume is Azure.ResourceManager.ProxyResource<VolumeProperties, false> { | ||
...ResourceNameParameter< | ||
Resource = Volume, | ||
KeyName = "volumeName", | ||
SegmentName = "volumes", | ||
NamePattern = "^[a-z0-9]+(-[a-z0-9A-Z]+)*$" | ||
>; | ||
} | ||
|
||
@armResourceOperations | ||
interface Volumes { | ||
/** | ||
* Get an Volume. | ||
*/ | ||
get is ArmResourceRead<Volume>; | ||
|
||
/** | ||
* Create a Volume. | ||
*/ | ||
create is ArmResourceCreateOrReplaceAsync< | ||
Volume, | ||
LroHeaders = ArmLroLocationHeader<FinalResult = Volume> & | ||
Azure.Core.Foundations.RetryAfterHeader | ||
>; | ||
|
||
/** | ||
* Update an Volume. | ||
*/ | ||
@patch(#{ implicitOptionality: false }) | ||
update is ArmCustomPatchAsync<Volume, PatchModel = VolumeUpdate>; | ||
|
||
/** | ||
* Delete an Volume. | ||
*/ | ||
#suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
delete is ArmResourceDeleteWithoutOkAsync< | ||
Volume, | ||
Parameters = { | ||
/** | ||
* Optional, used to delete snapshots under volume. Allowed value are only true or false. Default value is false. | ||
*/ | ||
#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
@header | ||
@clientName("deleteSnapshots", "csharp") // this could be temporary because we cannot reference this parameter through ::parameter syntax. | ||
`x-ms-delete-snapshots`?: `x-ms-delete-snapshots`; | ||
|
||
/** | ||
* Optional, used to delete volume if active sessions present. Allowed value are only true or false. Default value is false. | ||
*/ | ||
#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
@header | ||
@clientName("forceDelete", "csharp") // this could be temporary because we cannot reference this parameter through ::parameter syntax. | ||
`x-ms-force-delete`?: `x-ms-force-delete`; | ||
|
||
/** | ||
* Optional. Specifies that the delete operation should be a permanent delete for the soft deleted volume. The value of deleteType can only be 'permanent'. | ||
*/ | ||
@query("deleteType") | ||
deleteType?: DeleteType; | ||
}, | ||
Response = ArmDeletedResponse | ArmDeleteAcceptedLroResponse | ArmDeletedNoContentResponse | ||
>; | ||
|
||
/** | ||
* List Volumes in a VolumeGroup. | ||
*/ | ||
listByVolumeGroup is ArmResourceListByParent< | ||
Volume, | ||
Parameters = { | ||
/** | ||
* Optional, returns only soft deleted volumes if set to true. If set to false or if not specified, returns only active volumes. | ||
*/ | ||
#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
@header | ||
@clientName("accessSoftDeletedResources", "csharp") // this could be temporary because we cannot reference this parameter through ::parameter syntax. | ||
`x-ms-access-soft-deleted-resources`?: `x-ms-access-soft-deleted-resources`; | ||
}, | ||
Response = ArmResponse<VolumeList> | ||
>; | ||
} | ||
|
||
/** | ||
* Restore Soft Deleted Volumes. The volume name is obtained by using the API to list soft deleted volumes by volume group | ||
*/ | ||
@action("restore") | ||
@tag("Restore Volumes") | ||
op restoreVolume is ArmResourceActionAsync<Volume, void, Volume>; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should move to the root namespace. |
||
|
||
@@maxLength(Volume.name, 63); | ||
@@minLength(Volume.name, 3); | ||
@@doc(Volume.name, "The name of the Volume."); | ||
@@doc(Volume.properties, "Properties of Volume."); | ||
@@doc(Volumes.create::parameters.resource, "Volume object."); | ||
@@doc(Volumes.update::parameters.properties, "Volume object."); |
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.