Skip to content

Commit b73af22

Browse files
authored
Advisor : Adding 2026-02-preview version (#40288)
* adding 2026-02-preview version * resolving model validation issues * prettier and typespec validation errors * readme error resolved * tsp validation issues * reverting changes in package-lock * updating patch api * update * correcting example * updating example * tsp validation errors * fix for linting error * updating examples * updating examples * updating descriptions * tsp validation fix * updating state to status and recommendation status * updating examples * updating patch response model * updating arm operation * Testing original spec that was passing earlier after merge from main - Align PATCH response with ARM resource conventions Standardize the PATCH response for Recommendation state to return a full ARM resource shape, including id, name, and type fields. Updated models, OpenAPI schema, and routes to ensure consistency with Azure Resource Manager patterns and improve interoperability. * Simplify RecommendationsPatchPayload response model Removed Azure Resource inheritance from RecommendationsPatchPayload, making it a plain model with only a properties field. Updated OpenAPI schema and example responses to exclude id, name, and type fields. Adjusted PATCH operation response type and description for clarity and alignment with the new model structure. * updating the patch api * changing patch to arm custom patch for extensions * updating state to recommendation status * updating examples * updating properties for patch * removing sharedRoute * adding createdTime * updating operation id for patch api and example * Updating recommendationStatus * updating back-compatible
1 parent a5ffef1 commit b73af22

80 files changed

Lines changed: 8086 additions & 4 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

specification/advisor/resource-manager/Microsoft.Advisor/Advisor/ResourceRecommendationBase.tsp

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import "./models.tsp";
44

55
using Azure.ResourceManager;
66
using TypeSpec.Http;
7+
using TypeSpec.Versioning;
78

89
namespace Microsoft.Advisor;
910
/**
@@ -38,6 +39,8 @@ interface ResourceRecommendationBases {
3839
* Update the tracked properties of a Recommendation.
3940
*/
4041
#suppress "@azure-tools/typespec-azure-core/response-schema-problem" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
42+
@added(Versions.v2025_05_01_preview)
43+
@removed(Versions.v2026_02_01_preview)
4144
@patch(#{ implicitOptionality: false })
4245
patch is ArmCustomPatchSync<
4346
ResourceRecommendationBase,
@@ -46,6 +49,17 @@ interface ResourceRecommendationBases {
4649
Error = ArmDefaultErrorResponse
4750
>;
4851

52+
/**
53+
* Update the state of a Recommendation
54+
*/
55+
@added(Versions.v2026_02_01_preview)
56+
@patch(#{ implicitOptionality: false })
57+
update is Extension.CustomPatchSync<
58+
Extension.Subscription,
59+
ResourceRecommendationBase,
60+
RecommendationPatchPayload
61+
>;
62+
4963
/**
5064
* Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking generateRecommendations.
5165
*/
@@ -55,7 +69,11 @@ interface ResourceRecommendationBases {
5569
BaseParameters = Azure.ResourceManager.Foundations.SubscriptionBaseParameters,
5670
Parameters = {
5771
/**
58-
* The filter to apply to the recommendations.<br>Filter can be applied to properties ['ResourceId', 'ResourceGroup', 'RecommendationTypeGuid', '[Category](#category)'] with operators ['eq', 'and', 'or'].<br>Example:<br>- $filter=Category eq 'Cost' and ResourceGroup eq 'MyResourceGroup'
72+
* The filter to apply to the recommendations.<br>Filter can be applied to properties ['ResourceId', 'ResourceGroup', 'RecommendationTypeGuid', '[Category](#category)', 'SubCategory', 'RetirementDate', '[RecommendationStatus](#recommendationStatus)'] with operators ['eq', 'and', 'or', 'lt', 'gt', 'le', 'ge']<br>.
73+
* <br>**Note:** `Control` is a legacy filter property and will be deprecated in the future. Please use `SubCategory` for filtering recommendation subcategory.<br>
74+
* <br>**Note:** `RecommendationStatus` filter is available from API Version 2026-02-01-preview and onwards.<br>
75+
* <br>Valid options for SubCategory:<br>['BusinessContinuity', 'DisasterRecovery', 'HighAvailability', 'MonitoringAndAlerting', 'Other', 'Personalized', 'PrioritizedRecommendations', 'Scalability', 'ServiceUpgradeAndRetirement', 'Validation']<br>
76+
* <br>Example:<br>- $filter=Category eq 'Cost' and ResourceGroup eq 'MyResourceGroup'<br>-$filter=SubCategory eq 'ServiceUpgradeAndRetirement' and RetirementDate le '2024-01-01' and RetirementDate ge '2028-01-01'
5977
*/
6078
@query("$filter")
6179
$filter?: string;

specification/advisor/resource-manager/Microsoft.Advisor/Advisor/back-compatible.tsp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ using Microsoft.Advisor;
3535
"Recommendations",
3636
"!csharp"
3737
);
38+
@@clientLocation(
39+
ResourceRecommendationBases.update,
40+
"Recommendations",
41+
"!csharp"
42+
);
3843
@@clientLocation(
3944
ResourceRecommendationBases.listByTenant,
4045
"Recommendations",
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
{
2+
"parameters": {
3+
"subscriptionId": "58c3f667-7a62-4bfd-a658-846493e9a493",
4+
"resourceGroup": "resourceGroup",
5+
"configurationName": "default",
6+
"configContract": {
7+
"properties": {
8+
"lowCpuThreshold": "5",
9+
"duration": "7",
10+
"exclude": true,
11+
"digests": [
12+
{
13+
"name": "digestConfigName",
14+
"actionGroupResourceId": "/subscriptions/58c3f667-7a62-4bfd-a658-846493e9a493/resourceGroups/resourceGroup/providers/microsoft.insights/actionGroups/actionGroupName",
15+
"frequency": 30,
16+
"categories": [
17+
"HighAvailability",
18+
"Security",
19+
"Performance",
20+
"Cost",
21+
"OperationalExcellence"
22+
],
23+
"language": "en",
24+
"state": "Active"
25+
}
26+
]
27+
}
28+
},
29+
"api-version": "2026-02-01-preview"
30+
},
31+
"responses": {
32+
"200": {
33+
"body": {
34+
"id": "/subscriptions/58c3f667-7a62-4bfd-a658-846493e9a493/resourceGroups/resourceGroup/providers/Microsoft.Advisor/configurations/default",
35+
"type": "Microsoft.Advisor/configurations",
36+
"name": "default",
37+
"properties": {
38+
"lowCpuThreshold": "5",
39+
"duration": "7",
40+
"exclude": true,
41+
"digests": [
42+
{
43+
"name": "digestConfigName",
44+
"actionGroupResourceId": "/subscriptions/58c3f667-7a62-4bfd-a658-846493e9a493/resourceGroups/resourceGroup/providers/microsoft.insights/actionGroups/actionGroupName",
45+
"frequency": 30,
46+
"categories": [
47+
"HighAvailability",
48+
"Security",
49+
"Performance",
50+
"Cost",
51+
"OperationalExcellence"
52+
],
53+
"language": "en",
54+
"state": "Active"
55+
}
56+
]
57+
}
58+
}
59+
}
60+
},
61+
"operationId": "Configurations_CreateInResourceGroup",
62+
"title": "PutConfigurations"
63+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
{
2+
"parameters": {
3+
"subscriptionId": "58c3f667-7a62-4bfd-a658-846493e9a493",
4+
"resourceGroup": "resourceGroup",
5+
"configurationName": "default",
6+
"configContract": {
7+
"properties": {
8+
"lowCpuThreshold": "5",
9+
"duration": "7",
10+
"exclude": true,
11+
"digests": [
12+
{
13+
"name": "digestConfigName",
14+
"actionGroupResourceId": "/subscriptions/58c3f667-7a62-4bfd-a658-846493e9a493/resourceGroups/resourceGroup/providers/microsoft.insights/actionGroups/actionGroupName",
15+
"frequency": 30,
16+
"categories": [
17+
"HighAvailability",
18+
"Security",
19+
"Performance",
20+
"Cost",
21+
"OperationalExcellence"
22+
],
23+
"language": "en",
24+
"state": "Active"
25+
}
26+
]
27+
}
28+
},
29+
"api-version": "2026-02-01-preview"
30+
},
31+
"responses": {
32+
"200": {
33+
"body": {
34+
"id": "/subscriptions/58c3f667-7a62-4bfd-a658-846493e9a493/resourceGroups/resourceGroup/providers/Microsoft.Advisor/configurations/default",
35+
"type": "Microsoft.Advisor/configurations",
36+
"name": "default",
37+
"properties": {
38+
"lowCpuThreshold": "5",
39+
"duration": "7",
40+
"exclude": true,
41+
"digests": [
42+
{
43+
"name": "digestConfigName",
44+
"actionGroupResourceId": "/subscriptions/58c3f667-7a62-4bfd-a658-846493e9a493/resourceGroups/resourceGroup/providers/microsoft.insights/actionGroups/actionGroupName",
45+
"frequency": 30,
46+
"categories": [
47+
"HighAvailability",
48+
"Security",
49+
"Performance",
50+
"Cost",
51+
"OperationalExcellence"
52+
],
53+
"language": "en",
54+
"state": "Active"
55+
}
56+
]
57+
}
58+
}
59+
}
60+
},
61+
"operationId": "Configurations_CreateInSubscription",
62+
"title": "PutConfigurations"
63+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"parameters": {
3+
"resourceUri": "resourceUri",
4+
"recommendationId": "2e7c72b2d7987ec224a1ebae03398b0fbdaa9a5a6a762e6fcf1c806599744b36",
5+
"name": "2e7c72b2d7987ec224a1ebae03398b0fbdaa9a5a6a762e6fcf1c806599744b45",
6+
"suppressionContract": {
7+
"properties": {
8+
"ttl": "07:00:00:00"
9+
}
10+
},
11+
"api-version": "2026-02-01-preview"
12+
},
13+
"responses": {
14+
"200": {
15+
"body": {
16+
"id": "/subscriptions/a5481ee1-95df-47d0-85d4-dd3f0dfa19bc/resourceGroups/resourceGroup/providers/Microsoft.Compute/availabilitysets/armavset/providers/Microsoft.Advisor/recommendations/2e7c72b2d7987ec224a1ebae03398b0fbdaa9a5a6a762e6fcf1c806599744b36/suppressions/HardcodedSuppressionName",
17+
"name": "HardcodedSuppressionName",
18+
"type": "Microsoft.Advisor/suppressions",
19+
"properties": {
20+
"suppressionId": "2e7c72b2d7987ec224a1ebae03398b0fbdaa9a5a6a762e6fcf1c806599744b45",
21+
"ttl": "07:00:00:00"
22+
}
23+
}
24+
},
25+
"404": {
26+
"body": {
27+
"error": {
28+
"code": "NotFound",
29+
"message": "Recommendation to be suppressed is not found. Subscription Id:{0} Recommendation Id:{1}"
30+
}
31+
}
32+
}
33+
},
34+
"operationId": "Suppressions_Create",
35+
"title": "CreateSuppression"
36+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"parameters": {
3+
"api-version": "2026-02-01-preview",
4+
"assessmentName": "assessment1",
5+
"subscriptionId": "00000000-1111-2222-3333-444444444444"
6+
},
7+
"responses": {
8+
"200": {},
9+
"204": {
10+
"description": "The Assessment is not found or has been deleted already."
11+
}
12+
},
13+
"operationId": "Assessments_Delete",
14+
"title": "DeleteAssessment"
15+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"parameters": {
3+
"name": "HardcodedSuppressionName",
4+
"api-version": "2026-02-01-preview",
5+
"recommendationId": "recommendationId",
6+
"resourceUri": "resourceUri"
7+
},
8+
"responses": {
9+
"204": {}
10+
},
11+
"operationId": "Suppressions_Delete",
12+
"title": "DeleteSuppression"
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"parameters": {
3+
"operationId": "123e4567-e89b-12d3-a456-426614174000",
4+
"api-version": "2026-02-01-preview",
5+
"subscriptionId": "12345678-1234-1234-1234-123456789012"
6+
},
7+
"responses": {
8+
"202": {},
9+
"204": {}
10+
},
11+
"operationId": "Recommendations_GetGenerateStatus",
12+
"title": "GetGenerateStatus"
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"parameters": {
3+
"api-version": "2026-02-01-preview",
4+
"subscriptionId": "12345678-1234-1234-1234-123456789012"
5+
},
6+
"responses": {
7+
"202": {
8+
"headers": {
9+
"Location": "https://management.azure.com/subscriptions/subscriptionId/providers/Microsoft.Microsoft.Advisor/generateRecommendations/recGUID?api-version=2026-02-01-preview",
10+
"Retry-After": "60"
11+
}
12+
}
13+
},
14+
"operationId": "Recommendations_Generate",
15+
"title": "GenerateRecommendations"
16+
}

0 commit comments

Comments
 (0)