mirror of
https://github.com/SecurityBrewery/catalyst.git
synced 2026-04-02 00:41:49 +02:00
Release catalyst
This commit is contained in:
517
generated/caql/parser/caql_lexer.go
Normal file
517
generated/caql/parser/caql_lexer.go
Normal file
@@ -0,0 +1,517 @@
|
||||
// Code generated from CAQLLexer.g4 by ANTLR 4.9.2. DO NOT EDIT.
|
||||
|
||||
package parser
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"unicode"
|
||||
|
||||
"github.com/antlr/antlr4/runtime/Go/antlr"
|
||||
)
|
||||
|
||||
// Suppress unused import error
|
||||
var _ = fmt.Printf
|
||||
var _ = unicode.IsLetter
|
||||
|
||||
var serializedLexerAtn = []uint16{
|
||||
3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 2, 80, 739,
|
||||
8, 1, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7,
|
||||
9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12,
|
||||
4, 13, 9, 13, 4, 14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 4, 17, 9, 17, 4,
|
||||
18, 9, 18, 4, 19, 9, 19, 4, 20, 9, 20, 4, 21, 9, 21, 4, 22, 9, 22, 4, 23,
|
||||
9, 23, 4, 24, 9, 24, 4, 25, 9, 25, 4, 26, 9, 26, 4, 27, 9, 27, 4, 28, 9,
|
||||
28, 4, 29, 9, 29, 4, 30, 9, 30, 4, 31, 9, 31, 4, 32, 9, 32, 4, 33, 9, 33,
|
||||
4, 34, 9, 34, 4, 35, 9, 35, 4, 36, 9, 36, 4, 37, 9, 37, 4, 38, 9, 38, 4,
|
||||
39, 9, 39, 4, 40, 9, 40, 4, 41, 9, 41, 4, 42, 9, 42, 4, 43, 9, 43, 4, 44,
|
||||
9, 44, 4, 45, 9, 45, 4, 46, 9, 46, 4, 47, 9, 47, 4, 48, 9, 48, 4, 49, 9,
|
||||
49, 4, 50, 9, 50, 4, 51, 9, 51, 4, 52, 9, 52, 4, 53, 9, 53, 4, 54, 9, 54,
|
||||
4, 55, 9, 55, 4, 56, 9, 56, 4, 57, 9, 57, 4, 58, 9, 58, 4, 59, 9, 59, 4,
|
||||
60, 9, 60, 4, 61, 9, 61, 4, 62, 9, 62, 4, 63, 9, 63, 4, 64, 9, 64, 4, 65,
|
||||
9, 65, 4, 66, 9, 66, 4, 67, 9, 67, 4, 68, 9, 68, 4, 69, 9, 69, 4, 70, 9,
|
||||
70, 4, 71, 9, 71, 4, 72, 9, 72, 4, 73, 9, 73, 4, 74, 9, 74, 4, 75, 9, 75,
|
||||
4, 76, 9, 76, 4, 77, 9, 77, 4, 78, 9, 78, 4, 79, 9, 79, 4, 80, 9, 80, 4,
|
||||
81, 9, 81, 4, 82, 9, 82, 4, 83, 9, 83, 4, 84, 9, 84, 4, 85, 9, 85, 4, 86,
|
||||
9, 86, 4, 87, 9, 87, 4, 88, 9, 88, 4, 89, 9, 89, 4, 90, 9, 90, 4, 91, 9,
|
||||
91, 4, 92, 9, 92, 4, 93, 9, 93, 4, 94, 9, 94, 4, 95, 9, 95, 4, 96, 9, 96,
|
||||
4, 97, 9, 97, 4, 98, 9, 98, 4, 99, 9, 99, 4, 100, 9, 100, 4, 101, 9, 101,
|
||||
4, 102, 9, 102, 4, 103, 9, 103, 4, 104, 9, 104, 4, 105, 9, 105, 4, 106,
|
||||
9, 106, 4, 107, 9, 107, 3, 2, 3, 2, 3, 3, 3, 3, 3, 3, 3, 4, 3, 4, 3, 4,
|
||||
3, 5, 3, 5, 3, 5, 3, 6, 3, 6, 3, 6, 3, 7, 3, 7, 3, 8, 3, 8, 3, 9, 3, 9,
|
||||
3, 9, 3, 10, 3, 10, 3, 10, 3, 11, 3, 11, 3, 12, 3, 12, 3, 13, 3, 13, 3,
|
||||
14, 3, 14, 3, 15, 3, 15, 3, 16, 3, 16, 3, 17, 3, 17, 3, 18, 3, 18, 3, 18,
|
||||
3, 19, 3, 19, 3, 19, 3, 20, 3, 20, 3, 21, 3, 21, 3, 22, 3, 22, 3, 23, 3,
|
||||
23, 3, 24, 3, 24, 3, 25, 3, 25, 3, 26, 3, 26, 3, 27, 3, 27, 3, 27, 3, 27,
|
||||
3, 27, 3, 27, 3, 27, 3, 27, 3, 27, 3, 27, 3, 28, 3, 28, 3, 28, 3, 28, 3,
|
||||
29, 3, 29, 3, 29, 3, 29, 3, 29, 3, 29, 5, 29, 294, 10, 29, 3, 30, 3, 30,
|
||||
3, 30, 3, 30, 3, 31, 3, 31, 3, 31, 3, 31, 3, 32, 3, 32, 3, 32, 3, 32, 3,
|
||||
32, 3, 32, 3, 32, 3, 32, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 34, 3, 34,
|
||||
3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 35, 3, 35, 3, 35, 3,
|
||||
35, 3, 35, 3, 35, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 37,
|
||||
3, 37, 3, 37, 3, 37, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 39, 3,
|
||||
39, 3, 39, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 41,
|
||||
3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 42, 3, 42, 3, 42, 3, 42, 3,
|
||||
42, 3, 43, 3, 43, 3, 43, 3, 43, 3, 43, 3, 43, 3, 43, 3, 43, 3, 43, 3, 43,
|
||||
3, 43, 3, 43, 3, 43, 3, 43, 3, 43, 3, 43, 3, 43, 3, 44, 3, 44, 3, 44, 3,
|
||||
44, 3, 45, 3, 45, 3, 45, 3, 45, 3, 45, 3, 46, 3, 46, 3, 46, 3, 46, 3, 46,
|
||||
3, 46, 3, 47, 3, 47, 3, 47, 3, 47, 3, 47, 3, 48, 3, 48, 3, 48, 3, 48, 3,
|
||||
48, 5, 48, 414, 10, 48, 3, 49, 3, 49, 3, 49, 3, 49, 3, 49, 3, 50, 3, 50,
|
||||
3, 50, 3, 50, 3, 50, 5, 50, 426, 10, 50, 3, 51, 3, 51, 3, 51, 3, 51, 3,
|
||||
51, 3, 51, 3, 51, 3, 51, 3, 51, 3, 52, 3, 52, 3, 52, 3, 52, 3, 52, 3, 52,
|
||||
3, 52, 3, 53, 3, 53, 3, 53, 3, 53, 3, 53, 3, 53, 3, 53, 3, 53, 3, 54, 3,
|
||||
54, 3, 54, 3, 54, 3, 54, 3, 54, 3, 54, 3, 55, 3, 55, 3, 55, 3, 55, 3, 55,
|
||||
3, 55, 3, 55, 3, 55, 3, 55, 3, 55, 3, 55, 3, 55, 3, 55, 3, 55, 3, 56, 3,
|
||||
56, 3, 56, 3, 56, 3, 56, 3, 57, 3, 57, 3, 57, 3, 57, 3, 57, 3, 58, 3, 58,
|
||||
3, 58, 3, 58, 3, 58, 3, 58, 3, 58, 3, 59, 3, 59, 3, 59, 3, 59, 3, 59, 3,
|
||||
59, 3, 59, 3, 60, 3, 60, 3, 60, 3, 60, 3, 60, 3, 61, 3, 61, 3, 61, 3, 61,
|
||||
3, 61, 3, 62, 3, 62, 3, 62, 3, 62, 3, 62, 3, 62, 3, 63, 3, 63, 3, 63, 3,
|
||||
63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 64, 3, 64, 3, 64, 3, 64, 3, 64, 3, 64,
|
||||
3, 65, 3, 65, 3, 65, 3, 65, 3, 65, 3, 65, 3, 65, 3, 66, 3, 66, 3, 66, 3,
|
||||
67, 3, 67, 3, 67, 3, 67, 3, 67, 3, 67, 3, 67, 3, 67, 3, 68, 3, 68, 3, 68,
|
||||
3, 68, 3, 69, 3, 69, 3, 69, 3, 69, 3, 70, 3, 70, 7, 70, 555, 10, 70, 12,
|
||||
70, 14, 70, 558, 11, 70, 3, 71, 3, 71, 7, 71, 562, 10, 71, 12, 71, 14,
|
||||
71, 565, 11, 71, 3, 71, 3, 71, 3, 71, 3, 71, 3, 71, 6, 71, 572, 10, 71,
|
||||
13, 71, 14, 71, 573, 3, 71, 3, 71, 3, 71, 3, 71, 6, 71, 580, 10, 71, 13,
|
||||
71, 14, 71, 581, 5, 71, 584, 10, 71, 3, 72, 3, 72, 7, 72, 588, 10, 72,
|
||||
12, 72, 14, 72, 591, 11, 72, 3, 72, 5, 72, 594, 10, 72, 3, 72, 3, 72, 6,
|
||||
72, 598, 10, 72, 13, 72, 14, 72, 599, 3, 72, 3, 72, 5, 72, 604, 10, 72,
|
||||
3, 72, 6, 72, 607, 10, 72, 13, 72, 14, 72, 608, 5, 72, 611, 10, 72, 3,
|
||||
73, 3, 73, 3, 73, 3, 74, 3, 74, 3, 74, 3, 74, 3, 74, 3, 74, 7, 74, 622,
|
||||
10, 74, 12, 74, 14, 74, 625, 11, 74, 3, 74, 3, 74, 3, 74, 3, 74, 3, 74,
|
||||
3, 74, 3, 74, 7, 74, 634, 10, 74, 12, 74, 14, 74, 637, 11, 74, 3, 74, 5,
|
||||
74, 640, 10, 74, 3, 75, 3, 75, 3, 75, 3, 75, 7, 75, 646, 10, 75, 12, 75,
|
||||
14, 75, 649, 11, 75, 3, 75, 5, 75, 652, 10, 75, 3, 75, 3, 75, 5, 75, 656,
|
||||
10, 75, 3, 75, 3, 75, 3, 76, 3, 76, 3, 76, 3, 76, 7, 76, 664, 10, 76, 12,
|
||||
76, 14, 76, 667, 11, 76, 3, 76, 3, 76, 3, 76, 3, 76, 3, 76, 3, 77, 3, 77,
|
||||
3, 77, 3, 77, 3, 78, 3, 78, 3, 79, 3, 79, 3, 80, 3, 80, 3, 81, 3, 81, 3,
|
||||
82, 3, 82, 3, 83, 3, 83, 3, 84, 3, 84, 3, 85, 3, 85, 3, 86, 3, 86, 3, 87,
|
||||
3, 87, 3, 88, 3, 88, 3, 89, 3, 89, 3, 90, 3, 90, 3, 91, 3, 91, 3, 92, 3,
|
||||
92, 3, 93, 3, 93, 3, 94, 3, 94, 3, 95, 3, 95, 3, 96, 3, 96, 3, 97, 3, 97,
|
||||
3, 98, 3, 98, 3, 99, 3, 99, 3, 100, 3, 100, 3, 101, 3, 101, 3, 102, 3,
|
||||
102, 3, 103, 3, 103, 3, 104, 3, 104, 3, 105, 3, 105, 3, 106, 3, 106, 3,
|
||||
107, 3, 107, 3, 107, 3, 107, 3, 665, 2, 108, 3, 3, 5, 4, 7, 5, 9, 6, 11,
|
||||
7, 13, 8, 15, 9, 17, 10, 19, 11, 21, 12, 23, 13, 25, 14, 27, 15, 29, 16,
|
||||
31, 17, 33, 18, 35, 19, 37, 20, 39, 21, 41, 22, 43, 23, 45, 24, 47, 25,
|
||||
49, 26, 51, 27, 53, 28, 55, 29, 57, 30, 59, 31, 61, 32, 63, 33, 65, 34,
|
||||
67, 35, 69, 36, 71, 37, 73, 38, 75, 39, 77, 40, 79, 41, 81, 42, 83, 43,
|
||||
85, 44, 87, 45, 89, 46, 91, 47, 93, 48, 95, 49, 97, 50, 99, 51, 101, 52,
|
||||
103, 53, 105, 54, 107, 55, 109, 56, 111, 57, 113, 58, 115, 59, 117, 60,
|
||||
119, 61, 121, 62, 123, 63, 125, 64, 127, 65, 129, 66, 131, 67, 133, 68,
|
||||
135, 69, 137, 70, 139, 71, 141, 72, 143, 73, 145, 74, 147, 75, 149, 76,
|
||||
151, 77, 153, 78, 155, 79, 157, 2, 159, 2, 161, 2, 163, 2, 165, 2, 167,
|
||||
2, 169, 2, 171, 2, 173, 2, 175, 2, 177, 2, 179, 2, 181, 2, 183, 2, 185,
|
||||
2, 187, 2, 189, 2, 191, 2, 193, 2, 195, 2, 197, 2, 199, 2, 201, 2, 203,
|
||||
2, 205, 2, 207, 2, 209, 2, 211, 2, 213, 80, 3, 2, 39, 5, 2, 67, 92, 97,
|
||||
97, 99, 124, 6, 2, 50, 59, 67, 92, 97, 97, 99, 124, 3, 2, 51, 59, 3, 2,
|
||||
50, 51, 4, 2, 45, 45, 47, 47, 4, 2, 41, 41, 94, 94, 4, 2, 36, 36, 94, 94,
|
||||
4, 2, 12, 12, 15, 15, 5, 2, 11, 13, 15, 15, 34, 34, 5, 2, 50, 59, 67, 72,
|
||||
99, 104, 3, 2, 50, 59, 4, 2, 67, 67, 99, 99, 4, 2, 68, 68, 100, 100, 4,
|
||||
2, 69, 69, 101, 101, 4, 2, 70, 70, 102, 102, 4, 2, 71, 71, 103, 103, 4,
|
||||
2, 72, 72, 104, 104, 4, 2, 73, 73, 105, 105, 4, 2, 74, 74, 106, 106, 4,
|
||||
2, 75, 75, 107, 107, 4, 2, 76, 76, 108, 108, 4, 2, 77, 77, 109, 109, 4,
|
||||
2, 78, 78, 110, 110, 4, 2, 79, 79, 111, 111, 4, 2, 80, 80, 112, 112, 4,
|
||||
2, 81, 81, 113, 113, 4, 2, 82, 82, 114, 114, 4, 2, 83, 83, 115, 115, 4,
|
||||
2, 84, 84, 116, 116, 4, 2, 85, 85, 117, 117, 4, 2, 86, 86, 118, 118, 4,
|
||||
2, 87, 87, 119, 119, 4, 2, 88, 88, 120, 120, 4, 2, 89, 89, 121, 121, 4,
|
||||
2, 90, 90, 122, 122, 4, 2, 91, 91, 123, 123, 4, 2, 92, 92, 124, 124, 2,
|
||||
738, 2, 3, 3, 2, 2, 2, 2, 5, 3, 2, 2, 2, 2, 7, 3, 2, 2, 2, 2, 9, 3, 2,
|
||||
2, 2, 2, 11, 3, 2, 2, 2, 2, 13, 3, 2, 2, 2, 2, 15, 3, 2, 2, 2, 2, 17, 3,
|
||||
2, 2, 2, 2, 19, 3, 2, 2, 2, 2, 21, 3, 2, 2, 2, 2, 23, 3, 2, 2, 2, 2, 25,
|
||||
3, 2, 2, 2, 2, 27, 3, 2, 2, 2, 2, 29, 3, 2, 2, 2, 2, 31, 3, 2, 2, 2, 2,
|
||||
33, 3, 2, 2, 2, 2, 35, 3, 2, 2, 2, 2, 37, 3, 2, 2, 2, 2, 39, 3, 2, 2, 2,
|
||||
2, 41, 3, 2, 2, 2, 2, 43, 3, 2, 2, 2, 2, 45, 3, 2, 2, 2, 2, 47, 3, 2, 2,
|
||||
2, 2, 49, 3, 2, 2, 2, 2, 51, 3, 2, 2, 2, 2, 53, 3, 2, 2, 2, 2, 55, 3, 2,
|
||||
2, 2, 2, 57, 3, 2, 2, 2, 2, 59, 3, 2, 2, 2, 2, 61, 3, 2, 2, 2, 2, 63, 3,
|
||||
2, 2, 2, 2, 65, 3, 2, 2, 2, 2, 67, 3, 2, 2, 2, 2, 69, 3, 2, 2, 2, 2, 71,
|
||||
3, 2, 2, 2, 2, 73, 3, 2, 2, 2, 2, 75, 3, 2, 2, 2, 2, 77, 3, 2, 2, 2, 2,
|
||||
79, 3, 2, 2, 2, 2, 81, 3, 2, 2, 2, 2, 83, 3, 2, 2, 2, 2, 85, 3, 2, 2, 2,
|
||||
2, 87, 3, 2, 2, 2, 2, 89, 3, 2, 2, 2, 2, 91, 3, 2, 2, 2, 2, 93, 3, 2, 2,
|
||||
2, 2, 95, 3, 2, 2, 2, 2, 97, 3, 2, 2, 2, 2, 99, 3, 2, 2, 2, 2, 101, 3,
|
||||
2, 2, 2, 2, 103, 3, 2, 2, 2, 2, 105, 3, 2, 2, 2, 2, 107, 3, 2, 2, 2, 2,
|
||||
109, 3, 2, 2, 2, 2, 111, 3, 2, 2, 2, 2, 113, 3, 2, 2, 2, 2, 115, 3, 2,
|
||||
2, 2, 2, 117, 3, 2, 2, 2, 2, 119, 3, 2, 2, 2, 2, 121, 3, 2, 2, 2, 2, 123,
|
||||
3, 2, 2, 2, 2, 125, 3, 2, 2, 2, 2, 127, 3, 2, 2, 2, 2, 129, 3, 2, 2, 2,
|
||||
2, 131, 3, 2, 2, 2, 2, 133, 3, 2, 2, 2, 2, 135, 3, 2, 2, 2, 2, 137, 3,
|
||||
2, 2, 2, 2, 139, 3, 2, 2, 2, 2, 141, 3, 2, 2, 2, 2, 143, 3, 2, 2, 2, 2,
|
||||
145, 3, 2, 2, 2, 2, 147, 3, 2, 2, 2, 2, 149, 3, 2, 2, 2, 2, 151, 3, 2,
|
||||
2, 2, 2, 153, 3, 2, 2, 2, 2, 155, 3, 2, 2, 2, 2, 213, 3, 2, 2, 2, 3, 215,
|
||||
3, 2, 2, 2, 5, 217, 3, 2, 2, 2, 7, 220, 3, 2, 2, 2, 9, 223, 3, 2, 2, 2,
|
||||
11, 226, 3, 2, 2, 2, 13, 229, 3, 2, 2, 2, 15, 231, 3, 2, 2, 2, 17, 233,
|
||||
3, 2, 2, 2, 19, 236, 3, 2, 2, 2, 21, 239, 3, 2, 2, 2, 23, 241, 3, 2, 2,
|
||||
2, 25, 243, 3, 2, 2, 2, 27, 245, 3, 2, 2, 2, 29, 247, 3, 2, 2, 2, 31, 249,
|
||||
3, 2, 2, 2, 33, 251, 3, 2, 2, 2, 35, 253, 3, 2, 2, 2, 37, 256, 3, 2, 2,
|
||||
2, 39, 259, 3, 2, 2, 2, 41, 261, 3, 2, 2, 2, 43, 263, 3, 2, 2, 2, 45, 265,
|
||||
3, 2, 2, 2, 47, 267, 3, 2, 2, 2, 49, 269, 3, 2, 2, 2, 51, 271, 3, 2, 2,
|
||||
2, 53, 273, 3, 2, 2, 2, 55, 283, 3, 2, 2, 2, 57, 293, 3, 2, 2, 2, 59, 295,
|
||||
3, 2, 2, 2, 61, 299, 3, 2, 2, 2, 63, 303, 3, 2, 2, 2, 65, 311, 3, 2, 2,
|
||||
2, 67, 316, 3, 2, 2, 2, 69, 325, 3, 2, 2, 2, 71, 331, 3, 2, 2, 2, 73, 338,
|
||||
3, 2, 2, 2, 75, 342, 3, 2, 2, 2, 77, 348, 3, 2, 2, 2, 79, 351, 3, 2, 2,
|
||||
2, 81, 359, 3, 2, 2, 2, 83, 366, 3, 2, 2, 2, 85, 371, 3, 2, 2, 2, 87, 388,
|
||||
3, 2, 2, 2, 89, 392, 3, 2, 2, 2, 91, 397, 3, 2, 2, 2, 93, 403, 3, 2, 2,
|
||||
2, 95, 413, 3, 2, 2, 2, 97, 415, 3, 2, 2, 2, 99, 425, 3, 2, 2, 2, 101,
|
||||
427, 3, 2, 2, 2, 103, 436, 3, 2, 2, 2, 105, 443, 3, 2, 2, 2, 107, 451,
|
||||
3, 2, 2, 2, 109, 458, 3, 2, 2, 2, 111, 472, 3, 2, 2, 2, 113, 477, 3, 2,
|
||||
2, 2, 115, 482, 3, 2, 2, 2, 117, 489, 3, 2, 2, 2, 119, 496, 3, 2, 2, 2,
|
||||
121, 501, 3, 2, 2, 2, 123, 506, 3, 2, 2, 2, 125, 512, 3, 2, 2, 2, 127,
|
||||
520, 3, 2, 2, 2, 129, 526, 3, 2, 2, 2, 131, 533, 3, 2, 2, 2, 133, 536,
|
||||
3, 2, 2, 2, 135, 544, 3, 2, 2, 2, 137, 548, 3, 2, 2, 2, 139, 552, 3, 2,
|
||||
2, 2, 141, 583, 3, 2, 2, 2, 143, 593, 3, 2, 2, 2, 145, 612, 3, 2, 2, 2,
|
||||
147, 639, 3, 2, 2, 2, 149, 641, 3, 2, 2, 2, 151, 659, 3, 2, 2, 2, 153,
|
||||
673, 3, 2, 2, 2, 155, 677, 3, 2, 2, 2, 157, 679, 3, 2, 2, 2, 159, 681,
|
||||
3, 2, 2, 2, 161, 683, 3, 2, 2, 2, 163, 685, 3, 2, 2, 2, 165, 687, 3, 2,
|
||||
2, 2, 167, 689, 3, 2, 2, 2, 169, 691, 3, 2, 2, 2, 171, 693, 3, 2, 2, 2,
|
||||
173, 695, 3, 2, 2, 2, 175, 697, 3, 2, 2, 2, 177, 699, 3, 2, 2, 2, 179,
|
||||
701, 3, 2, 2, 2, 181, 703, 3, 2, 2, 2, 183, 705, 3, 2, 2, 2, 185, 707,
|
||||
3, 2, 2, 2, 187, 709, 3, 2, 2, 2, 189, 711, 3, 2, 2, 2, 191, 713, 3, 2,
|
||||
2, 2, 193, 715, 3, 2, 2, 2, 195, 717, 3, 2, 2, 2, 197, 719, 3, 2, 2, 2,
|
||||
199, 721, 3, 2, 2, 2, 201, 723, 3, 2, 2, 2, 203, 725, 3, 2, 2, 2, 205,
|
||||
727, 3, 2, 2, 2, 207, 729, 3, 2, 2, 2, 209, 731, 3, 2, 2, 2, 211, 733,
|
||||
3, 2, 2, 2, 213, 735, 3, 2, 2, 2, 215, 216, 7, 48, 2, 2, 216, 4, 3, 2,
|
||||
2, 2, 217, 218, 7, 63, 2, 2, 218, 219, 7, 128, 2, 2, 219, 6, 3, 2, 2, 2,
|
||||
220, 221, 7, 35, 2, 2, 221, 222, 7, 128, 2, 2, 222, 8, 3, 2, 2, 2, 223,
|
||||
224, 7, 63, 2, 2, 224, 225, 7, 63, 2, 2, 225, 10, 3, 2, 2, 2, 226, 227,
|
||||
7, 35, 2, 2, 227, 228, 7, 63, 2, 2, 228, 12, 3, 2, 2, 2, 229, 230, 7, 62,
|
||||
2, 2, 230, 14, 3, 2, 2, 2, 231, 232, 7, 64, 2, 2, 232, 16, 3, 2, 2, 2,
|
||||
233, 234, 7, 62, 2, 2, 234, 235, 7, 63, 2, 2, 235, 18, 3, 2, 2, 2, 236,
|
||||
237, 7, 64, 2, 2, 237, 238, 7, 63, 2, 2, 238, 20, 3, 2, 2, 2, 239, 240,
|
||||
7, 45, 2, 2, 240, 22, 3, 2, 2, 2, 241, 242, 7, 47, 2, 2, 242, 24, 3, 2,
|
||||
2, 2, 243, 244, 7, 44, 2, 2, 244, 26, 3, 2, 2, 2, 245, 246, 7, 49, 2, 2,
|
||||
246, 28, 3, 2, 2, 2, 247, 248, 7, 39, 2, 2, 248, 30, 3, 2, 2, 2, 249, 250,
|
||||
7, 65, 2, 2, 250, 32, 3, 2, 2, 2, 251, 252, 7, 60, 2, 2, 252, 34, 3, 2,
|
||||
2, 2, 253, 254, 7, 60, 2, 2, 254, 255, 7, 60, 2, 2, 255, 36, 3, 2, 2, 2,
|
||||
256, 257, 7, 48, 2, 2, 257, 258, 7, 48, 2, 2, 258, 38, 3, 2, 2, 2, 259,
|
||||
260, 7, 46, 2, 2, 260, 40, 3, 2, 2, 2, 261, 262, 7, 42, 2, 2, 262, 42,
|
||||
3, 2, 2, 2, 263, 264, 7, 43, 2, 2, 264, 44, 3, 2, 2, 2, 265, 266, 7, 125,
|
||||
2, 2, 266, 46, 3, 2, 2, 2, 267, 268, 7, 127, 2, 2, 268, 48, 3, 2, 2, 2,
|
||||
269, 270, 7, 93, 2, 2, 270, 50, 3, 2, 2, 2, 271, 272, 7, 95, 2, 2, 272,
|
||||
52, 3, 2, 2, 2, 273, 274, 5, 161, 81, 2, 274, 275, 5, 173, 87, 2, 275,
|
||||
276, 5, 173, 87, 2, 276, 277, 5, 195, 98, 2, 277, 278, 5, 169, 85, 2, 278,
|
||||
279, 5, 173, 87, 2, 279, 280, 5, 161, 81, 2, 280, 281, 5, 199, 100, 2,
|
||||
281, 282, 5, 169, 85, 2, 282, 54, 3, 2, 2, 2, 283, 284, 5, 161, 81, 2,
|
||||
284, 285, 5, 183, 92, 2, 285, 286, 5, 183, 92, 2, 286, 56, 3, 2, 2, 2,
|
||||
287, 288, 5, 161, 81, 2, 288, 289, 5, 187, 94, 2, 289, 290, 5, 167, 84,
|
||||
2, 290, 294, 3, 2, 2, 2, 291, 292, 7, 40, 2, 2, 292, 294, 7, 40, 2, 2,
|
||||
293, 287, 3, 2, 2, 2, 293, 291, 3, 2, 2, 2, 294, 58, 3, 2, 2, 2, 295, 296,
|
||||
5, 161, 81, 2, 296, 297, 5, 187, 94, 2, 297, 298, 5, 209, 105, 2, 298,
|
||||
60, 3, 2, 2, 2, 299, 300, 5, 161, 81, 2, 300, 301, 5, 197, 99, 2, 301,
|
||||
302, 5, 165, 83, 2, 302, 62, 3, 2, 2, 2, 303, 304, 5, 165, 83, 2, 304,
|
||||
305, 5, 189, 95, 2, 305, 306, 5, 183, 92, 2, 306, 307, 5, 183, 92, 2, 307,
|
||||
308, 5, 169, 85, 2, 308, 309, 5, 165, 83, 2, 309, 310, 5, 199, 100, 2,
|
||||
310, 64, 3, 2, 2, 2, 311, 312, 5, 167, 84, 2, 312, 313, 5, 169, 85, 2,
|
||||
313, 314, 5, 197, 99, 2, 314, 315, 5, 165, 83, 2, 315, 66, 3, 2, 2, 2,
|
||||
316, 317, 5, 167, 84, 2, 317, 318, 5, 177, 89, 2, 318, 319, 5, 197, 99,
|
||||
2, 319, 320, 5, 199, 100, 2, 320, 321, 5, 177, 89, 2, 321, 322, 5, 187,
|
||||
94, 2, 322, 323, 5, 165, 83, 2, 323, 324, 5, 199, 100, 2, 324, 68, 3, 2,
|
||||
2, 2, 325, 326, 5, 171, 86, 2, 326, 327, 5, 161, 81, 2, 327, 328, 5, 183,
|
||||
92, 2, 328, 329, 5, 197, 99, 2, 329, 330, 5, 169, 85, 2, 330, 70, 3, 2,
|
||||
2, 2, 331, 332, 5, 171, 86, 2, 332, 333, 5, 177, 89, 2, 333, 334, 5, 183,
|
||||
92, 2, 334, 335, 5, 199, 100, 2, 335, 336, 5, 169, 85, 2, 336, 337, 5,
|
||||
195, 98, 2, 337, 72, 3, 2, 2, 2, 338, 339, 5, 171, 86, 2, 339, 340, 5,
|
||||
189, 95, 2, 340, 341, 5, 195, 98, 2, 341, 74, 3, 2, 2, 2, 342, 343, 5,
|
||||
173, 87, 2, 343, 344, 5, 195, 98, 2, 344, 345, 5, 161, 81, 2, 345, 346,
|
||||
5, 191, 96, 2, 346, 347, 5, 175, 88, 2, 347, 76, 3, 2, 2, 2, 348, 349,
|
||||
5, 177, 89, 2, 349, 350, 5, 187, 94, 2, 350, 78, 3, 2, 2, 2, 351, 352,
|
||||
5, 177, 89, 2, 352, 353, 5, 187, 94, 2, 353, 354, 5, 163, 82, 2, 354, 355,
|
||||
5, 189, 95, 2, 355, 356, 5, 201, 101, 2, 356, 357, 5, 187, 94, 2, 357,
|
||||
358, 5, 167, 84, 2, 358, 80, 3, 2, 2, 2, 359, 360, 5, 177, 89, 2, 360,
|
||||
361, 5, 187, 94, 2, 361, 362, 5, 197, 99, 2, 362, 363, 5, 169, 85, 2, 363,
|
||||
364, 5, 195, 98, 2, 364, 365, 5, 199, 100, 2, 365, 82, 3, 2, 2, 2, 366,
|
||||
367, 5, 177, 89, 2, 367, 368, 5, 187, 94, 2, 368, 369, 5, 199, 100, 2,
|
||||
369, 370, 5, 189, 95, 2, 370, 84, 3, 2, 2, 2, 371, 372, 5, 181, 91, 2,
|
||||
372, 373, 7, 97, 2, 2, 373, 374, 5, 197, 99, 2, 374, 375, 5, 175, 88, 2,
|
||||
375, 376, 5, 189, 95, 2, 376, 377, 5, 195, 98, 2, 377, 378, 5, 199, 100,
|
||||
2, 378, 379, 5, 169, 85, 2, 379, 380, 5, 197, 99, 2, 380, 381, 5, 199,
|
||||
100, 2, 381, 382, 7, 97, 2, 2, 382, 383, 5, 191, 96, 2, 383, 384, 5, 161,
|
||||
81, 2, 384, 385, 5, 199, 100, 2, 385, 386, 5, 175, 88, 2, 386, 387, 5,
|
||||
197, 99, 2, 387, 86, 3, 2, 2, 2, 388, 389, 5, 183, 92, 2, 389, 390, 5,
|
||||
169, 85, 2, 390, 391, 5, 199, 100, 2, 391, 88, 3, 2, 2, 2, 392, 393, 5,
|
||||
183, 92, 2, 393, 394, 5, 177, 89, 2, 394, 395, 5, 181, 91, 2, 395, 396,
|
||||
5, 169, 85, 2, 396, 90, 3, 2, 2, 2, 397, 398, 5, 183, 92, 2, 398, 399,
|
||||
5, 177, 89, 2, 399, 400, 5, 185, 93, 2, 400, 401, 5, 177, 89, 2, 401, 402,
|
||||
5, 199, 100, 2, 402, 92, 3, 2, 2, 2, 403, 404, 5, 187, 94, 2, 404, 405,
|
||||
5, 189, 95, 2, 405, 406, 5, 187, 94, 2, 406, 407, 5, 169, 85, 2, 407, 94,
|
||||
3, 2, 2, 2, 408, 409, 5, 187, 94, 2, 409, 410, 5, 189, 95, 2, 410, 411,
|
||||
5, 199, 100, 2, 411, 414, 3, 2, 2, 2, 412, 414, 7, 35, 2, 2, 413, 408,
|
||||
3, 2, 2, 2, 413, 412, 3, 2, 2, 2, 414, 96, 3, 2, 2, 2, 415, 416, 5, 187,
|
||||
94, 2, 416, 417, 5, 201, 101, 2, 417, 418, 5, 183, 92, 2, 418, 419, 5,
|
||||
183, 92, 2, 419, 98, 3, 2, 2, 2, 420, 421, 5, 189, 95, 2, 421, 422, 5,
|
||||
195, 98, 2, 422, 426, 3, 2, 2, 2, 423, 424, 7, 126, 2, 2, 424, 426, 7,
|
||||
126, 2, 2, 425, 420, 3, 2, 2, 2, 425, 423, 3, 2, 2, 2, 426, 100, 3, 2,
|
||||
2, 2, 427, 428, 5, 189, 95, 2, 428, 429, 5, 201, 101, 2, 429, 430, 5, 199,
|
||||
100, 2, 430, 431, 5, 163, 82, 2, 431, 432, 5, 189, 95, 2, 432, 433, 5,
|
||||
201, 101, 2, 433, 434, 5, 187, 94, 2, 434, 435, 5, 167, 84, 2, 435, 102,
|
||||
3, 2, 2, 2, 436, 437, 5, 195, 98, 2, 437, 438, 5, 169, 85, 2, 438, 439,
|
||||
5, 185, 93, 2, 439, 440, 5, 189, 95, 2, 440, 441, 5, 203, 102, 2, 441,
|
||||
442, 5, 169, 85, 2, 442, 104, 3, 2, 2, 2, 443, 444, 5, 195, 98, 2, 444,
|
||||
445, 5, 169, 85, 2, 445, 446, 5, 191, 96, 2, 446, 447, 5, 183, 92, 2, 447,
|
||||
448, 5, 161, 81, 2, 448, 449, 5, 165, 83, 2, 449, 450, 5, 169, 85, 2, 450,
|
||||
106, 3, 2, 2, 2, 451, 452, 5, 195, 98, 2, 452, 453, 5, 169, 85, 2, 453,
|
||||
454, 5, 199, 100, 2, 454, 455, 5, 201, 101, 2, 455, 456, 5, 195, 98, 2,
|
||||
456, 457, 5, 187, 94, 2, 457, 108, 3, 2, 2, 2, 458, 459, 5, 197, 99, 2,
|
||||
459, 460, 5, 175, 88, 2, 460, 461, 5, 189, 95, 2, 461, 462, 5, 195, 98,
|
||||
2, 462, 463, 5, 199, 100, 2, 463, 464, 5, 169, 85, 2, 464, 465, 5, 197,
|
||||
99, 2, 465, 466, 5, 199, 100, 2, 466, 467, 7, 97, 2, 2, 467, 468, 5, 191,
|
||||
96, 2, 468, 469, 5, 161, 81, 2, 469, 470, 5, 199, 100, 2, 470, 471, 5,
|
||||
175, 88, 2, 471, 110, 3, 2, 2, 2, 472, 473, 5, 197, 99, 2, 473, 474, 5,
|
||||
189, 95, 2, 474, 475, 5, 195, 98, 2, 475, 476, 5, 199, 100, 2, 476, 112,
|
||||
3, 2, 2, 2, 477, 478, 5, 199, 100, 2, 478, 479, 5, 195, 98, 2, 479, 480,
|
||||
5, 201, 101, 2, 480, 481, 5, 169, 85, 2, 481, 114, 3, 2, 2, 2, 482, 483,
|
||||
5, 201, 101, 2, 483, 484, 5, 191, 96, 2, 484, 485, 5, 167, 84, 2, 485,
|
||||
486, 5, 161, 81, 2, 486, 487, 5, 199, 100, 2, 487, 488, 5, 169, 85, 2,
|
||||
488, 116, 3, 2, 2, 2, 489, 490, 5, 201, 101, 2, 490, 491, 5, 191, 96, 2,
|
||||
491, 492, 5, 197, 99, 2, 492, 493, 5, 169, 85, 2, 493, 494, 5, 195, 98,
|
||||
2, 494, 495, 5, 199, 100, 2, 495, 118, 3, 2, 2, 2, 496, 497, 5, 205, 103,
|
||||
2, 497, 498, 5, 177, 89, 2, 498, 499, 5, 199, 100, 2, 499, 500, 5, 175,
|
||||
88, 2, 500, 120, 3, 2, 2, 2, 501, 502, 5, 181, 91, 2, 502, 503, 5, 169,
|
||||
85, 2, 503, 504, 5, 169, 85, 2, 504, 505, 5, 191, 96, 2, 505, 122, 3, 2,
|
||||
2, 2, 506, 507, 5, 165, 83, 2, 507, 508, 5, 189, 95, 2, 508, 509, 5, 201,
|
||||
101, 2, 509, 510, 5, 187, 94, 2, 510, 511, 5, 199, 100, 2, 511, 124, 3,
|
||||
2, 2, 2, 512, 513, 5, 189, 95, 2, 513, 514, 5, 191, 96, 2, 514, 515, 5,
|
||||
199, 100, 2, 515, 516, 5, 177, 89, 2, 516, 517, 5, 189, 95, 2, 517, 518,
|
||||
5, 187, 94, 2, 518, 519, 5, 197, 99, 2, 519, 126, 3, 2, 2, 2, 520, 521,
|
||||
5, 191, 96, 2, 521, 522, 5, 195, 98, 2, 522, 523, 5, 201, 101, 2, 523,
|
||||
524, 5, 187, 94, 2, 524, 525, 5, 169, 85, 2, 525, 128, 3, 2, 2, 2, 526,
|
||||
527, 5, 197, 99, 2, 527, 528, 5, 169, 85, 2, 528, 529, 5, 161, 81, 2, 529,
|
||||
530, 5, 195, 98, 2, 530, 531, 5, 165, 83, 2, 531, 532, 5, 175, 88, 2, 532,
|
||||
130, 3, 2, 2, 2, 533, 534, 5, 199, 100, 2, 534, 535, 5, 189, 95, 2, 535,
|
||||
132, 3, 2, 2, 2, 536, 537, 5, 165, 83, 2, 537, 538, 5, 201, 101, 2, 538,
|
||||
539, 5, 195, 98, 2, 539, 540, 5, 195, 98, 2, 540, 541, 5, 169, 85, 2, 541,
|
||||
542, 5, 187, 94, 2, 542, 543, 5, 199, 100, 2, 543, 134, 3, 2, 2, 2, 544,
|
||||
545, 5, 187, 94, 2, 545, 546, 5, 169, 85, 2, 546, 547, 5, 205, 103, 2,
|
||||
547, 136, 3, 2, 2, 2, 548, 549, 5, 189, 95, 2, 549, 550, 5, 183, 92, 2,
|
||||
550, 551, 5, 167, 84, 2, 551, 138, 3, 2, 2, 2, 552, 556, 9, 2, 2, 2, 553,
|
||||
555, 9, 3, 2, 2, 554, 553, 3, 2, 2, 2, 555, 558, 3, 2, 2, 2, 556, 554,
|
||||
3, 2, 2, 2, 556, 557, 3, 2, 2, 2, 557, 140, 3, 2, 2, 2, 558, 556, 3, 2,
|
||||
2, 2, 559, 563, 9, 4, 2, 2, 560, 562, 5, 159, 80, 2, 561, 560, 3, 2, 2,
|
||||
2, 562, 565, 3, 2, 2, 2, 563, 561, 3, 2, 2, 2, 563, 564, 3, 2, 2, 2, 564,
|
||||
584, 3, 2, 2, 2, 565, 563, 3, 2, 2, 2, 566, 584, 7, 50, 2, 2, 567, 568,
|
||||
7, 50, 2, 2, 568, 569, 7, 122, 2, 2, 569, 571, 3, 2, 2, 2, 570, 572, 5,
|
||||
157, 79, 2, 571, 570, 3, 2, 2, 2, 572, 573, 3, 2, 2, 2, 573, 571, 3, 2,
|
||||
2, 2, 573, 574, 3, 2, 2, 2, 574, 584, 3, 2, 2, 2, 575, 576, 7, 50, 2, 2,
|
||||
576, 577, 7, 100, 2, 2, 577, 579, 3, 2, 2, 2, 578, 580, 9, 5, 2, 2, 579,
|
||||
578, 3, 2, 2, 2, 580, 581, 3, 2, 2, 2, 581, 579, 3, 2, 2, 2, 581, 582,
|
||||
3, 2, 2, 2, 582, 584, 3, 2, 2, 2, 583, 559, 3, 2, 2, 2, 583, 566, 3, 2,
|
||||
2, 2, 583, 567, 3, 2, 2, 2, 583, 575, 3, 2, 2, 2, 584, 142, 3, 2, 2, 2,
|
||||
585, 589, 9, 4, 2, 2, 586, 588, 5, 159, 80, 2, 587, 586, 3, 2, 2, 2, 588,
|
||||
591, 3, 2, 2, 2, 589, 587, 3, 2, 2, 2, 589, 590, 3, 2, 2, 2, 590, 594,
|
||||
3, 2, 2, 2, 591, 589, 3, 2, 2, 2, 592, 594, 7, 50, 2, 2, 593, 585, 3, 2,
|
||||
2, 2, 593, 592, 3, 2, 2, 2, 593, 594, 3, 2, 2, 2, 594, 595, 3, 2, 2, 2,
|
||||
595, 597, 7, 48, 2, 2, 596, 598, 5, 159, 80, 2, 597, 596, 3, 2, 2, 2, 598,
|
||||
599, 3, 2, 2, 2, 599, 597, 3, 2, 2, 2, 599, 600, 3, 2, 2, 2, 600, 610,
|
||||
3, 2, 2, 2, 601, 603, 5, 169, 85, 2, 602, 604, 9, 6, 2, 2, 603, 602, 3,
|
||||
2, 2, 2, 603, 604, 3, 2, 2, 2, 604, 606, 3, 2, 2, 2, 605, 607, 5, 159,
|
||||
80, 2, 606, 605, 3, 2, 2, 2, 607, 608, 3, 2, 2, 2, 608, 606, 3, 2, 2, 2,
|
||||
608, 609, 3, 2, 2, 2, 609, 611, 3, 2, 2, 2, 610, 601, 3, 2, 2, 2, 610,
|
||||
611, 3, 2, 2, 2, 611, 144, 3, 2, 2, 2, 612, 613, 7, 66, 2, 2, 613, 614,
|
||||
5, 139, 70, 2, 614, 146, 3, 2, 2, 2, 615, 623, 7, 41, 2, 2, 616, 617, 7,
|
||||
94, 2, 2, 617, 622, 11, 2, 2, 2, 618, 619, 7, 41, 2, 2, 619, 622, 7, 41,
|
||||
2, 2, 620, 622, 10, 7, 2, 2, 621, 616, 3, 2, 2, 2, 621, 618, 3, 2, 2, 2,
|
||||
621, 620, 3, 2, 2, 2, 622, 625, 3, 2, 2, 2, 623, 621, 3, 2, 2, 2, 623,
|
||||
624, 3, 2, 2, 2, 624, 626, 3, 2, 2, 2, 625, 623, 3, 2, 2, 2, 626, 640,
|
||||
7, 41, 2, 2, 627, 635, 7, 36, 2, 2, 628, 629, 7, 94, 2, 2, 629, 634, 11,
|
||||
2, 2, 2, 630, 631, 7, 36, 2, 2, 631, 634, 7, 36, 2, 2, 632, 634, 10, 8,
|
||||
2, 2, 633, 628, 3, 2, 2, 2, 633, 630, 3, 2, 2, 2, 633, 632, 3, 2, 2, 2,
|
||||
634, 637, 3, 2, 2, 2, 635, 633, 3, 2, 2, 2, 635, 636, 3, 2, 2, 2, 636,
|
||||
638, 3, 2, 2, 2, 637, 635, 3, 2, 2, 2, 638, 640, 7, 36, 2, 2, 639, 615,
|
||||
3, 2, 2, 2, 639, 627, 3, 2, 2, 2, 640, 148, 3, 2, 2, 2, 641, 642, 7, 49,
|
||||
2, 2, 642, 643, 7, 49, 2, 2, 643, 647, 3, 2, 2, 2, 644, 646, 10, 9, 2,
|
||||
2, 645, 644, 3, 2, 2, 2, 646, 649, 3, 2, 2, 2, 647, 645, 3, 2, 2, 2, 647,
|
||||
648, 3, 2, 2, 2, 648, 655, 3, 2, 2, 2, 649, 647, 3, 2, 2, 2, 650, 652,
|
||||
7, 15, 2, 2, 651, 650, 3, 2, 2, 2, 651, 652, 3, 2, 2, 2, 652, 653, 3, 2,
|
||||
2, 2, 653, 656, 7, 12, 2, 2, 654, 656, 7, 2, 2, 3, 655, 651, 3, 2, 2, 2,
|
||||
655, 654, 3, 2, 2, 2, 656, 657, 3, 2, 2, 2, 657, 658, 8, 75, 2, 2, 658,
|
||||
150, 3, 2, 2, 2, 659, 660, 7, 49, 2, 2, 660, 661, 7, 44, 2, 2, 661, 665,
|
||||
3, 2, 2, 2, 662, 664, 11, 2, 2, 2, 663, 662, 3, 2, 2, 2, 664, 667, 3, 2,
|
||||
2, 2, 665, 666, 3, 2, 2, 2, 665, 663, 3, 2, 2, 2, 666, 668, 3, 2, 2, 2,
|
||||
667, 665, 3, 2, 2, 2, 668, 669, 7, 44, 2, 2, 669, 670, 7, 49, 2, 2, 670,
|
||||
671, 3, 2, 2, 2, 671, 672, 8, 76, 2, 2, 672, 152, 3, 2, 2, 2, 673, 674,
|
||||
9, 10, 2, 2, 674, 675, 3, 2, 2, 2, 675, 676, 8, 77, 2, 2, 676, 154, 3,
|
||||
2, 2, 2, 677, 678, 11, 2, 2, 2, 678, 156, 3, 2, 2, 2, 679, 680, 9, 11,
|
||||
2, 2, 680, 158, 3, 2, 2, 2, 681, 682, 9, 12, 2, 2, 682, 160, 3, 2, 2, 2,
|
||||
683, 684, 9, 13, 2, 2, 684, 162, 3, 2, 2, 2, 685, 686, 9, 14, 2, 2, 686,
|
||||
164, 3, 2, 2, 2, 687, 688, 9, 15, 2, 2, 688, 166, 3, 2, 2, 2, 689, 690,
|
||||
9, 16, 2, 2, 690, 168, 3, 2, 2, 2, 691, 692, 9, 17, 2, 2, 692, 170, 3,
|
||||
2, 2, 2, 693, 694, 9, 18, 2, 2, 694, 172, 3, 2, 2, 2, 695, 696, 9, 19,
|
||||
2, 2, 696, 174, 3, 2, 2, 2, 697, 698, 9, 20, 2, 2, 698, 176, 3, 2, 2, 2,
|
||||
699, 700, 9, 21, 2, 2, 700, 178, 3, 2, 2, 2, 701, 702, 9, 22, 2, 2, 702,
|
||||
180, 3, 2, 2, 2, 703, 704, 9, 23, 2, 2, 704, 182, 3, 2, 2, 2, 705, 706,
|
||||
9, 24, 2, 2, 706, 184, 3, 2, 2, 2, 707, 708, 9, 25, 2, 2, 708, 186, 3,
|
||||
2, 2, 2, 709, 710, 9, 26, 2, 2, 710, 188, 3, 2, 2, 2, 711, 712, 9, 27,
|
||||
2, 2, 712, 190, 3, 2, 2, 2, 713, 714, 9, 28, 2, 2, 714, 192, 3, 2, 2, 2,
|
||||
715, 716, 9, 29, 2, 2, 716, 194, 3, 2, 2, 2, 717, 718, 9, 30, 2, 2, 718,
|
||||
196, 3, 2, 2, 2, 719, 720, 9, 31, 2, 2, 720, 198, 3, 2, 2, 2, 721, 722,
|
||||
9, 32, 2, 2, 722, 200, 3, 2, 2, 2, 723, 724, 9, 33, 2, 2, 724, 202, 3,
|
||||
2, 2, 2, 725, 726, 9, 34, 2, 2, 726, 204, 3, 2, 2, 2, 727, 728, 9, 35,
|
||||
2, 2, 728, 206, 3, 2, 2, 2, 729, 730, 9, 36, 2, 2, 730, 208, 3, 2, 2, 2,
|
||||
731, 732, 9, 37, 2, 2, 732, 210, 3, 2, 2, 2, 733, 734, 9, 38, 2, 2, 734,
|
||||
212, 3, 2, 2, 2, 735, 736, 11, 2, 2, 2, 736, 737, 3, 2, 2, 2, 737, 738,
|
||||
8, 107, 3, 2, 738, 214, 3, 2, 2, 2, 26, 2, 293, 413, 425, 556, 563, 573,
|
||||
581, 583, 589, 593, 599, 603, 608, 610, 621, 623, 633, 635, 639, 647, 651,
|
||||
655, 665, 4, 2, 3, 2, 2, 4, 2,
|
||||
}
|
||||
|
||||
var lexerChannelNames = []string{
|
||||
"DEFAULT_TOKEN_CHANNEL", "HIDDEN", "ERRORCHANNEL",
|
||||
}
|
||||
|
||||
var lexerModeNames = []string{
|
||||
"DEFAULT_MODE",
|
||||
}
|
||||
|
||||
var lexerLiteralNames = []string{
|
||||
"", "'.'", "'=~'", "'!~'", "'=='", "'!='", "'<'", "'>'", "'<='", "'>='",
|
||||
"'+'", "'-'", "'*'", "'/'", "'%'", "'?'", "':'", "'::'", "'..'", "','",
|
||||
"'('", "')'", "'{'", "'}'", "'['", "']'",
|
||||
}
|
||||
|
||||
var lexerSymbolicNames = []string{
|
||||
"", "DOT", "T_REGEX_MATCH", "T_REGEX_NON_MATCH", "T_EQ", "T_NE", "T_LT",
|
||||
"T_GT", "T_LE", "T_GE", "T_PLUS", "T_MINUS", "T_TIMES", "T_DIV", "T_MOD",
|
||||
"T_QUESTION", "T_COLON", "T_SCOPE", "T_RANGE", "T_COMMA", "T_OPEN", "T_CLOSE",
|
||||
"T_OBJECT_OPEN", "T_OBJECT_CLOSE", "T_ARRAY_OPEN", "T_ARRAY_CLOSE", "T_AGGREGATE",
|
||||
"T_ALL", "T_AND", "T_ANY", "T_ASC", "T_COLLECT", "T_DESC", "T_DISTINCT",
|
||||
"T_FALSE", "T_FILTER", "T_FOR", "T_GRAPH", "T_IN", "T_INBOUND", "T_INSERT",
|
||||
"T_INTO", "T_K_SHORTEST_PATHS", "T_LET", "T_LIKE", "T_LIMIT", "T_NONE",
|
||||
"T_NOT", "T_NULL", "T_OR", "T_OUTBOUND", "T_REMOVE", "T_REPLACE", "T_RETURN",
|
||||
"T_SHORTEST_PATH", "T_SORT", "T_TRUE", "T_UPDATE", "T_UPSERT", "T_WITH",
|
||||
"T_KEEP", "T_COUNT", "T_OPTIONS", "T_PRUNE", "T_SEARCH", "T_TO", "T_CURRENT",
|
||||
"T_NEW", "T_OLD", "T_STRING", "T_INT", "T_FLOAT", "T_PARAMETER", "T_QUOTED_STRING",
|
||||
"SINGLE_LINE_COMMENT", "MULTILINE_COMMENT", "SPACES", "UNEXPECTED_CHAR",
|
||||
"ERROR_RECONGNIGION",
|
||||
}
|
||||
|
||||
var lexerRuleNames = []string{
|
||||
"DOT", "T_REGEX_MATCH", "T_REGEX_NON_MATCH", "T_EQ", "T_NE", "T_LT", "T_GT",
|
||||
"T_LE", "T_GE", "T_PLUS", "T_MINUS", "T_TIMES", "T_DIV", "T_MOD", "T_QUESTION",
|
||||
"T_COLON", "T_SCOPE", "T_RANGE", "T_COMMA", "T_OPEN", "T_CLOSE", "T_OBJECT_OPEN",
|
||||
"T_OBJECT_CLOSE", "T_ARRAY_OPEN", "T_ARRAY_CLOSE", "T_AGGREGATE", "T_ALL",
|
||||
"T_AND", "T_ANY", "T_ASC", "T_COLLECT", "T_DESC", "T_DISTINCT", "T_FALSE",
|
||||
"T_FILTER", "T_FOR", "T_GRAPH", "T_IN", "T_INBOUND", "T_INSERT", "T_INTO",
|
||||
"T_K_SHORTEST_PATHS", "T_LET", "T_LIKE", "T_LIMIT", "T_NONE", "T_NOT",
|
||||
"T_NULL", "T_OR", "T_OUTBOUND", "T_REMOVE", "T_REPLACE", "T_RETURN", "T_SHORTEST_PATH",
|
||||
"T_SORT", "T_TRUE", "T_UPDATE", "T_UPSERT", "T_WITH", "T_KEEP", "T_COUNT",
|
||||
"T_OPTIONS", "T_PRUNE", "T_SEARCH", "T_TO", "T_CURRENT", "T_NEW", "T_OLD",
|
||||
"T_STRING", "T_INT", "T_FLOAT", "T_PARAMETER", "T_QUOTED_STRING", "SINGLE_LINE_COMMENT",
|
||||
"MULTILINE_COMMENT", "SPACES", "UNEXPECTED_CHAR", "HEX_DIGIT", "DIGIT",
|
||||
"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O",
|
||||
"P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "ERROR_RECONGNIGION",
|
||||
}
|
||||
|
||||
type CAQLLexer struct {
|
||||
*antlr.BaseLexer
|
||||
channelNames []string
|
||||
modeNames []string
|
||||
// TODO: EOF string
|
||||
}
|
||||
|
||||
// NewCAQLLexer produces a new lexer instance for the optional input antlr.CharStream.
|
||||
//
|
||||
// The *CAQLLexer instance produced may be reused by calling the SetInputStream method.
|
||||
// The initial lexer configuration is expensive to construct, and the object is not thread-safe;
|
||||
// however, if used within a Golang sync.Pool, the construction cost amortizes well and the
|
||||
// objects can be used in a thread-safe manner.
|
||||
func NewCAQLLexer(input antlr.CharStream) *CAQLLexer {
|
||||
l := new(CAQLLexer)
|
||||
lexerDeserializer := antlr.NewATNDeserializer(nil)
|
||||
lexerAtn := lexerDeserializer.DeserializeFromUInt16(serializedLexerAtn)
|
||||
lexerDecisionToDFA := make([]*antlr.DFA, len(lexerAtn.DecisionToState))
|
||||
for index, ds := range lexerAtn.DecisionToState {
|
||||
lexerDecisionToDFA[index] = antlr.NewDFA(ds, index)
|
||||
}
|
||||
l.BaseLexer = antlr.NewBaseLexer(input)
|
||||
l.Interpreter = antlr.NewLexerATNSimulator(l, lexerAtn, lexerDecisionToDFA, antlr.NewPredictionContextCache())
|
||||
|
||||
l.channelNames = lexerChannelNames
|
||||
l.modeNames = lexerModeNames
|
||||
l.RuleNames = lexerRuleNames
|
||||
l.LiteralNames = lexerLiteralNames
|
||||
l.SymbolicNames = lexerSymbolicNames
|
||||
l.GrammarFileName = "CAQLLexer.g4"
|
||||
// TODO: l.EOF = antlr.TokenEOF
|
||||
|
||||
return l
|
||||
}
|
||||
|
||||
// CAQLLexer tokens.
|
||||
const (
|
||||
CAQLLexerDOT = 1
|
||||
CAQLLexerT_REGEX_MATCH = 2
|
||||
CAQLLexerT_REGEX_NON_MATCH = 3
|
||||
CAQLLexerT_EQ = 4
|
||||
CAQLLexerT_NE = 5
|
||||
CAQLLexerT_LT = 6
|
||||
CAQLLexerT_GT = 7
|
||||
CAQLLexerT_LE = 8
|
||||
CAQLLexerT_GE = 9
|
||||
CAQLLexerT_PLUS = 10
|
||||
CAQLLexerT_MINUS = 11
|
||||
CAQLLexerT_TIMES = 12
|
||||
CAQLLexerT_DIV = 13
|
||||
CAQLLexerT_MOD = 14
|
||||
CAQLLexerT_QUESTION = 15
|
||||
CAQLLexerT_COLON = 16
|
||||
CAQLLexerT_SCOPE = 17
|
||||
CAQLLexerT_RANGE = 18
|
||||
CAQLLexerT_COMMA = 19
|
||||
CAQLLexerT_OPEN = 20
|
||||
CAQLLexerT_CLOSE = 21
|
||||
CAQLLexerT_OBJECT_OPEN = 22
|
||||
CAQLLexerT_OBJECT_CLOSE = 23
|
||||
CAQLLexerT_ARRAY_OPEN = 24
|
||||
CAQLLexerT_ARRAY_CLOSE = 25
|
||||
CAQLLexerT_AGGREGATE = 26
|
||||
CAQLLexerT_ALL = 27
|
||||
CAQLLexerT_AND = 28
|
||||
CAQLLexerT_ANY = 29
|
||||
CAQLLexerT_ASC = 30
|
||||
CAQLLexerT_COLLECT = 31
|
||||
CAQLLexerT_DESC = 32
|
||||
CAQLLexerT_DISTINCT = 33
|
||||
CAQLLexerT_FALSE = 34
|
||||
CAQLLexerT_FILTER = 35
|
||||
CAQLLexerT_FOR = 36
|
||||
CAQLLexerT_GRAPH = 37
|
||||
CAQLLexerT_IN = 38
|
||||
CAQLLexerT_INBOUND = 39
|
||||
CAQLLexerT_INSERT = 40
|
||||
CAQLLexerT_INTO = 41
|
||||
CAQLLexerT_K_SHORTEST_PATHS = 42
|
||||
CAQLLexerT_LET = 43
|
||||
CAQLLexerT_LIKE = 44
|
||||
CAQLLexerT_LIMIT = 45
|
||||
CAQLLexerT_NONE = 46
|
||||
CAQLLexerT_NOT = 47
|
||||
CAQLLexerT_NULL = 48
|
||||
CAQLLexerT_OR = 49
|
||||
CAQLLexerT_OUTBOUND = 50
|
||||
CAQLLexerT_REMOVE = 51
|
||||
CAQLLexerT_REPLACE = 52
|
||||
CAQLLexerT_RETURN = 53
|
||||
CAQLLexerT_SHORTEST_PATH = 54
|
||||
CAQLLexerT_SORT = 55
|
||||
CAQLLexerT_TRUE = 56
|
||||
CAQLLexerT_UPDATE = 57
|
||||
CAQLLexerT_UPSERT = 58
|
||||
CAQLLexerT_WITH = 59
|
||||
CAQLLexerT_KEEP = 60
|
||||
CAQLLexerT_COUNT = 61
|
||||
CAQLLexerT_OPTIONS = 62
|
||||
CAQLLexerT_PRUNE = 63
|
||||
CAQLLexerT_SEARCH = 64
|
||||
CAQLLexerT_TO = 65
|
||||
CAQLLexerT_CURRENT = 66
|
||||
CAQLLexerT_NEW = 67
|
||||
CAQLLexerT_OLD = 68
|
||||
CAQLLexerT_STRING = 69
|
||||
CAQLLexerT_INT = 70
|
||||
CAQLLexerT_FLOAT = 71
|
||||
CAQLLexerT_PARAMETER = 72
|
||||
CAQLLexerT_QUOTED_STRING = 73
|
||||
CAQLLexerSINGLE_LINE_COMMENT = 74
|
||||
CAQLLexerMULTILINE_COMMENT = 75
|
||||
CAQLLexerSPACES = 76
|
||||
CAQLLexerUNEXPECTED_CHAR = 77
|
||||
CAQLLexerERROR_RECONGNIGION = 78
|
||||
)
|
||||
|
||||
// CAQLLexerERRORCHANNEL is the CAQLLexer channel.
|
||||
const CAQLLexerERRORCHANNEL = 2
|
||||
2526
generated/caql/parser/caql_parser.go
Normal file
2526
generated/caql/parser/caql_parser.go
Normal file
File diff suppressed because it is too large
Load Diff
88
generated/caql/parser/caqlparser_base_listener.go
Normal file
88
generated/caql/parser/caqlparser_base_listener.go
Normal file
@@ -0,0 +1,88 @@
|
||||
// Code generated from CAQLParser.g4 by ANTLR 4.9.2. DO NOT EDIT.
|
||||
|
||||
package parser // CAQLParser
|
||||
|
||||
import "github.com/antlr/antlr4/runtime/Go/antlr"
|
||||
|
||||
// BaseCAQLParserListener is a complete listener for a parse tree produced by CAQLParser.
|
||||
type BaseCAQLParserListener struct{}
|
||||
|
||||
var _ CAQLParserListener = &BaseCAQLParserListener{}
|
||||
|
||||
// VisitTerminal is called when a terminal node is visited.
|
||||
func (s *BaseCAQLParserListener) VisitTerminal(node antlr.TerminalNode) {}
|
||||
|
||||
// VisitErrorNode is called when an error node is visited.
|
||||
func (s *BaseCAQLParserListener) VisitErrorNode(node antlr.ErrorNode) {}
|
||||
|
||||
// EnterEveryRule is called when any rule is entered.
|
||||
func (s *BaseCAQLParserListener) EnterEveryRule(ctx antlr.ParserRuleContext) {}
|
||||
|
||||
// ExitEveryRule is called when any rule is exited.
|
||||
func (s *BaseCAQLParserListener) ExitEveryRule(ctx antlr.ParserRuleContext) {}
|
||||
|
||||
// EnterParse is called when production parse is entered.
|
||||
func (s *BaseCAQLParserListener) EnterParse(ctx *ParseContext) {}
|
||||
|
||||
// ExitParse is called when production parse is exited.
|
||||
func (s *BaseCAQLParserListener) ExitParse(ctx *ParseContext) {}
|
||||
|
||||
// EnterExpression is called when production expression is entered.
|
||||
func (s *BaseCAQLParserListener) EnterExpression(ctx *ExpressionContext) {}
|
||||
|
||||
// ExitExpression is called when production expression is exited.
|
||||
func (s *BaseCAQLParserListener) ExitExpression(ctx *ExpressionContext) {}
|
||||
|
||||
// EnterOperator_unary is called when production operator_unary is entered.
|
||||
func (s *BaseCAQLParserListener) EnterOperator_unary(ctx *Operator_unaryContext) {}
|
||||
|
||||
// ExitOperator_unary is called when production operator_unary is exited.
|
||||
func (s *BaseCAQLParserListener) ExitOperator_unary(ctx *Operator_unaryContext) {}
|
||||
|
||||
// EnterReference is called when production reference is entered.
|
||||
func (s *BaseCAQLParserListener) EnterReference(ctx *ReferenceContext) {}
|
||||
|
||||
// ExitReference is called when production reference is exited.
|
||||
func (s *BaseCAQLParserListener) ExitReference(ctx *ReferenceContext) {}
|
||||
|
||||
// EnterCompound_value is called when production compound_value is entered.
|
||||
func (s *BaseCAQLParserListener) EnterCompound_value(ctx *Compound_valueContext) {}
|
||||
|
||||
// ExitCompound_value is called when production compound_value is exited.
|
||||
func (s *BaseCAQLParserListener) ExitCompound_value(ctx *Compound_valueContext) {}
|
||||
|
||||
// EnterFunction_call is called when production function_call is entered.
|
||||
func (s *BaseCAQLParserListener) EnterFunction_call(ctx *Function_callContext) {}
|
||||
|
||||
// ExitFunction_call is called when production function_call is exited.
|
||||
func (s *BaseCAQLParserListener) ExitFunction_call(ctx *Function_callContext) {}
|
||||
|
||||
// EnterValue_literal is called when production value_literal is entered.
|
||||
func (s *BaseCAQLParserListener) EnterValue_literal(ctx *Value_literalContext) {}
|
||||
|
||||
// ExitValue_literal is called when production value_literal is exited.
|
||||
func (s *BaseCAQLParserListener) ExitValue_literal(ctx *Value_literalContext) {}
|
||||
|
||||
// EnterArray is called when production array is entered.
|
||||
func (s *BaseCAQLParserListener) EnterArray(ctx *ArrayContext) {}
|
||||
|
||||
// ExitArray is called when production array is exited.
|
||||
func (s *BaseCAQLParserListener) ExitArray(ctx *ArrayContext) {}
|
||||
|
||||
// EnterObject is called when production object is entered.
|
||||
func (s *BaseCAQLParserListener) EnterObject(ctx *ObjectContext) {}
|
||||
|
||||
// ExitObject is called when production object is exited.
|
||||
func (s *BaseCAQLParserListener) ExitObject(ctx *ObjectContext) {}
|
||||
|
||||
// EnterObject_element is called when production object_element is entered.
|
||||
func (s *BaseCAQLParserListener) EnterObject_element(ctx *Object_elementContext) {}
|
||||
|
||||
// ExitObject_element is called when production object_element is exited.
|
||||
func (s *BaseCAQLParserListener) ExitObject_element(ctx *Object_elementContext) {}
|
||||
|
||||
// EnterObject_element_name is called when production object_element_name is entered.
|
||||
func (s *BaseCAQLParserListener) EnterObject_element_name(ctx *Object_element_nameContext) {}
|
||||
|
||||
// ExitObject_element_name is called when production object_element_name is exited.
|
||||
func (s *BaseCAQLParserListener) ExitObject_element_name(ctx *Object_element_nameContext) {}
|
||||
76
generated/caql/parser/caqlparser_listener.go
Normal file
76
generated/caql/parser/caqlparser_listener.go
Normal file
@@ -0,0 +1,76 @@
|
||||
// Code generated from CAQLParser.g4 by ANTLR 4.9.2. DO NOT EDIT.
|
||||
|
||||
package parser // CAQLParser
|
||||
|
||||
import "github.com/antlr/antlr4/runtime/Go/antlr"
|
||||
|
||||
// CAQLParserListener is a complete listener for a parse tree produced by CAQLParser.
|
||||
type CAQLParserListener interface {
|
||||
antlr.ParseTreeListener
|
||||
|
||||
// EnterParse is called when entering the parse production.
|
||||
EnterParse(c *ParseContext)
|
||||
|
||||
// EnterExpression is called when entering the expression production.
|
||||
EnterExpression(c *ExpressionContext)
|
||||
|
||||
// EnterOperator_unary is called when entering the operator_unary production.
|
||||
EnterOperator_unary(c *Operator_unaryContext)
|
||||
|
||||
// EnterReference is called when entering the reference production.
|
||||
EnterReference(c *ReferenceContext)
|
||||
|
||||
// EnterCompound_value is called when entering the compound_value production.
|
||||
EnterCompound_value(c *Compound_valueContext)
|
||||
|
||||
// EnterFunction_call is called when entering the function_call production.
|
||||
EnterFunction_call(c *Function_callContext)
|
||||
|
||||
// EnterValue_literal is called when entering the value_literal production.
|
||||
EnterValue_literal(c *Value_literalContext)
|
||||
|
||||
// EnterArray is called when entering the array production.
|
||||
EnterArray(c *ArrayContext)
|
||||
|
||||
// EnterObject is called when entering the object production.
|
||||
EnterObject(c *ObjectContext)
|
||||
|
||||
// EnterObject_element is called when entering the object_element production.
|
||||
EnterObject_element(c *Object_elementContext)
|
||||
|
||||
// EnterObject_element_name is called when entering the object_element_name production.
|
||||
EnterObject_element_name(c *Object_element_nameContext)
|
||||
|
||||
// ExitParse is called when exiting the parse production.
|
||||
ExitParse(c *ParseContext)
|
||||
|
||||
// ExitExpression is called when exiting the expression production.
|
||||
ExitExpression(c *ExpressionContext)
|
||||
|
||||
// ExitOperator_unary is called when exiting the operator_unary production.
|
||||
ExitOperator_unary(c *Operator_unaryContext)
|
||||
|
||||
// ExitReference is called when exiting the reference production.
|
||||
ExitReference(c *ReferenceContext)
|
||||
|
||||
// ExitCompound_value is called when exiting the compound_value production.
|
||||
ExitCompound_value(c *Compound_valueContext)
|
||||
|
||||
// ExitFunction_call is called when exiting the function_call production.
|
||||
ExitFunction_call(c *Function_callContext)
|
||||
|
||||
// ExitValue_literal is called when exiting the value_literal production.
|
||||
ExitValue_literal(c *Value_literalContext)
|
||||
|
||||
// ExitArray is called when exiting the array production.
|
||||
ExitArray(c *ArrayContext)
|
||||
|
||||
// ExitObject is called when exiting the object production.
|
||||
ExitObject(c *ObjectContext)
|
||||
|
||||
// ExitObject_element is called when exiting the object_element production.
|
||||
ExitObject_element(c *Object_elementContext)
|
||||
|
||||
// ExitObject_element_name is called when exiting the object_element_name production.
|
||||
ExitObject_element_name(c *Object_element_nameContext)
|
||||
}
|
||||
6646
generated/catalyst.json
Normal file
6646
generated/catalyst.json
Normal file
File diff suppressed because it is too large
Load Diff
7058
generated/catalyst.yml
Normal file
7058
generated/catalyst.yml
Normal file
File diff suppressed because it is too large
Load Diff
6067
generated/community.json
Normal file
6067
generated/community.json
Normal file
File diff suppressed because it is too large
Load Diff
6646
generated/community.yml
Normal file
6646
generated/community.yml
Normal file
File diff suppressed because it is too large
Load Diff
643
generated/models/models.go
Executable file
643
generated/models/models.go
Executable file
@@ -0,0 +1,643 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/xeipuuv/gojsonschema"
|
||||
)
|
||||
|
||||
var (
|
||||
schemaLoader = gojsonschema.NewSchemaLoader()
|
||||
ArtifactSchema = new(gojsonschema.Schema)
|
||||
ArtifactOriginSchema = new(gojsonschema.Schema)
|
||||
AutomationSchema = new(gojsonschema.Schema)
|
||||
AutomationFormSchema = new(gojsonschema.Schema)
|
||||
AutomationResponseSchema = new(gojsonschema.Schema)
|
||||
CommentSchema = new(gojsonschema.Schema)
|
||||
CommentFormSchema = new(gojsonschema.Schema)
|
||||
ContextSchema = new(gojsonschema.Schema)
|
||||
EnrichmentSchema = new(gojsonschema.Schema)
|
||||
EnrichmentFormSchema = new(gojsonschema.Schema)
|
||||
FileSchema = new(gojsonschema.Schema)
|
||||
JobSchema = new(gojsonschema.Schema)
|
||||
JobFormSchema = new(gojsonschema.Schema)
|
||||
JobResponseSchema = new(gojsonschema.Schema)
|
||||
LogEntrySchema = new(gojsonschema.Schema)
|
||||
MessageSchema = new(gojsonschema.Schema)
|
||||
NewUserResponseSchema = new(gojsonschema.Schema)
|
||||
OriginSchema = new(gojsonschema.Schema)
|
||||
PlaybookSchema = new(gojsonschema.Schema)
|
||||
PlaybookResponseSchema = new(gojsonschema.Schema)
|
||||
PlaybookTemplateSchema = new(gojsonschema.Schema)
|
||||
PlaybookTemplateFormSchema = new(gojsonschema.Schema)
|
||||
PlaybookTemplateResponseSchema = new(gojsonschema.Schema)
|
||||
ReferenceSchema = new(gojsonschema.Schema)
|
||||
SettingsSchema = new(gojsonschema.Schema)
|
||||
StatisticsSchema = new(gojsonschema.Schema)
|
||||
TaskSchema = new(gojsonschema.Schema)
|
||||
TaskFormSchema = new(gojsonschema.Schema)
|
||||
TaskOriginSchema = new(gojsonschema.Schema)
|
||||
TaskResponseSchema = new(gojsonschema.Schema)
|
||||
TaskWithContextSchema = new(gojsonschema.Schema)
|
||||
TicketSchema = new(gojsonschema.Schema)
|
||||
TicketFormSchema = new(gojsonschema.Schema)
|
||||
TicketListSchema = new(gojsonschema.Schema)
|
||||
TicketResponseSchema = new(gojsonschema.Schema)
|
||||
TicketSimpleResponseSchema = new(gojsonschema.Schema)
|
||||
TicketTemplateSchema = new(gojsonschema.Schema)
|
||||
TicketTemplateFormSchema = new(gojsonschema.Schema)
|
||||
TicketTemplateResponseSchema = new(gojsonschema.Schema)
|
||||
TicketTypeSchema = new(gojsonschema.Schema)
|
||||
TicketTypeFormSchema = new(gojsonschema.Schema)
|
||||
TicketTypeResponseSchema = new(gojsonschema.Schema)
|
||||
TicketWithTicketsSchema = new(gojsonschema.Schema)
|
||||
TypeSchema = new(gojsonschema.Schema)
|
||||
UserSchema = new(gojsonschema.Schema)
|
||||
UserDataSchema = new(gojsonschema.Schema)
|
||||
UserDataResponseSchema = new(gojsonschema.Schema)
|
||||
UserFormSchema = new(gojsonschema.Schema)
|
||||
UserResponseSchema = new(gojsonschema.Schema)
|
||||
)
|
||||
|
||||
func init() {
|
||||
err := schemaLoader.AddSchemas(
|
||||
gojsonschema.NewStringLoader(`{"type":"object","required":["name"],"x-embed":"","properties":{"enrichments":{"type":"object","additionalProperties":{"$ref":"#/definitions/Enrichment"}},"name":{"type":"string"},"status":{"type":"string"},"type":{"type":"string"}},"$id":"#/definitions/Artifact"}`),
|
||||
gojsonschema.NewStringLoader(`{"type":"object","required":["ticket_id","artifact"],"x-embed":"","properties":{"artifact":{"type":"string"},"ticket_id":{"format":"int64","type":"integer"}},"$id":"#/definitions/ArtifactOrigin"}`),
|
||||
gojsonschema.NewStringLoader(`{"type":"object","required":["image","script","type"],"x-embed":"","properties":{"image":{"type":"string"},"schema":{"type":"string"},"script":{"type":"string"},"type":{"items":{"type":"string","enum":["artifact","playbook","global"]},"type":"array"}},"$id":"#/definitions/Automation"}`),
|
||||
gojsonschema.NewStringLoader(`{"type":"object","required":["id","image","script","type"],"x-embed":"","properties":{"id":{"type":"string"},"image":{"type":"string"},"schema":{"type":"string"},"script":{"type":"string"},"type":{"items":{"type":"string","enum":["artifact","playbook","global"]},"type":"array"}},"$id":"#/definitions/AutomationForm"}`),
|
||||
gojsonschema.NewStringLoader(`{"type":"object","required":["id","image","script","type"],"x-embed":"","properties":{"id":{"type":"string"},"image":{"type":"string"},"schema":{"type":"string"},"script":{"type":"string"},"type":{"items":{"type":"string","enum":["artifact","playbook","global"]},"type":"array"}},"$id":"#/definitions/AutomationResponse"}`),
|
||||
gojsonschema.NewStringLoader(`{"type":"object","required":["creator","created","message"],"x-embed":"","properties":{"created":{"format":"date-time","type":"string"},"creator":{"type":"string"},"message":{"type":"string"}},"$id":"#/definitions/Comment"}`),
|
||||
gojsonschema.NewStringLoader(`{"type":"object","required":["message"],"x-embed":"","properties":{"created":{"format":"date-time","type":"string"},"creator":{"type":"string"},"message":{"type":"string"}},"$id":"#/definitions/CommentForm"}`),
|
||||
gojsonschema.NewStringLoader(`{"type":"object","x-embed":"","properties":{"artifact":{"$ref":"#/definitions/Artifact"},"playbook":{"$ref":"#/definitions/PlaybookResponse"},"task":{"$ref":"#/definitions/TaskResponse"},"ticket":{"$ref":"#/definitions/TicketResponse"}},"$id":"#/definitions/Context"}`),
|
||||
gojsonschema.NewStringLoader(`{"type":"object","required":["name","data","created"],"x-embed":"","properties":{"created":{"format":"date-time","type":"string"},"data":{"type":"object"},"name":{"type":"string"}},"$id":"#/definitions/Enrichment"}`),
|
||||
gojsonschema.NewStringLoader(`{"type":"object","required":["name","data"],"x-embed":"","properties":{"data":{"type":"object"},"name":{"type":"string"}},"$id":"#/definitions/EnrichmentForm"}`),
|
||||
gojsonschema.NewStringLoader(`{"type":"object","required":["key","name"],"x-embed":"","properties":{"key":{"type":"string"},"name":{"type":"string"}},"$id":"#/definitions/File"}`),
|
||||
gojsonschema.NewStringLoader(`{"type":"object","required":["automation","running","status"],"x-embed":"","properties":{"automation":{"type":"string"},"container":{"type":"string"},"log":{"type":"string"},"origin":{"$ref":"#/definitions/Origin"},"output":{"type":"object"},"payload":{},"running":{"type":"boolean"},"status":{"type":"string"}},"$id":"#/definitions/Job"}`),
|
||||
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":["reference","creator","created","message"],"x-embed":"","properties":{"created":{"format":"date-time","type":"string"},"creator":{"type":"string"},"message":{"type":"string"},"reference":{"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","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"}`),
|
||||
gojsonschema.NewStringLoader(`{"type":"object","required":["name","tasks"],"x-embed":"","properties":{"name":{"type":"string"},"tasks":{"type":"object","additionalProperties":{"$ref":"#/definitions/TaskResponse"}}},"$id":"#/definitions/PlaybookResponse"}`),
|
||||
gojsonschema.NewStringLoader(`{"type":"object","required":["name","yaml"],"x-embed":"","properties":{"name":{"type":"string"},"yaml":{"type":"string"}},"$id":"#/definitions/PlaybookTemplate"}`),
|
||||
gojsonschema.NewStringLoader(`{"type":"object","required":["yaml"],"x-embed":"","properties":{"id":{"type":"string"},"yaml":{"type":"string"}},"$id":"#/definitions/PlaybookTemplateForm"}`),
|
||||
gojsonschema.NewStringLoader(`{"type":"object","required":["id","name","yaml"],"x-embed":"","properties":{"id":{"type":"string"},"name":{"type":"string"},"yaml":{"type":"string"}},"$id":"#/definitions/PlaybookTemplateResponse"}`),
|
||||
gojsonschema.NewStringLoader(`{"type":"object","required":["name","href"],"x-embed":"","properties":{"href":{"type":"string"},"name":{"type":"string"}},"$id":"#/definitions/Reference"}`),
|
||||
gojsonschema.NewStringLoader(`{"type":"object","required":["version","tier","timeformat","ticketTypes","artifactStates"],"x-embed":"","properties":{"artifactStates":{"title":"Artifact States","items":{"$ref":"#/definitions/Type"},"type":"array"},"roles":{"title":"Roles","items":{"type":"string"},"type":"array"},"ticketTypes":{"title":"Ticket Types","items":{"$ref":"#/definitions/TicketTypeResponse"},"type":"array"},"tier":{"title":"Tier","type":"string","enum":["community","enterprise"]},"timeformat":{"title":"Time Format","type":"string"},"version":{"title":"Version","type":"string"}},"$id":"#/definitions/Settings"}`),
|
||||
gojsonschema.NewStringLoader(`{"type":"object","required":["unassigned","open_tickets_per_user","tickets_per_week","tickets_per_type"],"x-embed":"","properties":{"open_tickets_per_user":{"type":"object","additionalProperties":{"type":"integer"}},"tickets_per_type":{"type":"object","additionalProperties":{"type":"integer"}},"tickets_per_week":{"type":"object","additionalProperties":{"type":"integer"}},"unassigned":{"type":"integer"}},"$id":"#/definitions/Statistics"}`),
|
||||
gojsonschema.NewStringLoader(`{"type":"object","required":["name","type","done","created"],"x-embed":"","properties":{"automation":{"type":"string"},"closed":{"format":"date-time","type":"string"},"created":{"format":"date-time","type":"string"},"data":{"type":"object"},"done":{"type":"boolean"},"join":{"type":"boolean"},"name":{"type":"string"},"next":{"type":"object","additionalProperties":{"type":"string"}},"owner":{"type":"string"},"payload":{"type":"object","additionalProperties":{"type":"string"}},"schema":{"type":"object"},"type":{"type":"string","enum":["task","input","automation"]}},"$id":"#/definitions/Task"}`),
|
||||
gojsonschema.NewStringLoader(`{"type":"object","required":["name","type"],"x-embed":"","properties":{"automation":{"type":"string"},"closed":{"format":"date-time","type":"string"},"created":{"format":"date-time","type":"string"},"data":{"type":"object"},"done":{"type":"boolean"},"join":{"type":"boolean"},"name":{"type":"string"},"next":{"type":"object","additionalProperties":{"type":"string"}},"owner":{"type":"string"},"payload":{"type":"object","additionalProperties":{"type":"string"}},"schema":{"type":"object"},"type":{"type":"string","enum":["task","input","automation"]}},"$id":"#/definitions/TaskForm"}`),
|
||||
gojsonschema.NewStringLoader(`{"type":"object","required":["ticket_id","playbook_id","task_id"],"x-embed":"","properties":{"playbook_id":{"type":"string"},"task_id":{"type":"string"},"ticket_id":{"format":"int64","type":"integer"}},"$id":"#/definitions/TaskOrigin"}`),
|
||||
gojsonschema.NewStringLoader(`{"type":"object","required":["name","type","done","created","order","active"],"x-embed":"","properties":{"active":{"type":"boolean"},"automation":{"type":"string"},"closed":{"format":"date-time","type":"string"},"created":{"format":"date-time","type":"string"},"data":{"type":"object"},"done":{"type":"boolean"},"join":{"type":"boolean"},"name":{"type":"string"},"next":{"type":"object","additionalProperties":{"type":"string"}},"order":{"format":"int64","type":"number"},"owner":{"type":"string"},"payload":{"type":"object","additionalProperties":{"type":"string"}},"schema":{"type":"object"},"type":{"type":"string","enum":["task","input","automation"]}},"$id":"#/definitions/TaskResponse"}`),
|
||||
gojsonschema.NewStringLoader(`{"type":"object","required":["ticket_id","ticket_name","playbook_id","playbook_name","task_id","task"],"x-embed":"","properties":{"playbook_id":{"type":"string"},"playbook_name":{"type":"string"},"task":{"$ref":"#/definitions/TaskResponse"},"task_id":{"type":"string"},"ticket_id":{"format":"int64","type":"number"},"ticket_name":{"type":"string"}},"$id":"#/definitions/TaskWithContext"}`),
|
||||
gojsonschema.NewStringLoader(`{"type":"object","required":["name","type","status","created","modified","schema"],"x-embed":"","properties":{"artifacts":{"items":{"$ref":"#/definitions/Artifact"},"type":"array"},"comments":{"items":{"$ref":"#/definitions/Comment"},"type":"array"},"created":{"format":"date-time","type":"string"},"details":{"type":"object"},"files":{"items":{"$ref":"#/definitions/File"},"type":"array"},"modified":{"format":"date-time","type":"string"},"name":{"type":"string"},"owner":{"type":"string"},"playbooks":{"type":"object","additionalProperties":{"$ref":"#/definitions/Playbook"}},"read":{"items":{"type":"string"},"type":"array"},"references":{"items":{"$ref":"#/definitions/Reference"},"type":"array"},"schema":{"type":"string"},"status":{"type":"string"},"type":{"type":"string"},"write":{"items":{"type":"string"},"type":"array"}},"$id":"#/definitions/Ticket"}`),
|
||||
gojsonschema.NewStringLoader(`{"type":"object","required":["name","type","status"],"x-embed":"","properties":{"artifacts":{"items":{"$ref":"#/definitions/Artifact"},"type":"array"},"comments":{"items":{"$ref":"#/definitions/Comment"},"type":"array"},"created":{"format":"date-time","type":"string"},"details":{"type":"object"},"files":{"items":{"$ref":"#/definitions/File"},"type":"array"},"id":{"format":"int64","type":"integer"},"modified":{"format":"date-time","type":"string"},"name":{"type":"string"},"owner":{"type":"string"},"playbooks":{"items":{"$ref":"#/definitions/PlaybookTemplateForm"},"type":"array"},"read":{"items":{"type":"string"},"type":"array"},"references":{"items":{"$ref":"#/definitions/Reference"},"type":"array"},"schema":{"type":"string"},"status":{"type":"string"},"type":{"type":"string"},"write":{"items":{"type":"string"},"type":"array"}},"$id":"#/definitions/TicketForm"}`),
|
||||
gojsonschema.NewStringLoader(`{"type":"object","required":["tickets","count"],"x-embed":"","properties":{"count":{"type":"number"},"tickets":{"items":{"$ref":"#/definitions/TicketSimpleResponse"},"type":"array"}},"$id":"#/definitions/TicketList"}`),
|
||||
gojsonschema.NewStringLoader(`{"type":"object","required":["id","name","type","status","created","modified","schema"],"x-embed":"","properties":{"artifacts":{"items":{"$ref":"#/definitions/Artifact"},"type":"array"},"comments":{"items":{"$ref":"#/definitions/Comment"},"type":"array"},"created":{"format":"date-time","type":"string"},"details":{"type":"object"},"files":{"items":{"$ref":"#/definitions/File"},"type":"array"},"id":{"format":"int64","type":"integer"},"modified":{"format":"date-time","type":"string"},"name":{"type":"string"},"owner":{"type":"string"},"playbooks":{"type":"object","additionalProperties":{"$ref":"#/definitions/PlaybookResponse"}},"read":{"items":{"type":"string"},"type":"array"},"references":{"items":{"$ref":"#/definitions/Reference"},"type":"array"},"schema":{"type":"string"},"status":{"type":"string"},"type":{"type":"string"},"write":{"items":{"type":"string"},"type":"array"}},"$id":"#/definitions/TicketResponse"}`),
|
||||
gojsonschema.NewStringLoader(`{"type":"object","required":["id","name","type","status","created","modified","schema"],"x-embed":"","properties":{"artifacts":{"items":{"$ref":"#/definitions/Artifact"},"type":"array"},"comments":{"items":{"$ref":"#/definitions/Comment"},"type":"array"},"created":{"format":"date-time","type":"string"},"details":{"type":"object"},"files":{"items":{"$ref":"#/definitions/File"},"type":"array"},"id":{"format":"int64","type":"integer"},"modified":{"format":"date-time","type":"string"},"name":{"type":"string"},"owner":{"type":"string"},"playbooks":{"type":"object","additionalProperties":{"$ref":"#/definitions/Playbook"}},"read":{"items":{"type":"string"},"type":"array"},"references":{"items":{"$ref":"#/definitions/Reference"},"type":"array"},"schema":{"type":"string"},"status":{"type":"string"},"type":{"type":"string"},"write":{"items":{"type":"string"},"type":"array"}},"$id":"#/definitions/TicketSimpleResponse"}`),
|
||||
gojsonschema.NewStringLoader(`{"type":"object","required":["name","schema"],"x-embed":"","properties":{"name":{"type":"string"},"schema":{"type":"string"}},"$id":"#/definitions/TicketTemplate"}`),
|
||||
gojsonschema.NewStringLoader(`{"type":"object","required":["name","schema"],"x-embed":"","properties":{"id":{"type":"string"},"name":{"type":"string"},"schema":{"type":"string"}},"$id":"#/definitions/TicketTemplateForm"}`),
|
||||
gojsonschema.NewStringLoader(`{"type":"object","required":["id","name","schema"],"x-embed":"","properties":{"id":{"type":"string"},"name":{"type":"string"},"schema":{"type":"string"}},"$id":"#/definitions/TicketTemplateResponse"}`),
|
||||
gojsonschema.NewStringLoader(`{"type":"object","required":["name","icon","default_template","default_playbooks"],"x-embed":"","properties":{"default_groups":{"items":{"type":"string"},"type":"array"},"default_playbooks":{"items":{"type":"string"},"type":"array"},"default_template":{"type":"string"},"icon":{"type":"string"},"name":{"type":"string"}},"$id":"#/definitions/TicketType"}`),
|
||||
gojsonschema.NewStringLoader(`{"type":"object","required":["name","icon","default_template","default_playbooks"],"x-embed":"","properties":{"default_groups":{"items":{"type":"string"},"type":"array"},"default_playbooks":{"items":{"type":"string"},"type":"array"},"default_template":{"type":"string"},"icon":{"type":"string"},"id":{"type":"string"},"name":{"type":"string"}},"$id":"#/definitions/TicketTypeForm"}`),
|
||||
gojsonschema.NewStringLoader(`{"type":"object","required":["id","name","icon","default_template","default_playbooks"],"x-embed":"","properties":{"default_groups":{"items":{"type":"string"},"type":"array"},"default_playbooks":{"items":{"type":"string"},"type":"array"},"default_template":{"type":"string"},"icon":{"type":"string"},"id":{"type":"string"},"name":{"type":"string"}},"$id":"#/definitions/TicketTypeResponse"}`),
|
||||
gojsonschema.NewStringLoader(`{"type":"object","required":["id","name","type","status","created","modified","schema"],"x-embed":"","properties":{"artifacts":{"items":{"$ref":"#/definitions/Artifact"},"type":"array"},"comments":{"items":{"$ref":"#/definitions/Comment"},"type":"array"},"created":{"format":"date-time","type":"string"},"details":{"type":"object"},"files":{"items":{"$ref":"#/definitions/File"},"type":"array"},"id":{"format":"int64","type":"integer"},"modified":{"format":"date-time","type":"string"},"name":{"type":"string"},"owner":{"type":"string"},"playbooks":{"type":"object","additionalProperties":{"$ref":"#/definitions/PlaybookResponse"}},"read":{"items":{"type":"string"},"type":"array"},"references":{"items":{"$ref":"#/definitions/Reference"},"type":"array"},"schema":{"type":"string"},"status":{"type":"string"},"tickets":{"items":{"$ref":"#/definitions/TicketSimpleResponse"},"type":"array"},"type":{"type":"string"},"write":{"items":{"type":"string"},"type":"array"}},"$id":"#/definitions/TicketWithTickets"}`),
|
||||
gojsonschema.NewStringLoader(`{"type":"object","required":["id","name","icon"],"x-embed":"","properties":{"color":{"title":"Color","type":"string","enum":["error","info","success","warning"]},"icon":{"title":"Icon (https://materialdesignicons.com)","type":"string"},"id":{"title":"ID","type":"string"},"name":{"title":"Name","type":"string"}},"$id":"#/definitions/Type"}`),
|
||||
gojsonschema.NewStringLoader(`{"type":"object","required":["blocked","apikey","roles"],"x-embed":"","properties":{"apikey":{"type":"boolean"},"blocked":{"type":"boolean"},"roles":{"items":{"type":"string"},"type":"array"},"sha256":{"type":"string"}},"$id":"#/definitions/User"}`),
|
||||
gojsonschema.NewStringLoader(`{"type":"object","x-embed":"","properties":{"email":{"type":"string"},"image":{"type":"string"},"name":{"type":"string"},"timeformat":{"title":"Time Format (https://moment.github.io/luxon/docs/manual/formatting.html#table-of-tokens)","type":"string"}},"$id":"#/definitions/UserData"}`),
|
||||
gojsonschema.NewStringLoader(`{"type":"object","required":["id"],"x-embed":"","properties":{"email":{"type":"string"},"id":{"type":"string"},"image":{"type":"string"},"name":{"type":"string"},"timeformat":{"title":"Time Format (https://moment.github.io/luxon/docs/manual/formatting.html#table-of-tokens)","type":"string"}},"$id":"#/definitions/UserDataResponse"}`),
|
||||
gojsonschema.NewStringLoader(`{"type":"object","required":["id","blocked","roles","apikey"],"x-embed":"","properties":{"apikey":{"type":"boolean"},"blocked":{"type":"boolean"},"id":{"type":"string"},"roles":{"items":{"type":"string"},"type":"array"}},"$id":"#/definitions/UserForm"}`),
|
||||
gojsonschema.NewStringLoader(`{"type":"object","required":["id","blocked","roles","apikey"],"x-embed":"","properties":{"apikey":{"type":"boolean"},"blocked":{"type":"boolean"},"id":{"type":"string"},"roles":{"items":{"type":"string"},"type":"array"}},"$id":"#/definitions/UserResponse"}`),
|
||||
)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
ArtifactSchema = mustCompile(`#/definitions/Artifact`)
|
||||
ArtifactOriginSchema = mustCompile(`#/definitions/ArtifactOrigin`)
|
||||
AutomationSchema = mustCompile(`#/definitions/Automation`)
|
||||
AutomationFormSchema = mustCompile(`#/definitions/AutomationForm`)
|
||||
AutomationResponseSchema = mustCompile(`#/definitions/AutomationResponse`)
|
||||
CommentSchema = mustCompile(`#/definitions/Comment`)
|
||||
CommentFormSchema = mustCompile(`#/definitions/CommentForm`)
|
||||
ContextSchema = mustCompile(`#/definitions/Context`)
|
||||
EnrichmentSchema = mustCompile(`#/definitions/Enrichment`)
|
||||
EnrichmentFormSchema = mustCompile(`#/definitions/EnrichmentForm`)
|
||||
FileSchema = mustCompile(`#/definitions/File`)
|
||||
JobSchema = mustCompile(`#/definitions/Job`)
|
||||
JobFormSchema = mustCompile(`#/definitions/JobForm`)
|
||||
JobResponseSchema = mustCompile(`#/definitions/JobResponse`)
|
||||
LogEntrySchema = mustCompile(`#/definitions/LogEntry`)
|
||||
MessageSchema = mustCompile(`#/definitions/Message`)
|
||||
NewUserResponseSchema = mustCompile(`#/definitions/NewUserResponse`)
|
||||
OriginSchema = mustCompile(`#/definitions/Origin`)
|
||||
PlaybookSchema = mustCompile(`#/definitions/Playbook`)
|
||||
PlaybookResponseSchema = mustCompile(`#/definitions/PlaybookResponse`)
|
||||
PlaybookTemplateSchema = mustCompile(`#/definitions/PlaybookTemplate`)
|
||||
PlaybookTemplateFormSchema = mustCompile(`#/definitions/PlaybookTemplateForm`)
|
||||
PlaybookTemplateResponseSchema = mustCompile(`#/definitions/PlaybookTemplateResponse`)
|
||||
ReferenceSchema = mustCompile(`#/definitions/Reference`)
|
||||
SettingsSchema = mustCompile(`#/definitions/Settings`)
|
||||
StatisticsSchema = mustCompile(`#/definitions/Statistics`)
|
||||
TaskSchema = mustCompile(`#/definitions/Task`)
|
||||
TaskFormSchema = mustCompile(`#/definitions/TaskForm`)
|
||||
TaskOriginSchema = mustCompile(`#/definitions/TaskOrigin`)
|
||||
TaskResponseSchema = mustCompile(`#/definitions/TaskResponse`)
|
||||
TaskWithContextSchema = mustCompile(`#/definitions/TaskWithContext`)
|
||||
TicketSchema = mustCompile(`#/definitions/Ticket`)
|
||||
TicketFormSchema = mustCompile(`#/definitions/TicketForm`)
|
||||
TicketListSchema = mustCompile(`#/definitions/TicketList`)
|
||||
TicketResponseSchema = mustCompile(`#/definitions/TicketResponse`)
|
||||
TicketSimpleResponseSchema = mustCompile(`#/definitions/TicketSimpleResponse`)
|
||||
TicketTemplateSchema = mustCompile(`#/definitions/TicketTemplate`)
|
||||
TicketTemplateFormSchema = mustCompile(`#/definitions/TicketTemplateForm`)
|
||||
TicketTemplateResponseSchema = mustCompile(`#/definitions/TicketTemplateResponse`)
|
||||
TicketTypeSchema = mustCompile(`#/definitions/TicketType`)
|
||||
TicketTypeFormSchema = mustCompile(`#/definitions/TicketTypeForm`)
|
||||
TicketTypeResponseSchema = mustCompile(`#/definitions/TicketTypeResponse`)
|
||||
TicketWithTicketsSchema = mustCompile(`#/definitions/TicketWithTickets`)
|
||||
TypeSchema = mustCompile(`#/definitions/Type`)
|
||||
UserSchema = mustCompile(`#/definitions/User`)
|
||||
UserDataSchema = mustCompile(`#/definitions/UserData`)
|
||||
UserDataResponseSchema = mustCompile(`#/definitions/UserDataResponse`)
|
||||
UserFormSchema = mustCompile(`#/definitions/UserForm`)
|
||||
UserResponseSchema = mustCompile(`#/definitions/UserResponse`)
|
||||
}
|
||||
|
||||
type Artifact struct {
|
||||
Enrichments map[string]*Enrichment `json:"enrichments,omitempty"`
|
||||
Name string `json:"name"`
|
||||
Status *string `json:"status,omitempty"`
|
||||
Type *string `json:"type,omitempty"`
|
||||
}
|
||||
|
||||
type ArtifactOrigin struct {
|
||||
Artifact string `json:"artifact"`
|
||||
TicketId int64 `json:"ticket_id"`
|
||||
}
|
||||
|
||||
type Automation struct {
|
||||
Image string `json:"image"`
|
||||
Schema *string `json:"schema,omitempty"`
|
||||
Script string `json:"script"`
|
||||
Type []string `json:"type"`
|
||||
}
|
||||
|
||||
type AutomationForm struct {
|
||||
ID string `json:"id"`
|
||||
Image string `json:"image"`
|
||||
Schema *string `json:"schema,omitempty"`
|
||||
Script string `json:"script"`
|
||||
Type []string `json:"type"`
|
||||
}
|
||||
|
||||
type AutomationResponse struct {
|
||||
ID string `json:"id"`
|
||||
Image string `json:"image"`
|
||||
Schema *string `json:"schema,omitempty"`
|
||||
Script string `json:"script"`
|
||||
Type []string `json:"type"`
|
||||
}
|
||||
|
||||
type Comment struct {
|
||||
Created time.Time `json:"created"`
|
||||
Creator string `json:"creator"`
|
||||
Message string `json:"message"`
|
||||
}
|
||||
|
||||
type CommentForm struct {
|
||||
Created *time.Time `json:"created,omitempty"`
|
||||
Creator *string `json:"creator,omitempty"`
|
||||
Message string `json:"message"`
|
||||
}
|
||||
|
||||
type Context struct {
|
||||
Artifact *Artifact `json:"artifact,omitempty"`
|
||||
Playbook *PlaybookResponse `json:"playbook,omitempty"`
|
||||
Task *TaskResponse `json:"task,omitempty"`
|
||||
Ticket *TicketResponse `json:"ticket,omitempty"`
|
||||
}
|
||||
|
||||
type Enrichment struct {
|
||||
Created time.Time `json:"created"`
|
||||
Data interface{} `json:"data"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
type EnrichmentForm struct {
|
||||
Data interface{} `json:"data"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
type File struct {
|
||||
Key string `json:"key"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
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"`
|
||||
}
|
||||
|
||||
type JobForm struct {
|
||||
Automation string `json:"automation"`
|
||||
Origin *Origin `json:"origin,omitempty"`
|
||||
Payload interface{} `json:"payload,omitempty"`
|
||||
}
|
||||
|
||||
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"`
|
||||
}
|
||||
|
||||
type LogEntry struct {
|
||||
Created time.Time `json:"created"`
|
||||
Creator string `json:"creator"`
|
||||
Message string `json:"message"`
|
||||
Reference string `json:"reference"`
|
||||
}
|
||||
|
||||
type Message struct {
|
||||
Context *Context `json:"context,omitempty"`
|
||||
Payload interface{} `json:"payload,omitempty"`
|
||||
Secrets map[string]string `json:"secrets,omitempty"`
|
||||
}
|
||||
|
||||
type NewUserResponse struct {
|
||||
Blocked bool `json:"blocked"`
|
||||
ID string `json:"id"`
|
||||
Roles []string `json:"roles"`
|
||||
Secret *string `json:"secret,omitempty"`
|
||||
}
|
||||
|
||||
type Origin struct {
|
||||
ArtifactOrigin *ArtifactOrigin `json:"artifact_origin,omitempty"`
|
||||
TaskOrigin *TaskOrigin `json:"task_origin,omitempty"`
|
||||
}
|
||||
|
||||
type Playbook struct {
|
||||
Name string `json:"name"`
|
||||
Tasks map[string]*Task `json:"tasks"`
|
||||
}
|
||||
|
||||
type PlaybookResponse struct {
|
||||
Name string `json:"name"`
|
||||
Tasks map[string]*TaskResponse `json:"tasks"`
|
||||
}
|
||||
|
||||
type PlaybookTemplate struct {
|
||||
Name string `json:"name"`
|
||||
Yaml string `json:"yaml"`
|
||||
}
|
||||
|
||||
type PlaybookTemplateForm struct {
|
||||
ID *string `json:"id,omitempty"`
|
||||
Yaml string `json:"yaml"`
|
||||
}
|
||||
|
||||
type PlaybookTemplateResponse struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Yaml string `json:"yaml"`
|
||||
}
|
||||
|
||||
type Reference struct {
|
||||
Href string `json:"href"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
type Settings struct {
|
||||
ArtifactStates []*Type `json:"artifactStates"`
|
||||
Roles []string `json:"roles,omitempty"`
|
||||
TicketTypes []*TicketTypeResponse `json:"ticketTypes"`
|
||||
Tier string `json:"tier"`
|
||||
Timeformat string `json:"timeformat"`
|
||||
Version string `json:"version"`
|
||||
}
|
||||
|
||||
type Statistics struct {
|
||||
OpenTicketsPerUser map[string]int `json:"open_tickets_per_user"`
|
||||
TicketsPerType map[string]int `json:"tickets_per_type"`
|
||||
TicketsPerWeek map[string]int `json:"tickets_per_week"`
|
||||
Unassigned int `json:"unassigned"`
|
||||
}
|
||||
|
||||
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"`
|
||||
}
|
||||
|
||||
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"`
|
||||
}
|
||||
|
||||
type TaskOrigin struct {
|
||||
PlaybookId string `json:"playbook_id"`
|
||||
TaskId string `json:"task_id"`
|
||||
TicketId int64 `json:"ticket_id"`
|
||||
}
|
||||
|
||||
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"`
|
||||
}
|
||||
|
||||
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"`
|
||||
}
|
||||
|
||||
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"`
|
||||
}
|
||||
|
||||
type TicketForm struct {
|
||||
Artifacts []*Artifact `json:"artifacts,omitempty"`
|
||||
Comments []*Comment `json:"comments,omitempty"`
|
||||
Created *time.Time `json:"created,omitempty"`
|
||||
Details interface{} `json:"details,omitempty"`
|
||||
Files []*File `json:"files,omitempty"`
|
||||
ID *int64 `json:"id,omitempty"`
|
||||
Modified *time.Time `json:"modified,omitempty"`
|
||||
Name string `json:"name"`
|
||||
Owner *string `json:"owner,omitempty"`
|
||||
Playbooks []*PlaybookTemplateForm `json:"playbooks,omitempty"`
|
||||
Read []string `json:"read,omitempty"`
|
||||
References []*Reference `json:"references,omitempty"`
|
||||
Schema *string `json:"schema,omitempty"`
|
||||
Status string `json:"status"`
|
||||
Type string `json:"type"`
|
||||
Write []string `json:"write,omitempty"`
|
||||
}
|
||||
|
||||
type TicketList struct {
|
||||
Count int `json:"count"`
|
||||
Tickets []*TicketSimpleResponse `json:"tickets"`
|
||||
}
|
||||
|
||||
type TicketResponse 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]*PlaybookResponse `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 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"`
|
||||
}
|
||||
|
||||
type TicketTemplate struct {
|
||||
Name string `json:"name"`
|
||||
Schema string `json:"schema"`
|
||||
}
|
||||
|
||||
type TicketTemplateForm struct {
|
||||
ID *string `json:"id,omitempty"`
|
||||
Name string `json:"name"`
|
||||
Schema string `json:"schema"`
|
||||
}
|
||||
|
||||
type TicketTemplateResponse struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Schema string `json:"schema"`
|
||||
}
|
||||
|
||||
type TicketType struct {
|
||||
DefaultGroups []string `json:"default_groups,omitempty"`
|
||||
DefaultPlaybooks []string `json:"default_playbooks"`
|
||||
DefaultTemplate string `json:"default_template"`
|
||||
Icon string `json:"icon"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
type TicketTypeForm struct {
|
||||
DefaultGroups []string `json:"default_groups,omitempty"`
|
||||
DefaultPlaybooks []string `json:"default_playbooks"`
|
||||
DefaultTemplate string `json:"default_template"`
|
||||
Icon string `json:"icon"`
|
||||
ID *string `json:"id,omitempty"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
type TicketTypeResponse struct {
|
||||
DefaultGroups []string `json:"default_groups,omitempty"`
|
||||
DefaultPlaybooks []string `json:"default_playbooks"`
|
||||
DefaultTemplate string `json:"default_template"`
|
||||
Icon string `json:"icon"`
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
type TicketWithTickets 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]*PlaybookResponse `json:"playbooks,omitempty"`
|
||||
Read []string `json:"read,omitempty"`
|
||||
References []*Reference `json:"references,omitempty"`
|
||||
Schema string `json:"schema"`
|
||||
Status string `json:"status"`
|
||||
Tickets []*TicketSimpleResponse `json:"tickets,omitempty"`
|
||||
Type string `json:"type"`
|
||||
Write []string `json:"write,omitempty"`
|
||||
}
|
||||
|
||||
type Type struct {
|
||||
Color *string `json:"color,omitempty"`
|
||||
Icon string `json:"icon"`
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
type User struct {
|
||||
Apikey bool `json:"apikey"`
|
||||
Blocked bool `json:"blocked"`
|
||||
Roles []string `json:"roles"`
|
||||
Sha256 *string `json:"sha256,omitempty"`
|
||||
}
|
||||
|
||||
type UserData struct {
|
||||
Email *string `json:"email,omitempty"`
|
||||
Image *string `json:"image,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
Timeformat *string `json:"timeformat,omitempty"`
|
||||
}
|
||||
|
||||
type UserDataResponse struct {
|
||||
Email *string `json:"email,omitempty"`
|
||||
ID string `json:"id"`
|
||||
Image *string `json:"image,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
Timeformat *string `json:"timeformat,omitempty"`
|
||||
}
|
||||
|
||||
type UserForm struct {
|
||||
Apikey bool `json:"apikey"`
|
||||
Blocked bool `json:"blocked"`
|
||||
ID string `json:"id"`
|
||||
Roles []string `json:"roles"`
|
||||
}
|
||||
|
||||
type UserResponse struct {
|
||||
Apikey bool `json:"apikey"`
|
||||
Blocked bool `json:"blocked"`
|
||||
ID string `json:"id"`
|
||||
Roles []string `json:"roles"`
|
||||
}
|
||||
|
||||
func mustCompile(uri string) *gojsonschema.Schema {
|
||||
s, err := schemaLoader.Compile(gojsonschema.NewReferenceLoader(uri))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
func validate(s *gojsonschema.Schema, b []byte) error {
|
||||
res, err := s.Validate(gojsonschema.NewStringLoader(string(b)))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res.Errors()) > 0 {
|
||||
var l []string
|
||||
for _, e := range res.Errors() {
|
||||
l = append(l, e.String())
|
||||
}
|
||||
return fmt.Errorf("validation failed: %v", strings.Join(l, ", "))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
const (
|
||||
SettingsTierCommunity = "community"
|
||||
|
||||
SettingsTierEnterprise = "enterprise"
|
||||
|
||||
TaskTypeTask = "task"
|
||||
|
||||
TaskTypeInput = "input"
|
||||
|
||||
TaskTypeAutomation = "automation"
|
||||
|
||||
TaskFormTypeTask = "task"
|
||||
|
||||
TaskFormTypeInput = "input"
|
||||
|
||||
TaskFormTypeAutomation = "automation"
|
||||
|
||||
TaskResponseTypeTask = "task"
|
||||
|
||||
TaskResponseTypeInput = "input"
|
||||
|
||||
TaskResponseTypeAutomation = "automation"
|
||||
|
||||
TypeColorError = "error"
|
||||
|
||||
TypeColorInfo = "info"
|
||||
|
||||
TypeColorSuccess = "success"
|
||||
|
||||
TypeColorWarning = "warning"
|
||||
)
|
||||
252
generated/restapi/api.go
Normal file
252
generated/restapi/api.go
Normal file
@@ -0,0 +1,252 @@
|
||||
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
|
||||
}
|
||||
6
generated/restapi/api/response.go
Normal file
6
generated/restapi/api/response.go
Normal file
@@ -0,0 +1,6 @@
|
||||
package api
|
||||
|
||||
type Response struct {
|
||||
Code int
|
||||
Body interface{}
|
||||
}
|
||||
14076
generated/restapi/embedded_spec.go
Normal file
14076
generated/restapi/embedded_spec.go
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,90 @@
|
||||
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
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
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
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
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
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
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
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
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
|
||||
}
|
||||
87
generated/restapi/operations/jobs/get_job_parameters.go
Normal file
87
generated/restapi/operations/jobs/get_job_parameters.go
Normal file
@@ -0,0 +1,87 @@
|
||||
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
|
||||
}
|
||||
55
generated/restapi/operations/jobs/list_jobs_parameters.go
Normal file
55
generated/restapi/operations/jobs/list_jobs_parameters.go
Normal file
@@ -0,0 +1,55 @@
|
||||
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
|
||||
}
|
||||
90
generated/restapi/operations/jobs/run_job_parameters.go
Normal file
90
generated/restapi/operations/jobs/run_job_parameters.go
Normal file
@@ -0,0 +1,90 @@
|
||||
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
|
||||
}
|
||||
111
generated/restapi/operations/jobs/update_job_parameters.go
Normal file
111
generated/restapi/operations/jobs/update_job_parameters.go
Normal file
@@ -0,0 +1,111 @@
|
||||
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
|
||||
}
|
||||
87
generated/restapi/operations/logs/get_logs_parameters.go
Normal file
87
generated/restapi/operations/logs/get_logs_parameters.go
Normal file
@@ -0,0 +1,87 @@
|
||||
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
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
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
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
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
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
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
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
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
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
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
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
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
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
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
|
||||
}
|
||||
55
generated/restapi/operations/tasks/list_tasks_parameters.go
Normal file
55
generated/restapi/operations/tasks/list_tasks_parameters.go
Normal file
@@ -0,0 +1,55 @@
|
||||
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
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
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
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
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
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
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
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
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
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
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
|
||||
}
|
||||
116
generated/restapi/operations/tickets/add_artifact_parameters.go
Normal file
116
generated/restapi/operations/tickets/add_artifact_parameters.go
Normal file
@@ -0,0 +1,116 @@
|
||||
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
|
||||
}
|
||||
116
generated/restapi/operations/tickets/add_comment_parameters.go
Normal file
116
generated/restapi/operations/tickets/add_comment_parameters.go
Normal file
@@ -0,0 +1,116 @@
|
||||
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
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
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
|
||||
}
|
||||
157
generated/restapi/operations/tickets/complete_task_parameters.go
Normal file
157
generated/restapi/operations/tickets/complete_task_parameters.go
Normal file
@@ -0,0 +1,157 @@
|
||||
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
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
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
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
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
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
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
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
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
|
||||
}
|
||||
113
generated/restapi/operations/tickets/get_artifact_parameters.go
Normal file
113
generated/restapi/operations/tickets/get_artifact_parameters.go
Normal file
@@ -0,0 +1,113 @@
|
||||
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
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
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
|
||||
}
|
||||
116
generated/restapi/operations/tickets/link_files_parameters.go
Normal file
116
generated/restapi/operations/tickets/link_files_parameters.go
Normal file
@@ -0,0 +1,116 @@
|
||||
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
|
||||
}
|
||||
115
generated/restapi/operations/tickets/link_ticket_parameters.go
Normal file
115
generated/restapi/operations/tickets/link_ticket_parameters.go
Normal file
@@ -0,0 +1,115 @@
|
||||
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
|
||||
}
|
||||
269
generated/restapi/operations/tickets/list_tickets_parameters.go
Normal file
269
generated/restapi/operations/tickets/list_tickets_parameters.go
Normal file
@@ -0,0 +1,269 @@
|
||||
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
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
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
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
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
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
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
|
||||
}
|
||||
134
generated/restapi/operations/tickets/run_artifact_parameters.go
Normal file
134
generated/restapi/operations/tickets/run_artifact_parameters.go
Normal file
@@ -0,0 +1,134 @@
|
||||
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
|
||||
}
|
||||
134
generated/restapi/operations/tickets/run_task_parameters.go
Normal file
134
generated/restapi/operations/tickets/run_task_parameters.go
Normal file
@@ -0,0 +1,134 @@
|
||||
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
|
||||
}
|
||||
137
generated/restapi/operations/tickets/set_artifact_parameters.go
Normal file
137
generated/restapi/operations/tickets/set_artifact_parameters.go
Normal file
@@ -0,0 +1,137 @@
|
||||
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
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
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
|
||||
}
|
||||
106
generated/restapi/operations/tickets/set_schema_parameters.go
Normal file
106
generated/restapi/operations/tickets/set_schema_parameters.go
Normal file
@@ -0,0 +1,106 @@
|
||||
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
|
||||
}
|
||||
158
generated/restapi/operations/tickets/set_task_parameters.go
Normal file
158
generated/restapi/operations/tickets/set_task_parameters.go
Normal file
@@ -0,0 +1,158 @@
|
||||
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
|
||||
}
|
||||
115
generated/restapi/operations/tickets/unlink_ticket_parameters.go
Normal file
115
generated/restapi/operations/tickets/unlink_ticket_parameters.go
Normal file
@@ -0,0 +1,115 @@
|
||||
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
|
||||
}
|
||||
116
generated/restapi/operations/tickets/update_ticket_parameters.go
Normal file
116
generated/restapi/operations/tickets/update_ticket_parameters.go
Normal file
@@ -0,0 +1,116 @@
|
||||
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
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
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
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
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
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
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
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
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
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
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
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
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
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
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
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
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
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
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
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
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
|
||||
}
|
||||
90
generated/restapi/operations/users/create_user_parameters.go
Normal file
90
generated/restapi/operations/users/create_user_parameters.go
Normal file
@@ -0,0 +1,90 @@
|
||||
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
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
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
|
||||
}
|
||||
87
generated/restapi/operations/users/delete_user_parameters.go
Normal file
87
generated/restapi/operations/users/delete_user_parameters.go
Normal file
@@ -0,0 +1,87 @@
|
||||
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
|
||||
}
|
||||
87
generated/restapi/operations/users/get_user_parameters.go
Normal file
87
generated/restapi/operations/users/get_user_parameters.go
Normal file
@@ -0,0 +1,87 @@
|
||||
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
|
||||
}
|
||||
55
generated/restapi/operations/users/list_users_parameters.go
Normal file
55
generated/restapi/operations/users/list_users_parameters.go
Normal file
@@ -0,0 +1,55 @@
|
||||
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
|
||||
}
|
||||
111
generated/restapi/operations/users/update_user_parameters.go
Normal file
111
generated/restapi/operations/users/update_user_parameters.go
Normal file
@@ -0,0 +1,111 @@
|
||||
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
|
||||
}
|
||||
675
generated/test/api_server_test.go
Normal file
675
generated/test/api_server_test.go
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user