Skip to content

[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
merged 37 commits into from
Jul 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
0f7af6e
Convert ElsticSan to TypeSpec
Apr 21, 2025
6791f4d
update
Apr 23, 2025
f4418ed
Merge branch 'main' of https://github.com/Azure/azure-rest-api-specs …
May 9, 2025
8e86094
update
May 9, 2025
4b84071
update
May 9, 2025
27368ab
Fix properties order issue and fix pipeline error
melina5656 May 9, 2025
a508833
update
melina5656 May 9, 2025
e625c64
Merge branch 'main' into migration/elasticsan
melina5656 May 12, 2025
ff3a269
run prettier
melina5656 May 12, 2025
d35aa03
run prettier and compile
melina5656 May 12, 2025
06ca5f5
Merge branch 'main' into migration/elasticsan
melina5656 May 12, 2025
b316a4b
Merge branch 'main' of https://github.com/Azure/azure-rest-api-specs …
May 12, 2025
9459887
Update
May 12, 2025
a91b621
update
May 12, 2025
e143e2f
fix service-dir in tspconfig.yaml
XiaofeiCao May 12, 2025
ad8f172
Update tspconfig.yaml
kazrael2119 May 12, 2025
334edeb
update
May 14, 2025
dd563f6
Merge branch 'migration/elasticsan' of https://github.com/Azure/azure…
May 14, 2025
95e529b
Merge branch 'main' of https://github.com/Azure/azure-rest-api-specs …
May 14, 2025
fcc40fa
Delete conditionalClientFlatten
melina5656 Jun 6, 2025
653f00a
update
mcgallan Jun 6, 2025
3833d5f
update
mcgallan Jun 10, 2025
a082654
update
mcgallan Jun 10, 2025
8e68125
update examples
melina5656 Jun 18, 2025
44f44dc
Merge remote-tracking branch 'upstream/main' into migration/elasticsan
mcgallan Jun 19, 2025
4d3858e
update
mcgallan Jun 19, 2025
4297ffb
update
mcgallan Jun 24, 2025
dbe4242
Merge remote-tracking branch 'upstream/main' into migration/elasticsan
mcgallan Jun 30, 2025
acf885b
update
mcgallan Jun 30, 2025
8fcbad5
update
mcgallan Jul 1, 2025
8d5884d
update
Jul 3, 2025
69225b6
update
Jul 3, 2025
4cc897a
client tsp changes for csharp
ArcturusZhang Jul 3, 2025
01e479d
add client changes for csharp
ArcturusZhang Jul 4, 2025
b887d55
format
ArcturusZhang Jul 4, 2025
5e9b3a3
Merge branch 'main' into migration/elasticsan
ArcturusZhang Jul 4, 2025
f0d72db
Merge branch 'main' into migration/elasticsan
pshao25 Jul 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 90 additions & 0 deletions specification/elasticsan/ElasticSan.Management/ElasticSan.tsp
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.");
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 specification/elasticsan/ElasticSan.Management/Snapshot.tsp
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 specification/elasticsan/ElasticSan.Management/Volume.tsp
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>;
Copy link
Member

Choose a reason for hiding this comment

The 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.");
Loading
Loading