Skip to content

Commit 9768490

Browse files
tuguptmohitsinha-ms
authored andcommitted
Add FabricMirroringSettings API for MySQL FlexibleServers (#40348)
Adds a new FabricMirroringSettings singleton proxy resource under MySQL FlexibleServers with GET, PUT (LRO), and List operations. Includes TypeSpec source, examples, and addresses all review comments. Co-authored-by: Mohit Sinha <mohitsinha@microsoft.com>
1 parent 48ece9d commit 9768490

5 files changed

Lines changed: 209 additions & 0 deletions

File tree

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
import "@typespec/http";
2+
import "@typespec/rest";
3+
import "@typespec/versioning";
4+
import "@azure-tools/typespec-azure-core";
5+
import "@azure-tools/typespec-azure-resource-manager";
6+
7+
using TypeSpec.Http;
8+
using TypeSpec.Rest;
9+
using TypeSpec.Versioning;
10+
using Azure.Core;
11+
using Azure.ResourceManager;
12+
using TypeSpec.OpenAPI;
13+
14+
namespace Microsoft.DBforMySQL;
15+
16+
/**
17+
* State of Fabric Mirroring.
18+
* Extensible string-based union per Azure guidelines.
19+
*/
20+
@added(Versions.v2025_12_01_preview)
21+
union FabricMirroringState {
22+
/** Fabric Mirroring is enabled. */
23+
Enabled: "Enabled",
24+
25+
/** Fabric Mirroring is disabled. */
26+
Disabled: "Disabled",
27+
28+
/** Future/unknown values. */
29+
string,
30+
}
31+
32+
/**
33+
* Provisioning state of Fabric Mirroring.
34+
* Extensible string-based union per Azure guidelines.
35+
*/
36+
@added(Versions.v2025_12_01_preview)
37+
union FabricMirroringProvisioningState {
38+
/** Provisioning has succeeded. */
39+
Succeeded: "Succeeded",
40+
41+
/** Provisioning is in progress. */
42+
Updating: "Updating",
43+
44+
/** Provisioning was canceled. */
45+
Canceled: "Canceled",
46+
47+
/** Provisioning has failed. */
48+
Failed: "Failed",
49+
50+
/** Future/unknown values. */
51+
string,
52+
}
53+
54+
/**
55+
* Properties of the Fabric Mirroring settings resource.
56+
*/
57+
@added(Versions.v2025_12_01_preview)
58+
model FabricMirroringSettingsProperties {
59+
/** State of Fabric Mirroring (Enabled or Disabled). */
60+
state?: FabricMirroringState;
61+
62+
/** Resource ID of the user-assigned managed identity used for Fabric Mirroring. */
63+
identityResourceId?: armResourceIdentifier;
64+
65+
/** Provisioning state of Fabric Mirroring. */
66+
@visibility(Lifecycle.Read)
67+
provisioningState?: FabricMirroringProvisioningState;
68+
}
69+
70+
/**
71+
* Fabric Mirroring settings proxy resource.
72+
*/
73+
@parentResource(Server)
74+
model FabricMirroringSettings is ProxyResource<FabricMirroringSettingsProperties> {
75+
...ResourceNameParameter<
76+
Resource = FabricMirroringSettings,
77+
KeyName = "fabricMirroringSettingsName",
78+
SegmentName = "fabricMirroringSettings",
79+
NamePattern = "^[a-zA-Z0-9-]{3,24}$"
80+
>;
81+
}
82+
83+
#suppress "@azure-tools/typespec-azure-resource-manager/no-resource-delete-operation" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
84+
@armResourceOperations
85+
@added(Versions.v2025_12_01_preview)
86+
interface FabricMirroringSettingsOperations {
87+
@doc("Get Fabric Mirroring settings.")
88+
@operationId("FabricMirroringSettings_Get")
89+
get is ArmResourceRead<FabricMirroringSettings>;
90+
91+
#suppress "@azure-tools/typespec-azure-resource-manager/arm-put-operation-response-codes" "Async PUT returns 202 Accepted for long-running operations"
92+
@doc("Create or update Fabric Mirroring settings.")
93+
@operationId("FabricMirroringSettings_CreateOrUpdate")
94+
createOrUpdate is ArmResourceCreateOrUpdateAsync<
95+
FabricMirroringSettings,
96+
Response = ArmResourceUpdatedResponse<FabricMirroringSettings> | ArmResourceCreatedResponse<
97+
FabricMirroringSettings,
98+
ArmAsyncOperationHeader<FinalResult = FabricMirroringSettings> &
99+
Azure.Core.Foundations.RetryAfterHeader
100+
> | ArmAcceptedLroResponse
101+
>;
102+
103+
@doc("List Fabric Mirroring settings by server.")
104+
@operationId("FabricMirroringSettings_ListByServer")
105+
listByServer is Azure.ResourceManager.Legacy.ArmListSinglePageByParent<FabricMirroringSettings>;
106+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"parameters": {
3+
"subscriptionId": "00000000-1111-2222-3333-444444444444",
4+
"resourceGroupName": "fabricmirroring-rg",
5+
"serverName": "fabricmirroring-server",
6+
"fabricMirroringSettingsName": "Default",
7+
"api-version": "2025-12-01-preview"
8+
},
9+
"responses": {
10+
"200": {
11+
"body": {
12+
"id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/fabricmirroring-rg/providers/Microsoft.DBforMySQL/flexibleServers/fabricmirroring-server/fabricMirroringSettings/Default",
13+
"name": "Default",
14+
"type": "Microsoft.DBforMySQL/flexibleServers/fabricMirroringSettings",
15+
"properties": {
16+
"state": "Enabled",
17+
"identityResourceId": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/fabricmirroring-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/fabricmirroring-identity",
18+
"provisioningState": "Succeeded"
19+
}
20+
}
21+
}
22+
},
23+
"operationId": "FabricMirroringSettings_Get",
24+
"title": "Get a server's Fabric Mirroring settings."
25+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"parameters": {
3+
"subscriptionId": "00000000-1111-2222-3333-444444444444",
4+
"resourceGroupName": "fabricmirroring-rg",
5+
"serverName": "fabricmirroring-server",
6+
"api-version": "2025-12-01-preview"
7+
},
8+
"responses": {
9+
"200": {
10+
"body": {
11+
"value": [
12+
{
13+
"id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/fabricmirroring-rg/providers/Microsoft.DBforMySQL/flexibleServers/fabricmirroring-server/fabricMirroringSettings/Default",
14+
"name": "Default",
15+
"type": "Microsoft.DBforMySQL/flexibleServers/fabricMirroringSettings",
16+
"properties": {
17+
"state": "Enabled",
18+
"identityResourceId": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/fabricmirroring-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/fabricmirroring-identity",
19+
"provisioningState": "Succeeded"
20+
}
21+
}
22+
]
23+
}
24+
}
25+
},
26+
"operationId": "FabricMirroringSettings_ListByServer",
27+
"title": "List a server's Fabric Mirroring settings."
28+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"parameters": {
3+
"subscriptionId": "00000000-1111-2222-3333-444444444444",
4+
"resourceGroupName": "fabricmirroring-rg",
5+
"serverName": "fabricmirroring-server",
6+
"fabricMirroringSettingsName": "Default",
7+
"api-version": "2025-12-01-preview",
8+
"resource": {
9+
"properties": {
10+
"state": "Enabled",
11+
"identityResourceId": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/fabricmirroring-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/fabricmirroring-identity"
12+
}
13+
}
14+
},
15+
"responses": {
16+
"200": {
17+
"body": {
18+
"id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/fabricmirroring-rg/providers/Microsoft.DBforMySQL/flexibleServers/fabricmirroring-server/fabricMirroringSettings/Default",
19+
"name": "Default",
20+
"type": "Microsoft.DBforMySQL/flexibleServers/fabricMirroringSettings",
21+
"properties": {
22+
"state": "Enabled",
23+
"identityResourceId": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/fabricmirroring-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/fabricmirroring-identity",
24+
"provisioningState": "Succeeded"
25+
}
26+
}
27+
},
28+
"201": {
29+
"body": {
30+
"id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/fabricmirroring-rg/providers/Microsoft.DBforMySQL/flexibleServers/fabricmirroring-server/fabricMirroringSettings/Default",
31+
"name": "Default",
32+
"type": "Microsoft.DBforMySQL/flexibleServers/fabricMirroringSettings",
33+
"properties": {
34+
"state": "Enabled",
35+
"identityResourceId": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/fabricmirroring-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/fabricmirroring-identity",
36+
"provisioningState": "Succeeded"
37+
}
38+
}
39+
},
40+
"202": {
41+
"headers": {
42+
"Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DBforMySQL/locations/eastus/azureAsyncOperation/00000000-0000-0000-0000-000000000000?api-version=2025-12-01-preview",
43+
"Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DBforMySQL/locations/eastus/operationStatus/00000000-0000-0000-0000-000000000000?api-version=2025-12-01-preview"
44+
}
45+
}
46+
},
47+
"operationId": "FabricMirroringSettings_CreateOrUpdate",
48+
"title": "Create Or Update a server's Fabric Mirroring settings."
49+
}

specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/main.tsp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import "./Maintenance.tsp";
2626
import "./PrivateEndpointConnection.tsp";
2727
import "./PrivateLinkResource.tsp";
2828
import "./routes.tsp";
29+
import "./FabricMirroringSettings.tsp";
2930

3031
using TypeSpec.Rest;
3132
using TypeSpec.Http;

0 commit comments

Comments
 (0)