Skip to content

Commit 4af6bad

Browse files
feat: accept a target_reference value and pass it to the test request [OI-788] (#83)
2 parents 6d1fdd5 + 046f818 commit 4af6bad

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

internal/analysis/analysis.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,12 @@ type AnalysisOrchestrator interface {
4949
}
5050

5151
type AnalysisConfig struct {
52-
Report bool
53-
ProjectName *string
54-
TargetName *string
55-
ProjectId *uuid.UUID
56-
CommitId *string
52+
Report bool
53+
ProjectName *string
54+
TargetName *string
55+
TargetReference *string
56+
ProjectId *uuid.UUID
57+
CommitId *string
5758
}
5859
type analysisOrchestrator struct {
5960
httpClient codeClientHTTP.HTTPClient
@@ -238,6 +239,7 @@ func (a *analysisOrchestrator) RunTest(ctx context.Context, orgId string, b bund
238239
testApi.WithScanType(a.testType),
239240
testApi.WithProjectName(reportingConfig.ProjectName),
240241
testApi.WithTargetName(reportingConfig.TargetName),
242+
testApi.WithTargetReference(reportingConfig.TargetReference),
241243
testApi.WithReporting(&reportingConfig.Report),
242244
)
243245

internal/api/test/2024-12-21/helper.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,17 @@ func WithTargetName(name *string) CreateTestOption {
9292
out.TargetName = name
9393
}
9494
}
95+
96+
func WithTargetReference(targetRef *string) CreateTestOption {
97+
return func(body *CreateTestApplicationVndAPIPlusJSONRequestBody) {
98+
if targetRef == nil || len(*targetRef) == 0 {
99+
return
100+
}
101+
out := ensureOutput(body)
102+
out.TargetReference = targetRef
103+
}
104+
}
105+
95106
func WithReporting(report *bool) CreateTestOption {
96107
return func(body *CreateTestApplicationVndAPIPlusJSONRequestBody) {
97108
if report == nil {

0 commit comments

Comments
 (0)