Skip to content

Commit 6dae2cc

Browse files
Fix PrivateLinkResourceListResultV5 and PrivateEndpointConnectionListResultV5 (#2676)
issues: - #2636 - #2637
1 parent dee0040 commit 6dae2cc

File tree

3 files changed

+62
-3
lines changed

3 files changed

+62
-3
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
changeKind: fix
3+
packages:
4+
- "@azure-tools/typespec-azure-resource-manager"
5+
---
6+
7+
Corrected the references for `PrivateEndpointConnectionListResultV5` and `PrivateLinkResourceListResultV5` in `common-types`.

packages/typespec-autorest/test/arm/arm.test.ts

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,58 @@ it("can use private endpoints with common-types references", async () => {
160160
ok(openapi.paths[privateEndpointGet].get.parameters[1]);
161161
});
162162

163+
it("verify resolution of private endpoints and private links with v5 version", async () => {
164+
const openapi = await openApiFor(
165+
`@useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1)
166+
@armProviderNamespace
167+
@armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v5)
168+
namespace Microsoft.PrivateLinkTest;
169+
170+
interface Operations extends Azure.ResourceManager.Operations {}
171+
172+
@tenantResource
173+
model PrivateEndpointConnectionResource is ProxyResource<PrivateEndpointConnectionProperties> {
174+
@path
175+
@segment("privateEndpointConnections")
176+
@key("privateEndpointConnectionName")
177+
name: string;
178+
}
179+
180+
@armResourceOperations(PrivateEndpointConnectionResource)
181+
interface PrivateEndpointConnections {
182+
#suppress "deprecated" "PrivateLinkResourceListResultV5 validation"
183+
listConnections is ArmResourceListByParent<PrivateEndpointConnectionResource,
184+
Response = ArmResponse<Azure.ResourceManager.CommonTypes.PrivateEndpointConnectionListResultV5>>;
185+
}
186+
187+
model PrivateLinkResource is ProxyResource<PrivateLinkResourceProperties> {
188+
...PrivateLinkResourceParameter;
189+
}
190+
191+
@armResourceOperations(PrivateLinkResource)
192+
interface PrivateLinkResources {
193+
#suppress "deprecated" "PrivateLinkResourceListResultV5 validation"
194+
listByLinkResult is ArmResourceListByParent< PrivateLinkResource,
195+
Response = ArmResponse<Azure.ResourceManager.CommonTypes.PrivateLinkResourceListResultV5>
196+
>;
197+
}
198+
`,
199+
);
200+
201+
const privateEndpointList = "/providers/Microsoft.PrivateLinkTest/privateEndpointConnections";
202+
const privateLinkList =
203+
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PrivateLinkTest/privateLinkResources";
204+
205+
deepStrictEqual(
206+
openapi.paths[privateEndpointList].get.responses["200"].schema["$ref"],
207+
"../../common-types/resource-management/v5/privatelinks.json#/definitions/PrivateEndpointConnectionListResult",
208+
);
209+
deepStrictEqual(
210+
openapi.paths[privateLinkList].get.responses["200"].schema["$ref"],
211+
"../../common-types/resource-management/v5/privatelinks.json#/definitions/PrivateLinkResourceListResult",
212+
);
213+
});
214+
163215
it("can use ResourceNameParameter for custom name parameter definition", async () => {
164216
const openapi = await openApiFor(
165217
`@useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1)

packages/typespec-azure-resource-manager/lib/common-types/private-links-ref.tsp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,17 +163,17 @@ namespace Azure.ResourceManager.CommonTypes;
163163
);
164164

165165
/** PrivateLinkResourceListResult */
166-
@@armCommonDefinition(PrivateEndpointConnectionListResultV5,
166+
@@armCommonDefinition(PrivateLinkResourceListResultV5,
167167
"PrivateLinkResourceListResult",
168168
Azure.ResourceManager.CommonTypes.Versions.v3,
169169
"privatelinks.json"
170170
);
171-
@@armCommonDefinition(PrivateEndpointConnectionListResultV5,
171+
@@armCommonDefinition(PrivateLinkResourceListResultV5,
172172
"PrivateLinkResourceListResult",
173173
Azure.ResourceManager.CommonTypes.Versions.v4,
174174
"privatelinks.json"
175175
);
176-
@@armCommonDefinition(PrivateEndpointConnectionListResultV5,
176+
@@armCommonDefinition(PrivateLinkResourceListResultV5,
177177
"PrivateLinkResourceListResult",
178178
Azure.ResourceManager.CommonTypes.Versions.v5,
179179
"privatelinks.json"

0 commit comments

Comments
 (0)