-
Notifications
You must be signed in to change notification settings - Fork 1
/
veracode.go
562 lines (526 loc) · 21.6 KB
/
veracode.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
package main
import (
"encoding/xml"
"errors"
"log"
)
const (
APP_IS_OK = "[success] The build has no none-mitigated flaws with high severity."
APP_IS_NOT_OK = "[Error] The build has some none-mitigated flaws with high severity!"
APP_IS_READY = "[Ok] App is ready for new scan"
SCAN_IS_READY = "[Ok] Results Ready"
SCAN_IS_IN_PROGRESS = "[Error] The scan is still in progress. Please wait !"
SCAN_STUCKED = "[Error] The scan has been stuck and cannot be deleted automatically !"
SCAN_STUCK_AND_DELETED = "[Success] The scan was stuck and successfully deleted."
SCAN_STUCKEDNOTDELETED = "[Error] The scan has been stuck less than the threshold! Please try again later!"
APP_NOT_FOUND = "[Error] The App was not found!"
BUILD_NOT_FOUND = "[Error] The Build was not found!"
CATEGORY_IS_EMPTY = "[Error] Category is empty"
API_CON_ERROR = "[Error] Veracode API connection issue!"
API_UNEXPECTED_ERROR = "[Error] Unexpected error on API response!"
API_NOT_FOUND = "[Error] The requested API was not found!"
REQ_BUILDLIST = "Requesting build list"
REQ_BUILD_INFO = "Requesting build info"
REQ_LAST_BUILD = "Requesting last build"
REQ_DELETE_BUILD = "Deleting last build"
REQ_FULL_REPORT = "Requesting full report"
REQ_FIND_APPID = "Finding App ID"
BUILD_STATUS = "The build status is [%s]"
STATUS_SCAN_IS_READY = "Results Ready"
STATUS_SCAN_IS_NOT_READY = "[Error] Scan result is not ready!"
STATUS_SCAN_IN_PROGRESS = "Scan In Process"
STATUS_SCAN_INCOMPLETE = "Incomplete"
STATUS_PRE_SCAN_FAILED = "Pre-Scan Failed"
STATUS_PRE_SCAN_SUCCESS = "Pre-Scan Success"
STATUS_PRE_SCAN_SUBMITTED = "Pre-Scan Submitted"
STATUS_NO_MODULES_DEFINED = "No Modules Defined"
STATUS_SCAN_UNKNOWN = "[Error] Unknown status: "
STATUS_REPORT_UNAVAIL = "No report available."
FLAG_APP_NOT_FOUND = "N000"
FLAG_APP_ERROR = "0000"
FLAG_BUILD_NOT_FOUND = "YN00"
FLAG_BUILD_ERROR = "Y000"
FLAG_APP_IS_NOT_OK = "YYYY"
FLAG_APP_IS_OK = "YYYN"
FLAG_BUILD_NOT_READY = "YYN0"
FLAG_REPORT_ERROR = "YYY0"
INVALID_COMMAND = "[Error] Invalid Command."
INVALID_CREDS = "[Error] Invalid Credentials. Authentication failed !"
FORBIDEN_ACCESS = "[Error] Your account doesn't have sufficient access. Please contact with Security team."
)
type VeracodeApplist struct {
XMLName xml.Name `xml:"applist"`
Text string `xml:",chardata"`
Xsi string `xml:"xsi,attr"`
Xmlns string `xml:"xmlns,attr"`
SchemaLocation string `xml:"schemaLocation,attr"`
ApplistVersion string `xml:"applist_version,attr"`
AccountID string `xml:"account_id,attr"`
App []struct {
Text string `xml:",chardata"`
AppID string `xml:"app_id,attr"`
AppName string `xml:"app_name,attr"`
PolicyUpdatedDate string `xml:"policy_updated_date,attr"`
} `xml:"app"`
}
type VeracodeBuildList struct {
Buildlist xml.Name `xml:"buildlist"`
Text string `xml:",chardata"`
Xsi string `xml:"xsi,attr"`
Xmlns string `xml:"xmlns,attr"`
SchemaLocation string `xml:"schemaLocation,attr"`
BuildlistVersion string `xml:"buildlist_version,attr"`
AccountID string `xml:"account_id,attr"`
AppID string `xml:"app_id,attr"`
AppName string `xml:"app_name,attr"`
Build []struct {
Text string `xml:",chardata"`
BuildID string `xml:"build_id,attr"`
Version string `xml:"version,attr"`
PolicyUpdatedDate string `xml:"policy_updated_date,attr"`
DynamicScanType string `xml:"dynamic_scan_type,omitempty,attr"`
} `xml:"build"`
}
type BuildInfo struct {
XMLName xml.Name `xml:"buildinfo"`
Text string `xml:",chardata"`
Xsi string `xml:"xsi,attr"`
Xmlns string `xml:"xmlns,attr"`
SchemaLocation string `xml:"schemaLocation,attr"`
BuildinfoVersion string `xml:"buildinfo_version,attr"`
AccountID string `xml:"account_id,attr"`
AppID string `xml:"app_id,attr"`
BuildID string `xml:"build_id,attr"`
Build struct {
Text string `xml:",chardata"`
Version string `xml:"version,attr"`
BuildID string `xml:"build_id,attr"`
Submitter string `xml:"submitter,attr"`
Platform string `xml:"platform,attr"`
LifecycleStage string `xml:"lifecycle_stage,attr"`
ResultsReady string `xml:"results_ready,attr"`
PolicyName string `xml:"policy_name,attr"`
PolicyVersion string `xml:"policy_version,attr"`
PolicyComplianceStatus string `xml:"policy_compliance_status,attr"`
PolicyUpdatedDate string `xml:"policy_updated_date,attr"`
RulesStatus string `xml:"rules_status,attr"`
GracePeriodExpired string `xml:"grace_period_expired,attr"`
ScanOverdue string `xml:"scan_overdue,attr"`
LegacyScanEngine string `xml:"legacy_scan_engine,attr"`
AnalysisUnit struct {
Text string `xml:",chardata"`
AnalysisType string `xml:"analysis_type,attr"`
PublishedDate string `xml:"published_date,attr"`
PublishedDateSec string `xml:"published_date_sec,attr"`
Status string `xml:"status,attr"`
EngineVersion string `xml:"engine_version,attr"`
} `xml:"analysis_unit"`
} `xml:"build"`
}
type Detailedreport struct {
XMLName xml.Name `xml:"detailedreport"`
Text string `xml:",chardata"`
Xsi string `xml:"xsi,attr"`
Xmlns string `xml:"xmlns,attr"`
SchemaLocation string `xml:"schemaLocation,attr"`
ReportFormatVersion string `xml:"report_format_version,attr"`
AccountID string `xml:"account_id,attr"`
AppName string `xml:"app_name,attr"`
AppID string `xml:"app_id,attr"`
AnalysisID string `xml:"analysis_id,attr"`
StaticAnalysisUnitID string `xml:"static_analysis_unit_id,attr"`
SandboxID string `xml:"sandbox_id,attr"`
FirstBuildSubmittedDate string `xml:"first_build_submitted_date,attr"`
Version string `xml:"version,attr"`
BuildID string `xml:"build_id,attr"`
Submitter string `xml:"submitter,attr"`
Platform string `xml:"platform,attr"`
AssuranceLevel string `xml:"assurance_level,attr"`
BusinessCriticality string `xml:"business_criticality,attr"`
GenerationDate string `xml:"generation_date,attr"`
VeracodeLevel string `xml:"veracode_level,attr"`
TotalFlaws string `xml:"total_flaws,attr"`
FlawsNotMitigated string `xml:"flaws_not_mitigated,attr"`
Teams string `xml:"teams,attr"`
LifeCycleStage string `xml:"life_cycle_stage,attr"`
PlannedDeploymentDate string `xml:"planned_deployment_date,attr"`
LastUpdateTime string `xml:"last_update_time,attr"`
IsLatestBuild string `xml:"is_latest_build,attr"`
PolicyName string `xml:"policy_name,attr"`
PolicyVersion string `xml:"policy_version,attr"`
PolicyComplianceStatus string `xml:"policy_compliance_status,attr"`
PolicyRulesStatus string `xml:"policy_rules_status,attr"`
GracePeriodExpired string `xml:"grace_period_expired,attr"`
ScanOverdue string `xml:"scan_overdue,attr"`
BusinessOwner string `xml:"business_owner,attr"`
BusinessUnit string `xml:"business_unit,attr"`
Tags string `xml:"tags,attr"`
LegacyScanEngine string `xml:"legacy_scan_engine,attr"`
StaticAnalysis struct {
Text string `xml:",chardata"`
Rating string `xml:"rating,attr"`
Score string `xml:"score,attr"`
SubmittedDate string `xml:"submitted_date,attr"`
PublishedDate string `xml:"published_date,attr"`
Version string `xml:"version,attr"`
NextScanDue string `xml:"next_scan_due,attr"`
AnalysisSizeBytes string `xml:"analysis_size_bytes,attr"`
EngineVersion string `xml:"engine_version,attr"`
Modules struct {
Text string `xml:",chardata"`
Module struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Compiler string `xml:"compiler,attr"`
Os string `xml:"os,attr"`
Architecture string `xml:"architecture,attr"`
Loc string `xml:"loc,attr"`
Score string `xml:"score,attr"`
Numflawssev0 string `xml:"numflawssev0,attr"`
Numflawssev1 string `xml:"numflawssev1,attr"`
Numflawssev2 string `xml:"numflawssev2,attr"`
Numflawssev3 string `xml:"numflawssev3,attr"`
Numflawssev4 string `xml:"numflawssev4,attr"`
Numflawssev5 string `xml:"numflawssev5,attr"`
} `xml:"module"`
} `xml:"modules"`
} `xml:"static-analysis"`
Severity []struct {
Text string `xml:",chardata"`
Level string `xml:"level,attr"`
Category []Category `xml:"category"`
} `xml:"severity"`
FlawStatus struct {
Text string `xml:",chardata"`
New string `xml:"new,attr"`
Reopen string `xml:"reopen,attr"`
Open string `xml:"open,attr"`
CannotReproduce string `xml:"cannot-reproduce,attr"`
Fixed string `xml:"fixed,attr"`
Total string `xml:"total,attr"`
NotMitigated string `xml:"not_mitigated,attr"`
Sev1Change string `xml:"sev-1-change,attr"`
Sev2Change string `xml:"sev-2-change,attr"`
Sev3Change string `xml:"sev-3-change,attr"`
Sev4Change string `xml:"sev-4-change,attr"`
Sev5Change string `xml:"sev-5-change,attr"`
} `xml:"flaw-status"`
Customfields struct {
Text string `xml:",chardata"`
Customfield []struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Value string `xml:"value,attr"`
} `xml:"customfield"`
} `xml:"customfields"`
SoftwareCompositionAnalysis struct {
Text string `xml:",chardata"`
ThirdPartyComponents string `xml:"third_party_components,attr"`
ViolatePolicy string `xml:"violate_policy,attr"`
ComponentsViolatedPolicy string `xml:"components_violated_policy,attr"`
VulnerableComponents struct {
Text string `xml:",chardata"`
Component []struct {
Text string `xml:",chardata"`
ComponentID string `xml:"component_id,attr"`
FileName string `xml:"file_name,attr"`
Sha1 string `xml:"sha1,attr"`
AttrVulnerabilities string `xml:"vulnerabilities,attr"`
MaxCvssScore string `xml:"max_cvss_score,attr"`
Version string `xml:"version,attr"`
Library string `xml:"library,attr"`
Vendor string `xml:"vendor,attr"`
Description string `xml:"description,attr"`
AddedDate string `xml:"added_date,attr"`
ComponentAffectsPolicyCompliance string `xml:"component_affects_policy_compliance,attr"`
New string `xml:"new,attr"`
FilePaths struct {
Text string `xml:",chardata"`
FilePath struct {
Text string `xml:",chardata"`
Value string `xml:"value,attr"`
} `xml:"file_path"`
} `xml:"file_paths"`
Licenses struct {
Text string `xml:",chardata"`
License []struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
SpdxID string `xml:"spdx_id,attr"`
LicenseURL string `xml:"license_url,attr"`
RiskRating string `xml:"risk_rating,attr"`
} `xml:"license"`
} `xml:"licenses"`
Vulnerabilities struct {
Text string `xml:",chardata"`
Vulnerability []struct {
Text string `xml:",chardata"`
CveID string `xml:"cve_id,attr"`
CvssScore string `xml:"cvss_score,attr"`
Severity string `xml:"severity,attr"`
CweID string `xml:"cwe_id,attr"`
FirstFoundDate string `xml:"first_found_date,attr"`
CveSummary string `xml:"cve_summary,attr"`
SeverityDesc string `xml:"severity_desc,attr"`
Mitigation string `xml:"mitigation,attr"`
VulnerabilityAffectsPolicyCompliance string `xml:"vulnerability_affects_policy_compliance,attr"`
} `xml:"vulnerability"`
} `xml:"vulnerabilities"`
ViolatedPolicyRules string `xml:"violated_policy_rules"`
} `xml:"component"`
} `xml:"vulnerable_components"`
} `xml:"software_composition_analysis"`
}
type Category struct {
Text string `xml:",chardata"`
Categoryid string `xml:"categoryid,attr"`
Categoryname string `xml:"categoryname,attr"`
Pcirelated string `xml:"pcirelated,attr"`
Desc struct {
Text string `xml:",chardata"`
Para []struct {
Text string `xml:",chardata"`
AttrText string `xml:"text,attr"`
} `xml:"para"`
} `xml:"desc"`
Recommendations struct {
Text string `xml:",chardata"`
Para struct {
Text string `xml:",chardata"`
AttrText string `xml:"text,attr"`
} `xml:"para"`
} `xml:"recommendations"`
Cwe []struct {
Text string `xml:",chardata"`
Cweid string `xml:"cweid,attr"`
Cwename string `xml:"cwename,attr"`
Pcirelated string `xml:"pcirelated,attr"`
Owasp string `xml:"owasp,attr"`
Owasp2013 string `xml:"owasp2013,attr"`
Certjava string `xml:"certjava,attr"`
Description struct {
Chardata string `xml:",chardata"`
Text struct {
Text string `xml:",chardata"`
AttrText string `xml:"text,attr"`
} `xml:"text"`
} `xml:"description"`
Staticflaws struct {
Text string `xml:",chardata"`
Flaw []struct {
Text string `xml:",chardata"`
Severity string `xml:"severity,attr"`
Categoryname string `xml:"categoryname,attr"`
Count string `xml:"count,attr"`
Issueid string `xml:"issueid,attr"`
Module string `xml:"module,attr"`
Type string `xml:"type,attr"`
Description string `xml:"description,attr"`
Note string `xml:"note,attr"`
Cweid string `xml:"cweid,attr"`
Remediationeffort string `xml:"remediationeffort,attr"`
ExploitLevel string `xml:"exploitLevel,attr"`
Categoryid string `xml:"categoryid,attr"`
Pcirelated string `xml:"pcirelated,attr"`
DateFirstOccurrence string `xml:"date_first_occurrence,attr"`
RemediationStatus string `xml:"remediation_status,attr"`
CiaImpact string `xml:"cia_impact,attr"`
GracePeriodExpires string `xml:"grace_period_expires,attr"`
AffectsPolicyCompliance string `xml:"affects_policy_compliance,attr"`
MitigationStatus string `xml:"mitigation_status,attr"`
MitigationStatusDesc string `xml:"mitigation_status_desc,attr"`
Sourcefile string `xml:"sourcefile,attr"`
Line string `xml:"line,attr"`
Sourcefilepath string `xml:"sourcefilepath,attr"`
Scope string `xml:"scope,attr"`
Functionprototype string `xml:"functionprototype,attr"`
Functionrelativelocation string `xml:"functionrelativelocation,attr"`
Annotations struct {
Text string `xml:",chardata"`
Annotation []struct {
Text string `xml:",chardata"`
Action string `xml:"action,attr"`
Description string `xml:"description,attr"`
User string `xml:"user,attr"`
Date string `xml:"date,attr"`
} `xml:"annotation"`
} `xml:"annotations"`
} `xml:"flaw"`
} `xml:"staticflaws"`
} `xml:"cwe"`
}
type VeracodeSeverity struct {
Medium int
HighAndVeryHigh int
}
// VeracodeCredentials centralized credentials for veracode account and OpsGenie reporting
type VeracodeCredentials struct {
Username string
Password string
}
// Veracode Additional arguments
type VeracodeArgs struct {
Command string
AppID string
AppName string
BuildID string
BuildName string
}
//Find the last build information (build id)
func VeracodeLastBuildInfo(credentials VeracodeCredentials, appid *string, Binfo *BuildInfo) error {
url := "https://analysiscenter.veracode.com/api/5.0/getbuildinfo.do"
extraParams := map[string]string{
"app_id": *appid,
}
bodyString, err := makeRequest(url, credentials.Username, credentials.Password, extraParams, REQ_BUILD_INFO)
if err != nil {
return err
}
err = xml.Unmarshal([]byte(bodyString), &Binfo)
if err != nil {
return errors.New(BUILD_NOT_FOUND)
}
return nil
}
//Find a specific build information (build id)
func VeracodeBuildInfo(credentials VeracodeCredentials, appid *string, build_id *string, Binfo *BuildInfo) error {
url := "https://analysiscenter.veracode.com/api/5.0/getbuildinfo.do"
extraParams := map[string]string{
"app_id": *appid,
"build_id": *build_id,
}
bodyString, err := makeRequest(url, credentials.Username, credentials.Password, extraParams, REQ_BUILD_INFO)
if err != nil {
return err
}
err = xml.Unmarshal([]byte(bodyString), &Binfo)
if err != nil {
return errors.New(BUILD_NOT_FOUND)
}
return nil
}
func deleteAppLastBuild(credentials VeracodeCredentials, appid string) error {
extraParams := map[string]string{
"app_id": appid,
}
bodyString, err := makeRequest("https://analysiscenter.veracode.com/api/4.0/deletebuild.do", credentials.Username, credentials.Password, extraParams, REQ_DELETE_BUILD)
//log.Println(bodyString)
_ = bodyString
return err
}
func downloadFullReport(credentials VeracodeCredentials, build_id *string) (Detailedreport, error) {
var appBuildReport Detailedreport
url := "https://analysiscenter.veracode.com/api/5.0/detailedreport.do?build_id=" + *build_id
bodyString, err := makeRequest(url, credentials.Username, credentials.Password, nil, REQ_FULL_REPORT)
if err != nil {
return appBuildReport, err
}
err = xml.Unmarshal([]byte(bodyString), &appBuildReport)
if err != nil {
return appBuildReport, errors.New(bodyString)
}
return appBuildReport, err
}
func ScanCheckStatus(build *BuildInfo) error {
var err error
if build.AppID != "" {
log.Printf(BUILD_STATUS, build.Build.AnalysisUnit.Status)
switch build.Build.AnalysisUnit.Status {
case STATUS_SCAN_IS_READY:
err = errors.New(APP_IS_NOT_OK)
case STATUS_SCAN_IN_PROGRESS:
err = errors.New(SCAN_IS_IN_PROGRESS)
case STATUS_SCAN_INCOMPLETE:
err = errors.New(STATUS_SCAN_INCOMPLETE)
case STATUS_PRE_SCAN_FAILED:
err = errors.New(STATUS_PRE_SCAN_FAILED)
case STATUS_PRE_SCAN_SUCCESS:
err = errors.New(STATUS_PRE_SCAN_SUCCESS)
case STATUS_PRE_SCAN_SUBMITTED:
err = errors.New(STATUS_PRE_SCAN_SUBMITTED)
case STATUS_NO_MODULES_DEFINED:
err = errors.New(STATUS_NO_MODULES_DEFINED)
default:
err = errors.New(STATUS_SCAN_UNKNOWN + build.Build.AnalysisUnit.Status)
}
} else {
err = errors.New(BUILD_NOT_FOUND)
}
return err
}
func SeveritiesNotApproved(report *Detailedreport) (VeracodeSeverity, error) {
var severity_total VeracodeSeverity
for _, severity := range report.Severity {
if severity.Category != nil {
switch severity.Level {
case "3":
SeverityCounter(severity.Category, &severity_total.Medium)
case "4":
SeverityCounter(severity.Category, &severity_total.HighAndVeryHigh)
case "5":
SeverityCounter(severity.Category, &severity_total.HighAndVeryHigh)
}
}
}
return severity_total, nil
}
func SeverityCounter(_category []Category, total *int) error {
for _, category := range _category {
if category.Cwe != nil {
for _, cwe := range category.Cwe {
if cwe.Staticflaws.Flaw != nil {
for _, flaw := range cwe.Staticflaws.Flaw {
if flaw.MitigationStatus != "accepted" && flaw.RemediationStatus != "Fixed" {
*total++
}
}
}
}
}
}
return nil
}
func FindAppIdByName(credentials VeracodeCredentials, app_name *string, app_id *string) error {
var appList VeracodeApplist
url := "https://analysiscenter.veracode.com/api/5.0/getapplist.do"
bodyString, err := makeRequest(url, credentials.Username, credentials.Password, nil, REQ_FIND_APPID)
if err != nil {
return err
}
err = xml.Unmarshal([]byte(bodyString), &appList)
if err != nil {
log.Println(err)
}
for _, item := range appList.App {
if item.AppName == *app_name {
*app_id = item.AppID
log.Println("App ID: ", *app_id)
return err
}
}
return errors.New(APP_NOT_FOUND)
}
func FindBuildIdByBuildName(credentials VeracodeCredentials, build_id *string, appid *string, build_name *string) error {
var buildList VeracodeBuildList
url := "https://analysiscenter.veracode.com/api/5.0/getbuildlist.do"
extraParams := map[string]string{
"app_id": *appid,
}
bodyString, err := makeRequest(url, credentials.Username, credentials.Password, extraParams, REQ_BUILDLIST)
if err != nil {
return err
}
err = xml.Unmarshal([]byte(bodyString), &buildList)
if err != nil {
log.Println(err)
return err
}
for _, item := range buildList.Build {
if item.Version == *build_name {
*build_id = item.BuildID
log.Println("Build ID: ", *build_id)
return err
}
}
return errors.New(BUILD_NOT_FOUND)
}