An enaml
based tool
that allows you to perform transformations on bosh manifests.
Make sure you have a working Go toolchain and have installed glide.
go get -d -u github.com/enaml-ops/omg-transform
cd $GOPATH/src/enaml-ops/omg-transform
glide install
go build
go test `glide nv`
By default, omg-transform
attempts to read a manifest from standard in
and writes the transformed manifest to standard out.
For example, to run a transformation on a manifest produced by
omg-cli
:
omg-cli deploy-product --print-manifest cloudfoundry-plugin-linux | omg-transform <TRANSFORM> [flags...]
change-network
: change an instance group's networkclone
: clone an instance groupchange-az
: change an instance group's AZsadd-vm-extension
: add a vm extension to an existing instance groupadd-tags
: add key-value pairs for VM tagging
Implementing a transformation is straightforward.
-
Create a new *.go file for your transformation.
-
Add a type that implements
Transformation
-
Implement a function that builds your new type from a set of arguments. This function should have the signature
func(args []string) (Transformation, error)
.The
args
slice provided to your function will be everything after the transformation on the command line:omg-transform <transformation> **[args]**
.Go's built-in
flag.FlagSet
is a great way to parse these arguments. Take a look at the clone transformation for an example. -
Register your builder function in package main's
init()
function. The name that you provide toRegisterTransformationBuilder()
is the command that users will use to invoke your transformation.
Don't forget to add tests!