mirror of
https://github.com/SecurityBrewery/catalyst.git
synced 2026-01-23 14:33:26 +01:00
1094
generated/api/api.go
Executable file
1094
generated/api/api.go
Executable file
File diff suppressed because it is too large
Load Diff
587
generated/api/test_api.go
Executable file
587
generated/api/test_api.go
Executable file
File diff suppressed because one or more lines are too long
@@ -795,10 +795,7 @@
|
||||
"content" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"items" : {
|
||||
"$ref" : "#/components/schemas/PlaybookTemplateResponse"
|
||||
},
|
||||
"type" : "array"
|
||||
"$ref" : "#/components/schemas/PlaybookTemplateResponse"
|
||||
}
|
||||
},
|
||||
"test" : {
|
||||
@@ -1245,7 +1242,7 @@
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"items" : {
|
||||
"$ref" : "#/components/schemas/TaskResponse"
|
||||
"$ref" : "#/components/schemas/TaskWithContext"
|
||||
},
|
||||
"type" : "array"
|
||||
}
|
||||
@@ -1805,7 +1802,7 @@
|
||||
"content" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/TicketResponse"
|
||||
"$ref" : "#/components/schemas/TicketWithTickets"
|
||||
}
|
||||
},
|
||||
"test" : {
|
||||
@@ -1889,7 +1886,7 @@
|
||||
"content" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/TicketResponse"
|
||||
"$ref" : "#/components/schemas/TicketWithTickets"
|
||||
}
|
||||
},
|
||||
"test" : {
|
||||
@@ -1976,7 +1973,7 @@
|
||||
"content" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/TicketResponse"
|
||||
"$ref" : "#/components/schemas/TicketWithTickets"
|
||||
}
|
||||
},
|
||||
"test" : {
|
||||
@@ -2187,7 +2184,7 @@
|
||||
"content" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/TicketResponse"
|
||||
"$ref" : "#/components/schemas/TicketWithTickets"
|
||||
}
|
||||
},
|
||||
"test" : {
|
||||
@@ -2443,7 +2440,7 @@
|
||||
"content" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/TicketResponse"
|
||||
"$ref" : "#/components/schemas/TicketWithTickets"
|
||||
}
|
||||
},
|
||||
"test" : {
|
||||
@@ -2660,7 +2657,7 @@
|
||||
"content" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/Artifact"
|
||||
"$ref" : "#/components/schemas/TicketWithTickets"
|
||||
}
|
||||
},
|
||||
"test" : {
|
||||
@@ -2922,7 +2919,7 @@
|
||||
"content" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/TicketResponse"
|
||||
"$ref" : "#/components/schemas/TicketWithTickets"
|
||||
}
|
||||
},
|
||||
"test" : {
|
||||
@@ -3013,7 +3010,7 @@
|
||||
"content" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/TicketResponse"
|
||||
"$ref" : "#/components/schemas/TicketWithTickets"
|
||||
}
|
||||
},
|
||||
"test" : {
|
||||
@@ -3226,7 +3223,7 @@
|
||||
"content" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/TicketResponse"
|
||||
"$ref" : "#/components/schemas/TicketWithTickets"
|
||||
}
|
||||
},
|
||||
"test" : {
|
||||
@@ -3317,7 +3314,7 @@
|
||||
"content" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/TicketResponse"
|
||||
"$ref" : "#/components/schemas/TicketWithTickets"
|
||||
}
|
||||
},
|
||||
"test" : {
|
||||
@@ -3418,6 +3415,9 @@
|
||||
"description" : "successful operation"
|
||||
}
|
||||
},
|
||||
"security" : [ {
|
||||
"roles" : [ "ticket:write" ]
|
||||
} ],
|
||||
"summary" : "Add a new ticket playbook",
|
||||
"tags" : [ "tickets" ],
|
||||
"x-codegen-request-body-name" : "playbook"
|
||||
@@ -3451,7 +3451,7 @@
|
||||
"content" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/TicketResponse"
|
||||
"$ref" : "#/components/schemas/TicketWithTickets"
|
||||
}
|
||||
},
|
||||
"test" : {
|
||||
@@ -3545,7 +3545,7 @@
|
||||
"content" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/TicketResponse"
|
||||
"$ref" : "#/components/schemas/TicketWithTickets"
|
||||
}
|
||||
},
|
||||
"test" : {
|
||||
@@ -3776,7 +3776,7 @@
|
||||
"content" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/TicketResponse"
|
||||
"$ref" : "#/components/schemas/TicketWithTickets"
|
||||
}
|
||||
},
|
||||
"test" : {
|
||||
@@ -4038,7 +4038,7 @@
|
||||
"content" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/TicketResponse"
|
||||
"$ref" : "#/components/schemas/TicketWithTickets"
|
||||
}
|
||||
},
|
||||
"test" : {
|
||||
@@ -4112,14 +4112,14 @@
|
||||
}
|
||||
},
|
||||
"description" : "New ticket schema",
|
||||
"required" : false
|
||||
"required" : true
|
||||
},
|
||||
"responses" : {
|
||||
"200" : {
|
||||
"content" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/TicketResponse"
|
||||
"$ref" : "#/components/schemas/TicketWithTickets"
|
||||
}
|
||||
},
|
||||
"test" : {
|
||||
@@ -4207,7 +4207,7 @@
|
||||
"content" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/TicketResponse"
|
||||
"$ref" : "#/components/schemas/TicketWithTickets"
|
||||
}
|
||||
},
|
||||
"test" : {
|
||||
@@ -4273,7 +4273,7 @@
|
||||
"content" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/TicketResponse"
|
||||
"$ref" : "#/components/schemas/TicketWithTickets"
|
||||
}
|
||||
},
|
||||
"test" : {
|
||||
@@ -5433,7 +5433,6 @@
|
||||
"$ref" : "#/components/schemas/Context"
|
||||
},
|
||||
"payload" : {
|
||||
"properties" : { },
|
||||
"type" : "object"
|
||||
},
|
||||
"secrets" : {
|
||||
|
||||
@@ -325,8 +325,7 @@ definitions:
|
||||
properties:
|
||||
context:
|
||||
$ref: '#/definitions/Context'
|
||||
payload:
|
||||
type: object
|
||||
payload: {}
|
||||
secrets:
|
||||
additionalProperties:
|
||||
type: string
|
||||
@@ -2251,9 +2250,7 @@ paths:
|
||||
name: Escalate to malware team
|
||||
type: task
|
||||
schema:
|
||||
items:
|
||||
$ref: '#/definitions/PlaybookTemplateResponse'
|
||||
type: array
|
||||
$ref: '#/definitions/PlaybookTemplateResponse'
|
||||
security:
|
||||
- roles:
|
||||
- playbook:write
|
||||
@@ -2687,7 +2684,7 @@ paths:
|
||||
test: []
|
||||
schema:
|
||||
items:
|
||||
$ref: '#/definitions/TaskResponse'
|
||||
$ref: '#/definitions/TaskWithContext'
|
||||
type: array
|
||||
security:
|
||||
- roles:
|
||||
@@ -3726,7 +3723,7 @@ paths:
|
||||
type: alert
|
||||
type: alert
|
||||
schema:
|
||||
$ref: '#/definitions/TicketResponse'
|
||||
$ref: '#/definitions/TicketWithTickets'
|
||||
security:
|
||||
- roles:
|
||||
- ticket:read
|
||||
@@ -3801,7 +3798,7 @@ paths:
|
||||
type: alert
|
||||
type: alert
|
||||
schema:
|
||||
$ref: '#/definitions/TicketResponse'
|
||||
$ref: '#/definitions/TicketWithTickets'
|
||||
security:
|
||||
- roles:
|
||||
- ticket:write
|
||||
@@ -4053,7 +4050,7 @@ paths:
|
||||
status: closed
|
||||
type: incident
|
||||
schema:
|
||||
$ref: '#/definitions/TicketResponse'
|
||||
$ref: '#/definitions/TicketWithTickets'
|
||||
security:
|
||||
- roles:
|
||||
- ticket:write
|
||||
@@ -4297,7 +4294,7 @@ paths:
|
||||
status: closed
|
||||
type: incident
|
||||
schema:
|
||||
$ref: '#/definitions/TicketResponse'
|
||||
$ref: '#/definitions/TicketWithTickets'
|
||||
security:
|
||||
- roles:
|
||||
- ticket:write
|
||||
@@ -4580,7 +4577,7 @@ paths:
|
||||
status: closed
|
||||
type: incident
|
||||
schema:
|
||||
$ref: '#/definitions/TicketResponse'
|
||||
$ref: '#/definitions/TicketWithTickets'
|
||||
security:
|
||||
- roles:
|
||||
- ticket:write
|
||||
@@ -4841,7 +4838,7 @@ paths:
|
||||
status: closed
|
||||
type: incident
|
||||
schema:
|
||||
$ref: '#/definitions/Artifact'
|
||||
$ref: '#/definitions/TicketWithTickets'
|
||||
security:
|
||||
- roles:
|
||||
- ticket:write
|
||||
@@ -4938,7 +4935,7 @@ paths:
|
||||
type: alert
|
||||
type: alert
|
||||
schema:
|
||||
$ref: '#/definitions/TicketResponse'
|
||||
$ref: '#/definitions/TicketWithTickets'
|
||||
security:
|
||||
- roles:
|
||||
- ticket:write
|
||||
@@ -5186,7 +5183,7 @@ paths:
|
||||
status: closed
|
||||
type: incident
|
||||
schema:
|
||||
$ref: '#/definitions/TicketResponse'
|
||||
$ref: '#/definitions/TicketWithTickets'
|
||||
security:
|
||||
- roles:
|
||||
- ticket:write
|
||||
@@ -5257,7 +5254,7 @@ paths:
|
||||
type: alert
|
||||
type: alert
|
||||
schema:
|
||||
$ref: '#/definitions/TicketResponse'
|
||||
$ref: '#/definitions/TicketWithTickets'
|
||||
security:
|
||||
- roles:
|
||||
- ticket:write
|
||||
@@ -5388,7 +5385,10 @@ paths:
|
||||
type: alert
|
||||
type: alert
|
||||
schema:
|
||||
$ref: '#/definitions/TicketResponse'
|
||||
$ref: '#/definitions/TicketWithTickets'
|
||||
security:
|
||||
- roles:
|
||||
- ticket:write
|
||||
summary: Add a new ticket playbook
|
||||
tags:
|
||||
- tickets
|
||||
@@ -5527,7 +5527,7 @@ paths:
|
||||
status: closed
|
||||
type: incident
|
||||
schema:
|
||||
$ref: '#/definitions/TicketResponse'
|
||||
$ref: '#/definitions/TicketWithTickets'
|
||||
security:
|
||||
- roles:
|
||||
- ticket:write
|
||||
@@ -5809,7 +5809,7 @@ paths:
|
||||
status: closed
|
||||
type: incident
|
||||
schema:
|
||||
$ref: '#/definitions/TicketResponse'
|
||||
$ref: '#/definitions/TicketWithTickets'
|
||||
security:
|
||||
- roles:
|
||||
- ticket:write
|
||||
@@ -6073,7 +6073,7 @@ paths:
|
||||
status: closed
|
||||
type: incident
|
||||
schema:
|
||||
$ref: '#/definitions/TicketResponse'
|
||||
$ref: '#/definitions/TicketWithTickets'
|
||||
security:
|
||||
- roles:
|
||||
- ticket:write
|
||||
@@ -6167,7 +6167,7 @@ paths:
|
||||
type: alert
|
||||
type: alert
|
||||
schema:
|
||||
$ref: '#/definitions/TicketResponse'
|
||||
$ref: '#/definitions/TicketWithTickets'
|
||||
security:
|
||||
- roles:
|
||||
- ticket:write
|
||||
@@ -6188,6 +6188,7 @@ paths:
|
||||
- description: New ticket schema
|
||||
in: body
|
||||
name: schema
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
x-example: '{}'
|
||||
@@ -6228,7 +6229,7 @@ paths:
|
||||
type: alert
|
||||
type: alert
|
||||
schema:
|
||||
$ref: '#/definitions/TicketResponse'
|
||||
$ref: '#/definitions/TicketWithTickets'
|
||||
security:
|
||||
- roles:
|
||||
- ticket:write
|
||||
@@ -6275,7 +6276,7 @@ paths:
|
||||
status: closed
|
||||
type: alert
|
||||
schema:
|
||||
$ref: '#/definitions/TicketResponse'
|
||||
$ref: '#/definitions/TicketWithTickets'
|
||||
security:
|
||||
- roles:
|
||||
- ticket:write
|
||||
@@ -6540,7 +6541,7 @@ paths:
|
||||
type: alert
|
||||
type: alert
|
||||
schema:
|
||||
$ref: '#/definitions/TicketResponse'
|
||||
$ref: '#/definitions/TicketWithTickets'
|
||||
security:
|
||||
- roles:
|
||||
- ticket:write
|
||||
|
||||
@@ -563,10 +563,7 @@
|
||||
"content" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"items" : {
|
||||
"$ref" : "#/components/schemas/PlaybookTemplateResponse"
|
||||
},
|
||||
"type" : "array"
|
||||
"$ref" : "#/components/schemas/PlaybookTemplateResponse"
|
||||
}
|
||||
},
|
||||
"test" : {
|
||||
@@ -815,7 +812,7 @@
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"items" : {
|
||||
"$ref" : "#/components/schemas/TaskResponse"
|
||||
"$ref" : "#/components/schemas/TaskWithContext"
|
||||
},
|
||||
"type" : "array"
|
||||
}
|
||||
@@ -1375,7 +1372,7 @@
|
||||
"content" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/TicketResponse"
|
||||
"$ref" : "#/components/schemas/TicketWithTickets"
|
||||
}
|
||||
},
|
||||
"test" : {
|
||||
@@ -1459,7 +1456,7 @@
|
||||
"content" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/TicketResponse"
|
||||
"$ref" : "#/components/schemas/TicketWithTickets"
|
||||
}
|
||||
},
|
||||
"test" : {
|
||||
@@ -1546,7 +1543,7 @@
|
||||
"content" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/TicketResponse"
|
||||
"$ref" : "#/components/schemas/TicketWithTickets"
|
||||
}
|
||||
},
|
||||
"test" : {
|
||||
@@ -1757,7 +1754,7 @@
|
||||
"content" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/TicketResponse"
|
||||
"$ref" : "#/components/schemas/TicketWithTickets"
|
||||
}
|
||||
},
|
||||
"test" : {
|
||||
@@ -2013,7 +2010,7 @@
|
||||
"content" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/TicketResponse"
|
||||
"$ref" : "#/components/schemas/TicketWithTickets"
|
||||
}
|
||||
},
|
||||
"test" : {
|
||||
@@ -2230,7 +2227,7 @@
|
||||
"content" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/Artifact"
|
||||
"$ref" : "#/components/schemas/TicketWithTickets"
|
||||
}
|
||||
},
|
||||
"test" : {
|
||||
@@ -2492,7 +2489,7 @@
|
||||
"content" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/TicketResponse"
|
||||
"$ref" : "#/components/schemas/TicketWithTickets"
|
||||
}
|
||||
},
|
||||
"test" : {
|
||||
@@ -2583,7 +2580,7 @@
|
||||
"content" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/TicketResponse"
|
||||
"$ref" : "#/components/schemas/TicketWithTickets"
|
||||
}
|
||||
},
|
||||
"test" : {
|
||||
@@ -2796,7 +2793,7 @@
|
||||
"content" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/TicketResponse"
|
||||
"$ref" : "#/components/schemas/TicketWithTickets"
|
||||
}
|
||||
},
|
||||
"test" : {
|
||||
@@ -2887,7 +2884,7 @@
|
||||
"content" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/TicketResponse"
|
||||
"$ref" : "#/components/schemas/TicketWithTickets"
|
||||
}
|
||||
},
|
||||
"test" : {
|
||||
@@ -2988,6 +2985,9 @@
|
||||
"description" : "successful operation"
|
||||
}
|
||||
},
|
||||
"security" : [ {
|
||||
"roles" : [ "ticket:write" ]
|
||||
} ],
|
||||
"summary" : "Add a new ticket playbook",
|
||||
"tags" : [ "tickets" ],
|
||||
"x-codegen-request-body-name" : "playbook"
|
||||
@@ -3021,7 +3021,7 @@
|
||||
"content" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/TicketResponse"
|
||||
"$ref" : "#/components/schemas/TicketWithTickets"
|
||||
}
|
||||
},
|
||||
"test" : {
|
||||
@@ -3115,7 +3115,7 @@
|
||||
"content" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/TicketResponse"
|
||||
"$ref" : "#/components/schemas/TicketWithTickets"
|
||||
}
|
||||
},
|
||||
"test" : {
|
||||
@@ -3346,7 +3346,7 @@
|
||||
"content" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/TicketResponse"
|
||||
"$ref" : "#/components/schemas/TicketWithTickets"
|
||||
}
|
||||
},
|
||||
"test" : {
|
||||
@@ -3608,7 +3608,7 @@
|
||||
"content" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/TicketResponse"
|
||||
"$ref" : "#/components/schemas/TicketWithTickets"
|
||||
}
|
||||
},
|
||||
"test" : {
|
||||
@@ -3682,14 +3682,14 @@
|
||||
}
|
||||
},
|
||||
"description" : "New ticket schema",
|
||||
"required" : false
|
||||
"required" : true
|
||||
},
|
||||
"responses" : {
|
||||
"200" : {
|
||||
"content" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/TicketResponse"
|
||||
"$ref" : "#/components/schemas/TicketWithTickets"
|
||||
}
|
||||
},
|
||||
"test" : {
|
||||
@@ -3777,7 +3777,7 @@
|
||||
"content" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/TicketResponse"
|
||||
"$ref" : "#/components/schemas/TicketWithTickets"
|
||||
}
|
||||
},
|
||||
"test" : {
|
||||
@@ -3843,7 +3843,7 @@
|
||||
"content" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/TicketResponse"
|
||||
"$ref" : "#/components/schemas/TicketWithTickets"
|
||||
}
|
||||
},
|
||||
"test" : {
|
||||
@@ -4920,7 +4920,6 @@
|
||||
"$ref" : "#/components/schemas/Context"
|
||||
},
|
||||
"payload" : {
|
||||
"properties" : { },
|
||||
"type" : "object"
|
||||
},
|
||||
"secrets" : {
|
||||
|
||||
@@ -260,8 +260,7 @@ definitions:
|
||||
properties:
|
||||
context:
|
||||
$ref: '#/definitions/Context'
|
||||
payload:
|
||||
type: object
|
||||
payload: {}
|
||||
secrets:
|
||||
additionalProperties:
|
||||
type: string
|
||||
@@ -1980,9 +1979,7 @@ paths:
|
||||
name: Escalate to malware team
|
||||
type: task
|
||||
schema:
|
||||
items:
|
||||
$ref: '#/definitions/PlaybookTemplateResponse'
|
||||
type: array
|
||||
$ref: '#/definitions/PlaybookTemplateResponse'
|
||||
security:
|
||||
- roles:
|
||||
- playbook:write
|
||||
@@ -2275,7 +2272,7 @@ paths:
|
||||
test: []
|
||||
schema:
|
||||
items:
|
||||
$ref: '#/definitions/TaskResponse'
|
||||
$ref: '#/definitions/TaskWithContext'
|
||||
type: array
|
||||
security:
|
||||
- roles:
|
||||
@@ -3314,7 +3311,7 @@ paths:
|
||||
type: alert
|
||||
type: alert
|
||||
schema:
|
||||
$ref: '#/definitions/TicketResponse'
|
||||
$ref: '#/definitions/TicketWithTickets'
|
||||
security:
|
||||
- roles:
|
||||
- ticket:read
|
||||
@@ -3389,7 +3386,7 @@ paths:
|
||||
type: alert
|
||||
type: alert
|
||||
schema:
|
||||
$ref: '#/definitions/TicketResponse'
|
||||
$ref: '#/definitions/TicketWithTickets'
|
||||
security:
|
||||
- roles:
|
||||
- ticket:write
|
||||
@@ -3641,7 +3638,7 @@ paths:
|
||||
status: closed
|
||||
type: incident
|
||||
schema:
|
||||
$ref: '#/definitions/TicketResponse'
|
||||
$ref: '#/definitions/TicketWithTickets'
|
||||
security:
|
||||
- roles:
|
||||
- ticket:write
|
||||
@@ -3885,7 +3882,7 @@ paths:
|
||||
status: closed
|
||||
type: incident
|
||||
schema:
|
||||
$ref: '#/definitions/TicketResponse'
|
||||
$ref: '#/definitions/TicketWithTickets'
|
||||
security:
|
||||
- roles:
|
||||
- ticket:write
|
||||
@@ -4168,7 +4165,7 @@ paths:
|
||||
status: closed
|
||||
type: incident
|
||||
schema:
|
||||
$ref: '#/definitions/TicketResponse'
|
||||
$ref: '#/definitions/TicketWithTickets'
|
||||
security:
|
||||
- roles:
|
||||
- ticket:write
|
||||
@@ -4429,7 +4426,7 @@ paths:
|
||||
status: closed
|
||||
type: incident
|
||||
schema:
|
||||
$ref: '#/definitions/Artifact'
|
||||
$ref: '#/definitions/TicketWithTickets'
|
||||
security:
|
||||
- roles:
|
||||
- ticket:write
|
||||
@@ -4526,7 +4523,7 @@ paths:
|
||||
type: alert
|
||||
type: alert
|
||||
schema:
|
||||
$ref: '#/definitions/TicketResponse'
|
||||
$ref: '#/definitions/TicketWithTickets'
|
||||
security:
|
||||
- roles:
|
||||
- ticket:write
|
||||
@@ -4774,7 +4771,7 @@ paths:
|
||||
status: closed
|
||||
type: incident
|
||||
schema:
|
||||
$ref: '#/definitions/TicketResponse'
|
||||
$ref: '#/definitions/TicketWithTickets'
|
||||
security:
|
||||
- roles:
|
||||
- ticket:write
|
||||
@@ -4845,7 +4842,7 @@ paths:
|
||||
type: alert
|
||||
type: alert
|
||||
schema:
|
||||
$ref: '#/definitions/TicketResponse'
|
||||
$ref: '#/definitions/TicketWithTickets'
|
||||
security:
|
||||
- roles:
|
||||
- ticket:write
|
||||
@@ -4976,7 +4973,10 @@ paths:
|
||||
type: alert
|
||||
type: alert
|
||||
schema:
|
||||
$ref: '#/definitions/TicketResponse'
|
||||
$ref: '#/definitions/TicketWithTickets'
|
||||
security:
|
||||
- roles:
|
||||
- ticket:write
|
||||
summary: Add a new ticket playbook
|
||||
tags:
|
||||
- tickets
|
||||
@@ -5115,7 +5115,7 @@ paths:
|
||||
status: closed
|
||||
type: incident
|
||||
schema:
|
||||
$ref: '#/definitions/TicketResponse'
|
||||
$ref: '#/definitions/TicketWithTickets'
|
||||
security:
|
||||
- roles:
|
||||
- ticket:write
|
||||
@@ -5397,7 +5397,7 @@ paths:
|
||||
status: closed
|
||||
type: incident
|
||||
schema:
|
||||
$ref: '#/definitions/TicketResponse'
|
||||
$ref: '#/definitions/TicketWithTickets'
|
||||
security:
|
||||
- roles:
|
||||
- ticket:write
|
||||
@@ -5661,7 +5661,7 @@ paths:
|
||||
status: closed
|
||||
type: incident
|
||||
schema:
|
||||
$ref: '#/definitions/TicketResponse'
|
||||
$ref: '#/definitions/TicketWithTickets'
|
||||
security:
|
||||
- roles:
|
||||
- ticket:write
|
||||
@@ -5755,7 +5755,7 @@ paths:
|
||||
type: alert
|
||||
type: alert
|
||||
schema:
|
||||
$ref: '#/definitions/TicketResponse'
|
||||
$ref: '#/definitions/TicketWithTickets'
|
||||
security:
|
||||
- roles:
|
||||
- ticket:write
|
||||
@@ -5776,6 +5776,7 @@ paths:
|
||||
- description: New ticket schema
|
||||
in: body
|
||||
name: schema
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
x-example: '{}'
|
||||
@@ -5816,7 +5817,7 @@ paths:
|
||||
type: alert
|
||||
type: alert
|
||||
schema:
|
||||
$ref: '#/definitions/TicketResponse'
|
||||
$ref: '#/definitions/TicketWithTickets'
|
||||
security:
|
||||
- roles:
|
||||
- ticket:write
|
||||
@@ -5863,7 +5864,7 @@ paths:
|
||||
status: closed
|
||||
type: alert
|
||||
schema:
|
||||
$ref: '#/definitions/TicketResponse'
|
||||
$ref: '#/definitions/TicketWithTickets'
|
||||
security:
|
||||
- roles:
|
||||
- ticket:write
|
||||
@@ -6128,7 +6129,7 @@ paths:
|
||||
type: alert
|
||||
type: alert
|
||||
schema:
|
||||
$ref: '#/definitions/TicketResponse'
|
||||
$ref: '#/definitions/TicketWithTickets'
|
||||
security:
|
||||
- roles:
|
||||
- ticket:write
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package models
|
||||
package model
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
@@ -78,7 +78,7 @@ func init() {
|
||||
gojsonschema.NewStringLoader(`{"type":"object","required":["automation"],"x-embed":"","properties":{"automation":{"type":"string"},"origin":{"$ref":"#/definitions/Origin"},"payload":{}},"$id":"#/definitions/JobForm"}`),
|
||||
gojsonschema.NewStringLoader(`{"type":"object","required":["id","automation","status"],"x-embed":"","properties":{"automation":{"type":"string"},"container":{"type":"string"},"id":{"type":"string"},"log":{"type":"string"},"origin":{"$ref":"#/definitions/Origin"},"output":{"type":"object"},"payload":{},"status":{"type":"string"}},"$id":"#/definitions/JobResponse"}`),
|
||||
gojsonschema.NewStringLoader(`{"type":"object","required":["type","reference","creator","created","message"],"x-embed":"","properties":{"created":{"format":"date-time","type":"string"},"creator":{"type":"string"},"message":{"type":"string"},"reference":{"type":"string"},"type":{"type":"string"}},"$id":"#/definitions/LogEntry"}`),
|
||||
gojsonschema.NewStringLoader(`{"type":"object","x-embed":"","properties":{"context":{"$ref":"#/definitions/Context"},"payload":{"type":"object"},"secrets":{"type":"object","additionalProperties":{"type":"string"}}},"$id":"#/definitions/Message"}`),
|
||||
gojsonschema.NewStringLoader(`{"type":"object","x-embed":"","properties":{"context":{"$ref":"#/definitions/Context"},"payload":{},"secrets":{"type":"object","additionalProperties":{"type":"string"}}},"$id":"#/definitions/Message"}`),
|
||||
gojsonschema.NewStringLoader(`{"type":"object","required":["id","blocked","roles"],"x-embed":"","properties":{"blocked":{"type":"boolean"},"id":{"type":"string"},"roles":{"items":{"type":"string"},"type":"array"},"secret":{"type":"string"}},"$id":"#/definitions/NewUserResponse"}`),
|
||||
gojsonschema.NewStringLoader(`{"type":"object","x-embed":"","properties":{"artifact_origin":{"$ref":"#/definitions/ArtifactOrigin"},"task_origin":{"$ref":"#/definitions/TaskOrigin"}},"$id":"#/definitions/Origin"}`),
|
||||
gojsonschema.NewStringLoader(`{"type":"object","required":["name","tasks"],"x-embed":"","properties":{"name":{"type":"string"},"tasks":{"type":"object","additionalProperties":{"$ref":"#/definitions/Task"}}},"$id":"#/definitions/Playbook"}`),
|
||||
@@ -223,14 +223,14 @@ type Context struct {
|
||||
}
|
||||
|
||||
type Enrichment struct {
|
||||
Created time.Time `json:"created"`
|
||||
Data interface{} `json:"data"`
|
||||
Name string `json:"name"`
|
||||
Created time.Time `json:"created"`
|
||||
Data map[string]interface{} `json:"data"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
type EnrichmentForm struct {
|
||||
Data interface{} `json:"data"`
|
||||
Name string `json:"name"`
|
||||
Data map[string]interface{} `json:"data"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
type File struct {
|
||||
@@ -239,14 +239,14 @@ type File struct {
|
||||
}
|
||||
|
||||
type Job struct {
|
||||
Automation string `json:"automation"`
|
||||
Container *string `json:"container,omitempty"`
|
||||
Log *string `json:"log,omitempty"`
|
||||
Origin *Origin `json:"origin,omitempty"`
|
||||
Output interface{} `json:"output,omitempty"`
|
||||
Payload interface{} `json:"payload,omitempty"`
|
||||
Running bool `json:"running"`
|
||||
Status string `json:"status"`
|
||||
Automation string `json:"automation"`
|
||||
Container *string `json:"container,omitempty"`
|
||||
Log *string `json:"log,omitempty"`
|
||||
Origin *Origin `json:"origin,omitempty"`
|
||||
Output map[string]interface{} `json:"output,omitempty"`
|
||||
Payload interface{} `json:"payload,omitempty"`
|
||||
Running bool `json:"running"`
|
||||
Status string `json:"status"`
|
||||
}
|
||||
|
||||
type JobForm struct {
|
||||
@@ -256,14 +256,14 @@ type JobForm struct {
|
||||
}
|
||||
|
||||
type JobResponse struct {
|
||||
Automation string `json:"automation"`
|
||||
Container *string `json:"container,omitempty"`
|
||||
ID string `json:"id"`
|
||||
Log *string `json:"log,omitempty"`
|
||||
Origin *Origin `json:"origin,omitempty"`
|
||||
Output interface{} `json:"output,omitempty"`
|
||||
Payload interface{} `json:"payload,omitempty"`
|
||||
Status string `json:"status"`
|
||||
Automation string `json:"automation"`
|
||||
Container *string `json:"container,omitempty"`
|
||||
ID string `json:"id"`
|
||||
Log *string `json:"log,omitempty"`
|
||||
Origin *Origin `json:"origin,omitempty"`
|
||||
Output map[string]interface{} `json:"output,omitempty"`
|
||||
Payload interface{} `json:"payload,omitempty"`
|
||||
Status string `json:"status"`
|
||||
}
|
||||
|
||||
type LogEntry struct {
|
||||
@@ -340,33 +340,33 @@ type Statistics struct {
|
||||
}
|
||||
|
||||
type Task struct {
|
||||
Automation *string `json:"automation,omitempty"`
|
||||
Closed *time.Time `json:"closed,omitempty"`
|
||||
Created time.Time `json:"created"`
|
||||
Data interface{} `json:"data,omitempty"`
|
||||
Done bool `json:"done"`
|
||||
Join *bool `json:"join,omitempty"`
|
||||
Name string `json:"name"`
|
||||
Next map[string]string `json:"next,omitempty"`
|
||||
Owner *string `json:"owner,omitempty"`
|
||||
Payload map[string]string `json:"payload,omitempty"`
|
||||
Schema interface{} `json:"schema,omitempty"`
|
||||
Type string `json:"type"`
|
||||
Automation *string `json:"automation,omitempty"`
|
||||
Closed *time.Time `json:"closed,omitempty"`
|
||||
Created time.Time `json:"created"`
|
||||
Data map[string]interface{} `json:"data,omitempty"`
|
||||
Done bool `json:"done"`
|
||||
Join *bool `json:"join,omitempty"`
|
||||
Name string `json:"name"`
|
||||
Next map[string]string `json:"next,omitempty"`
|
||||
Owner *string `json:"owner,omitempty"`
|
||||
Payload map[string]string `json:"payload,omitempty"`
|
||||
Schema map[string]interface{} `json:"schema,omitempty"`
|
||||
Type string `json:"type"`
|
||||
}
|
||||
|
||||
type TaskForm struct {
|
||||
Automation *string `json:"automation,omitempty"`
|
||||
Closed *time.Time `json:"closed,omitempty"`
|
||||
Created *time.Time `json:"created,omitempty"`
|
||||
Data interface{} `json:"data,omitempty"`
|
||||
Done *bool `json:"done,omitempty"`
|
||||
Join *bool `json:"join,omitempty"`
|
||||
Name string `json:"name"`
|
||||
Next map[string]string `json:"next,omitempty"`
|
||||
Owner *string `json:"owner,omitempty"`
|
||||
Payload map[string]string `json:"payload,omitempty"`
|
||||
Schema interface{} `json:"schema,omitempty"`
|
||||
Type string `json:"type"`
|
||||
Automation *string `json:"automation,omitempty"`
|
||||
Closed *time.Time `json:"closed,omitempty"`
|
||||
Created *time.Time `json:"created,omitempty"`
|
||||
Data map[string]interface{} `json:"data,omitempty"`
|
||||
Done *bool `json:"done,omitempty"`
|
||||
Join *bool `json:"join,omitempty"`
|
||||
Name string `json:"name"`
|
||||
Next map[string]string `json:"next,omitempty"`
|
||||
Owner *string `json:"owner,omitempty"`
|
||||
Payload map[string]string `json:"payload,omitempty"`
|
||||
Schema map[string]interface{} `json:"schema,omitempty"`
|
||||
Type string `json:"type"`
|
||||
}
|
||||
|
||||
type TaskOrigin struct {
|
||||
@@ -376,54 +376,54 @@ type TaskOrigin struct {
|
||||
}
|
||||
|
||||
type TaskResponse struct {
|
||||
Active bool `json:"active"`
|
||||
Automation *string `json:"automation,omitempty"`
|
||||
Closed *time.Time `json:"closed,omitempty"`
|
||||
Created time.Time `json:"created"`
|
||||
Data interface{} `json:"data,omitempty"`
|
||||
Done bool `json:"done"`
|
||||
Join *bool `json:"join,omitempty"`
|
||||
Name string `json:"name"`
|
||||
Next map[string]string `json:"next,omitempty"`
|
||||
Order int64 `json:"order"`
|
||||
Owner *string `json:"owner,omitempty"`
|
||||
Payload map[string]string `json:"payload,omitempty"`
|
||||
Schema interface{} `json:"schema,omitempty"`
|
||||
Type string `json:"type"`
|
||||
Active bool `json:"active"`
|
||||
Automation *string `json:"automation,omitempty"`
|
||||
Closed *time.Time `json:"closed,omitempty"`
|
||||
Created time.Time `json:"created"`
|
||||
Data map[string]interface{} `json:"data,omitempty"`
|
||||
Done bool `json:"done"`
|
||||
Join *bool `json:"join,omitempty"`
|
||||
Name string `json:"name"`
|
||||
Next map[string]string `json:"next,omitempty"`
|
||||
Order int64 `json:"order"`
|
||||
Owner *string `json:"owner,omitempty"`
|
||||
Payload map[string]string `json:"payload,omitempty"`
|
||||
Schema map[string]interface{} `json:"schema,omitempty"`
|
||||
Type string `json:"type"`
|
||||
}
|
||||
|
||||
type TaskWithContext struct {
|
||||
PlaybookId string `json:"playbook_id"`
|
||||
PlaybookName string `json:"playbook_name"`
|
||||
Task TaskResponse `json:"task"`
|
||||
TaskId string `json:"task_id"`
|
||||
TicketId int64 `json:"ticket_id"`
|
||||
TicketName string `json:"ticket_name"`
|
||||
PlaybookId string `json:"playbook_id"`
|
||||
PlaybookName string `json:"playbook_name"`
|
||||
Task *TaskResponse `json:"task"`
|
||||
TaskId string `json:"task_id"`
|
||||
TicketId int64 `json:"ticket_id"`
|
||||
TicketName string `json:"ticket_name"`
|
||||
}
|
||||
|
||||
type Ticket struct {
|
||||
Artifacts []*Artifact `json:"artifacts,omitempty"`
|
||||
Comments []*Comment `json:"comments,omitempty"`
|
||||
Created time.Time `json:"created"`
|
||||
Details interface{} `json:"details,omitempty"`
|
||||
Files []*File `json:"files,omitempty"`
|
||||
Modified time.Time `json:"modified"`
|
||||
Name string `json:"name"`
|
||||
Owner *string `json:"owner,omitempty"`
|
||||
Playbooks map[string]*Playbook `json:"playbooks,omitempty"`
|
||||
Read []string `json:"read,omitempty"`
|
||||
References []*Reference `json:"references,omitempty"`
|
||||
Schema string `json:"schema"`
|
||||
Status string `json:"status"`
|
||||
Type string `json:"type"`
|
||||
Write []string `json:"write,omitempty"`
|
||||
Artifacts []*Artifact `json:"artifacts,omitempty"`
|
||||
Comments []*Comment `json:"comments,omitempty"`
|
||||
Created time.Time `json:"created"`
|
||||
Details map[string]interface{} `json:"details,omitempty"`
|
||||
Files []*File `json:"files,omitempty"`
|
||||
Modified time.Time `json:"modified"`
|
||||
Name string `json:"name"`
|
||||
Owner *string `json:"owner,omitempty"`
|
||||
Playbooks map[string]*Playbook `json:"playbooks,omitempty"`
|
||||
Read []string `json:"read,omitempty"`
|
||||
References []*Reference `json:"references,omitempty"`
|
||||
Schema string `json:"schema"`
|
||||
Status string `json:"status"`
|
||||
Type string `json:"type"`
|
||||
Write []string `json:"write,omitempty"`
|
||||
}
|
||||
|
||||
type TicketForm struct {
|
||||
Artifacts []*Artifact `json:"artifacts,omitempty"`
|
||||
Comments []*Comment `json:"comments,omitempty"`
|
||||
Created *time.Time `json:"created,omitempty"`
|
||||
Details interface{} `json:"details,omitempty"`
|
||||
Details map[string]interface{} `json:"details,omitempty"`
|
||||
Files []*File `json:"files,omitempty"`
|
||||
ID *int64 `json:"id,omitempty"`
|
||||
Modified *time.Time `json:"modified,omitempty"`
|
||||
@@ -447,7 +447,7 @@ type TicketResponse struct {
|
||||
Artifacts []*Artifact `json:"artifacts,omitempty"`
|
||||
Comments []*Comment `json:"comments,omitempty"`
|
||||
Created time.Time `json:"created"`
|
||||
Details interface{} `json:"details,omitempty"`
|
||||
Details map[string]interface{} `json:"details,omitempty"`
|
||||
Files []*File `json:"files,omitempty"`
|
||||
ID int64 `json:"id"`
|
||||
Modified time.Time `json:"modified"`
|
||||
@@ -463,22 +463,22 @@ type TicketResponse struct {
|
||||
}
|
||||
|
||||
type TicketSimpleResponse struct {
|
||||
Artifacts []*Artifact `json:"artifacts,omitempty"`
|
||||
Comments []*Comment `json:"comments,omitempty"`
|
||||
Created time.Time `json:"created"`
|
||||
Details interface{} `json:"details,omitempty"`
|
||||
Files []*File `json:"files,omitempty"`
|
||||
ID int64 `json:"id"`
|
||||
Modified time.Time `json:"modified"`
|
||||
Name string `json:"name"`
|
||||
Owner *string `json:"owner,omitempty"`
|
||||
Playbooks map[string]*Playbook `json:"playbooks,omitempty"`
|
||||
Read []string `json:"read,omitempty"`
|
||||
References []*Reference `json:"references,omitempty"`
|
||||
Schema string `json:"schema"`
|
||||
Status string `json:"status"`
|
||||
Type string `json:"type"`
|
||||
Write []string `json:"write,omitempty"`
|
||||
Artifacts []*Artifact `json:"artifacts,omitempty"`
|
||||
Comments []*Comment `json:"comments,omitempty"`
|
||||
Created time.Time `json:"created"`
|
||||
Details map[string]interface{} `json:"details,omitempty"`
|
||||
Files []*File `json:"files,omitempty"`
|
||||
ID int64 `json:"id"`
|
||||
Modified time.Time `json:"modified"`
|
||||
Name string `json:"name"`
|
||||
Owner *string `json:"owner,omitempty"`
|
||||
Playbooks map[string]*Playbook `json:"playbooks,omitempty"`
|
||||
Read []string `json:"read,omitempty"`
|
||||
References []*Reference `json:"references,omitempty"`
|
||||
Schema string `json:"schema"`
|
||||
Status string `json:"status"`
|
||||
Type string `json:"type"`
|
||||
Write []string `json:"write,omitempty"`
|
||||
}
|
||||
|
||||
type TicketTemplate struct {
|
||||
@@ -528,7 +528,7 @@ type TicketWithTickets struct {
|
||||
Artifacts []*Artifact `json:"artifacts,omitempty"`
|
||||
Comments []*Comment `json:"comments,omitempty"`
|
||||
Created time.Time `json:"created"`
|
||||
Details interface{} `json:"details,omitempty"`
|
||||
Details map[string]interface{} `json:"details,omitempty"`
|
||||
Files []*File `json:"files,omitempty"`
|
||||
ID int64 `json:"id"`
|
||||
Logs []*LogEntry `json:"logs,omitempty"`
|
||||
@@ -1,252 +0,0 @@
|
||||
package restapi
|
||||
|
||||
import (
|
||||
"context"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/operations/automations"
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/operations/jobs"
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/operations/logs"
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/operations/playbooks"
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/operations/settings"
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/operations/statistics"
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/operations/tasks"
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/operations/templates"
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/operations/tickets"
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/operations/tickettypes"
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/operations/userdata"
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/operations/users"
|
||||
"github.com/SecurityBrewery/catalyst/role"
|
||||
)
|
||||
|
||||
// Service is the interface that must be implemented in order to provide
|
||||
// business logic for the Server service.
|
||||
type Service interface {
|
||||
AddArtifact(ctx context.Context, params *tickets.AddArtifactParams) *api.Response
|
||||
AddComment(ctx context.Context, params *tickets.AddCommentParams) *api.Response
|
||||
AddTicketPlaybook(ctx context.Context, params *tickets.AddTicketPlaybookParams) *api.Response
|
||||
CompleteTask(ctx context.Context, params *tickets.CompleteTaskParams) *api.Response
|
||||
CreateAutomation(ctx context.Context, params *automations.CreateAutomationParams) *api.Response
|
||||
CreatePlaybook(ctx context.Context, params *playbooks.CreatePlaybookParams) *api.Response
|
||||
CreateTemplate(ctx context.Context, params *templates.CreateTemplateParams) *api.Response
|
||||
CreateTicket(ctx context.Context, params *tickets.CreateTicketParams) *api.Response
|
||||
CreateTicketBatch(ctx context.Context, params *tickets.CreateTicketBatchParams) *api.Response
|
||||
CreateTicketType(ctx context.Context, params *tickettypes.CreateTicketTypeParams) *api.Response
|
||||
CreateUser(ctx context.Context, params *users.CreateUserParams) *api.Response
|
||||
CurrentUser(ctx context.Context) *api.Response
|
||||
CurrentUserData(ctx context.Context) *api.Response
|
||||
DeleteAutomation(ctx context.Context, params *automations.DeleteAutomationParams) *api.Response
|
||||
DeletePlaybook(ctx context.Context, params *playbooks.DeletePlaybookParams) *api.Response
|
||||
DeleteTemplate(ctx context.Context, params *templates.DeleteTemplateParams) *api.Response
|
||||
DeleteTicket(ctx context.Context, params *tickets.DeleteTicketParams) *api.Response
|
||||
DeleteTicketType(ctx context.Context, params *tickettypes.DeleteTicketTypeParams) *api.Response
|
||||
DeleteUser(ctx context.Context, params *users.DeleteUserParams) *api.Response
|
||||
EnrichArtifact(ctx context.Context, params *tickets.EnrichArtifactParams) *api.Response
|
||||
GetArtifact(ctx context.Context, params *tickets.GetArtifactParams) *api.Response
|
||||
GetAutomation(ctx context.Context, params *automations.GetAutomationParams) *api.Response
|
||||
GetJob(ctx context.Context, params *jobs.GetJobParams) *api.Response
|
||||
GetLogs(ctx context.Context, params *logs.GetLogsParams) *api.Response
|
||||
GetPlaybook(ctx context.Context, params *playbooks.GetPlaybookParams) *api.Response
|
||||
GetSettings(ctx context.Context) *api.Response
|
||||
GetStatistics(ctx context.Context) *api.Response
|
||||
GetTemplate(ctx context.Context, params *templates.GetTemplateParams) *api.Response
|
||||
GetTicket(ctx context.Context, params *tickets.GetTicketParams) *api.Response
|
||||
GetTicketType(ctx context.Context, params *tickettypes.GetTicketTypeParams) *api.Response
|
||||
GetUser(ctx context.Context, params *users.GetUserParams) *api.Response
|
||||
GetUserData(ctx context.Context, params *userdata.GetUserDataParams) *api.Response
|
||||
LinkFiles(ctx context.Context, params *tickets.LinkFilesParams) *api.Response
|
||||
LinkTicket(ctx context.Context, params *tickets.LinkTicketParams) *api.Response
|
||||
ListAutomations(ctx context.Context) *api.Response
|
||||
ListJobs(ctx context.Context) *api.Response
|
||||
ListPlaybooks(ctx context.Context) *api.Response
|
||||
ListTasks(ctx context.Context) *api.Response
|
||||
ListTemplates(ctx context.Context) *api.Response
|
||||
ListTicketTypes(ctx context.Context) *api.Response
|
||||
ListTickets(ctx context.Context, params *tickets.ListTicketsParams) *api.Response
|
||||
ListUserData(ctx context.Context) *api.Response
|
||||
ListUsers(ctx context.Context) *api.Response
|
||||
RemoveArtifact(ctx context.Context, params *tickets.RemoveArtifactParams) *api.Response
|
||||
RemoveComment(ctx context.Context, params *tickets.RemoveCommentParams) *api.Response
|
||||
RemoveTicketPlaybook(ctx context.Context, params *tickets.RemoveTicketPlaybookParams) *api.Response
|
||||
RunArtifact(ctx context.Context, params *tickets.RunArtifactParams) *api.Response
|
||||
RunJob(ctx context.Context, params *jobs.RunJobParams) *api.Response
|
||||
RunTask(ctx context.Context, params *tickets.RunTaskParams) *api.Response
|
||||
SetArtifact(ctx context.Context, params *tickets.SetArtifactParams) *api.Response
|
||||
SetReferences(ctx context.Context, params *tickets.SetReferencesParams) *api.Response
|
||||
SetSchema(ctx context.Context, params *tickets.SetSchemaParams) *api.Response
|
||||
SetTask(ctx context.Context, params *tickets.SetTaskParams) *api.Response
|
||||
UnlinkTicket(ctx context.Context, params *tickets.UnlinkTicketParams) *api.Response
|
||||
UpdateAutomation(ctx context.Context, params *automations.UpdateAutomationParams) *api.Response
|
||||
UpdateCurrentUserData(ctx context.Context, params *userdata.UpdateCurrentUserDataParams) *api.Response
|
||||
UpdateJob(ctx context.Context, params *jobs.UpdateJobParams) *api.Response
|
||||
UpdatePlaybook(ctx context.Context, params *playbooks.UpdatePlaybookParams) *api.Response
|
||||
UpdateTemplate(ctx context.Context, params *templates.UpdateTemplateParams) *api.Response
|
||||
UpdateTicket(ctx context.Context, params *tickets.UpdateTicketParams) *api.Response
|
||||
UpdateTicketType(ctx context.Context, params *tickettypes.UpdateTicketTypeParams) *api.Response
|
||||
UpdateUser(ctx context.Context, params *users.UpdateUserParams) *api.Response
|
||||
UpdateUserData(ctx context.Context, params *userdata.UpdateUserDataParams) *api.Response
|
||||
}
|
||||
|
||||
// Config defines the config options for the API server.
|
||||
type Config struct {
|
||||
Address string
|
||||
InsecureHTTP bool
|
||||
TLSCertFile string
|
||||
TLSKeyFile string
|
||||
}
|
||||
|
||||
// Server defines the Server service.
|
||||
type Server struct {
|
||||
*gin.Engine
|
||||
config *Config
|
||||
server *http.Server
|
||||
service Service
|
||||
|
||||
ApiGroup *gin.RouterGroup
|
||||
|
||||
RoleAuth func([]role.Role) gin.HandlerFunc
|
||||
}
|
||||
|
||||
// New initializes a new Server service.
|
||||
func New(svc Service, config *Config) *Server {
|
||||
engine := gin.New()
|
||||
engine.Use(gin.Recovery())
|
||||
|
||||
return &Server{
|
||||
Engine: engine,
|
||||
service: svc,
|
||||
config: config,
|
||||
server: &http.Server{
|
||||
Addr: config.Address,
|
||||
Handler: engine,
|
||||
ReadTimeout: 10 * time.Second,
|
||||
WriteTimeout: 10 * time.Second,
|
||||
},
|
||||
|
||||
ApiGroup: engine.Group("/api"),
|
||||
|
||||
RoleAuth: func(i []role.Role) gin.HandlerFunc { return func(c *gin.Context) { c.Next() } },
|
||||
}
|
||||
}
|
||||
|
||||
// ConfigureRoutes configures the routes for the Server service.
|
||||
// Configuring of routes includes setting up Auth if it is enabled.
|
||||
func (s *Server) ConfigureRoutes() {
|
||||
s.ApiGroup.POST("/tickets/:id/artifacts", s.RoleAuth([]role.Role{role.TicketWrite}), tickets.AddArtifactEndpoint(s.service.AddArtifact))
|
||||
s.ApiGroup.POST("/tickets/:id/comments", s.RoleAuth([]role.Role{role.TicketWrite}), tickets.AddCommentEndpoint(s.service.AddComment))
|
||||
s.ApiGroup.POST("/tickets/:id/playbooks", s.RoleAuth([]role.Role{}), tickets.AddTicketPlaybookEndpoint(s.service.AddTicketPlaybook))
|
||||
s.ApiGroup.PUT("/tickets/:id/playbooks/:playbookID/task/:taskID/complete", s.RoleAuth([]role.Role{role.TicketWrite}), tickets.CompleteTaskEndpoint(s.service.CompleteTask))
|
||||
s.ApiGroup.POST("/automations", s.RoleAuth([]role.Role{role.AutomationWrite}), automations.CreateAutomationEndpoint(s.service.CreateAutomation))
|
||||
s.ApiGroup.POST("/playbooks", s.RoleAuth([]role.Role{role.PlaybookWrite}), playbooks.CreatePlaybookEndpoint(s.service.CreatePlaybook))
|
||||
s.ApiGroup.POST("/templates", s.RoleAuth([]role.Role{role.TemplateWrite}), templates.CreateTemplateEndpoint(s.service.CreateTemplate))
|
||||
s.ApiGroup.POST("/tickets", s.RoleAuth([]role.Role{role.TicketWrite}), tickets.CreateTicketEndpoint(s.service.CreateTicket))
|
||||
s.ApiGroup.POST("/tickets/batch", s.RoleAuth([]role.Role{role.TicketWrite}), tickets.CreateTicketBatchEndpoint(s.service.CreateTicketBatch))
|
||||
s.ApiGroup.POST("/tickettypes", s.RoleAuth([]role.Role{role.TickettypeWrite}), tickettypes.CreateTicketTypeEndpoint(s.service.CreateTicketType))
|
||||
s.ApiGroup.POST("/users", s.RoleAuth([]role.Role{role.UserWrite}), users.CreateUserEndpoint(s.service.CreateUser))
|
||||
s.ApiGroup.GET("/currentuser", s.RoleAuth([]role.Role{role.CurrentuserRead}), users.CurrentUserEndpoint(s.service.CurrentUser))
|
||||
s.ApiGroup.GET("/currentuserdata", s.RoleAuth([]role.Role{role.CurrentuserdataRead}), userdata.CurrentUserDataEndpoint(s.service.CurrentUserData))
|
||||
s.ApiGroup.DELETE("/automations/:id", s.RoleAuth([]role.Role{role.AutomationWrite}), automations.DeleteAutomationEndpoint(s.service.DeleteAutomation))
|
||||
s.ApiGroup.DELETE("/playbooks/:id", s.RoleAuth([]role.Role{role.PlaybookWrite}), playbooks.DeletePlaybookEndpoint(s.service.DeletePlaybook))
|
||||
s.ApiGroup.DELETE("/templates/:id", s.RoleAuth([]role.Role{role.TemplateWrite}), templates.DeleteTemplateEndpoint(s.service.DeleteTemplate))
|
||||
s.ApiGroup.DELETE("/tickets/:id", s.RoleAuth([]role.Role{role.TicketDelete}), tickets.DeleteTicketEndpoint(s.service.DeleteTicket))
|
||||
s.ApiGroup.DELETE("/tickettypes/:id", s.RoleAuth([]role.Role{role.TickettypeWrite}), tickettypes.DeleteTicketTypeEndpoint(s.service.DeleteTicketType))
|
||||
s.ApiGroup.DELETE("/users/:id", s.RoleAuth([]role.Role{role.UserWrite}), users.DeleteUserEndpoint(s.service.DeleteUser))
|
||||
s.ApiGroup.POST("/tickets/:id/artifacts/:name/enrich", s.RoleAuth([]role.Role{role.TicketWrite}), tickets.EnrichArtifactEndpoint(s.service.EnrichArtifact))
|
||||
s.ApiGroup.GET("/tickets/:id/artifacts/:name", s.RoleAuth([]role.Role{role.TicketWrite}), tickets.GetArtifactEndpoint(s.service.GetArtifact))
|
||||
s.ApiGroup.GET("/automations/:id", s.RoleAuth([]role.Role{role.AutomationRead}), automations.GetAutomationEndpoint(s.service.GetAutomation))
|
||||
s.ApiGroup.GET("/jobs/:id", s.RoleAuth([]role.Role{role.JobRead}), jobs.GetJobEndpoint(s.service.GetJob))
|
||||
s.ApiGroup.GET("/logs/:reference", s.RoleAuth([]role.Role{role.LogRead}), logs.GetLogsEndpoint(s.service.GetLogs))
|
||||
s.ApiGroup.GET("/playbooks/:id", s.RoleAuth([]role.Role{role.PlaybookRead}), playbooks.GetPlaybookEndpoint(s.service.GetPlaybook))
|
||||
s.ApiGroup.GET("/settings", s.RoleAuth([]role.Role{role.SettingsRead}), settings.GetSettingsEndpoint(s.service.GetSettings))
|
||||
s.ApiGroup.GET("/statistics", s.RoleAuth([]role.Role{role.TicketRead}), statistics.GetStatisticsEndpoint(s.service.GetStatistics))
|
||||
s.ApiGroup.GET("/templates/:id", s.RoleAuth([]role.Role{role.TemplateRead}), templates.GetTemplateEndpoint(s.service.GetTemplate))
|
||||
s.ApiGroup.GET("/tickets/:id", s.RoleAuth([]role.Role{role.TicketRead}), tickets.GetTicketEndpoint(s.service.GetTicket))
|
||||
s.ApiGroup.GET("/tickettypes/:id", s.RoleAuth([]role.Role{role.TickettypeRead}), tickettypes.GetTicketTypeEndpoint(s.service.GetTicketType))
|
||||
s.ApiGroup.GET("/users/:id", s.RoleAuth([]role.Role{role.UserRead}), users.GetUserEndpoint(s.service.GetUser))
|
||||
s.ApiGroup.GET("/userdata/:id", s.RoleAuth([]role.Role{role.UserdataRead}), userdata.GetUserDataEndpoint(s.service.GetUserData))
|
||||
s.ApiGroup.PUT("/tickets/:id/files", s.RoleAuth([]role.Role{role.TicketWrite}), tickets.LinkFilesEndpoint(s.service.LinkFiles))
|
||||
s.ApiGroup.PATCH("/tickets/:id/tickets", s.RoleAuth([]role.Role{role.TicketWrite}), tickets.LinkTicketEndpoint(s.service.LinkTicket))
|
||||
s.ApiGroup.GET("/automations", s.RoleAuth([]role.Role{role.AutomationRead}), automations.ListAutomationsEndpoint(s.service.ListAutomations))
|
||||
s.ApiGroup.GET("/jobs", s.RoleAuth([]role.Role{role.JobRead}), jobs.ListJobsEndpoint(s.service.ListJobs))
|
||||
s.ApiGroup.GET("/playbooks", s.RoleAuth([]role.Role{role.PlaybookRead}), playbooks.ListPlaybooksEndpoint(s.service.ListPlaybooks))
|
||||
s.ApiGroup.GET("/tasks", s.RoleAuth([]role.Role{role.TicketRead}), tasks.ListTasksEndpoint(s.service.ListTasks))
|
||||
s.ApiGroup.GET("/templates", s.RoleAuth([]role.Role{role.TemplateRead}), templates.ListTemplatesEndpoint(s.service.ListTemplates))
|
||||
s.ApiGroup.GET("/tickettypes", s.RoleAuth([]role.Role{role.TickettypeRead}), tickettypes.ListTicketTypesEndpoint(s.service.ListTicketTypes))
|
||||
s.ApiGroup.GET("/tickets", s.RoleAuth([]role.Role{role.TicketRead}), tickets.ListTicketsEndpoint(s.service.ListTickets))
|
||||
s.ApiGroup.GET("/userdata", s.RoleAuth([]role.Role{role.UserdataRead}), userdata.ListUserDataEndpoint(s.service.ListUserData))
|
||||
s.ApiGroup.GET("/users", s.RoleAuth([]role.Role{role.UserRead}), users.ListUsersEndpoint(s.service.ListUsers))
|
||||
s.ApiGroup.DELETE("/tickets/:id/artifacts/:name", s.RoleAuth([]role.Role{role.TicketWrite}), tickets.RemoveArtifactEndpoint(s.service.RemoveArtifact))
|
||||
s.ApiGroup.DELETE("/tickets/:id/comments/:commentID", s.RoleAuth([]role.Role{role.TicketWrite}), tickets.RemoveCommentEndpoint(s.service.RemoveComment))
|
||||
s.ApiGroup.DELETE("/tickets/:id/playbooks/:playbookID", s.RoleAuth([]role.Role{role.TicketWrite}), tickets.RemoveTicketPlaybookEndpoint(s.service.RemoveTicketPlaybook))
|
||||
s.ApiGroup.POST("/tickets/:id/artifacts/:name/run/:automation", s.RoleAuth([]role.Role{role.TicketWrite}), tickets.RunArtifactEndpoint(s.service.RunArtifact))
|
||||
s.ApiGroup.POST("/jobs", s.RoleAuth([]role.Role{role.JobWrite}), jobs.RunJobEndpoint(s.service.RunJob))
|
||||
s.ApiGroup.POST("/tickets/:id/playbooks/:playbookID/task/:taskID/run", s.RoleAuth([]role.Role{role.TicketWrite}), tickets.RunTaskEndpoint(s.service.RunTask))
|
||||
s.ApiGroup.PUT("/tickets/:id/artifacts/:name", s.RoleAuth([]role.Role{role.TicketWrite}), tickets.SetArtifactEndpoint(s.service.SetArtifact))
|
||||
s.ApiGroup.PUT("/tickets/:id/references", s.RoleAuth([]role.Role{role.TicketWrite}), tickets.SetReferencesEndpoint(s.service.SetReferences))
|
||||
s.ApiGroup.PUT("/tickets/:id/schema", s.RoleAuth([]role.Role{role.TicketWrite}), tickets.SetSchemaEndpoint(s.service.SetSchema))
|
||||
s.ApiGroup.PUT("/tickets/:id/playbooks/:playbookID/task/:taskID", s.RoleAuth([]role.Role{role.TicketWrite}), tickets.SetTaskEndpoint(s.service.SetTask))
|
||||
s.ApiGroup.DELETE("/tickets/:id/tickets", s.RoleAuth([]role.Role{role.TicketWrite}), tickets.UnlinkTicketEndpoint(s.service.UnlinkTicket))
|
||||
s.ApiGroup.PUT("/automations/:id", s.RoleAuth([]role.Role{role.AutomationWrite}), automations.UpdateAutomationEndpoint(s.service.UpdateAutomation))
|
||||
s.ApiGroup.PUT("/currentuserdata", s.RoleAuth([]role.Role{role.CurrentuserdataWrite}), userdata.UpdateCurrentUserDataEndpoint(s.service.UpdateCurrentUserData))
|
||||
s.ApiGroup.PUT("/jobs/:id", s.RoleAuth([]role.Role{role.JobWrite}), jobs.UpdateJobEndpoint(s.service.UpdateJob))
|
||||
s.ApiGroup.PUT("/playbooks/:id", s.RoleAuth([]role.Role{role.PlaybookWrite}), playbooks.UpdatePlaybookEndpoint(s.service.UpdatePlaybook))
|
||||
s.ApiGroup.PUT("/templates/:id", s.RoleAuth([]role.Role{role.TemplateWrite}), templates.UpdateTemplateEndpoint(s.service.UpdateTemplate))
|
||||
s.ApiGroup.PUT("/tickets/:id", s.RoleAuth([]role.Role{role.TicketWrite}), tickets.UpdateTicketEndpoint(s.service.UpdateTicket))
|
||||
s.ApiGroup.PUT("/tickettypes/:id", s.RoleAuth([]role.Role{role.TickettypeWrite}), tickettypes.UpdateTicketTypeEndpoint(s.service.UpdateTicketType))
|
||||
s.ApiGroup.PUT("/users/:id", s.RoleAuth([]role.Role{role.UserWrite}), users.UpdateUserEndpoint(s.service.UpdateUser))
|
||||
s.ApiGroup.PUT("/userdata/:id", s.RoleAuth([]role.Role{role.UserdataWrite}), userdata.UpdateUserDataEndpoint(s.service.UpdateUserData))
|
||||
}
|
||||
|
||||
// run the Server. It will listen on either HTTP or HTTPS depending on the
|
||||
// config passed to NewServer.
|
||||
func (s *Server) run() error {
|
||||
log.Printf("Serving on address %s\n", s.server.Addr)
|
||||
if s.config.InsecureHTTP {
|
||||
return s.server.ListenAndServe()
|
||||
}
|
||||
return s.server.ListenAndServeTLS(s.config.TLSCertFile, s.config.TLSKeyFile)
|
||||
}
|
||||
|
||||
// Shutdown will gracefully shutdown the Server.
|
||||
func (s *Server) Shutdown() error {
|
||||
return s.server.Shutdown(context.Background())
|
||||
}
|
||||
|
||||
// RunWithSigHandler runs the Server with SIGTERM handling automatically
|
||||
// enabled. The server will listen for a SIGTERM signal and gracefully shutdown
|
||||
// the web server.
|
||||
// It's possible to optionally pass any number shutdown functions which will
|
||||
// execute one by one after the webserver has been shutdown successfully.
|
||||
func (s *Server) RunWithSigHandler(shutdown ...func() error) error {
|
||||
sigCh := make(chan os.Signal, 1)
|
||||
signal.Notify(sigCh, syscall.SIGHUP, syscall.SIGINT, syscall.SIGTERM)
|
||||
|
||||
go func() {
|
||||
<-sigCh
|
||||
s.Shutdown()
|
||||
}()
|
||||
|
||||
err := s.run()
|
||||
if err != nil {
|
||||
if err != http.ErrServerClosed {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
for _, fn := range shutdown {
|
||||
err := fn()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
package api
|
||||
|
||||
type Response struct {
|
||||
Code int
|
||||
Body interface{}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,90 +0,0 @@
|
||||
package automations
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/models"
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// CreateAutomationEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func CreateAutomationEndpoint(handler func(ctx context.Context, params *CreateAutomationParams) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
// generate params from request
|
||||
params := NewCreateAutomationParams()
|
||||
err := params.ReadRequest(ctx)
|
||||
if err != nil {
|
||||
errObj := err.(*errors.CompositeError)
|
||||
ctx.Writer.Header().Set("Content-Type", "application/problem+json")
|
||||
ctx.JSON(int(errObj.Code()), gin.H{"error": errObj.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
resp := handler(ctx, params)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewCreateAutomationParams creates a new CreateAutomationParams object
|
||||
// with the default values initialized.
|
||||
func NewCreateAutomationParams() *CreateAutomationParams {
|
||||
var ()
|
||||
return &CreateAutomationParams{}
|
||||
}
|
||||
|
||||
// CreateAutomationParams contains all the bound params for the create automation operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters createAutomation
|
||||
type CreateAutomationParams struct {
|
||||
|
||||
/*New automation
|
||||
Required: true
|
||||
In: body
|
||||
*/
|
||||
Automation *models.AutomationForm
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *CreateAutomationParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
if runtime.HasBody(ctx.Request) {
|
||||
var body models.AutomationForm
|
||||
if err := ctx.BindJSON(&body); err != nil {
|
||||
if err == io.EOF {
|
||||
res = append(res, errors.Required("automation", "body", ""))
|
||||
} else {
|
||||
res = append(res, errors.NewParseError("automation", "body", "", err))
|
||||
}
|
||||
|
||||
} else {
|
||||
o.Automation = &body
|
||||
}
|
||||
} else {
|
||||
res = append(res, errors.Required("automation", "body", ""))
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
package automations
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// DeleteAutomationEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func DeleteAutomationEndpoint(handler func(ctx context.Context, params *DeleteAutomationParams) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
// generate params from request
|
||||
params := NewDeleteAutomationParams()
|
||||
err := params.ReadRequest(ctx)
|
||||
if err != nil {
|
||||
errObj := err.(*errors.CompositeError)
|
||||
ctx.Writer.Header().Set("Content-Type", "application/problem+json")
|
||||
ctx.JSON(int(errObj.Code()), gin.H{"error": errObj.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
resp := handler(ctx, params)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewDeleteAutomationParams creates a new DeleteAutomationParams object
|
||||
// with the default values initialized.
|
||||
func NewDeleteAutomationParams() *DeleteAutomationParams {
|
||||
var ()
|
||||
return &DeleteAutomationParams{}
|
||||
}
|
||||
|
||||
// DeleteAutomationParams contains all the bound params for the delete automation operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters deleteAutomation
|
||||
type DeleteAutomationParams struct {
|
||||
|
||||
/*Automation ID
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
ID string
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *DeleteAutomationParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
rID := []string{ctx.Param("id")}
|
||||
if err := o.bindID(rID, true); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *DeleteAutomationParams) bindID(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
o.ID = raw
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
package automations
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// GetAutomationEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func GetAutomationEndpoint(handler func(ctx context.Context, params *GetAutomationParams) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
// generate params from request
|
||||
params := NewGetAutomationParams()
|
||||
err := params.ReadRequest(ctx)
|
||||
if err != nil {
|
||||
errObj := err.(*errors.CompositeError)
|
||||
ctx.Writer.Header().Set("Content-Type", "application/problem+json")
|
||||
ctx.JSON(int(errObj.Code()), gin.H{"error": errObj.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
resp := handler(ctx, params)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetAutomationParams creates a new GetAutomationParams object
|
||||
// with the default values initialized.
|
||||
func NewGetAutomationParams() *GetAutomationParams {
|
||||
var ()
|
||||
return &GetAutomationParams{}
|
||||
}
|
||||
|
||||
// GetAutomationParams contains all the bound params for the get automation operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters getAutomation
|
||||
type GetAutomationParams struct {
|
||||
|
||||
/*Automation ID
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
ID string
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *GetAutomationParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
rID := []string{ctx.Param("id")}
|
||||
if err := o.bindID(rID, true); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *GetAutomationParams) bindID(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
o.ID = raw
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
package automations
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// ListAutomationsEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func ListAutomationsEndpoint(handler func(ctx context.Context) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
resp := handler(ctx)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewListAutomationsParams creates a new ListAutomationsParams object
|
||||
// with the default values initialized.
|
||||
func NewListAutomationsParams() *ListAutomationsParams {
|
||||
var ()
|
||||
return &ListAutomationsParams{}
|
||||
}
|
||||
|
||||
// ListAutomationsParams contains all the bound params for the list automations operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters listAutomations
|
||||
type ListAutomationsParams struct {
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *ListAutomationsParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1,111 +0,0 @@
|
||||
package automations
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/models"
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// UpdateAutomationEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func UpdateAutomationEndpoint(handler func(ctx context.Context, params *UpdateAutomationParams) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
// generate params from request
|
||||
params := NewUpdateAutomationParams()
|
||||
err := params.ReadRequest(ctx)
|
||||
if err != nil {
|
||||
errObj := err.(*errors.CompositeError)
|
||||
ctx.Writer.Header().Set("Content-Type", "application/problem+json")
|
||||
ctx.JSON(int(errObj.Code()), gin.H{"error": errObj.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
resp := handler(ctx, params)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewUpdateAutomationParams creates a new UpdateAutomationParams object
|
||||
// with the default values initialized.
|
||||
func NewUpdateAutomationParams() *UpdateAutomationParams {
|
||||
var ()
|
||||
return &UpdateAutomationParams{}
|
||||
}
|
||||
|
||||
// UpdateAutomationParams contains all the bound params for the update automation operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters updateAutomation
|
||||
type UpdateAutomationParams struct {
|
||||
|
||||
/*Automation object that needs to be added
|
||||
Required: true
|
||||
In: body
|
||||
*/
|
||||
Automation *models.AutomationForm
|
||||
/*Automation ID
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
ID string
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *UpdateAutomationParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
if runtime.HasBody(ctx.Request) {
|
||||
var body models.AutomationForm
|
||||
if err := ctx.BindJSON(&body); err != nil {
|
||||
if err == io.EOF {
|
||||
res = append(res, errors.Required("automation", "body", ""))
|
||||
} else {
|
||||
res = append(res, errors.NewParseError("automation", "body", "", err))
|
||||
}
|
||||
|
||||
} else {
|
||||
o.Automation = &body
|
||||
}
|
||||
} else {
|
||||
res = append(res, errors.Required("automation", "body", ""))
|
||||
}
|
||||
|
||||
rID := []string{ctx.Param("id")}
|
||||
if err := o.bindID(rID, true); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *UpdateAutomationParams) bindID(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
o.ID = raw
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
package jobs
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// GetJobEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func GetJobEndpoint(handler func(ctx context.Context, params *GetJobParams) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
// generate params from request
|
||||
params := NewGetJobParams()
|
||||
err := params.ReadRequest(ctx)
|
||||
if err != nil {
|
||||
errObj := err.(*errors.CompositeError)
|
||||
ctx.Writer.Header().Set("Content-Type", "application/problem+json")
|
||||
ctx.JSON(int(errObj.Code()), gin.H{"error": errObj.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
resp := handler(ctx, params)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetJobParams creates a new GetJobParams object
|
||||
// with the default values initialized.
|
||||
func NewGetJobParams() *GetJobParams {
|
||||
var ()
|
||||
return &GetJobParams{}
|
||||
}
|
||||
|
||||
// GetJobParams contains all the bound params for the get job operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters getJob
|
||||
type GetJobParams struct {
|
||||
|
||||
/*Job ID
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
ID string
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *GetJobParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
rID := []string{ctx.Param("id")}
|
||||
if err := o.bindID(rID, true); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *GetJobParams) bindID(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
o.ID = raw
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
package jobs
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// ListJobsEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func ListJobsEndpoint(handler func(ctx context.Context) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
resp := handler(ctx)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewListJobsParams creates a new ListJobsParams object
|
||||
// with the default values initialized.
|
||||
func NewListJobsParams() *ListJobsParams {
|
||||
var ()
|
||||
return &ListJobsParams{}
|
||||
}
|
||||
|
||||
// ListJobsParams contains all the bound params for the list jobs operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters listJobs
|
||||
type ListJobsParams struct {
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *ListJobsParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
package jobs
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/models"
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// RunJobEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func RunJobEndpoint(handler func(ctx context.Context, params *RunJobParams) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
// generate params from request
|
||||
params := NewRunJobParams()
|
||||
err := params.ReadRequest(ctx)
|
||||
if err != nil {
|
||||
errObj := err.(*errors.CompositeError)
|
||||
ctx.Writer.Header().Set("Content-Type", "application/problem+json")
|
||||
ctx.JSON(int(errObj.Code()), gin.H{"error": errObj.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
resp := handler(ctx, params)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewRunJobParams creates a new RunJobParams object
|
||||
// with the default values initialized.
|
||||
func NewRunJobParams() *RunJobParams {
|
||||
var ()
|
||||
return &RunJobParams{}
|
||||
}
|
||||
|
||||
// RunJobParams contains all the bound params for the run job operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters runJob
|
||||
type RunJobParams struct {
|
||||
|
||||
/*New job
|
||||
Required: true
|
||||
In: body
|
||||
*/
|
||||
Job *models.JobForm
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *RunJobParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
if runtime.HasBody(ctx.Request) {
|
||||
var body models.JobForm
|
||||
if err := ctx.BindJSON(&body); err != nil {
|
||||
if err == io.EOF {
|
||||
res = append(res, errors.Required("job", "body", ""))
|
||||
} else {
|
||||
res = append(res, errors.NewParseError("job", "body", "", err))
|
||||
}
|
||||
|
||||
} else {
|
||||
o.Job = &body
|
||||
}
|
||||
} else {
|
||||
res = append(res, errors.Required("job", "body", ""))
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1,111 +0,0 @@
|
||||
package jobs
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/models"
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// UpdateJobEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func UpdateJobEndpoint(handler func(ctx context.Context, params *UpdateJobParams) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
// generate params from request
|
||||
params := NewUpdateJobParams()
|
||||
err := params.ReadRequest(ctx)
|
||||
if err != nil {
|
||||
errObj := err.(*errors.CompositeError)
|
||||
ctx.Writer.Header().Set("Content-Type", "application/problem+json")
|
||||
ctx.JSON(int(errObj.Code()), gin.H{"error": errObj.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
resp := handler(ctx, params)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewUpdateJobParams creates a new UpdateJobParams object
|
||||
// with the default values initialized.
|
||||
func NewUpdateJobParams() *UpdateJobParams {
|
||||
var ()
|
||||
return &UpdateJobParams{}
|
||||
}
|
||||
|
||||
// UpdateJobParams contains all the bound params for the update job operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters updateJob
|
||||
type UpdateJobParams struct {
|
||||
|
||||
/*Job ID
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
ID string
|
||||
/*Job object that needs to be added
|
||||
Required: true
|
||||
In: body
|
||||
*/
|
||||
Job *models.Job
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *UpdateJobParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
rID := []string{ctx.Param("id")}
|
||||
if err := o.bindID(rID, true); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if runtime.HasBody(ctx.Request) {
|
||||
var body models.Job
|
||||
if err := ctx.BindJSON(&body); err != nil {
|
||||
if err == io.EOF {
|
||||
res = append(res, errors.Required("job", "body", ""))
|
||||
} else {
|
||||
res = append(res, errors.NewParseError("job", "body", "", err))
|
||||
}
|
||||
|
||||
} else {
|
||||
o.Job = &body
|
||||
}
|
||||
} else {
|
||||
res = append(res, errors.Required("job", "body", ""))
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *UpdateJobParams) bindID(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
o.ID = raw
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
package logs
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// GetLogsEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func GetLogsEndpoint(handler func(ctx context.Context, params *GetLogsParams) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
// generate params from request
|
||||
params := NewGetLogsParams()
|
||||
err := params.ReadRequest(ctx)
|
||||
if err != nil {
|
||||
errObj := err.(*errors.CompositeError)
|
||||
ctx.Writer.Header().Set("Content-Type", "application/problem+json")
|
||||
ctx.JSON(int(errObj.Code()), gin.H{"error": errObj.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
resp := handler(ctx, params)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetLogsParams creates a new GetLogsParams object
|
||||
// with the default values initialized.
|
||||
func NewGetLogsParams() *GetLogsParams {
|
||||
var ()
|
||||
return &GetLogsParams{}
|
||||
}
|
||||
|
||||
// GetLogsParams contains all the bound params for the get logs operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters getLogs
|
||||
type GetLogsParams struct {
|
||||
|
||||
/*Reference
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
Reference string
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *GetLogsParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
rReference := []string{ctx.Param("reference")}
|
||||
if err := o.bindReference(rReference, true); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *GetLogsParams) bindReference(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
o.Reference = raw
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
package playbooks
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/models"
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// CreatePlaybookEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func CreatePlaybookEndpoint(handler func(ctx context.Context, params *CreatePlaybookParams) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
// generate params from request
|
||||
params := NewCreatePlaybookParams()
|
||||
err := params.ReadRequest(ctx)
|
||||
if err != nil {
|
||||
errObj := err.(*errors.CompositeError)
|
||||
ctx.Writer.Header().Set("Content-Type", "application/problem+json")
|
||||
ctx.JSON(int(errObj.Code()), gin.H{"error": errObj.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
resp := handler(ctx, params)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewCreatePlaybookParams creates a new CreatePlaybookParams object
|
||||
// with the default values initialized.
|
||||
func NewCreatePlaybookParams() *CreatePlaybookParams {
|
||||
var ()
|
||||
return &CreatePlaybookParams{}
|
||||
}
|
||||
|
||||
// CreatePlaybookParams contains all the bound params for the create playbook operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters createPlaybook
|
||||
type CreatePlaybookParams struct {
|
||||
|
||||
/*New playbook
|
||||
Required: true
|
||||
In: body
|
||||
*/
|
||||
Playbook *models.PlaybookTemplateForm
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *CreatePlaybookParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
if runtime.HasBody(ctx.Request) {
|
||||
var body models.PlaybookTemplateForm
|
||||
if err := ctx.BindJSON(&body); err != nil {
|
||||
if err == io.EOF {
|
||||
res = append(res, errors.Required("playbook", "body", ""))
|
||||
} else {
|
||||
res = append(res, errors.NewParseError("playbook", "body", "", err))
|
||||
}
|
||||
|
||||
} else {
|
||||
o.Playbook = &body
|
||||
}
|
||||
} else {
|
||||
res = append(res, errors.Required("playbook", "body", ""))
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
package playbooks
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// DeletePlaybookEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func DeletePlaybookEndpoint(handler func(ctx context.Context, params *DeletePlaybookParams) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
// generate params from request
|
||||
params := NewDeletePlaybookParams()
|
||||
err := params.ReadRequest(ctx)
|
||||
if err != nil {
|
||||
errObj := err.(*errors.CompositeError)
|
||||
ctx.Writer.Header().Set("Content-Type", "application/problem+json")
|
||||
ctx.JSON(int(errObj.Code()), gin.H{"error": errObj.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
resp := handler(ctx, params)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewDeletePlaybookParams creates a new DeletePlaybookParams object
|
||||
// with the default values initialized.
|
||||
func NewDeletePlaybookParams() *DeletePlaybookParams {
|
||||
var ()
|
||||
return &DeletePlaybookParams{}
|
||||
}
|
||||
|
||||
// DeletePlaybookParams contains all the bound params for the delete playbook operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters deletePlaybook
|
||||
type DeletePlaybookParams struct {
|
||||
|
||||
/*Playbook name
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
ID string
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *DeletePlaybookParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
rID := []string{ctx.Param("id")}
|
||||
if err := o.bindID(rID, true); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *DeletePlaybookParams) bindID(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
o.ID = raw
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
package playbooks
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// GetPlaybookEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func GetPlaybookEndpoint(handler func(ctx context.Context, params *GetPlaybookParams) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
// generate params from request
|
||||
params := NewGetPlaybookParams()
|
||||
err := params.ReadRequest(ctx)
|
||||
if err != nil {
|
||||
errObj := err.(*errors.CompositeError)
|
||||
ctx.Writer.Header().Set("Content-Type", "application/problem+json")
|
||||
ctx.JSON(int(errObj.Code()), gin.H{"error": errObj.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
resp := handler(ctx, params)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetPlaybookParams creates a new GetPlaybookParams object
|
||||
// with the default values initialized.
|
||||
func NewGetPlaybookParams() *GetPlaybookParams {
|
||||
var ()
|
||||
return &GetPlaybookParams{}
|
||||
}
|
||||
|
||||
// GetPlaybookParams contains all the bound params for the get playbook operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters getPlaybook
|
||||
type GetPlaybookParams struct {
|
||||
|
||||
/*Playbook name
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
ID string
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *GetPlaybookParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
rID := []string{ctx.Param("id")}
|
||||
if err := o.bindID(rID, true); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *GetPlaybookParams) bindID(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
o.ID = raw
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
package playbooks
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// ListPlaybooksEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func ListPlaybooksEndpoint(handler func(ctx context.Context) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
resp := handler(ctx)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewListPlaybooksParams creates a new ListPlaybooksParams object
|
||||
// with the default values initialized.
|
||||
func NewListPlaybooksParams() *ListPlaybooksParams {
|
||||
var ()
|
||||
return &ListPlaybooksParams{}
|
||||
}
|
||||
|
||||
// ListPlaybooksParams contains all the bound params for the list playbooks operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters listPlaybooks
|
||||
type ListPlaybooksParams struct {
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *ListPlaybooksParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1,111 +0,0 @@
|
||||
package playbooks
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/models"
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// UpdatePlaybookEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func UpdatePlaybookEndpoint(handler func(ctx context.Context, params *UpdatePlaybookParams) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
// generate params from request
|
||||
params := NewUpdatePlaybookParams()
|
||||
err := params.ReadRequest(ctx)
|
||||
if err != nil {
|
||||
errObj := err.(*errors.CompositeError)
|
||||
ctx.Writer.Header().Set("Content-Type", "application/problem+json")
|
||||
ctx.JSON(int(errObj.Code()), gin.H{"error": errObj.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
resp := handler(ctx, params)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewUpdatePlaybookParams creates a new UpdatePlaybookParams object
|
||||
// with the default values initialized.
|
||||
func NewUpdatePlaybookParams() *UpdatePlaybookParams {
|
||||
var ()
|
||||
return &UpdatePlaybookParams{}
|
||||
}
|
||||
|
||||
// UpdatePlaybookParams contains all the bound params for the update playbook operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters updatePlaybook
|
||||
type UpdatePlaybookParams struct {
|
||||
|
||||
/*Playbook ID
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
ID string
|
||||
/*Updated playbook
|
||||
Required: true
|
||||
In: body
|
||||
*/
|
||||
Playbook *models.PlaybookTemplateForm
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *UpdatePlaybookParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
rID := []string{ctx.Param("id")}
|
||||
if err := o.bindID(rID, true); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if runtime.HasBody(ctx.Request) {
|
||||
var body models.PlaybookTemplateForm
|
||||
if err := ctx.BindJSON(&body); err != nil {
|
||||
if err == io.EOF {
|
||||
res = append(res, errors.Required("playbook", "body", ""))
|
||||
} else {
|
||||
res = append(res, errors.NewParseError("playbook", "body", "", err))
|
||||
}
|
||||
|
||||
} else {
|
||||
o.Playbook = &body
|
||||
}
|
||||
} else {
|
||||
res = append(res, errors.Required("playbook", "body", ""))
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *UpdatePlaybookParams) bindID(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
o.ID = raw
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
package settings
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// GetSettingsEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func GetSettingsEndpoint(handler func(ctx context.Context) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
resp := handler(ctx)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetSettingsParams creates a new GetSettingsParams object
|
||||
// with the default values initialized.
|
||||
func NewGetSettingsParams() *GetSettingsParams {
|
||||
var ()
|
||||
return &GetSettingsParams{}
|
||||
}
|
||||
|
||||
// GetSettingsParams contains all the bound params for the get settings operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters getSettings
|
||||
type GetSettingsParams struct {
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *GetSettingsParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
package statistics
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// GetStatisticsEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func GetStatisticsEndpoint(handler func(ctx context.Context) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
resp := handler(ctx)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetStatisticsParams creates a new GetStatisticsParams object
|
||||
// with the default values initialized.
|
||||
func NewGetStatisticsParams() *GetStatisticsParams {
|
||||
var ()
|
||||
return &GetStatisticsParams{}
|
||||
}
|
||||
|
||||
// GetStatisticsParams contains all the bound params for the get statistics operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters getStatistics
|
||||
type GetStatisticsParams struct {
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *GetStatisticsParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
package tasks
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// ListTasksEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func ListTasksEndpoint(handler func(ctx context.Context) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
resp := handler(ctx)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewListTasksParams creates a new ListTasksParams object
|
||||
// with the default values initialized.
|
||||
func NewListTasksParams() *ListTasksParams {
|
||||
var ()
|
||||
return &ListTasksParams{}
|
||||
}
|
||||
|
||||
// ListTasksParams contains all the bound params for the list tasks operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters listTasks
|
||||
type ListTasksParams struct {
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *ListTasksParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
package templates
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/models"
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// CreateTemplateEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func CreateTemplateEndpoint(handler func(ctx context.Context, params *CreateTemplateParams) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
// generate params from request
|
||||
params := NewCreateTemplateParams()
|
||||
err := params.ReadRequest(ctx)
|
||||
if err != nil {
|
||||
errObj := err.(*errors.CompositeError)
|
||||
ctx.Writer.Header().Set("Content-Type", "application/problem+json")
|
||||
ctx.JSON(int(errObj.Code()), gin.H{"error": errObj.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
resp := handler(ctx, params)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewCreateTemplateParams creates a new CreateTemplateParams object
|
||||
// with the default values initialized.
|
||||
func NewCreateTemplateParams() *CreateTemplateParams {
|
||||
var ()
|
||||
return &CreateTemplateParams{}
|
||||
}
|
||||
|
||||
// CreateTemplateParams contains all the bound params for the create template operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters createTemplate
|
||||
type CreateTemplateParams struct {
|
||||
|
||||
/*New template
|
||||
Required: true
|
||||
In: body
|
||||
*/
|
||||
Template *models.TicketTemplateForm
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *CreateTemplateParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
if runtime.HasBody(ctx.Request) {
|
||||
var body models.TicketTemplateForm
|
||||
if err := ctx.BindJSON(&body); err != nil {
|
||||
if err == io.EOF {
|
||||
res = append(res, errors.Required("template", "body", ""))
|
||||
} else {
|
||||
res = append(res, errors.NewParseError("template", "body", "", err))
|
||||
}
|
||||
|
||||
} else {
|
||||
o.Template = &body
|
||||
}
|
||||
} else {
|
||||
res = append(res, errors.Required("template", "body", ""))
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
package templates
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// DeleteTemplateEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func DeleteTemplateEndpoint(handler func(ctx context.Context, params *DeleteTemplateParams) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
// generate params from request
|
||||
params := NewDeleteTemplateParams()
|
||||
err := params.ReadRequest(ctx)
|
||||
if err != nil {
|
||||
errObj := err.(*errors.CompositeError)
|
||||
ctx.Writer.Header().Set("Content-Type", "application/problem+json")
|
||||
ctx.JSON(int(errObj.Code()), gin.H{"error": errObj.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
resp := handler(ctx, params)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewDeleteTemplateParams creates a new DeleteTemplateParams object
|
||||
// with the default values initialized.
|
||||
func NewDeleteTemplateParams() *DeleteTemplateParams {
|
||||
var ()
|
||||
return &DeleteTemplateParams{}
|
||||
}
|
||||
|
||||
// DeleteTemplateParams contains all the bound params for the delete template operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters deleteTemplate
|
||||
type DeleteTemplateParams struct {
|
||||
|
||||
/*Template ID
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
ID string
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *DeleteTemplateParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
rID := []string{ctx.Param("id")}
|
||||
if err := o.bindID(rID, true); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *DeleteTemplateParams) bindID(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
o.ID = raw
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
package templates
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// GetTemplateEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func GetTemplateEndpoint(handler func(ctx context.Context, params *GetTemplateParams) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
// generate params from request
|
||||
params := NewGetTemplateParams()
|
||||
err := params.ReadRequest(ctx)
|
||||
if err != nil {
|
||||
errObj := err.(*errors.CompositeError)
|
||||
ctx.Writer.Header().Set("Content-Type", "application/problem+json")
|
||||
ctx.JSON(int(errObj.Code()), gin.H{"error": errObj.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
resp := handler(ctx, params)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetTemplateParams creates a new GetTemplateParams object
|
||||
// with the default values initialized.
|
||||
func NewGetTemplateParams() *GetTemplateParams {
|
||||
var ()
|
||||
return &GetTemplateParams{}
|
||||
}
|
||||
|
||||
// GetTemplateParams contains all the bound params for the get template operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters getTemplate
|
||||
type GetTemplateParams struct {
|
||||
|
||||
/*Template ID
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
ID string
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *GetTemplateParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
rID := []string{ctx.Param("id")}
|
||||
if err := o.bindID(rID, true); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *GetTemplateParams) bindID(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
o.ID = raw
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
package templates
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// ListTemplatesEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func ListTemplatesEndpoint(handler func(ctx context.Context) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
resp := handler(ctx)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewListTemplatesParams creates a new ListTemplatesParams object
|
||||
// with the default values initialized.
|
||||
func NewListTemplatesParams() *ListTemplatesParams {
|
||||
var ()
|
||||
return &ListTemplatesParams{}
|
||||
}
|
||||
|
||||
// ListTemplatesParams contains all the bound params for the list templates operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters listTemplates
|
||||
type ListTemplatesParams struct {
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *ListTemplatesParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1,111 +0,0 @@
|
||||
package templates
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/models"
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// UpdateTemplateEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func UpdateTemplateEndpoint(handler func(ctx context.Context, params *UpdateTemplateParams) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
// generate params from request
|
||||
params := NewUpdateTemplateParams()
|
||||
err := params.ReadRequest(ctx)
|
||||
if err != nil {
|
||||
errObj := err.(*errors.CompositeError)
|
||||
ctx.Writer.Header().Set("Content-Type", "application/problem+json")
|
||||
ctx.JSON(int(errObj.Code()), gin.H{"error": errObj.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
resp := handler(ctx, params)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewUpdateTemplateParams creates a new UpdateTemplateParams object
|
||||
// with the default values initialized.
|
||||
func NewUpdateTemplateParams() *UpdateTemplateParams {
|
||||
var ()
|
||||
return &UpdateTemplateParams{}
|
||||
}
|
||||
|
||||
// UpdateTemplateParams contains all the bound params for the update template operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters updateTemplate
|
||||
type UpdateTemplateParams struct {
|
||||
|
||||
/*Template ID
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
ID string
|
||||
/*Template object that needs to be added
|
||||
Required: true
|
||||
In: body
|
||||
*/
|
||||
Template *models.TicketTemplateForm
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *UpdateTemplateParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
rID := []string{ctx.Param("id")}
|
||||
if err := o.bindID(rID, true); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if runtime.HasBody(ctx.Request) {
|
||||
var body models.TicketTemplateForm
|
||||
if err := ctx.BindJSON(&body); err != nil {
|
||||
if err == io.EOF {
|
||||
res = append(res, errors.Required("template", "body", ""))
|
||||
} else {
|
||||
res = append(res, errors.NewParseError("template", "body", "", err))
|
||||
}
|
||||
|
||||
} else {
|
||||
o.Template = &body
|
||||
}
|
||||
} else {
|
||||
res = append(res, errors.Required("template", "body", ""))
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *UpdateTemplateParams) bindID(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
o.ID = raw
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,116 +0,0 @@
|
||||
package tickets
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/swag"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/models"
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// AddArtifactEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func AddArtifactEndpoint(handler func(ctx context.Context, params *AddArtifactParams) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
// generate params from request
|
||||
params := NewAddArtifactParams()
|
||||
err := params.ReadRequest(ctx)
|
||||
if err != nil {
|
||||
errObj := err.(*errors.CompositeError)
|
||||
ctx.Writer.Header().Set("Content-Type", "application/problem+json")
|
||||
ctx.JSON(int(errObj.Code()), gin.H{"error": errObj.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
resp := handler(ctx, params)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewAddArtifactParams creates a new AddArtifactParams object
|
||||
// with the default values initialized.
|
||||
func NewAddArtifactParams() *AddArtifactParams {
|
||||
var ()
|
||||
return &AddArtifactParams{}
|
||||
}
|
||||
|
||||
// AddArtifactParams contains all the bound params for the add artifact operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters addArtifact
|
||||
type AddArtifactParams struct {
|
||||
|
||||
/*Artifact object that needs to be added
|
||||
Required: true
|
||||
In: body
|
||||
*/
|
||||
Artifact *models.Artifact
|
||||
/*Ticket ID
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
ID int64
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *AddArtifactParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
if runtime.HasBody(ctx.Request) {
|
||||
var body models.Artifact
|
||||
if err := ctx.BindJSON(&body); err != nil {
|
||||
if err == io.EOF {
|
||||
res = append(res, errors.Required("artifact", "body", ""))
|
||||
} else {
|
||||
res = append(res, errors.NewParseError("artifact", "body", "", err))
|
||||
}
|
||||
|
||||
} else {
|
||||
o.Artifact = &body
|
||||
}
|
||||
} else {
|
||||
res = append(res, errors.Required("artifact", "body", ""))
|
||||
}
|
||||
|
||||
rID := []string{ctx.Param("id")}
|
||||
if err := o.bindID(rID, true); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *AddArtifactParams) bindID(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
value, err := swag.ConvertInt64(raw)
|
||||
if err != nil {
|
||||
return errors.InvalidType("id", "path", "int64", raw)
|
||||
}
|
||||
o.ID = value
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,116 +0,0 @@
|
||||
package tickets
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/swag"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/models"
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// AddCommentEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func AddCommentEndpoint(handler func(ctx context.Context, params *AddCommentParams) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
// generate params from request
|
||||
params := NewAddCommentParams()
|
||||
err := params.ReadRequest(ctx)
|
||||
if err != nil {
|
||||
errObj := err.(*errors.CompositeError)
|
||||
ctx.Writer.Header().Set("Content-Type", "application/problem+json")
|
||||
ctx.JSON(int(errObj.Code()), gin.H{"error": errObj.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
resp := handler(ctx, params)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewAddCommentParams creates a new AddCommentParams object
|
||||
// with the default values initialized.
|
||||
func NewAddCommentParams() *AddCommentParams {
|
||||
var ()
|
||||
return &AddCommentParams{}
|
||||
}
|
||||
|
||||
// AddCommentParams contains all the bound params for the add comment operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters addComment
|
||||
type AddCommentParams struct {
|
||||
|
||||
/*Ticket comment
|
||||
Required: true
|
||||
In: body
|
||||
*/
|
||||
Comment *models.CommentForm
|
||||
/*Ticket ID
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
ID int64
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *AddCommentParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
if runtime.HasBody(ctx.Request) {
|
||||
var body models.CommentForm
|
||||
if err := ctx.BindJSON(&body); err != nil {
|
||||
if err == io.EOF {
|
||||
res = append(res, errors.Required("comment", "body", ""))
|
||||
} else {
|
||||
res = append(res, errors.NewParseError("comment", "body", "", err))
|
||||
}
|
||||
|
||||
} else {
|
||||
o.Comment = &body
|
||||
}
|
||||
} else {
|
||||
res = append(res, errors.Required("comment", "body", ""))
|
||||
}
|
||||
|
||||
rID := []string{ctx.Param("id")}
|
||||
if err := o.bindID(rID, true); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *AddCommentParams) bindID(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
value, err := swag.ConvertInt64(raw)
|
||||
if err != nil {
|
||||
return errors.InvalidType("id", "path", "int64", raw)
|
||||
}
|
||||
o.ID = value
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,116 +0,0 @@
|
||||
package tickets
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/swag"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/models"
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// AddTicketPlaybookEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func AddTicketPlaybookEndpoint(handler func(ctx context.Context, params *AddTicketPlaybookParams) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
// generate params from request
|
||||
params := NewAddTicketPlaybookParams()
|
||||
err := params.ReadRequest(ctx)
|
||||
if err != nil {
|
||||
errObj := err.(*errors.CompositeError)
|
||||
ctx.Writer.Header().Set("Content-Type", "application/problem+json")
|
||||
ctx.JSON(int(errObj.Code()), gin.H{"error": errObj.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
resp := handler(ctx, params)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewAddTicketPlaybookParams creates a new AddTicketPlaybookParams object
|
||||
// with the default values initialized.
|
||||
func NewAddTicketPlaybookParams() *AddTicketPlaybookParams {
|
||||
var ()
|
||||
return &AddTicketPlaybookParams{}
|
||||
}
|
||||
|
||||
// AddTicketPlaybookParams contains all the bound params for the add ticket playbook operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters addTicketPlaybook
|
||||
type AddTicketPlaybookParams struct {
|
||||
|
||||
/*Ticket ID
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
ID int64
|
||||
/*Ticket playbook object that needs to be added
|
||||
Required: true
|
||||
In: body
|
||||
*/
|
||||
Playbook *models.PlaybookTemplateForm
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *AddTicketPlaybookParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
rID := []string{ctx.Param("id")}
|
||||
if err := o.bindID(rID, true); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if runtime.HasBody(ctx.Request) {
|
||||
var body models.PlaybookTemplateForm
|
||||
if err := ctx.BindJSON(&body); err != nil {
|
||||
if err == io.EOF {
|
||||
res = append(res, errors.Required("playbook", "body", ""))
|
||||
} else {
|
||||
res = append(res, errors.NewParseError("playbook", "body", "", err))
|
||||
}
|
||||
|
||||
} else {
|
||||
o.Playbook = &body
|
||||
}
|
||||
} else {
|
||||
res = append(res, errors.Required("playbook", "body", ""))
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *AddTicketPlaybookParams) bindID(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
value, err := swag.ConvertInt64(raw)
|
||||
if err != nil {
|
||||
return errors.InvalidType("id", "path", "int64", raw)
|
||||
}
|
||||
o.ID = value
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,157 +0,0 @@
|
||||
package tickets
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/swag"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// CompleteTaskEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func CompleteTaskEndpoint(handler func(ctx context.Context, params *CompleteTaskParams) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
// generate params from request
|
||||
params := NewCompleteTaskParams()
|
||||
err := params.ReadRequest(ctx)
|
||||
if err != nil {
|
||||
errObj := err.(*errors.CompositeError)
|
||||
ctx.Writer.Header().Set("Content-Type", "application/problem+json")
|
||||
ctx.JSON(int(errObj.Code()), gin.H{"error": errObj.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
resp := handler(ctx, params)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewCompleteTaskParams creates a new CompleteTaskParams object
|
||||
// with the default values initialized.
|
||||
func NewCompleteTaskParams() *CompleteTaskParams {
|
||||
var ()
|
||||
return &CompleteTaskParams{}
|
||||
}
|
||||
|
||||
// CompleteTaskParams contains all the bound params for the complete task operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters completeTask
|
||||
type CompleteTaskParams struct {
|
||||
|
||||
/*Ticket playbook object that needs to be added
|
||||
Required: true
|
||||
In: body
|
||||
*/
|
||||
Data interface{}
|
||||
/*Ticket ID
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
ID int64
|
||||
/*Playbook ID
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
PlaybookID string
|
||||
/*Task ID
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
TaskID string
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *CompleteTaskParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
if runtime.HasBody(ctx.Request) {
|
||||
var body interface{}
|
||||
if err := ctx.BindJSON(&body); err != nil {
|
||||
if err == io.EOF {
|
||||
res = append(res, errors.Required("data", "body", ""))
|
||||
} else {
|
||||
res = append(res, errors.NewParseError("data", "body", "", err))
|
||||
}
|
||||
|
||||
} else {
|
||||
o.Data = body
|
||||
}
|
||||
} else {
|
||||
res = append(res, errors.Required("data", "body", ""))
|
||||
}
|
||||
|
||||
rID := []string{ctx.Param("id")}
|
||||
if err := o.bindID(rID, true); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
rPlaybookID := []string{ctx.Param("playbookID")}
|
||||
if err := o.bindPlaybookID(rPlaybookID, true); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
rTaskID := []string{ctx.Param("taskID")}
|
||||
if err := o.bindTaskID(rTaskID, true); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *CompleteTaskParams) bindID(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
value, err := swag.ConvertInt64(raw)
|
||||
if err != nil {
|
||||
return errors.InvalidType("id", "path", "int64", raw)
|
||||
}
|
||||
o.ID = value
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *CompleteTaskParams) bindPlaybookID(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
o.PlaybookID = raw
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *CompleteTaskParams) bindTaskID(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
o.TaskID = raw
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
package tickets
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/models"
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// CreateTicketBatchEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func CreateTicketBatchEndpoint(handler func(ctx context.Context, params *CreateTicketBatchParams) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
// generate params from request
|
||||
params := NewCreateTicketBatchParams()
|
||||
err := params.ReadRequest(ctx)
|
||||
if err != nil {
|
||||
errObj := err.(*errors.CompositeError)
|
||||
ctx.Writer.Header().Set("Content-Type", "application/problem+json")
|
||||
ctx.JSON(int(errObj.Code()), gin.H{"error": errObj.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
resp := handler(ctx, params)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewCreateTicketBatchParams creates a new CreateTicketBatchParams object
|
||||
// with the default values initialized.
|
||||
func NewCreateTicketBatchParams() *CreateTicketBatchParams {
|
||||
var ()
|
||||
return &CreateTicketBatchParams{}
|
||||
}
|
||||
|
||||
// CreateTicketBatchParams contains all the bound params for the create ticket batch operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters createTicketBatch
|
||||
type CreateTicketBatchParams struct {
|
||||
|
||||
/*New ticket
|
||||
Required: true
|
||||
In: body
|
||||
*/
|
||||
Ticket []*models.TicketForm
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *CreateTicketBatchParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
if runtime.HasBody(ctx.Request) {
|
||||
var body []*models.TicketForm
|
||||
if err := ctx.BindJSON(&body); err != nil {
|
||||
if err == io.EOF {
|
||||
res = append(res, errors.Required("ticket", "body", ""))
|
||||
} else {
|
||||
res = append(res, errors.NewParseError("ticket", "body", "", err))
|
||||
}
|
||||
|
||||
} else {
|
||||
o.Ticket = body
|
||||
}
|
||||
} else {
|
||||
res = append(res, errors.Required("ticket", "body", ""))
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
package tickets
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/models"
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// CreateTicketEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func CreateTicketEndpoint(handler func(ctx context.Context, params *CreateTicketParams) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
// generate params from request
|
||||
params := NewCreateTicketParams()
|
||||
err := params.ReadRequest(ctx)
|
||||
if err != nil {
|
||||
errObj := err.(*errors.CompositeError)
|
||||
ctx.Writer.Header().Set("Content-Type", "application/problem+json")
|
||||
ctx.JSON(int(errObj.Code()), gin.H{"error": errObj.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
resp := handler(ctx, params)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewCreateTicketParams creates a new CreateTicketParams object
|
||||
// with the default values initialized.
|
||||
func NewCreateTicketParams() *CreateTicketParams {
|
||||
var ()
|
||||
return &CreateTicketParams{}
|
||||
}
|
||||
|
||||
// CreateTicketParams contains all the bound params for the create ticket operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters createTicket
|
||||
type CreateTicketParams struct {
|
||||
|
||||
/*New ticket
|
||||
Required: true
|
||||
In: body
|
||||
*/
|
||||
Ticket *models.TicketForm
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *CreateTicketParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
if runtime.HasBody(ctx.Request) {
|
||||
var body models.TicketForm
|
||||
if err := ctx.BindJSON(&body); err != nil {
|
||||
if err == io.EOF {
|
||||
res = append(res, errors.Required("ticket", "body", ""))
|
||||
} else {
|
||||
res = append(res, errors.NewParseError("ticket", "body", "", err))
|
||||
}
|
||||
|
||||
} else {
|
||||
o.Ticket = &body
|
||||
}
|
||||
} else {
|
||||
res = append(res, errors.Required("ticket", "body", ""))
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1,92 +0,0 @@
|
||||
package tickets
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/swag"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// DeleteTicketEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func DeleteTicketEndpoint(handler func(ctx context.Context, params *DeleteTicketParams) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
// generate params from request
|
||||
params := NewDeleteTicketParams()
|
||||
err := params.ReadRequest(ctx)
|
||||
if err != nil {
|
||||
errObj := err.(*errors.CompositeError)
|
||||
ctx.Writer.Header().Set("Content-Type", "application/problem+json")
|
||||
ctx.JSON(int(errObj.Code()), gin.H{"error": errObj.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
resp := handler(ctx, params)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewDeleteTicketParams creates a new DeleteTicketParams object
|
||||
// with the default values initialized.
|
||||
func NewDeleteTicketParams() *DeleteTicketParams {
|
||||
var ()
|
||||
return &DeleteTicketParams{}
|
||||
}
|
||||
|
||||
// DeleteTicketParams contains all the bound params for the delete ticket operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters deleteTicket
|
||||
type DeleteTicketParams struct {
|
||||
|
||||
/*Ticket ID
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
ID int64
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *DeleteTicketParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
rID := []string{ctx.Param("id")}
|
||||
if err := o.bindID(rID, true); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *DeleteTicketParams) bindID(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
value, err := swag.ConvertInt64(raw)
|
||||
if err != nil {
|
||||
return errors.InvalidType("id", "path", "int64", raw)
|
||||
}
|
||||
o.ID = value
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,137 +0,0 @@
|
||||
package tickets
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/swag"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/models"
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// EnrichArtifactEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func EnrichArtifactEndpoint(handler func(ctx context.Context, params *EnrichArtifactParams) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
// generate params from request
|
||||
params := NewEnrichArtifactParams()
|
||||
err := params.ReadRequest(ctx)
|
||||
if err != nil {
|
||||
errObj := err.(*errors.CompositeError)
|
||||
ctx.Writer.Header().Set("Content-Type", "application/problem+json")
|
||||
ctx.JSON(int(errObj.Code()), gin.H{"error": errObj.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
resp := handler(ctx, params)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewEnrichArtifactParams creates a new EnrichArtifactParams object
|
||||
// with the default values initialized.
|
||||
func NewEnrichArtifactParams() *EnrichArtifactParams {
|
||||
var ()
|
||||
return &EnrichArtifactParams{}
|
||||
}
|
||||
|
||||
// EnrichArtifactParams contains all the bound params for the enrich artifact operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters enrichArtifact
|
||||
type EnrichArtifactParams struct {
|
||||
|
||||
/*
|
||||
Required: true
|
||||
In: body
|
||||
*/
|
||||
Data *models.EnrichmentForm
|
||||
/*Ticket ID
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
ID int64
|
||||
/*
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
Name string
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *EnrichArtifactParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
if runtime.HasBody(ctx.Request) {
|
||||
var body models.EnrichmentForm
|
||||
if err := ctx.BindJSON(&body); err != nil {
|
||||
if err == io.EOF {
|
||||
res = append(res, errors.Required("data", "body", ""))
|
||||
} else {
|
||||
res = append(res, errors.NewParseError("data", "body", "", err))
|
||||
}
|
||||
|
||||
} else {
|
||||
o.Data = &body
|
||||
}
|
||||
} else {
|
||||
res = append(res, errors.Required("data", "body", ""))
|
||||
}
|
||||
|
||||
rID := []string{ctx.Param("id")}
|
||||
if err := o.bindID(rID, true); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
rName := []string{ctx.Param("name")}
|
||||
if err := o.bindName(rName, true); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *EnrichArtifactParams) bindID(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
value, err := swag.ConvertInt64(raw)
|
||||
if err != nil {
|
||||
return errors.InvalidType("id", "path", "int64", raw)
|
||||
}
|
||||
o.ID = value
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *EnrichArtifactParams) bindName(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
o.Name = raw
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,113 +0,0 @@
|
||||
package tickets
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/swag"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// GetArtifactEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func GetArtifactEndpoint(handler func(ctx context.Context, params *GetArtifactParams) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
// generate params from request
|
||||
params := NewGetArtifactParams()
|
||||
err := params.ReadRequest(ctx)
|
||||
if err != nil {
|
||||
errObj := err.(*errors.CompositeError)
|
||||
ctx.Writer.Header().Set("Content-Type", "application/problem+json")
|
||||
ctx.JSON(int(errObj.Code()), gin.H{"error": errObj.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
resp := handler(ctx, params)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetArtifactParams creates a new GetArtifactParams object
|
||||
// with the default values initialized.
|
||||
func NewGetArtifactParams() *GetArtifactParams {
|
||||
var ()
|
||||
return &GetArtifactParams{}
|
||||
}
|
||||
|
||||
// GetArtifactParams contains all the bound params for the get artifact operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters getArtifact
|
||||
type GetArtifactParams struct {
|
||||
|
||||
/*Ticket ID
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
ID int64
|
||||
/*
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
Name string
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *GetArtifactParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
rID := []string{ctx.Param("id")}
|
||||
if err := o.bindID(rID, true); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
rName := []string{ctx.Param("name")}
|
||||
if err := o.bindName(rName, true); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *GetArtifactParams) bindID(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
value, err := swag.ConvertInt64(raw)
|
||||
if err != nil {
|
||||
return errors.InvalidType("id", "path", "int64", raw)
|
||||
}
|
||||
o.ID = value
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *GetArtifactParams) bindName(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
o.Name = raw
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,92 +0,0 @@
|
||||
package tickets
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/swag"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// GetTicketEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func GetTicketEndpoint(handler func(ctx context.Context, params *GetTicketParams) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
// generate params from request
|
||||
params := NewGetTicketParams()
|
||||
err := params.ReadRequest(ctx)
|
||||
if err != nil {
|
||||
errObj := err.(*errors.CompositeError)
|
||||
ctx.Writer.Header().Set("Content-Type", "application/problem+json")
|
||||
ctx.JSON(int(errObj.Code()), gin.H{"error": errObj.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
resp := handler(ctx, params)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetTicketParams creates a new GetTicketParams object
|
||||
// with the default values initialized.
|
||||
func NewGetTicketParams() *GetTicketParams {
|
||||
var ()
|
||||
return &GetTicketParams{}
|
||||
}
|
||||
|
||||
// GetTicketParams contains all the bound params for the get ticket operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters getTicket
|
||||
type GetTicketParams struct {
|
||||
|
||||
/*Ticket ID
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
ID int64
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *GetTicketParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
rID := []string{ctx.Param("id")}
|
||||
if err := o.bindID(rID, true); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *GetTicketParams) bindID(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
value, err := swag.ConvertInt64(raw)
|
||||
if err != nil {
|
||||
return errors.InvalidType("id", "path", "int64", raw)
|
||||
}
|
||||
o.ID = value
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,116 +0,0 @@
|
||||
package tickets
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/swag"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/models"
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// LinkFilesEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func LinkFilesEndpoint(handler func(ctx context.Context, params *LinkFilesParams) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
// generate params from request
|
||||
params := NewLinkFilesParams()
|
||||
err := params.ReadRequest(ctx)
|
||||
if err != nil {
|
||||
errObj := err.(*errors.CompositeError)
|
||||
ctx.Writer.Header().Set("Content-Type", "application/problem+json")
|
||||
ctx.JSON(int(errObj.Code()), gin.H{"error": errObj.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
resp := handler(ctx, params)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewLinkFilesParams creates a new LinkFilesParams object
|
||||
// with the default values initialized.
|
||||
func NewLinkFilesParams() *LinkFilesParams {
|
||||
var ()
|
||||
return &LinkFilesParams{}
|
||||
}
|
||||
|
||||
// LinkFilesParams contains all the bound params for the link files operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters linkFiles
|
||||
type LinkFilesParams struct {
|
||||
|
||||
/*Added files
|
||||
Required: true
|
||||
In: body
|
||||
*/
|
||||
Files []*models.File
|
||||
/*Ticket ID
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
ID int64
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *LinkFilesParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
if runtime.HasBody(ctx.Request) {
|
||||
var body []*models.File
|
||||
if err := ctx.BindJSON(&body); err != nil {
|
||||
if err == io.EOF {
|
||||
res = append(res, errors.Required("files", "body", ""))
|
||||
} else {
|
||||
res = append(res, errors.NewParseError("files", "body", "", err))
|
||||
}
|
||||
|
||||
} else {
|
||||
o.Files = body
|
||||
}
|
||||
} else {
|
||||
res = append(res, errors.Required("files", "body", ""))
|
||||
}
|
||||
|
||||
rID := []string{ctx.Param("id")}
|
||||
if err := o.bindID(rID, true); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *LinkFilesParams) bindID(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
value, err := swag.ConvertInt64(raw)
|
||||
if err != nil {
|
||||
return errors.InvalidType("id", "path", "int64", raw)
|
||||
}
|
||||
o.ID = value
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,115 +0,0 @@
|
||||
package tickets
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/swag"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// LinkTicketEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func LinkTicketEndpoint(handler func(ctx context.Context, params *LinkTicketParams) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
// generate params from request
|
||||
params := NewLinkTicketParams()
|
||||
err := params.ReadRequest(ctx)
|
||||
if err != nil {
|
||||
errObj := err.(*errors.CompositeError)
|
||||
ctx.Writer.Header().Set("Content-Type", "application/problem+json")
|
||||
ctx.JSON(int(errObj.Code()), gin.H{"error": errObj.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
resp := handler(ctx, params)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewLinkTicketParams creates a new LinkTicketParams object
|
||||
// with the default values initialized.
|
||||
func NewLinkTicketParams() *LinkTicketParams {
|
||||
var ()
|
||||
return &LinkTicketParams{}
|
||||
}
|
||||
|
||||
// LinkTicketParams contains all the bound params for the link ticket operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters linkTicket
|
||||
type LinkTicketParams struct {
|
||||
|
||||
/*Ticket ID
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
ID int64
|
||||
/*Added ticket ID
|
||||
Required: true
|
||||
In: body
|
||||
*/
|
||||
LinkedID int64
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *LinkTicketParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
rID := []string{ctx.Param("id")}
|
||||
if err := o.bindID(rID, true); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if runtime.HasBody(ctx.Request) {
|
||||
var body int64
|
||||
if err := ctx.BindJSON(&body); err != nil {
|
||||
if err == io.EOF {
|
||||
res = append(res, errors.Required("linkedId", "body", ""))
|
||||
} else {
|
||||
res = append(res, errors.NewParseError("linkedId", "body", "", err))
|
||||
}
|
||||
|
||||
} else {
|
||||
o.LinkedID = body
|
||||
}
|
||||
} else {
|
||||
res = append(res, errors.Required("linkedId", "body", ""))
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *LinkTicketParams) bindID(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
value, err := swag.ConvertInt64(raw)
|
||||
if err != nil {
|
||||
return errors.InvalidType("id", "path", "int64", raw)
|
||||
}
|
||||
o.ID = value
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,269 +0,0 @@
|
||||
package tickets
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// ListTicketsEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func ListTicketsEndpoint(handler func(ctx context.Context, params *ListTicketsParams) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
// generate params from request
|
||||
params := NewListTicketsParams()
|
||||
err := params.ReadRequest(ctx)
|
||||
if err != nil {
|
||||
errObj := err.(*errors.CompositeError)
|
||||
ctx.Writer.Header().Set("Content-Type", "application/problem+json")
|
||||
ctx.JSON(int(errObj.Code()), gin.H{"error": errObj.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
resp := handler(ctx, params)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewListTicketsParams creates a new ListTicketsParams object
|
||||
// with the default values initialized.
|
||||
func NewListTicketsParams() *ListTicketsParams {
|
||||
var (
|
||||
countDefault = int64(25)
|
||||
offsetDefault = int64(0)
|
||||
)
|
||||
return &ListTicketsParams{
|
||||
Count: &countDefault,
|
||||
|
||||
Offset: &offsetDefault,
|
||||
}
|
||||
}
|
||||
|
||||
// ListTicketsParams contains all the bound params for the list tickets operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters listTickets
|
||||
type ListTicketsParams struct {
|
||||
|
||||
/*Number of tickets
|
||||
Maximum: 100
|
||||
In: query
|
||||
Default: 25
|
||||
*/
|
||||
Count *int64
|
||||
/*Sort descending
|
||||
In: query
|
||||
*/
|
||||
Desc []bool
|
||||
/*Offset of the list
|
||||
In: query
|
||||
Default: 0
|
||||
*/
|
||||
Offset *int64
|
||||
/*Search query
|
||||
In: query
|
||||
*/
|
||||
Query *string
|
||||
/*Sort columns
|
||||
In: query
|
||||
*/
|
||||
Sort []string
|
||||
/*Ticket Type
|
||||
In: query
|
||||
*/
|
||||
Type *string
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *ListTicketsParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
qs := runtime.Values(ctx.Request.URL.Query())
|
||||
|
||||
qCount, qhkCount, _ := qs.GetOK("count")
|
||||
if err := o.bindCount(qCount, qhkCount); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
qDesc, qhkDesc, _ := qs.GetOK("desc")
|
||||
if err := o.bindDesc(qDesc, qhkDesc); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
qOffset, qhkOffset, _ := qs.GetOK("offset")
|
||||
if err := o.bindOffset(qOffset, qhkOffset); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
qQuery, qhkQuery, _ := qs.GetOK("query")
|
||||
if err := o.bindQuery(qQuery, qhkQuery); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
qSort, qhkSort, _ := qs.GetOK("sort")
|
||||
if err := o.bindSort(qSort, qhkSort); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
qType, qhkType, _ := qs.GetOK("type")
|
||||
if err := o.bindType(qType, qhkType); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *ListTicketsParams) bindCount(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
if raw == "" { // empty values pass all other validations
|
||||
var countDefault int64 = int64(25)
|
||||
o.Count = &countDefault
|
||||
return nil
|
||||
}
|
||||
|
||||
value, err := swag.ConvertInt64(raw)
|
||||
if err != nil {
|
||||
return errors.InvalidType("count", "query", "int64", raw)
|
||||
}
|
||||
o.Count = &value
|
||||
|
||||
if err := o.validateCount(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *ListTicketsParams) validateCount() error {
|
||||
|
||||
if err := validate.MaximumInt("count", "query", int64(*o.Count), 100, false); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *ListTicketsParams) bindDesc(rawData []string, hasKey bool) error {
|
||||
|
||||
var qvDesc string
|
||||
if len(rawData) > 0 {
|
||||
qvDesc = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
descIC := swag.SplitByFormat(qvDesc, "")
|
||||
|
||||
if len(descIC) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
var descIR []bool
|
||||
for i, descIV := range descIC {
|
||||
descI, err := swag.ConvertBool(descIV)
|
||||
if err != nil {
|
||||
return errors.InvalidType(fmt.Sprintf("%s.%v", "desc", i), "query", "bool", descI)
|
||||
}
|
||||
|
||||
descIR = append(descIR, descI)
|
||||
}
|
||||
|
||||
o.Desc = descIR
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *ListTicketsParams) bindOffset(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
if raw == "" { // empty values pass all other validations
|
||||
var offsetDefault int64 = int64(0)
|
||||
o.Offset = &offsetDefault
|
||||
return nil
|
||||
}
|
||||
|
||||
value, err := swag.ConvertInt64(raw)
|
||||
if err != nil {
|
||||
return errors.InvalidType("offset", "query", "int64", raw)
|
||||
}
|
||||
o.Offset = &value
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *ListTicketsParams) bindQuery(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
if raw == "" { // empty values pass all other validations
|
||||
return nil
|
||||
}
|
||||
|
||||
o.Query = &raw
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *ListTicketsParams) bindSort(rawData []string, hasKey bool) error {
|
||||
|
||||
var qvSort string
|
||||
if len(rawData) > 0 {
|
||||
qvSort = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
sortIC := swag.SplitByFormat(qvSort, "")
|
||||
|
||||
if len(sortIC) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
var sortIR []string
|
||||
for _, sortIV := range sortIC {
|
||||
sortI := sortIV
|
||||
|
||||
sortIR = append(sortIR, sortI)
|
||||
}
|
||||
|
||||
o.Sort = sortIR
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *ListTicketsParams) bindType(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
if raw == "" { // empty values pass all other validations
|
||||
return nil
|
||||
}
|
||||
|
||||
o.Type = &raw
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,113 +0,0 @@
|
||||
package tickets
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/swag"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// RemoveArtifactEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func RemoveArtifactEndpoint(handler func(ctx context.Context, params *RemoveArtifactParams) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
// generate params from request
|
||||
params := NewRemoveArtifactParams()
|
||||
err := params.ReadRequest(ctx)
|
||||
if err != nil {
|
||||
errObj := err.(*errors.CompositeError)
|
||||
ctx.Writer.Header().Set("Content-Type", "application/problem+json")
|
||||
ctx.JSON(int(errObj.Code()), gin.H{"error": errObj.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
resp := handler(ctx, params)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewRemoveArtifactParams creates a new RemoveArtifactParams object
|
||||
// with the default values initialized.
|
||||
func NewRemoveArtifactParams() *RemoveArtifactParams {
|
||||
var ()
|
||||
return &RemoveArtifactParams{}
|
||||
}
|
||||
|
||||
// RemoveArtifactParams contains all the bound params for the remove artifact operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters removeArtifact
|
||||
type RemoveArtifactParams struct {
|
||||
|
||||
/*Ticket ID
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
ID int64
|
||||
/*
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
Name string
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *RemoveArtifactParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
rID := []string{ctx.Param("id")}
|
||||
if err := o.bindID(rID, true); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
rName := []string{ctx.Param("name")}
|
||||
if err := o.bindName(rName, true); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *RemoveArtifactParams) bindID(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
value, err := swag.ConvertInt64(raw)
|
||||
if err != nil {
|
||||
return errors.InvalidType("id", "path", "int64", raw)
|
||||
}
|
||||
o.ID = value
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *RemoveArtifactParams) bindName(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
o.Name = raw
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,117 +0,0 @@
|
||||
package tickets
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/swag"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// RemoveCommentEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func RemoveCommentEndpoint(handler func(ctx context.Context, params *RemoveCommentParams) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
// generate params from request
|
||||
params := NewRemoveCommentParams()
|
||||
err := params.ReadRequest(ctx)
|
||||
if err != nil {
|
||||
errObj := err.(*errors.CompositeError)
|
||||
ctx.Writer.Header().Set("Content-Type", "application/problem+json")
|
||||
ctx.JSON(int(errObj.Code()), gin.H{"error": errObj.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
resp := handler(ctx, params)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewRemoveCommentParams creates a new RemoveCommentParams object
|
||||
// with the default values initialized.
|
||||
func NewRemoveCommentParams() *RemoveCommentParams {
|
||||
var ()
|
||||
return &RemoveCommentParams{}
|
||||
}
|
||||
|
||||
// RemoveCommentParams contains all the bound params for the remove comment operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters removeComment
|
||||
type RemoveCommentParams struct {
|
||||
|
||||
/*Comment ID to remove
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
CommentID int64
|
||||
/*Ticket ID
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
ID int64
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *RemoveCommentParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
rCommentID := []string{ctx.Param("commentID")}
|
||||
if err := o.bindCommentID(rCommentID, true); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
rID := []string{ctx.Param("id")}
|
||||
if err := o.bindID(rID, true); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *RemoveCommentParams) bindCommentID(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
value, err := swag.ConvertInt64(raw)
|
||||
if err != nil {
|
||||
return errors.InvalidType("commentID", "path", "int64", raw)
|
||||
}
|
||||
o.CommentID = value
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *RemoveCommentParams) bindID(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
value, err := swag.ConvertInt64(raw)
|
||||
if err != nil {
|
||||
return errors.InvalidType("id", "path", "int64", raw)
|
||||
}
|
||||
o.ID = value
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,113 +0,0 @@
|
||||
package tickets
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/swag"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// RemoveTicketPlaybookEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func RemoveTicketPlaybookEndpoint(handler func(ctx context.Context, params *RemoveTicketPlaybookParams) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
// generate params from request
|
||||
params := NewRemoveTicketPlaybookParams()
|
||||
err := params.ReadRequest(ctx)
|
||||
if err != nil {
|
||||
errObj := err.(*errors.CompositeError)
|
||||
ctx.Writer.Header().Set("Content-Type", "application/problem+json")
|
||||
ctx.JSON(int(errObj.Code()), gin.H{"error": errObj.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
resp := handler(ctx, params)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewRemoveTicketPlaybookParams creates a new RemoveTicketPlaybookParams object
|
||||
// with the default values initialized.
|
||||
func NewRemoveTicketPlaybookParams() *RemoveTicketPlaybookParams {
|
||||
var ()
|
||||
return &RemoveTicketPlaybookParams{}
|
||||
}
|
||||
|
||||
// RemoveTicketPlaybookParams contains all the bound params for the remove ticket playbook operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters removeTicketPlaybook
|
||||
type RemoveTicketPlaybookParams struct {
|
||||
|
||||
/*Ticket ID
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
ID int64
|
||||
/*Playbook ID
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
PlaybookID string
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *RemoveTicketPlaybookParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
rID := []string{ctx.Param("id")}
|
||||
if err := o.bindID(rID, true); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
rPlaybookID := []string{ctx.Param("playbookID")}
|
||||
if err := o.bindPlaybookID(rPlaybookID, true); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *RemoveTicketPlaybookParams) bindID(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
value, err := swag.ConvertInt64(raw)
|
||||
if err != nil {
|
||||
return errors.InvalidType("id", "path", "int64", raw)
|
||||
}
|
||||
o.ID = value
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *RemoveTicketPlaybookParams) bindPlaybookID(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
o.PlaybookID = raw
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,134 +0,0 @@
|
||||
package tickets
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/swag"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// RunArtifactEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func RunArtifactEndpoint(handler func(ctx context.Context, params *RunArtifactParams) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
// generate params from request
|
||||
params := NewRunArtifactParams()
|
||||
err := params.ReadRequest(ctx)
|
||||
if err != nil {
|
||||
errObj := err.(*errors.CompositeError)
|
||||
ctx.Writer.Header().Set("Content-Type", "application/problem+json")
|
||||
ctx.JSON(int(errObj.Code()), gin.H{"error": errObj.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
resp := handler(ctx, params)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewRunArtifactParams creates a new RunArtifactParams object
|
||||
// with the default values initialized.
|
||||
func NewRunArtifactParams() *RunArtifactParams {
|
||||
var ()
|
||||
return &RunArtifactParams{}
|
||||
}
|
||||
|
||||
// RunArtifactParams contains all the bound params for the run artifact operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters runArtifact
|
||||
type RunArtifactParams struct {
|
||||
|
||||
/*
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
Automation string
|
||||
/*Ticket ID
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
ID int64
|
||||
/*
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
Name string
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *RunArtifactParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
rAutomation := []string{ctx.Param("automation")}
|
||||
if err := o.bindAutomation(rAutomation, true); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
rID := []string{ctx.Param("id")}
|
||||
if err := o.bindID(rID, true); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
rName := []string{ctx.Param("name")}
|
||||
if err := o.bindName(rName, true); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *RunArtifactParams) bindAutomation(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
o.Automation = raw
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *RunArtifactParams) bindID(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
value, err := swag.ConvertInt64(raw)
|
||||
if err != nil {
|
||||
return errors.InvalidType("id", "path", "int64", raw)
|
||||
}
|
||||
o.ID = value
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *RunArtifactParams) bindName(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
o.Name = raw
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,134 +0,0 @@
|
||||
package tickets
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/swag"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// RunTaskEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func RunTaskEndpoint(handler func(ctx context.Context, params *RunTaskParams) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
// generate params from request
|
||||
params := NewRunTaskParams()
|
||||
err := params.ReadRequest(ctx)
|
||||
if err != nil {
|
||||
errObj := err.(*errors.CompositeError)
|
||||
ctx.Writer.Header().Set("Content-Type", "application/problem+json")
|
||||
ctx.JSON(int(errObj.Code()), gin.H{"error": errObj.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
resp := handler(ctx, params)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewRunTaskParams creates a new RunTaskParams object
|
||||
// with the default values initialized.
|
||||
func NewRunTaskParams() *RunTaskParams {
|
||||
var ()
|
||||
return &RunTaskParams{}
|
||||
}
|
||||
|
||||
// RunTaskParams contains all the bound params for the run task operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters runTask
|
||||
type RunTaskParams struct {
|
||||
|
||||
/*Ticket ID
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
ID int64
|
||||
/*Playbook ID
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
PlaybookID string
|
||||
/*Task ID
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
TaskID string
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *RunTaskParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
rID := []string{ctx.Param("id")}
|
||||
if err := o.bindID(rID, true); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
rPlaybookID := []string{ctx.Param("playbookID")}
|
||||
if err := o.bindPlaybookID(rPlaybookID, true); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
rTaskID := []string{ctx.Param("taskID")}
|
||||
if err := o.bindTaskID(rTaskID, true); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *RunTaskParams) bindID(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
value, err := swag.ConvertInt64(raw)
|
||||
if err != nil {
|
||||
return errors.InvalidType("id", "path", "int64", raw)
|
||||
}
|
||||
o.ID = value
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *RunTaskParams) bindPlaybookID(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
o.PlaybookID = raw
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *RunTaskParams) bindTaskID(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
o.TaskID = raw
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,137 +0,0 @@
|
||||
package tickets
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/swag"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/models"
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// SetArtifactEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func SetArtifactEndpoint(handler func(ctx context.Context, params *SetArtifactParams) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
// generate params from request
|
||||
params := NewSetArtifactParams()
|
||||
err := params.ReadRequest(ctx)
|
||||
if err != nil {
|
||||
errObj := err.(*errors.CompositeError)
|
||||
ctx.Writer.Header().Set("Content-Type", "application/problem+json")
|
||||
ctx.JSON(int(errObj.Code()), gin.H{"error": errObj.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
resp := handler(ctx, params)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewSetArtifactParams creates a new SetArtifactParams object
|
||||
// with the default values initialized.
|
||||
func NewSetArtifactParams() *SetArtifactParams {
|
||||
var ()
|
||||
return &SetArtifactParams{}
|
||||
}
|
||||
|
||||
// SetArtifactParams contains all the bound params for the set artifact operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters setArtifact
|
||||
type SetArtifactParams struct {
|
||||
|
||||
/*
|
||||
Required: true
|
||||
In: body
|
||||
*/
|
||||
Artifact *models.Artifact
|
||||
/*Ticket ID
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
ID int64
|
||||
/*
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
Name string
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *SetArtifactParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
if runtime.HasBody(ctx.Request) {
|
||||
var body models.Artifact
|
||||
if err := ctx.BindJSON(&body); err != nil {
|
||||
if err == io.EOF {
|
||||
res = append(res, errors.Required("artifact", "body", ""))
|
||||
} else {
|
||||
res = append(res, errors.NewParseError("artifact", "body", "", err))
|
||||
}
|
||||
|
||||
} else {
|
||||
o.Artifact = &body
|
||||
}
|
||||
} else {
|
||||
res = append(res, errors.Required("artifact", "body", ""))
|
||||
}
|
||||
|
||||
rID := []string{ctx.Param("id")}
|
||||
if err := o.bindID(rID, true); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
rName := []string{ctx.Param("name")}
|
||||
if err := o.bindName(rName, true); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *SetArtifactParams) bindID(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
value, err := swag.ConvertInt64(raw)
|
||||
if err != nil {
|
||||
return errors.InvalidType("id", "path", "int64", raw)
|
||||
}
|
||||
o.ID = value
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *SetArtifactParams) bindName(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
o.Name = raw
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,116 +0,0 @@
|
||||
package tickets
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/swag"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/models"
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// SetReferencesEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func SetReferencesEndpoint(handler func(ctx context.Context, params *SetReferencesParams) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
// generate params from request
|
||||
params := NewSetReferencesParams()
|
||||
err := params.ReadRequest(ctx)
|
||||
if err != nil {
|
||||
errObj := err.(*errors.CompositeError)
|
||||
ctx.Writer.Header().Set("Content-Type", "application/problem+json")
|
||||
ctx.JSON(int(errObj.Code()), gin.H{"error": errObj.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
resp := handler(ctx, params)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewSetReferencesParams creates a new SetReferencesParams object
|
||||
// with the default values initialized.
|
||||
func NewSetReferencesParams() *SetReferencesParams {
|
||||
var ()
|
||||
return &SetReferencesParams{}
|
||||
}
|
||||
|
||||
// SetReferencesParams contains all the bound params for the set references operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters setReferences
|
||||
type SetReferencesParams struct {
|
||||
|
||||
/*Ticket ID
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
ID int64
|
||||
/*All ticket references
|
||||
Required: true
|
||||
In: body
|
||||
*/
|
||||
References []*models.Reference
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *SetReferencesParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
rID := []string{ctx.Param("id")}
|
||||
if err := o.bindID(rID, true); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if runtime.HasBody(ctx.Request) {
|
||||
var body []*models.Reference
|
||||
if err := ctx.BindJSON(&body); err != nil {
|
||||
if err == io.EOF {
|
||||
res = append(res, errors.Required("references", "body", ""))
|
||||
} else {
|
||||
res = append(res, errors.NewParseError("references", "body", "", err))
|
||||
}
|
||||
|
||||
} else {
|
||||
o.References = body
|
||||
}
|
||||
} else {
|
||||
res = append(res, errors.Required("references", "body", ""))
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *SetReferencesParams) bindID(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
value, err := swag.ConvertInt64(raw)
|
||||
if err != nil {
|
||||
return errors.InvalidType("id", "path", "int64", raw)
|
||||
}
|
||||
o.ID = value
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,106 +0,0 @@
|
||||
package tickets
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/swag"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// SetSchemaEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func SetSchemaEndpoint(handler func(ctx context.Context, params *SetSchemaParams) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
// generate params from request
|
||||
params := NewSetSchemaParams()
|
||||
err := params.ReadRequest(ctx)
|
||||
if err != nil {
|
||||
errObj := err.(*errors.CompositeError)
|
||||
ctx.Writer.Header().Set("Content-Type", "application/problem+json")
|
||||
ctx.JSON(int(errObj.Code()), gin.H{"error": errObj.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
resp := handler(ctx, params)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewSetSchemaParams creates a new SetSchemaParams object
|
||||
// with the default values initialized.
|
||||
func NewSetSchemaParams() *SetSchemaParams {
|
||||
var ()
|
||||
return &SetSchemaParams{}
|
||||
}
|
||||
|
||||
// SetSchemaParams contains all the bound params for the set schema operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters setSchema
|
||||
type SetSchemaParams struct {
|
||||
|
||||
/*Ticket ID
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
ID int64
|
||||
/*New ticket schema
|
||||
In: body
|
||||
*/
|
||||
Schema string
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *SetSchemaParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
rID := []string{ctx.Param("id")}
|
||||
if err := o.bindID(rID, true); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if runtime.HasBody(ctx.Request) {
|
||||
var body string
|
||||
if err := ctx.BindJSON(&body); err != nil {
|
||||
res = append(res, errors.NewParseError("schema", "body", "", err))
|
||||
} else {
|
||||
o.Schema = body
|
||||
}
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *SetSchemaParams) bindID(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
value, err := swag.ConvertInt64(raw)
|
||||
if err != nil {
|
||||
return errors.InvalidType("id", "path", "int64", raw)
|
||||
}
|
||||
o.ID = value
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,158 +0,0 @@
|
||||
package tickets
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/swag"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/models"
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// SetTaskEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func SetTaskEndpoint(handler func(ctx context.Context, params *SetTaskParams) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
// generate params from request
|
||||
params := NewSetTaskParams()
|
||||
err := params.ReadRequest(ctx)
|
||||
if err != nil {
|
||||
errObj := err.(*errors.CompositeError)
|
||||
ctx.Writer.Header().Set("Content-Type", "application/problem+json")
|
||||
ctx.JSON(int(errObj.Code()), gin.H{"error": errObj.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
resp := handler(ctx, params)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewSetTaskParams creates a new SetTaskParams object
|
||||
// with the default values initialized.
|
||||
func NewSetTaskParams() *SetTaskParams {
|
||||
var ()
|
||||
return &SetTaskParams{}
|
||||
}
|
||||
|
||||
// SetTaskParams contains all the bound params for the set task operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters setTask
|
||||
type SetTaskParams struct {
|
||||
|
||||
/*Ticket ID
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
ID int64
|
||||
/*Playbook ID
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
PlaybookID string
|
||||
/*Task
|
||||
Required: true
|
||||
In: body
|
||||
*/
|
||||
Task *models.Task
|
||||
/*Task ID
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
TaskID string
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *SetTaskParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
rID := []string{ctx.Param("id")}
|
||||
if err := o.bindID(rID, true); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
rPlaybookID := []string{ctx.Param("playbookID")}
|
||||
if err := o.bindPlaybookID(rPlaybookID, true); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if runtime.HasBody(ctx.Request) {
|
||||
var body models.Task
|
||||
if err := ctx.BindJSON(&body); err != nil {
|
||||
if err == io.EOF {
|
||||
res = append(res, errors.Required("task", "body", ""))
|
||||
} else {
|
||||
res = append(res, errors.NewParseError("task", "body", "", err))
|
||||
}
|
||||
|
||||
} else {
|
||||
o.Task = &body
|
||||
}
|
||||
} else {
|
||||
res = append(res, errors.Required("task", "body", ""))
|
||||
}
|
||||
|
||||
rTaskID := []string{ctx.Param("taskID")}
|
||||
if err := o.bindTaskID(rTaskID, true); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *SetTaskParams) bindID(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
value, err := swag.ConvertInt64(raw)
|
||||
if err != nil {
|
||||
return errors.InvalidType("id", "path", "int64", raw)
|
||||
}
|
||||
o.ID = value
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *SetTaskParams) bindPlaybookID(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
o.PlaybookID = raw
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *SetTaskParams) bindTaskID(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
o.TaskID = raw
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,115 +0,0 @@
|
||||
package tickets
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/swag"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// UnlinkTicketEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func UnlinkTicketEndpoint(handler func(ctx context.Context, params *UnlinkTicketParams) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
// generate params from request
|
||||
params := NewUnlinkTicketParams()
|
||||
err := params.ReadRequest(ctx)
|
||||
if err != nil {
|
||||
errObj := err.(*errors.CompositeError)
|
||||
ctx.Writer.Header().Set("Content-Type", "application/problem+json")
|
||||
ctx.JSON(int(errObj.Code()), gin.H{"error": errObj.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
resp := handler(ctx, params)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewUnlinkTicketParams creates a new UnlinkTicketParams object
|
||||
// with the default values initialized.
|
||||
func NewUnlinkTicketParams() *UnlinkTicketParams {
|
||||
var ()
|
||||
return &UnlinkTicketParams{}
|
||||
}
|
||||
|
||||
// UnlinkTicketParams contains all the bound params for the unlink ticket operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters unlinkTicket
|
||||
type UnlinkTicketParams struct {
|
||||
|
||||
/*Ticket ID
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
ID int64
|
||||
/*Added ticket ID
|
||||
Required: true
|
||||
In: body
|
||||
*/
|
||||
LinkedID int64
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *UnlinkTicketParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
rID := []string{ctx.Param("id")}
|
||||
if err := o.bindID(rID, true); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if runtime.HasBody(ctx.Request) {
|
||||
var body int64
|
||||
if err := ctx.BindJSON(&body); err != nil {
|
||||
if err == io.EOF {
|
||||
res = append(res, errors.Required("linkedId", "body", ""))
|
||||
} else {
|
||||
res = append(res, errors.NewParseError("linkedId", "body", "", err))
|
||||
}
|
||||
|
||||
} else {
|
||||
o.LinkedID = body
|
||||
}
|
||||
} else {
|
||||
res = append(res, errors.Required("linkedId", "body", ""))
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *UnlinkTicketParams) bindID(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
value, err := swag.ConvertInt64(raw)
|
||||
if err != nil {
|
||||
return errors.InvalidType("id", "path", "int64", raw)
|
||||
}
|
||||
o.ID = value
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,116 +0,0 @@
|
||||
package tickets
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/swag"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/models"
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// UpdateTicketEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func UpdateTicketEndpoint(handler func(ctx context.Context, params *UpdateTicketParams) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
// generate params from request
|
||||
params := NewUpdateTicketParams()
|
||||
err := params.ReadRequest(ctx)
|
||||
if err != nil {
|
||||
errObj := err.(*errors.CompositeError)
|
||||
ctx.Writer.Header().Set("Content-Type", "application/problem+json")
|
||||
ctx.JSON(int(errObj.Code()), gin.H{"error": errObj.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
resp := handler(ctx, params)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewUpdateTicketParams creates a new UpdateTicketParams object
|
||||
// with the default values initialized.
|
||||
func NewUpdateTicketParams() *UpdateTicketParams {
|
||||
var ()
|
||||
return &UpdateTicketParams{}
|
||||
}
|
||||
|
||||
// UpdateTicketParams contains all the bound params for the update ticket operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters updateTicket
|
||||
type UpdateTicketParams struct {
|
||||
|
||||
/*Ticket ID
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
ID int64
|
||||
/*Updated ticket
|
||||
Required: true
|
||||
In: body
|
||||
*/
|
||||
Ticket *models.Ticket
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *UpdateTicketParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
rID := []string{ctx.Param("id")}
|
||||
if err := o.bindID(rID, true); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if runtime.HasBody(ctx.Request) {
|
||||
var body models.Ticket
|
||||
if err := ctx.BindJSON(&body); err != nil {
|
||||
if err == io.EOF {
|
||||
res = append(res, errors.Required("ticket", "body", ""))
|
||||
} else {
|
||||
res = append(res, errors.NewParseError("ticket", "body", "", err))
|
||||
}
|
||||
|
||||
} else {
|
||||
o.Ticket = &body
|
||||
}
|
||||
} else {
|
||||
res = append(res, errors.Required("ticket", "body", ""))
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *UpdateTicketParams) bindID(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
value, err := swag.ConvertInt64(raw)
|
||||
if err != nil {
|
||||
return errors.InvalidType("id", "path", "int64", raw)
|
||||
}
|
||||
o.ID = value
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
package tickettypes
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/models"
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// CreateTicketTypeEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func CreateTicketTypeEndpoint(handler func(ctx context.Context, params *CreateTicketTypeParams) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
// generate params from request
|
||||
params := NewCreateTicketTypeParams()
|
||||
err := params.ReadRequest(ctx)
|
||||
if err != nil {
|
||||
errObj := err.(*errors.CompositeError)
|
||||
ctx.Writer.Header().Set("Content-Type", "application/problem+json")
|
||||
ctx.JSON(int(errObj.Code()), gin.H{"error": errObj.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
resp := handler(ctx, params)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewCreateTicketTypeParams creates a new CreateTicketTypeParams object
|
||||
// with the default values initialized.
|
||||
func NewCreateTicketTypeParams() *CreateTicketTypeParams {
|
||||
var ()
|
||||
return &CreateTicketTypeParams{}
|
||||
}
|
||||
|
||||
// CreateTicketTypeParams contains all the bound params for the create ticket type operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters createTicketType
|
||||
type CreateTicketTypeParams struct {
|
||||
|
||||
/*New tickettype
|
||||
Required: true
|
||||
In: body
|
||||
*/
|
||||
Tickettype *models.TicketTypeForm
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *CreateTicketTypeParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
if runtime.HasBody(ctx.Request) {
|
||||
var body models.TicketTypeForm
|
||||
if err := ctx.BindJSON(&body); err != nil {
|
||||
if err == io.EOF {
|
||||
res = append(res, errors.Required("tickettype", "body", ""))
|
||||
} else {
|
||||
res = append(res, errors.NewParseError("tickettype", "body", "", err))
|
||||
}
|
||||
|
||||
} else {
|
||||
o.Tickettype = &body
|
||||
}
|
||||
} else {
|
||||
res = append(res, errors.Required("tickettype", "body", ""))
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
package tickettypes
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// DeleteTicketTypeEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func DeleteTicketTypeEndpoint(handler func(ctx context.Context, params *DeleteTicketTypeParams) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
// generate params from request
|
||||
params := NewDeleteTicketTypeParams()
|
||||
err := params.ReadRequest(ctx)
|
||||
if err != nil {
|
||||
errObj := err.(*errors.CompositeError)
|
||||
ctx.Writer.Header().Set("Content-Type", "application/problem+json")
|
||||
ctx.JSON(int(errObj.Code()), gin.H{"error": errObj.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
resp := handler(ctx, params)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewDeleteTicketTypeParams creates a new DeleteTicketTypeParams object
|
||||
// with the default values initialized.
|
||||
func NewDeleteTicketTypeParams() *DeleteTicketTypeParams {
|
||||
var ()
|
||||
return &DeleteTicketTypeParams{}
|
||||
}
|
||||
|
||||
// DeleteTicketTypeParams contains all the bound params for the delete ticket type operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters deleteTicketType
|
||||
type DeleteTicketTypeParams struct {
|
||||
|
||||
/*TicketType ID
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
ID string
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *DeleteTicketTypeParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
rID := []string{ctx.Param("id")}
|
||||
if err := o.bindID(rID, true); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *DeleteTicketTypeParams) bindID(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
o.ID = raw
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
package tickettypes
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// GetTicketTypeEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func GetTicketTypeEndpoint(handler func(ctx context.Context, params *GetTicketTypeParams) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
// generate params from request
|
||||
params := NewGetTicketTypeParams()
|
||||
err := params.ReadRequest(ctx)
|
||||
if err != nil {
|
||||
errObj := err.(*errors.CompositeError)
|
||||
ctx.Writer.Header().Set("Content-Type", "application/problem+json")
|
||||
ctx.JSON(int(errObj.Code()), gin.H{"error": errObj.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
resp := handler(ctx, params)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetTicketTypeParams creates a new GetTicketTypeParams object
|
||||
// with the default values initialized.
|
||||
func NewGetTicketTypeParams() *GetTicketTypeParams {
|
||||
var ()
|
||||
return &GetTicketTypeParams{}
|
||||
}
|
||||
|
||||
// GetTicketTypeParams contains all the bound params for the get ticket type operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters getTicketType
|
||||
type GetTicketTypeParams struct {
|
||||
|
||||
/*TicketType ID
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
ID string
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *GetTicketTypeParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
rID := []string{ctx.Param("id")}
|
||||
if err := o.bindID(rID, true); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *GetTicketTypeParams) bindID(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
o.ID = raw
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
package tickettypes
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// ListTicketTypesEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func ListTicketTypesEndpoint(handler func(ctx context.Context) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
resp := handler(ctx)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewListTicketTypesParams creates a new ListTicketTypesParams object
|
||||
// with the default values initialized.
|
||||
func NewListTicketTypesParams() *ListTicketTypesParams {
|
||||
var ()
|
||||
return &ListTicketTypesParams{}
|
||||
}
|
||||
|
||||
// ListTicketTypesParams contains all the bound params for the list ticket types operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters listTicketTypes
|
||||
type ListTicketTypesParams struct {
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *ListTicketTypesParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1,111 +0,0 @@
|
||||
package tickettypes
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/models"
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// UpdateTicketTypeEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func UpdateTicketTypeEndpoint(handler func(ctx context.Context, params *UpdateTicketTypeParams) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
// generate params from request
|
||||
params := NewUpdateTicketTypeParams()
|
||||
err := params.ReadRequest(ctx)
|
||||
if err != nil {
|
||||
errObj := err.(*errors.CompositeError)
|
||||
ctx.Writer.Header().Set("Content-Type", "application/problem+json")
|
||||
ctx.JSON(int(errObj.Code()), gin.H{"error": errObj.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
resp := handler(ctx, params)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewUpdateTicketTypeParams creates a new UpdateTicketTypeParams object
|
||||
// with the default values initialized.
|
||||
func NewUpdateTicketTypeParams() *UpdateTicketTypeParams {
|
||||
var ()
|
||||
return &UpdateTicketTypeParams{}
|
||||
}
|
||||
|
||||
// UpdateTicketTypeParams contains all the bound params for the update ticket type operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters updateTicketType
|
||||
type UpdateTicketTypeParams struct {
|
||||
|
||||
/*TicketType ID
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
ID string
|
||||
/*TicketType object that needs to be added
|
||||
Required: true
|
||||
In: body
|
||||
*/
|
||||
Tickettype *models.TicketTypeForm
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *UpdateTicketTypeParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
rID := []string{ctx.Param("id")}
|
||||
if err := o.bindID(rID, true); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if runtime.HasBody(ctx.Request) {
|
||||
var body models.TicketTypeForm
|
||||
if err := ctx.BindJSON(&body); err != nil {
|
||||
if err == io.EOF {
|
||||
res = append(res, errors.Required("tickettype", "body", ""))
|
||||
} else {
|
||||
res = append(res, errors.NewParseError("tickettype", "body", "", err))
|
||||
}
|
||||
|
||||
} else {
|
||||
o.Tickettype = &body
|
||||
}
|
||||
} else {
|
||||
res = append(res, errors.Required("tickettype", "body", ""))
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *UpdateTicketTypeParams) bindID(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
o.ID = raw
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
package userdata
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// CurrentUserDataEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func CurrentUserDataEndpoint(handler func(ctx context.Context) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
resp := handler(ctx)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewCurrentUserDataParams creates a new CurrentUserDataParams object
|
||||
// with the default values initialized.
|
||||
func NewCurrentUserDataParams() *CurrentUserDataParams {
|
||||
var ()
|
||||
return &CurrentUserDataParams{}
|
||||
}
|
||||
|
||||
// CurrentUserDataParams contains all the bound params for the current user data operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters currentUserData
|
||||
type CurrentUserDataParams struct {
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *CurrentUserDataParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
package userdata
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// GetUserDataEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func GetUserDataEndpoint(handler func(ctx context.Context, params *GetUserDataParams) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
// generate params from request
|
||||
params := NewGetUserDataParams()
|
||||
err := params.ReadRequest(ctx)
|
||||
if err != nil {
|
||||
errObj := err.(*errors.CompositeError)
|
||||
ctx.Writer.Header().Set("Content-Type", "application/problem+json")
|
||||
ctx.JSON(int(errObj.Code()), gin.H{"error": errObj.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
resp := handler(ctx, params)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetUserDataParams creates a new GetUserDataParams object
|
||||
// with the default values initialized.
|
||||
func NewGetUserDataParams() *GetUserDataParams {
|
||||
var ()
|
||||
return &GetUserDataParams{}
|
||||
}
|
||||
|
||||
// GetUserDataParams contains all the bound params for the get user data operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters getUserData
|
||||
type GetUserDataParams struct {
|
||||
|
||||
/*User Data ID
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
ID string
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *GetUserDataParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
rID := []string{ctx.Param("id")}
|
||||
if err := o.bindID(rID, true); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *GetUserDataParams) bindID(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
o.ID = raw
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
package userdata
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// ListUserDataEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func ListUserDataEndpoint(handler func(ctx context.Context) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
resp := handler(ctx)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewListUserDataParams creates a new ListUserDataParams object
|
||||
// with the default values initialized.
|
||||
func NewListUserDataParams() *ListUserDataParams {
|
||||
var ()
|
||||
return &ListUserDataParams{}
|
||||
}
|
||||
|
||||
// ListUserDataParams contains all the bound params for the list user data operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters listUserData
|
||||
type ListUserDataParams struct {
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *ListUserDataParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
package userdata
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/models"
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// UpdateCurrentUserDataEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func UpdateCurrentUserDataEndpoint(handler func(ctx context.Context, params *UpdateCurrentUserDataParams) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
// generate params from request
|
||||
params := NewUpdateCurrentUserDataParams()
|
||||
err := params.ReadRequest(ctx)
|
||||
if err != nil {
|
||||
errObj := err.(*errors.CompositeError)
|
||||
ctx.Writer.Header().Set("Content-Type", "application/problem+json")
|
||||
ctx.JSON(int(errObj.Code()), gin.H{"error": errObj.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
resp := handler(ctx, params)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewUpdateCurrentUserDataParams creates a new UpdateCurrentUserDataParams object
|
||||
// with the default values initialized.
|
||||
func NewUpdateCurrentUserDataParams() *UpdateCurrentUserDataParams {
|
||||
var ()
|
||||
return &UpdateCurrentUserDataParams{}
|
||||
}
|
||||
|
||||
// UpdateCurrentUserDataParams contains all the bound params for the update current user data operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters updateCurrentUserData
|
||||
type UpdateCurrentUserDataParams struct {
|
||||
|
||||
/*User data object that needs to be added
|
||||
Required: true
|
||||
In: body
|
||||
*/
|
||||
Userdata *models.UserData
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *UpdateCurrentUserDataParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
if runtime.HasBody(ctx.Request) {
|
||||
var body models.UserData
|
||||
if err := ctx.BindJSON(&body); err != nil {
|
||||
if err == io.EOF {
|
||||
res = append(res, errors.Required("userdata", "body", ""))
|
||||
} else {
|
||||
res = append(res, errors.NewParseError("userdata", "body", "", err))
|
||||
}
|
||||
|
||||
} else {
|
||||
o.Userdata = &body
|
||||
}
|
||||
} else {
|
||||
res = append(res, errors.Required("userdata", "body", ""))
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1,111 +0,0 @@
|
||||
package userdata
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/models"
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// UpdateUserDataEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func UpdateUserDataEndpoint(handler func(ctx context.Context, params *UpdateUserDataParams) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
// generate params from request
|
||||
params := NewUpdateUserDataParams()
|
||||
err := params.ReadRequest(ctx)
|
||||
if err != nil {
|
||||
errObj := err.(*errors.CompositeError)
|
||||
ctx.Writer.Header().Set("Content-Type", "application/problem+json")
|
||||
ctx.JSON(int(errObj.Code()), gin.H{"error": errObj.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
resp := handler(ctx, params)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewUpdateUserDataParams creates a new UpdateUserDataParams object
|
||||
// with the default values initialized.
|
||||
func NewUpdateUserDataParams() *UpdateUserDataParams {
|
||||
var ()
|
||||
return &UpdateUserDataParams{}
|
||||
}
|
||||
|
||||
// UpdateUserDataParams contains all the bound params for the update user data operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters updateUserData
|
||||
type UpdateUserDataParams struct {
|
||||
|
||||
/*User Data ID
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
ID string
|
||||
/*User data object that needs to be added
|
||||
Required: true
|
||||
In: body
|
||||
*/
|
||||
Userdata *models.UserData
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *UpdateUserDataParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
rID := []string{ctx.Param("id")}
|
||||
if err := o.bindID(rID, true); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if runtime.HasBody(ctx.Request) {
|
||||
var body models.UserData
|
||||
if err := ctx.BindJSON(&body); err != nil {
|
||||
if err == io.EOF {
|
||||
res = append(res, errors.Required("userdata", "body", ""))
|
||||
} else {
|
||||
res = append(res, errors.NewParseError("userdata", "body", "", err))
|
||||
}
|
||||
|
||||
} else {
|
||||
o.Userdata = &body
|
||||
}
|
||||
} else {
|
||||
res = append(res, errors.Required("userdata", "body", ""))
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *UpdateUserDataParams) bindID(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
o.ID = raw
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
package users
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/models"
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// CreateUserEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func CreateUserEndpoint(handler func(ctx context.Context, params *CreateUserParams) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
// generate params from request
|
||||
params := NewCreateUserParams()
|
||||
err := params.ReadRequest(ctx)
|
||||
if err != nil {
|
||||
errObj := err.(*errors.CompositeError)
|
||||
ctx.Writer.Header().Set("Content-Type", "application/problem+json")
|
||||
ctx.JSON(int(errObj.Code()), gin.H{"error": errObj.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
resp := handler(ctx, params)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewCreateUserParams creates a new CreateUserParams object
|
||||
// with the default values initialized.
|
||||
func NewCreateUserParams() *CreateUserParams {
|
||||
var ()
|
||||
return &CreateUserParams{}
|
||||
}
|
||||
|
||||
// CreateUserParams contains all the bound params for the create user operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters createUser
|
||||
type CreateUserParams struct {
|
||||
|
||||
/*user object that needs to be added
|
||||
Required: true
|
||||
In: body
|
||||
*/
|
||||
User *models.UserForm
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *CreateUserParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
if runtime.HasBody(ctx.Request) {
|
||||
var body models.UserForm
|
||||
if err := ctx.BindJSON(&body); err != nil {
|
||||
if err == io.EOF {
|
||||
res = append(res, errors.Required("user", "body", ""))
|
||||
} else {
|
||||
res = append(res, errors.NewParseError("user", "body", "", err))
|
||||
}
|
||||
|
||||
} else {
|
||||
o.User = &body
|
||||
}
|
||||
} else {
|
||||
res = append(res, errors.Required("user", "body", ""))
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
package users
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// CurrentUserEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func CurrentUserEndpoint(handler func(ctx context.Context) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
resp := handler(ctx)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewCurrentUserParams creates a new CurrentUserParams object
|
||||
// with the default values initialized.
|
||||
func NewCurrentUserParams() *CurrentUserParams {
|
||||
var ()
|
||||
return &CurrentUserParams{}
|
||||
}
|
||||
|
||||
// CurrentUserParams contains all the bound params for the current user operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters currentUser
|
||||
type CurrentUserParams struct {
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *CurrentUserParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
package users
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// DeleteUserEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func DeleteUserEndpoint(handler func(ctx context.Context, params *DeleteUserParams) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
// generate params from request
|
||||
params := NewDeleteUserParams()
|
||||
err := params.ReadRequest(ctx)
|
||||
if err != nil {
|
||||
errObj := err.(*errors.CompositeError)
|
||||
ctx.Writer.Header().Set("Content-Type", "application/problem+json")
|
||||
ctx.JSON(int(errObj.Code()), gin.H{"error": errObj.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
resp := handler(ctx, params)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewDeleteUserParams creates a new DeleteUserParams object
|
||||
// with the default values initialized.
|
||||
func NewDeleteUserParams() *DeleteUserParams {
|
||||
var ()
|
||||
return &DeleteUserParams{}
|
||||
}
|
||||
|
||||
// DeleteUserParams contains all the bound params for the delete user operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters deleteUser
|
||||
type DeleteUserParams struct {
|
||||
|
||||
/*user ID
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
ID string
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *DeleteUserParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
rID := []string{ctx.Param("id")}
|
||||
if err := o.bindID(rID, true); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *DeleteUserParams) bindID(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
o.ID = raw
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
package users
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// GetUserEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func GetUserEndpoint(handler func(ctx context.Context, params *GetUserParams) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
// generate params from request
|
||||
params := NewGetUserParams()
|
||||
err := params.ReadRequest(ctx)
|
||||
if err != nil {
|
||||
errObj := err.(*errors.CompositeError)
|
||||
ctx.Writer.Header().Set("Content-Type", "application/problem+json")
|
||||
ctx.JSON(int(errObj.Code()), gin.H{"error": errObj.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
resp := handler(ctx, params)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetUserParams creates a new GetUserParams object
|
||||
// with the default values initialized.
|
||||
func NewGetUserParams() *GetUserParams {
|
||||
var ()
|
||||
return &GetUserParams{}
|
||||
}
|
||||
|
||||
// GetUserParams contains all the bound params for the get user operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters getUser
|
||||
type GetUserParams struct {
|
||||
|
||||
/*user ID
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
ID string
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *GetUserParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
rID := []string{ctx.Param("id")}
|
||||
if err := o.bindID(rID, true); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *GetUserParams) bindID(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
o.ID = raw
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
package users
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// ListUsersEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func ListUsersEndpoint(handler func(ctx context.Context) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
resp := handler(ctx)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewListUsersParams creates a new ListUsersParams object
|
||||
// with the default values initialized.
|
||||
func NewListUsersParams() *ListUsersParams {
|
||||
var ()
|
||||
return &ListUsersParams{}
|
||||
}
|
||||
|
||||
// ListUsersParams contains all the bound params for the list users operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters listUsers
|
||||
type ListUsersParams struct {
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *ListUsersParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1,111 +0,0 @@
|
||||
package users
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/models"
|
||||
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
|
||||
)
|
||||
|
||||
// UpdateUserEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func UpdateUserEndpoint(handler func(ctx context.Context, params *UpdateUserParams) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
// generate params from request
|
||||
params := NewUpdateUserParams()
|
||||
err := params.ReadRequest(ctx)
|
||||
if err != nil {
|
||||
errObj := err.(*errors.CompositeError)
|
||||
ctx.Writer.Header().Set("Content-Type", "application/problem+json")
|
||||
ctx.JSON(int(errObj.Code()), gin.H{"error": errObj.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
resp := handler(ctx, params)
|
||||
|
||||
switch resp.Code {
|
||||
case http.StatusNoContent:
|
||||
ctx.AbortWithStatus(resp.Code)
|
||||
default:
|
||||
ctx.JSON(resp.Code, resp.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewUpdateUserParams creates a new UpdateUserParams object
|
||||
// with the default values initialized.
|
||||
func NewUpdateUserParams() *UpdateUserParams {
|
||||
var ()
|
||||
return &UpdateUserParams{}
|
||||
}
|
||||
|
||||
// UpdateUserParams contains all the bound params for the update user operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters updateUser
|
||||
type UpdateUserParams struct {
|
||||
|
||||
/*Template ID
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
ID string
|
||||
/*user object that needs to be added
|
||||
Required: true
|
||||
In: body
|
||||
*/
|
||||
User *models.UserForm
|
||||
}
|
||||
|
||||
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *UpdateUserParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
rID := []string{ctx.Param("id")}
|
||||
if err := o.bindID(rID, true); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if runtime.HasBody(ctx.Request) {
|
||||
var body models.UserForm
|
||||
if err := ctx.BindJSON(&body); err != nil {
|
||||
if err == io.EOF {
|
||||
res = append(res, errors.Required("user", "body", ""))
|
||||
} else {
|
||||
res = append(res, errors.NewParseError("user", "body", "", err))
|
||||
}
|
||||
|
||||
} else {
|
||||
o.User = &body
|
||||
}
|
||||
} else {
|
||||
res = append(res, errors.Required("user", "body", ""))
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *UpdateUserParams) bindID(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
o.ID = raw
|
||||
|
||||
return nil
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user