github.com/akamai/AkamaiOPEN-edgegrid-golang/v8@v8.1.0/pkg/botman/bot_analytics_cookie_values.go (about) 1 package botman 2 3 import ( 4 "context" 5 "fmt" 6 "net/http" 7 ) 8 9 type ( 10 // The BotAnalyticsCookieValues interface supports retrieving bot analytics cookie values for an account 11 BotAnalyticsCookieValues interface { 12 // GetBotAnalyticsCookieValues https://techdocs.akamai.com/bot-manager/reference/get-akamai-defined-bots 13 GetBotAnalyticsCookieValues(ctx context.Context) (map[string]interface{}, error) 14 } 15 ) 16 17 func (b *botman) GetBotAnalyticsCookieValues(ctx context.Context) (map[string]interface{}, error) { 18 19 logger := b.Log(ctx) 20 logger.Debug("GetBotAnalyticsCookieValues") 21 22 uri := "/appsec/v1/bot-analytics-cookie/values" 23 24 req, err := http.NewRequestWithContext(ctx, http.MethodGet, uri, nil) 25 if err != nil { 26 return nil, fmt.Errorf("failed to create GetBotAnalyticsCookieValues request: %w", err) 27 } 28 29 var result map[string]interface{} 30 resp, err := b.Exec(req, &result) 31 if err != nil { 32 return nil, fmt.Errorf("GetBotAnalyticsCookieValues request failed: %w", err) 33 } 34 35 if resp.StatusCode != http.StatusOK { 36 return nil, b.Error(resp) 37 } 38 39 return result, nil 40 }