Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pkg/registrybroker/coverage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ func TestCoverageAllEndpoints(t *testing.T) {
// skills
_, _ = client.GetSkillsCatalog(ctx, SkillCatalogOptions{})
_, _ = client.ListSkills(ctx, ListSkillsOptions{})
_, _ = client.GetSkillSecurityBreakdown(ctx, SkillSecurityBreakdownOptions{JobID: "job-1"})
_, _ = client.ListSkillVersions(ctx, "skill-id")
_, _ = client.ListMySkills(ctx, ListMySkillsOptions{})
_, _ = client.GetMySkillsList(ctx, MySkillsListOptions{})
Expand Down
20 changes: 20 additions & 0 deletions pkg/registrybroker/skills.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,26 @@ func (c *RegistryBrokerClient) ListSkills(
)
}

// GetSkillSecurityBreakdown returns scanner summary and findings for a skill release.
func (c *RegistryBrokerClient) GetSkillSecurityBreakdown(
ctx context.Context,
options SkillSecurityBreakdownOptions,
) (JSONObject, error) {
if err := ensureNonEmpty(options.JobID, "jobID"); err != nil {
return nil, err
}

path := "/skills/" + percentPath(strings.TrimSpace(options.JobID)) + "/security-breakdown"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The percentPath function already trims whitespace from its input, so the call to strings.TrimSpace here is redundant and can be removed for cleaner code.

Suggested change
path := "/skills/" + percentPath(strings.TrimSpace(options.JobID)) + "/security-breakdown"
path := "/skills/" + percentPath(options.JobID) + "/security-breakdown"


return c.requestJSON(
ctx,
http.MethodGet,
path,
nil,
nil,
)
}

// ListSkillVersions performs the requested operation.
func (c *RegistryBrokerClient) ListSkillVersions(
ctx context.Context,
Expand Down
4 changes: 4 additions & 0 deletions pkg/registrybroker/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,10 @@ type ListSkillsOptions struct {
AccountID string
}

type SkillSecurityBreakdownOptions struct {
JobID string
}

type ListMySkillsOptions struct {
Limit *int
}
Expand Down
Loading