Skip to content

Commit 84fb7f9

Browse files
committed
fix: use job id for skill security breakdown
Signed-off-by: Michael Kantor <6068672+kantorcodes@users.noreply.github.com>
1 parent 447d7cf commit 84fb7f9

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

pkg/registrybroker/coverage_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ func TestCoverageAllEndpoints(t *testing.T) {
4848
// skills
4949
_, _ = client.GetSkillsCatalog(ctx, SkillCatalogOptions{})
5050
_, _ = client.ListSkills(ctx, ListSkillsOptions{})
51+
_, _ = client.GetSkillSecurityBreakdown(ctx, SkillSecurityBreakdownOptions{JobID: "job-1"})
5152
_, _ = client.ListSkillVersions(ctx, "skill-id")
5253
_, _ = client.ListMySkills(ctx, ListMySkillsOptions{})
5354
_, _ = client.GetMySkillsList(ctx, MySkillsListOptions{})

pkg/registrybroker/skills.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,26 @@ func (c *RegistryBrokerClient) ListSkills(
7979
)
8080
}
8181

82+
// GetSkillSecurityBreakdown returns scanner summary and findings for a skill release.
83+
func (c *RegistryBrokerClient) GetSkillSecurityBreakdown(
84+
ctx context.Context,
85+
options SkillSecurityBreakdownOptions,
86+
) (JSONObject, error) {
87+
if err := ensureNonEmpty(options.JobID, "jobID"); err != nil {
88+
return nil, err
89+
}
90+
91+
path := "/skills/" + percentPath(strings.TrimSpace(options.JobID)) + "/security-breakdown"
92+
93+
return c.requestJSON(
94+
ctx,
95+
http.MethodGet,
96+
path,
97+
nil,
98+
nil,
99+
)
100+
}
101+
82102
// ListSkillVersions performs the requested operation.
83103
func (c *RegistryBrokerClient) ListSkillVersions(
84104
ctx context.Context,

pkg/registrybroker/types.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,10 @@ type ListSkillsOptions struct {
311311
AccountID string
312312
}
313313

314+
type SkillSecurityBreakdownOptions struct {
315+
JobID string
316+
}
317+
314318
type ListMySkillsOptions struct {
315319
Limit *int
316320
}

0 commit comments

Comments
 (0)