-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopencti_intrusion_set.go
114 lines (92 loc) · 4.54 KB
/
opencti_intrusion_set.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
// Code generated by '/tools/gocti_type_generator' for OpenCTI version 6.5.2 - DO NOT EDIT.
package entity
import (
"fmt"
"time"
"github.com/weisshorn-cyd/gocti/graphql"
_ "embed"
)
type IntrusionSet struct {
graphql.IntrusionSet `gocti:",squash"`
}
//go:embed default_properties/intrusion_set_default_properties.txt
var intrusionSetDefaultProperties string
func (i IntrusionSet) DefaultProperties() string {
return intrusionSetDefaultProperties
}
// Implementing the [api.ListableEntity] interface.
//go:embed list_queries/intrusion_set_list_query.txt
var intrusionSetListQueryString string
func (i IntrusionSet) ListQueryString(customAttributes string) string {
return fmt.Sprintf(
intrusionSetListQueryString,
customAttributes,
)
}
func (i IntrusionSet) ListResponseField() string { return "intrusionSets" }
// Implementing the [api.ReadableEntity] interface.
func (i IntrusionSet) ReadQueryString(customAttributes string) string {
return fmt.Sprintf(
`query ($id: String) {
intrusionSet (id: $id) {%s}
}`,
customAttributes,
)
}
func (i IntrusionSet) ReadResponseField() string { return "intrusionSet" }
// Implementing the [api.CreatableEntity] interface.
func (i IntrusionSet) CreateQueryString(customAttributes string) string {
return fmt.Sprintf(
`mutation ($input: IntrusionSetAddInput!) {
intrusionSetAdd (input: $input) {%s}
}`,
customAttributes,
)
}
func (i IntrusionSet) CreateResponseField() string { return "intrusionSetAdd" }
// IntrusionSetAddInput represents a GraphQL INPUT_OBJECT
// Some fields from the OpenCTI schema may be missing
// (See the examples for ways to expand an existing type).
type IntrusionSetAddInput struct {
// IntrusionSetAddInput
StixID string `gocti:"stix_id" json:"stix_id,omitempty"`
XOpenctiStixIDs []string `gocti:"x_opencti_stix_ids" json:"x_opencti_stix_ids,omitempty"`
Name string `gocti:"name" json:"name,omitempty"`
Description string `gocti:"description" json:"description,omitempty"`
Aliases []string `gocti:"aliases" json:"aliases,omitempty"`
FirstSeen *time.Time `gocti:"first_seen" json:"first_seen,omitempty"`
LastSeen *time.Time `gocti:"last_seen" json:"last_seen,omitempty"`
Goals []string `gocti:"goals" json:"goals,omitempty"`
ResourceLevel string `gocti:"resource_level" json:"resource_level,omitempty"`
PrimaryMotivation string `gocti:"primary_motivation" json:"primary_motivation,omitempty"`
SecondaryMotivations []string `gocti:"secondary_motivations" json:"secondary_motivations,omitempty"`
Confidence int `gocti:"confidence" json:"confidence,omitempty"`
Revoked bool `gocti:"revoked" json:"revoked,omitempty"`
Lang string `gocti:"lang" json:"lang,omitempty"`
CreatedBy string `gocti:"createdBy" json:"createdBy,omitempty"`
ObjectMarking []string `gocti:"objectMarking" json:"objectMarking,omitempty"`
ObjectAssignee []string `gocti:"objectAssignee" json:"objectAssignee,omitempty"`
ObjectOrganization []string `gocti:"objectOrganization" json:"objectOrganization,omitempty"`
ObjectLabel []string `gocti:"objectLabel" json:"objectLabel,omitempty"`
ExternalReferences []string `gocti:"externalReferences" json:"externalReferences,omitempty"`
XOpenctiWorkflowID string `gocti:"x_opencti_workflow_id" json:"x_opencti_workflow_id,omitempty"`
Created *time.Time `gocti:"created" json:"created,omitempty"`
Modified *time.Time `gocti:"modified" json:"modified,omitempty"`
ClientMutationID string `gocti:"clientMutationId" json:"clientMutationId,omitempty"`
Update bool `gocti:"update" json:"update,omitempty"`
File []byte `gocti:"file" json:"file,omitempty"`
}
func (input IntrusionSetAddInput) Input() (map[string]any, error) {
return map[string]any{
"input": input,
}, nil
}
// Implementing the [api.DeletableEntity] interface.
func (i IntrusionSet) DeleteQueryString() string {
return `mutation ($id: ID!) {
intrusionSetEdit (id: $id) {
delete
}
}`
}
func (i IntrusionSet) DeleteResponseField() string { return "intrusionSetEdit" }