github.com/akamai/AkamaiOPEN-edgegrid-golang/v8@v8.1.0/pkg/botman/botman.go (about)

     1  // Package botman provides access to the Akamai Application Security Botman APIs
     2  package botman
     3  
     4  import (
     5  	"errors"
     6  
     7  	"github.com/akamai/AkamaiOPEN-edgegrid-golang/v8/pkg/session"
     8  )
     9  
    10  var (
    11  	// ErrStructValidation is returned when given struct validation failed
    12  	ErrStructValidation = errors.New("struct validation")
    13  )
    14  
    15  type (
    16  	// BotMan is the botman api interface
    17  	BotMan interface {
    18  		AkamaiBotCategory
    19  		AkamaiBotCategoryAction
    20  		AkamaiDefinedBot
    21  		BotAnalyticsCookie
    22  		BotAnalyticsCookieValues
    23  		BotCategoryException
    24  		BotDetection
    25  		BotDetectionAction
    26  		BotEndpointCoverageReport
    27  		BotManagementSetting
    28  		ChallengeAction
    29  		ChallengeInjectionRules
    30  		ChallengeInterceptionRules
    31  		ClientSideSecurity
    32  		ConditionalAction
    33  		CustomBotCategory
    34  		CustomBotCategoryAction
    35  		CustomBotCategorySequence
    36  		CustomClient
    37  		CustomClientSequence
    38  		CustomDefinedBot
    39  		CustomDenyAction
    40  		CustomCode
    41  		JavascriptInjection
    42  		RecategorizedAkamaiDefinedBot
    43  		ResponseAction
    44  		ServeAlternateAction
    45  		TransactionalEndpoint
    46  		TransactionalEndpointProtection
    47  	}
    48  
    49  	botman struct {
    50  		session.Session
    51  	}
    52  
    53  	// Option defines a BotMan option
    54  	Option func(*botman)
    55  
    56  	// ClientFunc is a botman client new method, this can be used for mocking
    57  	ClientFunc func(sess session.Session, opts ...Option) BotMan
    58  )
    59  
    60  // Client returns a new botman Client instance with the specified controller
    61  func Client(sess session.Session, opts ...Option) BotMan {
    62  	p := &botman{
    63  		Session: sess,
    64  	}
    65  
    66  	for _, opt := range opts {
    67  		opt(p)
    68  	}
    69  	return p
    70  }