Skip to content

Commit 4704382

Browse files
tundwedDanny Tundwe (from Dev Box)
andauthored
Unify EdgeActions with CDN 2025-09-01-preview and migrate to TypeSpec (#38054)
* Add EdgeActions 2025-09-01-preview baseline from 2024-07-22-preview Copy EdgeActions API specification from 2024-07-22-preview to new EdgeActions directory structure as baseline for 2025-09-01-preview. * Migrate EdgeActions to TypeSpec with API changes for 2025-09-01-preview - Convert EdgeActions from JSON swagger to TypeSpec - Add TypeSpec configuration for all SDK languages (Python, Java, Go, TypeScript, C#) - Configure separate Azure.ResourceManager.EdgeActions package for .NET SDK - Add @clientName decorator for EdgeActionAttachmentResponse -> EdgeActionAttachmentResult (C# naming convention) - Add file-scoped suppression for ProvisioningStateMustBeReadOnly - Add new operations: SwapDefault, DeployVersionCode, GetVersionCode - Update all examples to 2025-09-01-preview - Generate OpenAPI via TypeSpec compiler with automatic x-ms-examples * fix java sdk validation * fix(edgeactions): address PR review comments for 2025-09-01-preview - Add x-ms-client-flatten and x-ms-mutability to properties field on EdgeAction, EdgeActionVersion, and EdgeActionExecutionFilter resource models for backwards compatibility with 2024-07-22-preview baseline - Change EdgeActionAttachmentResponse.edgeActionId from readOnly to x-ms-mutability [read, update, create] to match baseline behavior - Replace 'ARM' with 'Azure' in resource identifier descriptions (AttachedResourceId and EdgeActionVersionId) - Consolidate multiple PostResponseCodes suppressions into single entry with array of where clauses in readme.md - Add OpenAPI extension decorators using @@extension augments in TypeSpec with appropriate suppressions for no-openapi warnings * style(edgeactions): apply tsp format to TypeSpec files - Reformat @@extension calls to multi-line style for better readability - Reorder #suppress directive placement per formatter rules * remove unnecessary ProvisioningStateMustBeReadOnly suppression All provisioningState properties are already correctly marked as readOnly in the generated OpenAPI spec. The suppression is not needed as the spec complies with ARM validation rules. * Revert "remove unnecessary ProvisioningStateMustBeReadOnly suppression" This reverts commit a5988e2. * extend ResourceProvisioningState for standard ARM compliance Change ProvisioningState to extend ResourceProvisioningState which provides the three required states (Succeeded, Failed, Canceled) with standard ARM descriptions, and add custom states (Provisioning, Upgrading) specific to edge actions lifecycle. * remove ProvisioningStateMustBeReadOnly suppression Suppression no longer needed after extending ResourceProvisioningState which properly handles ARM validation requirements. * add use-read-only-status-schema to resolve ProvisioningStateMustBeReadOnly validation Enable use-read-only-status-schema: true in tspconfig.yaml to work around known limitation in azure-openapi-validator and oav with \ siblings. This adds readOnly: true directly to status schema definitions, resolving ProvisioningStateMustBeReadOnly validation errors. References: - Azure/azure-openapi-validator#637 - Azure/oav#848 --------- Co-authored-by: Danny Tundwe (from Dev Box) <[email protected]>
1 parent 84298cd commit 4704382

File tree

57 files changed

+4386
-0
lines changed

Some content is hidden

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

57 files changed

+4386
-0
lines changed
Lines changed: 234 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,234 @@
1+
import "@typespec/http";
2+
import "@typespec/rest";
3+
import "@typespec/versioning";
4+
import "@typespec/openapi";
5+
import "@azure-tools/typespec-autorest";
6+
import "@azure-tools/typespec-azure-core";
7+
import "@azure-tools/typespec-azure-resource-manager";
8+
import "@azure-tools/typespec-client-generator-core";
9+
10+
using TypeSpec.Http;
11+
using TypeSpec.Rest;
12+
using TypeSpec.Versioning;
13+
using TypeSpec.OpenAPI;
14+
using Azure.ResourceManager;
15+
using Azure.ResourceManager.Foundations;
16+
using Azure.Core;
17+
using Azure.ClientGenerator.Core;
18+
19+
namespace Microsoft.Cdn;
20+
21+
/** The SKU type for the edge action */
22+
model SkuType {
23+
/** The name of the SKU */
24+
name: string;
25+
26+
/** The tier of the SKU */
27+
tier: string;
28+
}
29+
30+
/** The deployment type for edge action versions */
31+
union EdgeActionVersionDeploymentType {
32+
string,
33+
34+
/** ZIP file deployment */
35+
zip: "zip",
36+
37+
/** Single file deployment */
38+
file: "file",
39+
40+
/** Other deployment types */
41+
others: "others",
42+
}
43+
44+
/** The validation status for edge action versions */
45+
union EdgeActionVersionValidationStatus {
46+
string,
47+
48+
/** Validation succeeded */
49+
Succeeded: "Succeeded",
50+
51+
/** Validation failed */
52+
Failed: "Failed",
53+
}
54+
55+
/** Indicates whether this is the default version */
56+
union EdgeActionIsDefaultVersion {
57+
string,
58+
59+
/** This is the default version */
60+
True: "True",
61+
62+
/** This is not the default version */
63+
False: "False",
64+
}
65+
66+
/** The status of an operation */
67+
union OperationStatus {
68+
string,
69+
70+
/** Operation is running */
71+
Running: "Running",
72+
73+
/** Operation succeeded */
74+
Succeeded: "Succeeded",
75+
76+
/** Operation failed */
77+
Failed: "Failed",
78+
79+
/** Operation was canceled */
80+
Canceled: "Canceled",
81+
}
82+
83+
@pattern("[a-zA-Z0-9]+")
84+
@maxLength(50)
85+
scalar smallString extends string;
86+
87+
@doc("Azure resource identifier for attached routes")
88+
scalar AttachedResourceId
89+
extends Azure.Core.armResourceIdentifier<[
90+
{
91+
type: "Microsoft.Cdn/Profiles/afdEndpoints/routes",
92+
}
93+
]>;
94+
95+
@doc("Azure resource identifier for edge action versions")
96+
scalar EdgeActionVersionId
97+
extends Azure.Core.armResourceIdentifier<[
98+
{
99+
type: "Microsoft.Cdn/edgeActions/versions",
100+
}
101+
]>;
102+
103+
/** The status of the current operation */
104+
@Azure.Core.lroStatus
105+
union ProvisioningState {
106+
ResourceProvisioningState,
107+
108+
@doc("Initial provisioning in progress")
109+
Provisioning: "Provisioning",
110+
111+
@doc("Upgrade in progress")
112+
Upgrading: "Upgrading",
113+
}
114+
115+
/** Edge action attachment information */
116+
model EdgeActionAttachment {
117+
@doc("The edge action attachment id")
118+
@visibility(Lifecycle.Read)
119+
id: string;
120+
121+
@doc("The attached resource Id")
122+
@visibility(Lifecycle.Read, Lifecycle.Create, Lifecycle.Update)
123+
attachedResourceId: AttachedResourceId;
124+
}
125+
126+
/** Edge action attachment response */
127+
@clientName("EdgeActionAttachmentResult", "csharp")
128+
model EdgeActionAttachmentResponse {
129+
#suppress "@azure-tools/typespec-azure-core/no-openapi" "Extension needed for backwards compatibility with 2024-07-22-preview"
130+
@doc("Non changing guid to identity edge action")
131+
@extension("x-ms-mutability", #["read", "update", "create"])
132+
edgeActionId: string;
133+
}
134+
135+
@doc("Represents an edge action properties")
136+
model EdgeActionProperties {
137+
@doc("The provisioning state of the edge action")
138+
@visibility(Lifecycle.Read)
139+
provisioningState?: ProvisioningState;
140+
141+
@doc("A list of attachments for the edge action")
142+
@visibility(Lifecycle.Read)
143+
attachments: EdgeActionAttachment[];
144+
}
145+
146+
@doc("Represents an edge action version")
147+
model EdgeActionVersionProperties {
148+
@doc("The deployment type")
149+
@visibility(Lifecycle.Read, Lifecycle.Create, Lifecycle.Update)
150+
deploymentType: EdgeActionVersionDeploymentType;
151+
152+
@doc("The validation status")
153+
@visibility(Lifecycle.Read)
154+
validationStatus: EdgeActionVersionValidationStatus;
155+
156+
@doc("The provisioning state")
157+
@visibility(Lifecycle.Read)
158+
provisioningState?: ProvisioningState;
159+
160+
@doc("The active state")
161+
@visibility(Lifecycle.Read, Lifecycle.Create, Lifecycle.Update)
162+
isDefaultVersion: EdgeActionIsDefaultVersion;
163+
164+
@doc("The last update time in UTC for package update")
165+
@visibility(Lifecycle.Read)
166+
lastPackageUpdateTime: utcDateTime;
167+
}
168+
169+
/** Properties for edge action execution filter */
170+
model EdgeActionExecutionFilterProperties {
171+
@doc("The referenced versionId of the edgeaction version")
172+
@visibility(Lifecycle.Read, Lifecycle.Create, Lifecycle.Update)
173+
versionId: EdgeActionVersionId;
174+
175+
@doc("The last update time in UTC for the execution filter")
176+
@visibility(Lifecycle.Read)
177+
lastUpdateTime: utcDateTime;
178+
179+
@doc("Custom Header Key associated with the execution filter")
180+
@visibility(Lifecycle.Read, Lifecycle.Create, Lifecycle.Update)
181+
executionFilterIdentifierHeaderName: string;
182+
183+
@doc("Custom Header Value associated with the execution filter")
184+
@visibility(Lifecycle.Read, Lifecycle.Create, Lifecycle.Update)
185+
executionFilterIdentifierHeaderValue: string;
186+
187+
@doc("The provisioning state")
188+
@visibility(Lifecycle.Read)
189+
provisioningState?: ProvisioningState;
190+
}
191+
192+
/** Version code information for edge action */
193+
model VersionCode {
194+
@doc("The version code deployment content ")
195+
@visibility(Lifecycle.Read, Lifecycle.Create, Lifecycle.Update)
196+
content: string;
197+
198+
@doc("The version code name")
199+
@visibility(Lifecycle.Read, Lifecycle.Create, Lifecycle.Update)
200+
name: string;
201+
}
202+
203+
/** Edge action operation properties */
204+
model EdgeActionOperationProperties {
205+
@doc("The resource id of the operation.")
206+
resourceId: string;
207+
208+
@doc("The GUID representing operationID.")
209+
operationId: string;
210+
211+
@doc("The current status of the operation.")
212+
status: OperationStatus;
213+
214+
@doc("The operation type.")
215+
operationType: string;
216+
217+
@doc("The start time of the operation.")
218+
startTime?: utcDateTime;
219+
220+
@doc("The end time of the operation (if completed).")
221+
endTime?: utcDateTime;
222+
223+
@doc("Error details, if applicable.")
224+
error?: ErrorDetails;
225+
}
226+
227+
/** Error details for operations */
228+
model ErrorDetails {
229+
@doc("Error code.")
230+
code: string;
231+
232+
@doc("Detailed error message.")
233+
message: string;
234+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
"operationId": "EdgeActionExecutionFilters_Create",
3+
"title": "CreateEdgeActionExecutionFilters",
4+
"parameters": {
5+
"subscriptionId": "00000000-0000-0000-0000-000000000000",
6+
"resourceGroupName": "testrg",
7+
"api-version": "2025-09-01-preview",
8+
"edgeActionName": "edgeAction1",
9+
"executionFilter": "executionFilter1",
10+
"resource": {
11+
"location": "global",
12+
"properties": {
13+
"versionId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/testrg/providers/Microsoft.Cdn/EdgeActions/edgeAction1/versions/version1",
14+
"executionFilterIdentifierHeaderName": "header-key",
15+
"executionFilterIdentifierHeaderValue": "header-value"
16+
}
17+
}
18+
},
19+
"responses": {
20+
"201": {
21+
"body": {
22+
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testrg/providers/Microsoft.Cdn/edgeActions/edgeAction1/executionFilters/executionFilters1",
23+
"name": "executionFilter1",
24+
"type": "Microsoft.Cdn/edgeActions/executionFilters",
25+
"location": "global",
26+
"properties": {
27+
"versionId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/testrg/providers/Microsoft.Cdn/EdgeActions/edgeAction1/versions/version1",
28+
"executionFilterIdentifierHeaderName": "header-key",
29+
"executionFilterIdentifierHeaderValue": "header-value",
30+
"provisioningState": "Accepted",
31+
"lastUpdateTime": "2024-04-25T15:19:23Z"
32+
}
33+
}
34+
},
35+
"200": {
36+
"body": {
37+
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testrg/providers/Microsoft.Cdn/edgeActions/edgeAction1/executionFilters/executionFilters1",
38+
"name": "executionFilter1",
39+
"type": "Microsoft.Cdn/edgeActions/executionFilters",
40+
"location": "global",
41+
"properties": {
42+
"versionId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/testrg/providers/Microsoft.Cdn/EdgeActions/edgeAction1/versions/version1",
43+
"executionFilterIdentifierHeaderName": "header-key",
44+
"executionFilterIdentifierHeaderValue": "header-value",
45+
"provisioningState": "Succeeded",
46+
"lastUpdateTime": "2024-04-25T15:19:23Z"
47+
}
48+
}
49+
}
50+
}
51+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"operationId": "EdgeActionExecutionFilters_Delete",
3+
"title": "DeleteEdgeActionExecutionFilters",
4+
"parameters": {
5+
"subscriptionId": "00000000-0000-0000-0000-000000000000",
6+
"resourceGroupName": "testrg",
7+
"api-version": "2025-09-01-preview",
8+
"edgeActionName": "edgeAction1",
9+
"executionFilter": "executionFilter1"
10+
},
11+
"responses": {
12+
"202": {
13+
"headers": {
14+
"location": "https://management.azure.com/subscriptions/subid/resourcegroups/resourceGroupName/providers/Microsoft.Cdn/operationresults/operationId?api-version=2025-09-01-preview"
15+
}
16+
},
17+
"204": {}
18+
}
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"operationId": "EdgeActionExecutionFilters_Get",
3+
"title": "GetEdgeActionExecutionFilters",
4+
"parameters": {
5+
"subscriptionId": "00000000-0000-0000-0000-000000000000",
6+
"resourceGroupName": "testrg",
7+
"api-version": "2025-09-01-preview",
8+
"edgeActionName": "edgeAction1",
9+
"executionFilter": "executionFilter1"
10+
},
11+
"responses": {
12+
"200": {
13+
"body": {
14+
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testrg/providers/Microsoft.Cdn/edgeActions/edgeAction1/executionFilters/executionFilters1",
15+
"name": "executionFilter1",
16+
"type": "Microsoft.Cdn/edgeActions/executionFilters",
17+
"location": "global",
18+
"properties": {
19+
"versionId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/testrg/providers/Microsoft.Cdn/EdgeActions/edgeAction1/versions/version1",
20+
"executionFilterIdentifierHeaderName": "header-key",
21+
"executionFilterIdentifierHeaderValue": "header-value",
22+
"provisioningState": "Succeeded",
23+
"lastUpdateTime": "2024-04-25T15:19:23Z"
24+
}
25+
}
26+
}
27+
}
28+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"operationId": "EdgeActionExecutionFilters_ListByEdgeAction",
3+
"title": "ListEdgeActionsExecutionFiltersByEdgeAction",
4+
"parameters": {
5+
"subscriptionId": "00000000-0000-0000-0000-000000000000",
6+
"resourceGroupName": "testrg",
7+
"api-version": "2025-09-01-preview",
8+
"edgeActionName": "edgeAction1"
9+
},
10+
"responses": {
11+
"200": {
12+
"body": {
13+
"value": [
14+
{
15+
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testrg/providers/Microsoft.Cdn/edgeActions/edgeAction1/executionFilters/executionFilters1",
16+
"name": "executionFilter1",
17+
"type": "Microsoft.Cdn/edgeActions/executionFilters",
18+
"location": "global",
19+
"properties": {
20+
"versionId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/testrg/providers/Microsoft.Cdn/EdgeActions/edgeAction1/versions/version1",
21+
"executionFilterIdentifierHeaderName": "header-key",
22+
"executionFilterIdentifierHeaderValue": "header-value",
23+
"provisioningState": "Succeeded",
24+
"lastUpdateTime": "2024-04-25T15:19:23Z"
25+
}
26+
},
27+
{
28+
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testrg/providers/Microsoft.Cdn/edgeActions/edgeAction1/executionFilters/executionFilters2",
29+
"name": "executionFilter2",
30+
"type": "Microsoft.Cdn/edgeActions/executionFilters",
31+
"location": "global",
32+
"properties": {
33+
"versionId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/testrg/providers/Microsoft.Cdn/EdgeActions/edgeAction1/versions/version2",
34+
"executionFilterIdentifierHeaderName": "header-key2",
35+
"executionFilterIdentifierHeaderValue": "header-value2",
36+
"provisioningState": "Succeeded",
37+
"lastUpdateTime": "2024-04-25T15:19:23Z"
38+
}
39+
}
40+
]
41+
}
42+
}
43+
}
44+
}

0 commit comments

Comments
 (0)