From 68b1d18ad34ddfa9e16292dad7f15f0486c37c83 Mon Sep 17 00:00:00 2001 From: Nick Saika Date: Wed, 27 Mar 2024 14:22:06 +0000 Subject: [PATCH] fixup! providers: add "akamai" provider --- internal/providers/akamai/akamai.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/internal/providers/akamai/akamai.go b/internal/providers/akamai/akamai.go index f316ded78..73fecaa20 100644 --- a/internal/providers/akamai/akamai.go +++ b/internal/providers/akamai/akamai.go @@ -18,6 +18,7 @@ package akamai import ( "encoding/base64" + "errors" "fmt" "net/http" "net/url" @@ -44,7 +45,15 @@ var ( ) func fetchConfig(f *resource.Fetcher) (types.Config, report.Report, error) { - encoded, err := f.FetchToBuffer(userdataURL, resource.FetchOptions{}) + if f.AkamaiMetadataToken == "" { + return types.Config{}, report.Report{}, errors.New("akamai metadata token not set") + } + + encoded, err := f.FetchToBuffer(userdataURL, resource.FetchOptions{ + Headers: http.Header{ + "Metadata-Token": []string{f.AkamaiMetadataToken}, + }, + }) if err != nil { return types.Config{}, report.Report{}, err }