Skip to content

Commit 473f70b

Browse files
fix: align resource group list/get/delete paths with authz API
Use /authz/api/v2/resourcegroup instead of /resourcegroup/api/v2/resourcegroup. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 47752e5 commit 473f70b

1 file changed

Lines changed: 22 additions & 5 deletions

File tree

src/registry/toolsets/access-control.ts

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ export const accessControlToolset: ToolsetDefinition = {
323323
operations: {
324324
list: {
325325
method: "GET",
326-
path: "/resourcegroup/api/v2/resourcegroup",
326+
path: "/authz/api/v2/resourcegroup",
327327
operationPolicy: { risk: "read", retryPolicy: "safe" },
328328
queryParams: {
329329
search_term: "searchTerm",
@@ -335,17 +335,34 @@ export const accessControlToolset: ToolsetDefinition = {
335335
},
336336
get: {
337337
method: "GET",
338-
path: "/resourcegroup/api/v2/resourcegroup/{resourceGroupIdentifier}",
338+
path: "/authz/api/v2/resourcegroup/{resourceGroupIdentifier}",
339339
operationPolicy: { risk: "read", retryPolicy: "safe" },
340340
pathParams: { resource_group_id: "resourceGroupIdentifier" },
341341
responseExtractor: ngExtract,
342342
description: "Get resource group details",
343343
},
344344
create: {
345345
method: "POST",
346-
path: "/resourcegroup/api/v2/resourcegroup",
346+
path: "/authz/api/v2/resourcegroup",
347347
operationPolicy: { risk: "low_write", retryPolicy: "do_not_retry" },
348-
bodyBuilder: (input) => input.body,
348+
/** POST body must be `{ resourceGroup: { ... } }` per Harness authz API. */
349+
bodyBuilder: (input) => {
350+
const b = input.body;
351+
if (b === undefined || b === null) return b;
352+
if (typeof b !== "object" || Array.isArray(b)) return b;
353+
const rec = b as Record<string, unknown>;
354+
if (
355+
"resourceGroup" in rec &&
356+
typeof rec.resourceGroup === "object" &&
357+
rec.resourceGroup !== null &&
358+
!Array.isArray(rec.resourceGroup)
359+
) {
360+
return { resourceGroup: rec.resourceGroup };
361+
}
362+
return { resourceGroup: rec };
363+
},
364+
bodyWrapperKey: "resourceGroup",
365+
injectAccountInBody: true,
349366
responseExtractor: ngExtract,
350367
description: "Create a resource group",
351368
bodySchema: {
@@ -361,7 +378,7 @@ export const accessControlToolset: ToolsetDefinition = {
361378
},
362379
delete: {
363380
method: "DELETE",
364-
path: "/resourcegroup/api/v2/resourcegroup/{resourceGroupIdentifier}",
381+
path: "/authz/api/v2/resourcegroup/{resourceGroupIdentifier}",
365382
operationPolicy: { risk: "destructive", retryPolicy: "do_not_retry" },
366383
pathParams: { resource_group_id: "resourceGroupIdentifier" },
367384
responseExtractor: ngExtract,

0 commit comments

Comments
 (0)