github.com/akamai/AkamaiOPEN-edgegrid-golang/v2@v2.17.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/v2/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  		ChallengeInterceptionRules
    30  		ClientSideSecurity
    31  		ConditionalAction
    32  		CustomBotCategory
    33  		CustomBotCategoryAction
    34  		CustomBotCategorySequence
    35  		CustomClient
    36  		CustomDefinedBot
    37  		CustomDenyAction
    38  		JavascriptInjection
    39  		RecategorizedAkamaiDefinedBot
    40  		ResponseAction
    41  		ServeAlternateAction
    42  		TransactionalEndpoint
    43  		TransactionalEndpointProtection
    44  	}
    45  
    46  	botman struct {
    47  		session.Session
    48  	}
    49  
    50  	// Option defines a BotMan option
    51  	Option func(*botman)
    52  
    53  	// ClientFunc is a botman client new method, this can be used for mocking
    54  	ClientFunc func(sess session.Session, opts ...Option) BotMan
    55  )
    56  
    57  // Client returns a new botman Client instance with the specified controller
    58  func Client(sess session.Session, opts ...Option) BotMan {
    59  	p := &botman{
    60  		Session: sess,
    61  	}
    62  
    63  	for _, opt := range opts {
    64  		opt(p)
    65  	}
    66  	return p
    67  }