Created
November 17, 2017 19:53
-
-
Save ncdc/88b9b5bb4818fe6b6353cc8bf2da81fe to your computer and use it in GitHub Desktop.
Sample Heptio Ark plugin
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 ( | |
plugin "github.com/hashicorp/go-plugin" | |
"github.com/heptio/ark/pkg/cloudprovider" | |
"github.com/heptio/ark/pkg/cloudprovider/aws" | |
arkplugin "github.com/heptio/ark/pkg/plugin" | |
"github.com/sirupsen/logrus" | |
) | |
func main() { | |
objectStore := &MyObjectStore{ | |
ObjectStore: aws.NewObjectStore(), | |
log: arkplugin.NewPluginLogger(), | |
} | |
plugin.Serve(&plugin.ServeConfig{ | |
HandshakeConfig: arkplugin.Handshake, | |
Plugins: map[string]plugin.Plugin{ | |
string(arkplugin.PluginKindBlockStore): arkplugin.NewObjectStorePlugin(objectStore), | |
}, | |
GRPCServer: plugin.DefaultGRPCServer, | |
}) | |
} | |
type MyObjectStore struct { | |
cloudprovider.ObjectStore | |
log logrus.FieldLogger | |
} | |
func (mos *MyObjectStore) Init(config map[string]string) error { | |
mos.log.Info("HELLO FROM MyObjectStore!!!") | |
return mos.ObjectStore.Init(config) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment