crossplane-tools

module
v0.0.0-...-e252b93 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 4, 2019 License: Apache-2.0

README

crossplane-tools Godoc

Experimental code generators for Crossplane controllers.

angryjet is the only extant tool within crossplane-tools. It will detect Go structs that appear to be capable of satisfying crossplane-runtime's interfaces (such as resource.Managed) and automatically generate the method set required to satisfy that interface. A struct is considered capable of satisfying crossplane-runtime's interfaces based on the heuristics described in the Crossplane Services Developer Guide, for example a managed resource must:

  • Embed a ResourceStatus struct in their Status struct.
  • Embed a ResourceSpec struct in their Spec struct.
  • Embed a Parameters struct in their Spec struct.

Methods are not written if they are already defined outside of the file that would be generated. Use the //+crossplane:generate:methods=false comment marker to explicitly disable generation of any methods for a type. Use go generate to generate your Crossplane API types by adding a generate marker to the top level of your api/ directory, for example:

// Generate crossplane-runtime methodsets (resource.Claim, etc)
//go:generate go run ../vendor/github.com/crossplaneio/crossplane-tools/cmd/angryjet/main.go generate-methodsets ./...
$ angryjet generate-methodsets --help
usage: angryjet generate-methodsets [<flags>] [<packages>]

Generate a Crossplane method sets.

Flags:
  --help                     Show context-sensitive help (also try --help-long and --help-man).
  --base-dir=/Users/negz/control/go/src  
                             Generated files are written to their package paths relative to this directory.
  --header-file=HEADER-FILE  The contents of this file will be added to the top of all generated files.
  --filename-managed="zz_generated.managed.go"  
                             The filename of generated managed resource files.
  --filename-claim="zz_generated.claim.go"  
                             The filename of generated resource claim files.
  --filename-portable-class="zz_generated.portableclass.go"  
                             The filename of generated portable class files.
  --filename-portable-class-list="zz_generated.portableclasslist.go"  
                             The filename of generated portable class list files.
  --filename-non-portable-class="zz_generated.nonportableclass.go"  
                             The filename of generated non-portable class files.

Args:
  [<packages>]  Package(s) for which to generate methods, for example github.com/crossplaneio/crossplane/apis/...

Directories

Path Synopsis
cmd
internal
comments
Package comments extracts and parses comments from a package.
Package comments extracts and parses comments from a package.
fields
Package fields defines and matches common struct fields.
Package fields defines and matches common struct fields.
generate
Package generate generates method sets for Go types.
Package generate generates method sets for Go types.
match
Package match identifies Go types as common Crossplane resources.
Package match identifies Go types as common Crossplane resources.
method
Package method contains methods that may be generated for a Go type.
Package method contains methods that may be generated for a Go type.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL