appconfig-go-sdk is a Go client library for accessing the Azure App Configuration REST API.
First, you need to get the library:
go get github.com/stone-payments/appconfig-go-sdk
Then you can import the library into your code:
import "github.com/stone-payments/appconfig-go-sdk"
import "github.com/stone-payments/appconfig-go-sdk/appconfig/keyvalues"
Construct a new client for the desired resource. In this example, we will use the KeyValue Client.
args := keyvalues.NewClientAzureADArgs{
ClientID: clientID,
ClientSecret: clientSecret,
TenantID: tenantID,
ResourceEndpoint: endpoint,
}
client, err := keyvalues.NewClientAzureAD(args)
Then you can use the various methods on the client to access the App Configuration API. For Example:
list, err := client.ListKeyValues(keyvalues.ListKeyValuesArgs{})
kv, err := client.GetKeyValue("mykey", "mylabel")
For more sample code snippets, head over to the example directory.
All clients provide interfaces to SDK calls to improve testability, so you can create a mock struct that implements the methods that you need to test.
Head over to the KeyValues client to see an interface example.
Contributions are always welcome. Please, submit pull requests and open new issues!
This library is distributed under the MIT license found in the LICENSE file.