6
6
"fmt"
7
7
"net/http"
8
8
"time"
9
+
10
+ "github.com/intelowlproject/go-intelowl/constants"
9
11
)
10
12
11
13
// UserDetails represents user details in an IntelOwl job.
@@ -81,7 +83,7 @@ type JobService struct {
81
83
//
82
84
// IntelOwl REST API docs: https://intelowl.readthedocs.io/en/latest/Redoc.html#tag/jobs/operation/jobs_list
83
85
func (jobService * JobService ) List (ctx context.Context ) (* JobListResponse , error ) {
84
- requestUrl := fmt . Sprintf ( BASE_JOB_URL , jobService .client .options .Url )
86
+ requestUrl := jobService .client .options .Url + constants . BASE_JOB_URL
85
87
contentType := "application/json"
86
88
method := "GET"
87
89
request , err := jobService .client .buildRequest (ctx , method , contentType , nil , requestUrl )
@@ -107,7 +109,8 @@ func (jobService *JobService) List(ctx context.Context) (*JobListResponse, error
107
109
//
108
110
// IntelOwl REST API docs: https://intelowl.readthedocs.io/en/latest/Redoc.html#tag/jobs/operation/jobs_retrieve
109
111
func (jobService * JobService ) Get (ctx context.Context , jobId uint64 ) (* Job , error ) {
110
- requestUrl := fmt .Sprintf (SPECIFIC_JOB_URL , jobService .client .options .Url , jobId )
112
+ route := jobService .client .options .Url + constants .SPECIFIC_JOB_URL
113
+ requestUrl := fmt .Sprintf (route , jobId )
111
114
contentType := "application/json"
112
115
method := "GET"
113
116
request , err := jobService .client .buildRequest (ctx , method , contentType , nil , requestUrl )
@@ -132,7 +135,8 @@ func (jobService *JobService) Get(ctx context.Context, jobId uint64) (*Job, erro
132
135
//
133
136
// IntelOwl REST API docs: https://intelowl.readthedocs.io/en/latest/Redoc.html#tag/jobs/operation/jobs_download_sample_retrieve
134
137
func (jobService * JobService ) DownloadSample (ctx context.Context , jobId uint64 ) ([]byte , error ) {
135
- requestUrl := fmt .Sprintf (DOWNLOAD_SAMPLE_JOB_URL , jobService .client .options .Url , jobId )
138
+ route := jobService .client .options .Url + constants .DOWNLOAD_SAMPLE_JOB_URL
139
+ requestUrl := fmt .Sprintf (route , jobId )
136
140
contentType := "application/json"
137
141
method := "GET"
138
142
request , err := jobService .client .buildRequest (ctx , method , contentType , nil , requestUrl )
@@ -152,7 +156,8 @@ func (jobService *JobService) DownloadSample(ctx context.Context, jobId uint64)
152
156
//
153
157
// IntelOwl REST API docs: https://intelowl.readthedocs.io/en/latest/Redoc.html#tag/jobs/operation/jobs_destroy
154
158
func (jobService * JobService ) Delete (ctx context.Context , jobId uint64 ) (bool , error ) {
155
- requestUrl := fmt .Sprintf (SPECIFIC_JOB_URL , jobService .client .options .Url , jobId )
159
+ route := jobService .client .options .Url + constants .SPECIFIC_JOB_URL
160
+ requestUrl := fmt .Sprintf (route , jobId )
156
161
contentType := "application/json"
157
162
method := "DELETE"
158
163
request , err := jobService .client .buildRequest (ctx , method , contentType , nil , requestUrl )
@@ -175,7 +180,8 @@ func (jobService *JobService) Delete(ctx context.Context, jobId uint64) (bool, e
175
180
//
176
181
// IntelOwl REST API docs: https://intelowl.readthedocs.io/en/latest/Redoc.html#tag/jobs/operation/jobs_kill_partial_update
177
182
func (jobService * JobService ) Kill (ctx context.Context , jobId uint64 ) (bool , error ) {
178
- requestUrl := fmt .Sprintf (KILL_JOB_URL , jobService .client .options .Url , jobId )
183
+ route := jobService .client .options .Url + constants .KILL_JOB_URL
184
+ requestUrl := fmt .Sprintf (route , jobId )
179
185
contentType := "application/json"
180
186
method := "PATCH"
181
187
request , err := jobService .client .buildRequest (ctx , method , contentType , nil , requestUrl )
@@ -198,7 +204,8 @@ func (jobService *JobService) Kill(ctx context.Context, jobId uint64) (bool, err
198
204
//
199
205
// IntelOwl REST API docs: https://intelowl.readthedocs.io/en/latest/Redoc.html#tag/jobs/operation/jobs_analyzer_kill_partial_update
200
206
func (jobService * JobService ) KillAnalyzer (ctx context.Context , jobId uint64 , analyzerName string ) (bool , error ) {
201
- requestUrl := fmt .Sprintf (KILL_ANALYZER_JOB_URL , jobService .client .options .Url , jobId , analyzerName )
207
+ route := jobService .client .options .Url + constants .KILL_ANALYZER_JOB_URL
208
+ requestUrl := fmt .Sprintf (route , jobId , analyzerName )
202
209
contentType := "application/json"
203
210
method := "PATCH"
204
211
request , err := jobService .client .buildRequest (ctx , method , contentType , nil , requestUrl )
@@ -221,7 +228,8 @@ func (jobService *JobService) KillAnalyzer(ctx context.Context, jobId uint64, an
221
228
//
222
229
// IntelOwl REST API docs: https://intelowl.readthedocs.io/en/latest/Redoc.html#tag/jobs/operation/jobs_analyzer_retry_partial_update
223
230
func (jobService * JobService ) RetryAnalyzer (ctx context.Context , jobId uint64 , analyzerName string ) (bool , error ) {
224
- requestUrl := fmt .Sprintf (RETRY_ANALYZER_JOB_URL , jobService .client .options .Url , jobId , analyzerName )
231
+ route := jobService .client .options .Url + constants .RETRY_ANALYZER_JOB_URL
232
+ requestUrl := fmt .Sprintf (route , jobId , analyzerName )
225
233
contentType := "application/json"
226
234
method := "PATCH"
227
235
request , err := jobService .client .buildRequest (ctx , method , contentType , nil , requestUrl )
@@ -244,7 +252,8 @@ func (jobService *JobService) RetryAnalyzer(ctx context.Context, jobId uint64, a
244
252
//
245
253
// IntelOwl REST API docs: https://intelowl.readthedocs.io/en/latest/Redoc.html#tag/jobs/operation/jobs_connector_kill_partial_update
246
254
func (jobService * JobService ) KillConnector (ctx context.Context , jobId uint64 , connectorName string ) (bool , error ) {
247
- requestUrl := fmt .Sprintf (KILL_CONNECTOR_JOB_URL , jobService .client .options .Url , jobId , connectorName )
255
+ route := jobService .client .options .Url + constants .KILL_CONNECTOR_JOB_URL
256
+ requestUrl := fmt .Sprintf (route , jobId , connectorName )
248
257
contentType := "application/json"
249
258
method := "PATCH"
250
259
request , err := jobService .client .buildRequest (ctx , method , contentType , nil , requestUrl )
@@ -267,7 +276,8 @@ func (jobService *JobService) KillConnector(ctx context.Context, jobId uint64, c
267
276
//
268
277
// IntelOwl REST API docs: https://intelowl.readthedocs.io/en/latest/Redoc.html#tag/jobs/operation/jobs_connector_retry_partial_update
269
278
func (jobService * JobService ) RetryConnector (ctx context.Context , jobId uint64 , connectorName string ) (bool , error ) {
270
- requestUrl := fmt .Sprintf (RETRY_CONNECTOR_JOB_URL , jobService .client .options .Url , jobId , connectorName )
279
+ route := jobService .client .options .Url + constants .RETRY_CONNECTOR_JOB_URL
280
+ requestUrl := fmt .Sprintf (route , jobId , connectorName )
271
281
contentType := "application/json"
272
282
method := "PATCH"
273
283
request , err := jobService .client .buildRequest (ctx , method , contentType , nil , requestUrl )
0 commit comments