Skip to content

Commit 00fea50

Browse files
kazrael2119Pan Shaoweidongxu-microsoftmsyycjliusan
authored
[Typespec Migration] migrate mysql-flexible to typespec (#35895)
* migrate mysql to typespec * update * update * update * update * update * update * update * update * remove old swagger * update * update * update * update * update * update * update * update * Update models.tsp * update * update * update * update * Update readme.md * update * update * pretty check * update * Update client.tsp * update * Update routes.tsp * Update readme.md * update * update * update * update * Update tspconfig.yaml * update * update * Update tspconfig.yaml * update * update * update * update * update * update * Revert "update" This reverts commit e9d1b9b. * revert customized code change * update PrivateEndpointConnection * update * update * update * update * update * update * update * update * update * Update tspconfig.yaml * Update tspconfig.yaml * java backward compatibility * remove @operationid & fix operation group name and operation name * Update PrivateEndpointConnection.tsp * update * Revert "update" This reverts commit 3cd500d. * Update client.tsp * resolve comments --------- Co-authored-by: Pan Shao <[email protected]> Co-authored-by: Weidong Xu <[email protected]> Co-authored-by: Yuchao Yan <[email protected]> Co-authored-by: Judy Liu <[email protected]> Co-authored-by: Arthur Ma <[email protected]> Co-authored-by: Chenjie Shi <[email protected]> Co-authored-by: Qiaoqiao Zhang <[email protected]> Co-authored-by: Qiaoqiao Zhang <[email protected]>
1 parent d013cc7 commit 00fea50

File tree

188 files changed

+21609
-9300
lines changed

Some content is hidden

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

188 files changed

+21609
-9300
lines changed
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
import "@azure-tools/typespec-azure-core";
2+
import "@azure-tools/typespec-azure-resource-manager";
3+
import "@typespec/openapi";
4+
import "@typespec/rest";
5+
import "./models.tsp";
6+
import "./Server.tsp";
7+
8+
using TypeSpec.Rest;
9+
using Azure.ResourceManager;
10+
using TypeSpec.Http;
11+
using TypeSpec.OpenAPI;
12+
13+
namespace Microsoft.DBforMySQL;
14+
/**
15+
* A server's Advanced Threat Protection.
16+
*/
17+
@parentResource(Server)
18+
model AdvancedThreatProtection
19+
is Azure.ResourceManager.ProxyResource<AdvancedThreatProtectionProperties> {
20+
...ResourceNameParameter<
21+
Resource = AdvancedThreatProtection,
22+
KeyName = "advancedThreatProtectionName",
23+
SegmentName = "advancedThreatProtectionSettings",
24+
NamePattern = "",
25+
Type = AdvancedThreatProtectionName
26+
>;
27+
}
28+
29+
#suppress "@azure-tools/typespec-azure-resource-manager/no-resource-delete-operation" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
30+
@armResourceOperations
31+
interface AdvancedThreatProtectionSettings {
32+
/**
33+
* Get a server's Advanced Threat Protection state
34+
*/
35+
#suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
36+
get is ArmResourceRead<AdvancedThreatProtection>;
37+
38+
/**
39+
* Updates a server's Advanced Threat Protection state.
40+
*/
41+
#suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
42+
#suppress "@azure-tools/typespec-azure-resource-manager/arm-put-operation-response-codes" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
43+
@operationId("AdvancedThreatProtectionSettings_UpdatePut")
44+
updatePut is ArmResourceCreateOrReplaceAsync<
45+
AdvancedThreatProtection,
46+
Response = ArmResourceUpdatedResponse<AdvancedThreatProtection> | ArmResourceCreatedResponse<
47+
AdvancedThreatProtection,
48+
ArmLroLocationHeader<FinalResult = AdvancedThreatProtection> &
49+
Azure.Core.Foundations.RetryAfterHeader
50+
> | ArmAcceptedLroResponse
51+
>;
52+
53+
/**
54+
* Updates a server's Advanced Threat Protection state.
55+
*/
56+
#suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
57+
@patch(#{ implicitOptionality: false })
58+
@operationId("AdvancedThreatProtectionSettings_Update")
59+
update is ArmCustomPatchAsync<
60+
AdvancedThreatProtection,
61+
PatchModel = AdvancedThreatProtectionForUpdate
62+
>;
63+
64+
/**
65+
* Gets a list of server's Advanced Threat Protection states.
66+
*/
67+
#suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
68+
@operationId("AdvancedThreatProtectionSettings_List")
69+
list is ArmResourceListByParent<
70+
AdvancedThreatProtection,
71+
Response = ArmResponse<AdvancedThreatProtectionListResult>
72+
>;
73+
}
74+
75+
@@doc(AdvancedThreatProtection.name,
76+
"The name of the Advanced Threat Protection state."
77+
);
78+
@@doc(AdvancedThreatProtection.properties, "Resource properties.");
79+
@@doc(AdvancedThreatProtectionSettings.updatePut::parameters.resource,
80+
"The server's Advanced Threat Protection body to update."
81+
);
82+
@@doc(AdvancedThreatProtectionSettings.update::parameters.properties,
83+
"The server's Advanced Threat Protection body to update."
84+
);
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
import "@azure-tools/typespec-azure-core";
2+
import "@azure-tools/typespec-azure-resource-manager";
3+
import "@typespec/openapi";
4+
import "@typespec/rest";
5+
import "./models.tsp";
6+
import "./Server.tsp";
7+
8+
using TypeSpec.Rest;
9+
using Azure.ResourceManager;
10+
using TypeSpec.Http;
11+
using TypeSpec.OpenAPI;
12+
13+
namespace Microsoft.DBforMySQL;
14+
/**
15+
* Represents a Administrator.
16+
*/
17+
#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
18+
@parentResource(Server)
19+
model AzureADAdministrator
20+
is Azure.ResourceManager.ProxyResource<AdministratorProperties> {
21+
...ResourceNameParameter<
22+
Resource = AzureADAdministrator,
23+
KeyName = "administratorName",
24+
SegmentName = "administrators",
25+
NamePattern = "",
26+
Type = AdministratorName
27+
>;
28+
}
29+
30+
#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
31+
@armResourceOperations
32+
interface AzureADAdministrators {
33+
/**
34+
* Gets information about an azure ad administrator.
35+
*/
36+
#suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
37+
get is ArmResourceRead<AzureADAdministrator>;
38+
39+
/**
40+
* Creates or updates an existing Azure Active Directory administrator.
41+
*/
42+
#suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
43+
#suppress "@azure-tools/typespec-azure-resource-manager/arm-put-operation-response-codes" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
44+
createOrUpdate is ArmResourceCreateOrReplaceAsync<
45+
AzureADAdministrator,
46+
Response = ArmResourceUpdatedResponse<AzureADAdministrator> | ArmResourceCreatedResponse<
47+
AzureADAdministrator,
48+
ArmLroLocationHeader<FinalResult = AzureADAdministrator> &
49+
Azure.Core.Foundations.RetryAfterHeader
50+
> | ArmAcceptedLroResponse
51+
>;
52+
53+
/**
54+
* Deletes an Azure AD Administrator.
55+
*/
56+
#suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
57+
#suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
58+
delete is ArmResourceDeleteWithoutOkAsync<
59+
AzureADAdministrator,
60+
Response = ArmDeletedResponse | ArmDeleteAcceptedLroResponse | ArmDeletedNoContentResponse
61+
>;
62+
63+
/**
64+
* List all the AAD administrators in a given server.
65+
*/
66+
#suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
67+
listByServer is ArmResourceListByParent<
68+
AzureADAdministrator,
69+
Response = ArmResponse<AdministratorListResult>
70+
>;
71+
}
72+
73+
@@doc(AzureADAdministrator.name, "The name of the Azure AD Administrator.");
74+
@@doc(AzureADAdministrator.properties, "The properties of an administrator.");
75+
@@doc(AzureADAdministrators.createOrUpdate::parameters.resource,
76+
"The required parameters for creating or updating an aad administrator."
77+
);
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
import "@azure-tools/typespec-azure-core";
2+
import "@azure-tools/typespec-azure-resource-manager";
3+
import "@typespec/openapi";
4+
import "@typespec/rest";
5+
import "./models.tsp";
6+
7+
using TypeSpec.Rest;
8+
using Azure.ResourceManager;
9+
using TypeSpec.Http;
10+
using TypeSpec.OpenAPI;
11+
12+
namespace Microsoft.DBforMySQL;
13+
/**
14+
* Represents a location capability set.
15+
*/
16+
@subscriptionResource
17+
@parentResource(SubscriptionLocationResource)
18+
model Capability
19+
is Azure.ResourceManager.ProxyResource<CapabilityPropertiesV2> {
20+
/**
21+
* Name of capability set
22+
*/
23+
@key("capabilitySetName")
24+
@path
25+
@segment("capabilitySets")
26+
@pattern("^[a-z0-9][-a-z0-9]*(?<!-)$")
27+
name: string = "default";
28+
}
29+
30+
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-interface-requires-decorator" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
31+
interface LocationBasedCapabilityOps
32+
extends Azure.ResourceManager.Legacy.LegacyOperations<
33+
{
34+
...ApiVersionParameter,
35+
...SubscriptionIdParameter,
36+
...Azure.ResourceManager.Legacy.Provider,
37+
...LocationNameParameter,
38+
},
39+
{}
40+
> {}
41+
42+
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-interface-requires-decorator" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
43+
interface LocationBasedCapabilityOperationOps
44+
extends Azure.ResourceManager.Legacy.LegacyOperations<
45+
{
46+
...ApiVersionParameter,
47+
...SubscriptionIdParameter,
48+
...Azure.ResourceManager.Legacy.Provider,
49+
...LocationNameParameter,
50+
51+
/**
52+
* Name of capability set
53+
*/
54+
@path
55+
@segment("capabilitySets")
56+
@pattern("^[a-z0-9][-a-z0-9]*(?<!-)$")
57+
capabilitySetName: string = "default",
58+
},
59+
{}
60+
> {}
61+
62+
@armResourceOperations
63+
interface LocationBasedCapabilitySet {
64+
/**
65+
* Get capabilities at specified location in a given subscription.
66+
*/
67+
#suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
68+
get is LocationBasedCapabilityOperationOps.Read<Capability>;
69+
70+
/**
71+
* Get capabilities at specified location in a given subscription.
72+
*/
73+
#suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
74+
@action("capabilitySets")
75+
@get
76+
@list
77+
list is LocationBasedCapabilityOps.Read<
78+
Capability,
79+
Response = ArmResponse<CapabilitySetsList>
80+
>;
81+
}
82+
83+
@@doc(Capability.name, "Name of capability set");
84+
@@doc(Capability.properties, "The properties of a location capability set.");
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
import "@azure-tools/typespec-azure-core";
2+
import "@azure-tools/typespec-azure-resource-manager";
3+
import "@typespec/openapi";
4+
import "@typespec/rest";
5+
import "./models.tsp";
6+
import "./Server.tsp";
7+
8+
using TypeSpec.Rest;
9+
using Azure.ResourceManager;
10+
using TypeSpec.Http;
11+
using TypeSpec.OpenAPI;
12+
13+
namespace Microsoft.DBforMySQL;
14+
/**
15+
* Represents a Configuration.
16+
*/
17+
@parentResource(Server)
18+
model Configuration
19+
is Azure.ResourceManager.ProxyResource<ConfigurationProperties> {
20+
...ResourceNameParameter<
21+
Resource = Configuration,
22+
KeyName = "configurationName",
23+
SegmentName = "configurations",
24+
NamePattern = ""
25+
>;
26+
}
27+
28+
#suppress "@azure-tools/typespec-azure-resource-manager/no-resource-delete-operation" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
29+
@armResourceOperations
30+
interface Configurations {
31+
/**
32+
* Gets information about a configuration of server.
33+
*/
34+
get is ArmResourceRead<Configuration>;
35+
36+
/**
37+
* Updates a configuration of a server.
38+
*/
39+
#suppress "@azure-tools/typespec-azure-resource-manager/arm-put-operation-response-codes" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
40+
createOrUpdate is ArmResourceCreateOrReplaceAsync<
41+
Configuration,
42+
Response = ArmResourceUpdatedResponse<Configuration> | ArmAcceptedLroResponse<LroHeaders = ArmLroLocationHeader<FinalResult = Configuration> &
43+
Azure.Core.Foundations.RetryAfterHeader>
44+
>;
45+
46+
/**
47+
* Updates a configuration of a server.
48+
*/
49+
@patch(#{ implicitOptionality: false })
50+
update is ArmCustomPatchAsync<Configuration, PatchModel = Configuration>;
51+
52+
/**
53+
* List all the configurations in a given server.
54+
*/
55+
@TypeSpec.list
56+
listByServer is ArmResourceListByParent<
57+
Configuration,
58+
Parameters = {
59+
/**
60+
* The tags of the server configuration.
61+
*/
62+
@query("tags")
63+
tags?: string;
64+
65+
/**
66+
* The keyword of the server configuration.
67+
*/
68+
@query("keyword")
69+
keyword?: string;
70+
71+
/**
72+
* The page of the server configuration.
73+
*/
74+
@query("page")
75+
page?: int32;
76+
77+
/**
78+
* The pageSize of the server configuration.
79+
*/
80+
@query("pageSize")
81+
pageSize?: int32;
82+
},
83+
Response = ArmResponse<ConfigurationListResult>
84+
>;
85+
86+
/**
87+
* Update a list of configurations in a given server.
88+
*/
89+
#suppress "@azure-tools/typespec-azure-core/invalid-final-state" ""
90+
#suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
91+
@action("updateConfigurations")
92+
@Azure.Core.useFinalStateVia("azure-async-operation")
93+
batchUpdate is ArmResourceActionAsyncBase<
94+
Server,
95+
ConfigurationListForBatchUpdate,
96+
BaseParameters = Azure.ResourceManager.Foundations.ResourceGroupBaseParameters,
97+
Response = ArmResponse<ConfigurationListResult> | ArmAcceptedLroResponse<LroHeaders = ArmAsyncOperationHeader<FinalResult = ConfigurationListResult> &
98+
ArmLroLocationHeader>
99+
>;
100+
}
101+
102+
@@doc(Configuration.name, "The name of the server configuration.");
103+
@@doc(Configuration.properties, "The properties of a configuration.");
104+
@@doc(Configurations.createOrUpdate::parameters.resource,
105+
"The required parameters for updating a server configuration."
106+
);
107+
@@doc(Configurations.update::parameters.properties,
108+
"The required parameters for updating a server configuration."
109+
);
110+
@@doc(Configurations.batchUpdate::parameters.body,
111+
"The parameters for updating a list of server configuration."
112+
);

0 commit comments

Comments
 (0)