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
{ | |
"Plugins": [ | |
{ | |
"id": "sample-plugin", | |
"label": "Sample Weave Plugin", | |
"description": "Adds links to deployments", | |
"interfaces": [ | |
"reporter" | |
], | |
"api_version": 1 |
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
package main | |
import ( | |
"fmt" | |
"log" | |
"net" | |
"net/http" | |
"os" | |
"os/signal" | |
"path/filepath" |
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
type Plugin struct { | |
ID string `json:"id"` | |
Label string `json:"label"` | |
Description string `json:"description,omitempty"` | |
Interfaces []string `json:"interfaces"` | |
APIVersion int `json:"api_version,omitempty"` | |
Report WeaveReport | |
// This is a concurrently accessed data structure |
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
import ( | |
"fmt" | |
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" | |
"k8s.io/client-go/kubernetes" | |
"k8s.io/client-go/rest" | |
) | |
type K8sObject interface { | |
GetAnnotations() map[string]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
package main | |
import ( | |
"bytes" | |
"encoding/json" | |
"flag" | |
"io/ioutil" | |
"log" | |
"net/http" | |
"net/http/httputil" |
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
import ( | |
"gopkg.in/launchdarkly/go-sdk-common.v2/lduser" | |
) | |
flagName := "some-flag-name" | |
user := lduser.NewUser("some-user-key") | |
defaultValue := false | |
showFeature, _ := ldClient.BoolVariation(flagName, user, defaultValue) | |
if showFeature { | |
// application code to show the feature |
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
... | |
showFeature, _ := ldClient.BoolVariation(flagName, lduser.User{}, defaultValue) | |
... |
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
type Client interface { | |
GetValue(ctx context.Context, name Key, defaultValue interface{}) (interface{}, error) | |
GetIntValue(ctx context.Context, name Key, defaultValue int) (int, error) | |
GetIntArrayValue(ctx context.Context, name Key, defaultValue []int) ([]int, error) | |
GetBoolValue(ctx context.Context, name Key, defaultValue bool) (bool, error) | |
GetStringValue(ctx context.Context, name Key, defaultValue string) (string, error) | |
} |