-
Notifications
You must be signed in to change notification settings - Fork 70
/
botman.go
74 lines (65 loc) · 1.59 KB
/
botman.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
// Package botman provides access to the Akamai Application Security Botman APIs
package botman
import (
"errors"
"github.com/akamai/AkamaiOPEN-edgegrid-golang/v9/pkg/session"
)
var (
// ErrStructValidation is returned when given struct validation failed
ErrStructValidation = errors.New("struct validation")
)
type (
// BotMan is the botman api interface
BotMan interface {
AkamaiBotCategory
AkamaiBotCategoryAction
AkamaiDefinedBot
BotAnalyticsCookie
BotAnalyticsCookieValues
BotCategoryException
BotDetection
BotDetectionAction
BotEndpointCoverageReport
BotManagementSetting
ChallengeAction
ChallengeInjectionRules
ChallengeInterceptionRules
ClientSideSecurity
ConditionalAction
ContentProtectionJavaScriptInjectionRule
ContentProtectionRule
ContentProtectionRuleSequence
CustomBotCategory
CustomBotCategoryAction
CustomBotCategoryItemSequence
CustomBotCategorySequence
CustomClient
CustomClientSequence
CustomDefinedBot
CustomDenyAction
CustomCode
JavascriptInjection
RecategorizedAkamaiDefinedBot
ResponseAction
ServeAlternateAction
TransactionalEndpoint
TransactionalEndpointProtection
}
botman struct {
session.Session
}
// Option defines a BotMan option
Option func(*botman)
// ClientFunc is a botman client new method, this can be used for mocking
ClientFunc func(sess session.Session, opts ...Option) BotMan
)
// Client returns a new botman Client instance with the specified controller
func Client(sess session.Session, opts ...Option) BotMan {
p := &botman{
Session: sess,
}
for _, opt := range opts {
opt(p)
}
return p
}