-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
just one way of making a wavefront sender
- Loading branch information
1 parent
1bb70b1
commit d3bb71c
Showing
10 changed files
with
101 additions
and
170 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,20 @@ | ||
package token | ||
|
||
var ( | ||
defaultNoopService TokenService = &TokenNoOpService{} | ||
defaultNoopService Service = &NoOpService{} | ||
) | ||
|
||
func (t TokenNoOpService) GetToken() string { | ||
type NoOpService struct { | ||
} | ||
|
||
func (t NoOpService) GetToken() string { | ||
return "" | ||
} | ||
|
||
func (t TokenNoOpService) Close() { | ||
func (t NoOpService) Close() { | ||
} | ||
|
||
// NewNoopTokenService returns a TokenService instance where it always returns an empty string for the token (for proxy usage). | ||
func NewNoopTokenService() TokenService { | ||
// NewNoopTokenService returns a Service instance where it always returns an empty string for the token (for proxy usage). | ||
func NewNoopTokenService() Service { | ||
return defaultNoopService | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,17 @@ | ||
package token | ||
|
||
type WavefrontTokenService struct { | ||
Token string | ||
} | ||
|
||
func (t WavefrontTokenService) GetToken() string { | ||
return t.Token | ||
} | ||
|
||
func (t WavefrontTokenService) Close() { | ||
} | ||
|
||
// NewWavefrontTokenService returns a TokenService instance where it always returns a Wavefront API Token | ||
func NewWavefrontTokenService(Token string) TokenService { | ||
// NewWavefrontTokenService returns a Service instance where it always returns a Wavefront API Token | ||
func NewWavefrontTokenService(Token string) Service { | ||
return &WavefrontTokenService{Token: Token} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,11 @@ | ||
package token | ||
|
||
import ( | ||
"sync" | ||
"time" | ||
) | ||
|
||
// TokenService Interface for getting auth tokens (Wavefront, CSP) | ||
type TokenService interface { | ||
// Service Interface for getting authentication tokens (Wavefront, CSP) | ||
type Service interface { | ||
GetToken() string | ||
Close() | ||
} | ||
|
||
type TokenNoOpService struct { | ||
} | ||
|
||
type WavefrontTokenService struct { | ||
type ApiToken struct { | ||
Token string | ||
} | ||
|
||
type CspServerToServerTokenService struct { | ||
CSPBaseUrl string | ||
CSPClientId string | ||
CSPClientSecret string | ||
|
||
mutex sync.Mutex | ||
AccessToken string | ||
tokenReady bool | ||
|
||
ticker *time.Ticker | ||
done chan bool | ||
tickerDelay int | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package senders | ||
|
||
type APITokenAuth struct { | ||
Token string | ||
} | ||
|
||
type CSPAuth struct { | ||
ClientID string | ||
ClientSecret string | ||
BaseURL string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters