Documentation ¶
Overview ¶
SharedDiscovery is a shared library that supports getting data from the discovery dynamodb tables based on several criteria, including:
- APIToken
- Country
- Workspace (tablename)
Admin Capabilities ¶
This library also supports the idea of admin calls that can get any token needed. This is done using HMAC and the private key is stored in Secrets Manager.
Example ¶
Typical usage is to setup a variable with the interface type and initialize that variable in your modules init function using the New() function provided
var shareddiscovery SharedDiscoveryIFace // setup AWS Session session := session.New() // setup DynamoDB dynamo := dynamodb.New(session) // define a QueryInput query := QueryInput{Workspace: "tableName"} // setup shareddiscovery now shareddiscovery = New(dynamo) // call functions shareddiscovery.GetConfig(context.Background(), "someApiToken", query)
Output:
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type QueryInput ¶
type QueryInput struct { Environment string AppName string Country string Brand string Workspace string QueryString map[string]string }
QueryInput defines the values used to query dynamo with.
type SharedDiscovery ¶
type SharedDiscovery struct {}
SharedDiscovery is a custom service object for interacting with the global config
func New ¶
func New(dynamodb dynamodbiface.DynamoDBAPI) SharedDiscovery
New is a constructor that takes a preconfigured dynamodbiface and returns an implementation of SharedDiscoveryIFace Use this in your init function after creating your aws session and initializing dynamo.
func (SharedDiscovery) GetConfig ¶
func (service SharedDiscovery) GetConfig(ctx context.Context, apiToken string, query QueryInput) (map[string]interface{}, error)
GetConfig uses the provided `APIToken` to get the correct configuration from the specified `tableName`.
type SharedDiscoveryIFace ¶
type SharedDiscoveryIFace interface {
}SharedDiscoveryIFace describes what is required for building a SharedDiscovery implementation.
Directories ¶
Path | Synopsis |
---|---|
mocks
|
|
mock_dynamodbiface
Package mock_dynamodbiface is a generated GoMock package.
|
Package mock_dynamodbiface is a generated GoMock package. |