-
Notifications
You must be signed in to change notification settings - Fork 5.8k
[StorageCache] Add RebalanceJob sub-resource for API version 2026-08-01 #43757
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
base: main
Are you sure you want to change the base?
Changes from all commits
1198940
8ab8a2d
e9e01e7
fb7b0c8
b883a66
ca236e1
bb6da1a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,4 +10,5 @@ import: | |
| words: | ||
| - amlfilesystem | ||
| - clfs | ||
| - mebibytes | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| import "@azure-tools/typespec-azure-core"; | ||
| import "@azure-tools/typespec-azure-resource-manager"; | ||
| import "@typespec/rest"; | ||
| import "@typespec/versioning"; | ||
| import "./models.tsp"; | ||
| import "./AmlFilesystem.tsp"; | ||
|
|
||
| using TypeSpec.Rest; | ||
| using TypeSpec.Versioning; | ||
| using Azure.ResourceManager; | ||
| using TypeSpec.Http; | ||
|
|
||
| namespace Microsoft.StorageCache; | ||
|
|
||
| /** | ||
| * A rebalance job instance. Rebalances OST data across storage targets after a cluster expansion. | ||
| * Follows Azure Resource Manager standards: https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/resource-api-reference.md | ||
| */ | ||
| @added(Versions.v2026_08_01) | ||
| @parentResource(AmlFilesystem) | ||
| model RebalanceJob | ||
| is Azure.ResourceManager.ProxyResource<RebalanceJobProperties> { | ||
| ...ResourceNameParameter< | ||
| Resource = RebalanceJob, | ||
| KeyName = "rebalanceJobName", | ||
| SegmentName = "rebalanceJobs", | ||
| NamePattern = "^[0-9a-zA-Z][-0-9a-zA-Z_]{0,78}[0-9a-zA-Z]$" | ||
| >; | ||
| } | ||
|
|
||
| @added(Versions.v2026_08_01) | ||
| @armResourceOperations(#{ omitTags: true }) | ||
| interface RebalanceJobs { | ||
| /** | ||
| * Returns a rebalance job. | ||
| */ | ||
| @tag("rebalanceJobs") | ||
| get is ArmResourceRead<RebalanceJob, Error = CloudError>; | ||
|
Member
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. [NEW] 🔵 Suggestion [Consistent error responses §2.7] — mixed error models within the same interface. Classification reasoning: New resource interface added in this PR. Issue: Suggested fix: Use a single consistent error model across all operations of the |
||
|
|
||
| /** | ||
| * Update a rebalance job instance. | ||
| */ | ||
| @tag("rebalanceJobs") | ||
| @patch(#{ implicitOptionality: false }) | ||
| @Azure.Core.useFinalStateVia("azure-async-operation") | ||
| update is ArmCustomPatchAsync< | ||
| RebalanceJob, | ||
| PatchModel = RebalanceJobUpdate, | ||
| LroHeaders = ArmCombinedLroHeaders<FinalResult = RebalanceJob> & | ||
| Azure.Core.Foundations.RetryAfterHeader, | ||
| Error = ErrorResponse | ||
| >; | ||
|
|
||
| /** | ||
| * Schedules a rebalance job for deletion. | ||
| */ | ||
| @tag("rebalanceJobs") | ||
| delete is ArmResourceDeleteWithoutOkAsync< | ||
| RebalanceJob, | ||
| Response = | ||
| | ArmDeleteAcceptedLroResponse<ArmCombinedLroHeaders<FinalResult = void> & | ||
| Azure.Core.Foundations.RetryAfterHeader> | ||
| | ArmDeletedNoContentResponse, | ||
| Error = ErrorResponse | ||
| >; | ||
|
|
||
| /** | ||
| * Returns all the rebalance jobs the user has access to under an AML File System. | ||
| */ | ||
| @tag("rebalanceJobs") | ||
| listByAmlFilesystem is ArmResourceListByParent< | ||
| RebalanceJob, | ||
| Response = ArmResponse<RebalanceJobsListResult>, | ||
| Error = CloudError | ||
| >; | ||
| } | ||
|
|
||
| @@maxLength(RebalanceJob.name, 80); | ||
| @@minLength(RebalanceJob.name, 2); | ||
| @@doc( | ||
| RebalanceJob.name, | ||
| "Name for the rebalance job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric." | ||
| ); | ||
| @@doc(RebalanceJob.properties, "Properties of the rebalance job."); | ||
| @@doc( | ||
| RebalanceJobs.update::parameters.properties, | ||
| "Object containing the user-selectable properties of the rebalance job. If read-only properties are included, they must match the existing values of those properties." | ||
| ); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -108,6 +108,9 @@ using Microsoft.StorageCache; | |
| #suppress "@azure-tools/typespec-azure-core/no-legacy-usage" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
| @@Legacy.flattenProperty(ExpansionJob.properties); | ||
|
|
||
| #suppress "@azure-tools/typespec-azure-core/no-legacy-usage" "Required for ProvisioningStateMustBeReadOnly lint rule to traverse properties" | ||
|
Member
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. [NEW] 🔵 Suggestion [ Classification reasoning: New resource ( Issue: New resource types should avoid legacy property flattening (SDK-breaking risk). The suppression reason ( Suggested fix: Verify whether flattening is truly required. If kept for consistency with the sibling job resources, document that concrete rationale in the suppression reason. Low severity given family consistency. |
||
| @@Legacy.flattenProperty(RebalanceJob.properties); | ||
|
|
||
| @@clientName(Caches.createOrUpdate::parameters.resource, "cache"); | ||
| @@clientName(Caches.update::parameters.properties, "cache"); | ||
| @@clientName(Caches.startPrimingJob::parameters.body, "primingjob"); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| { | ||
| "parameters": { | ||
| "operationId": "testoperationid", | ||
| "api-version": "2026-08-01", | ||
| "location": "westus", | ||
| "subscriptionId": "00000000-0000-0000-0000-000000000000" | ||
| }, | ||
| "responses": { | ||
| "200": { | ||
| "body": { | ||
| "name": "testoperationid", | ||
| "endTime": "2023-01-01T16:13:13.933Z", | ||
| "id": "/subscriptions/id/locations/westus/ascOperations/testoperationid", | ||
| "startTime": "2023-01-01T13:13:13.933Z", | ||
| "status": "Succeeded" | ||
| } | ||
| } | ||
| }, | ||
| "operationId": "AscOperations_Get", | ||
| "title": "AscOperations_Get" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| { | ||
| "parameters": { | ||
| "api-version": "2026-08-01", | ||
| "location": "eastus", | ||
| "subscriptionId": "00000000-0000-0000-0000-000000000000" | ||
| }, | ||
| "responses": { | ||
| "200": { | ||
| "body": { | ||
| "value": [ | ||
| { | ||
| "name": { | ||
| "localizedValue": "Cache", | ||
| "value": "Cache" | ||
| }, | ||
| "currentValue": 1, | ||
| "limit": 4, | ||
| "unit": "Count" | ||
| }, | ||
| { | ||
| "name": { | ||
| "localizedValue": "AmlFilesystem", | ||
| "value": "AmlFilesystem" | ||
| }, | ||
| "currentValue": 0, | ||
| "limit": 4, | ||
| "unit": "Count" | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| }, | ||
| "operationId": "AscUsages_List", | ||
| "title": "AscUsages_List" | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[NEW] 🔵 Suggestion [ARM job-cancellation pattern] —
RebalanceJobsexposes GET/LIST/PATCH/DELETE, no PUT; cancellation is via PATCHadminStatus: Cancel.Classification reasoning: New resource interface added in this PR.
Issue: A dedicated POST cancel action is the more idiomatic ARM pattern for cancelling a job, versus overloading PATCH with an
adminStatusfield.Suggested fix: Optional / design observation only — PATCH-
adminStatusmatches this project's existing job-resource family (ImportJob, AutoExportJob, etc.), so keeping it for consistency is reasonable. No PUT is correct here sinceRebalanceJobis system-created via the expansionrunRebalanceJobflag.