Repository navigation
Expand file tree
/
Copy pathautomate.go
More file actions
123 lines (107 loc) · 3.34 KB
/
Copy pathautomate.go
File metadata and controls
123 lines (107 loc) · 3.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
package caido
import (
"context"
gen "github.com/caido-community/sdk-go/graphql"
)
// AutomateSDK provides operations on fuzzing (Automate) sessions.
type AutomateSDK struct {
client *Client
}
// ListSessionsOptions configures session listing.
type ListAutomateSessionsOptions struct {
First *int
Last *int
After *string
Before *string
}
// ListSessions returns paginated Automate sessions.
func (s *AutomateSDK) ListSessions(
ctx context.Context, opts *ListAutomateSessionsOptions,
) (*gen.ListAutomateSessionsResponse, error) {
var o ListAutomateSessionsOptions
if opts != nil {
o = *opts
}
return gen.ListAutomateSessions(
ctx, s.client.GraphQL,
o.First, o.Last, o.After, o.Before,
)
}
// GetSession returns a single Automate session by ID.
func (s *AutomateSDK) GetSession(
ctx context.Context, id string,
) (*gen.GetAutomateSessionResponse, error) {
return gen.GetAutomateSession(ctx, s.client.GraphQL, id)
}
// GetEntry returns a single Automate entry by ID.
func (s *AutomateSDK) GetEntry(
ctx context.Context, id string,
) (*gen.GetAutomateEntryResponse, error) {
return gen.GetAutomateEntry(ctx, s.client.GraphQL, id)
}
// ListEntryRequestsOptions configures entry request listing.
type ListEntryRequestsOptions struct {
First *int
Last *int
After *string
Before *string
Filter *string
Order *gen.AutomateEntryRequestOrderInput
}
// GetEntryRequests returns paginated requests for an Automate entry.
func (s *AutomateSDK) GetEntryRequests(
ctx context.Context, id string,
opts *ListEntryRequestsOptions,
) (*gen.GetAutomateEntryRequestsResponse, error) {
var o ListEntryRequestsOptions
if opts != nil {
o = *opts
}
return gen.GetAutomateEntryRequests(
ctx, s.client.GraphQL,
id, o.First, o.Last, o.After, o.Before,
filterToInput(o.Filter), o.Order,
)
}
// CreateSession creates a new Automate session.
func (s *AutomateSDK) CreateSession(
ctx context.Context, input *gen.CreateAutomateSessionInput,
) (*gen.CreateAutomateSessionResponse, error) {
return gen.CreateAutomateSession(ctx, s.client.GraphQL, *input)
}
// RenameSession renames an Automate session.
func (s *AutomateSDK) RenameSession(
ctx context.Context, id, name string,
) (*gen.RenameAutomateSessionResponse, error) {
return gen.RenameAutomateSession(ctx, s.client.GraphQL, id, name)
}
// DeleteSession deletes an Automate session.
func (s *AutomateSDK) DeleteSession(
ctx context.Context, id string,
) (*gen.DeleteAutomateSessionResponse, error) {
return gen.DeleteAutomateSession(ctx, s.client.GraphQL, id)
}
// StartTask starts an Automate fuzzing task.
func (s *AutomateSDK) StartTask(
ctx context.Context, sessionID string,
) (*gen.StartAutomateTaskResponse, error) {
return gen.StartAutomateTask(ctx, s.client.GraphQL, sessionID)
}
// CancelTask cancels an Automate task.
func (s *AutomateSDK) CancelTask(
ctx context.Context, id string,
) (*gen.CancelAutomateTaskResponse, error) {
return gen.CancelAutomateTask(ctx, s.client.GraphQL, id)
}
// PauseTask pauses an Automate task.
func (s *AutomateSDK) PauseTask(
ctx context.Context, id string,
) (*gen.PauseAutomateTaskResponse, error) {
return gen.PauseAutomateTask(ctx, s.client.GraphQL, id)
}
// ResumeTask resumes a paused Automate task.
func (s *AutomateSDK) ResumeTask(
ctx context.Context, id string,
) (*gen.ResumeAutomateTaskResponse, error) {
return gen.ResumeAutomateTask(ctx, s.client.GraphQL, id)
}