{"id":19144174,"url":"https://github.com/crossplane/crossplane-tools","last_synced_at":"2025-04-05T13:03:20.880Z","repository":{"id":43274607,"uuid":"205741268","full_name":"crossplane/crossplane-tools","owner":"crossplane","description":"Experimental code generators for Crossplane controllers.","archived":false,"fork":false,"pushed_at":"2025-03-13T00:29:09.000Z","size":4944,"stargazers_count":35,"open_issues_count":26,"forks_count":28,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-29T12:03:31.121Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://crossplane.io","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/crossplane.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-09-01T22:51:42.000Z","updated_at":"2025-02-22T00:54:08.000Z","dependencies_parsed_at":"2024-06-04T21:36:26.344Z","dependency_job_id":"a935b5b3-7f8a-487c-a956-cb2f2d0537f7","html_url":"https://github.com/crossplane/crossplane-tools","commit_stats":null,"previous_names":["crossplaneio/crossplane-tools"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crossplane%2Fcrossplane-tools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crossplane%2Fcrossplane-tools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crossplane%2Fcrossplane-tools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crossplane%2Fcrossplane-tools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/crossplane","download_url":"https://codeload.github.com/crossplane/crossplane-tools/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247339149,"owners_count":20923014,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T07:34:01.596Z","updated_at":"2025-04-05T13:03:20.857Z","avatar_url":"https://github.com/crossplane.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# crossplane-tools [![Godoc](https://img.shields.io/badge/godoc-reference-blue.svg)](https://godoc.org/github.com/crossplane/crossplane-tools)\n\nCode generators for [Crossplane] controllers.\n\n## angryjet\n\n`angryjet` will detect Go structs that appear to be capable of satisfying\ncrossplane-runtime's interfaces (such as [`resource.Managed`]) and automatically\ngenerate the method set required to satisfy that interface. A struct is\nconsidered capable of satisfying crossplane-runtime's interfaces based on the\nheuristics described in the [Provider Development Guide], for example a\nmanaged resource must:\n\n* Embed a [`ResourceStatus`] struct in their `Status` struct.\n* Embed a [`ResourceSpec`] struct in their `Spec` struct.\n* Embed a `Parameters` struct in their `Spec` struct.\n\nMethods are not written if they are already defined outside of the file that\nwould be generated. Use the `//+crossplane:generate:methods=false` comment\nmarker to explicitly disable generation of any methods for a type. Use `go\ngenerate` to generate your Crossplane API types by adding a generate marker to\nthe top level of your `api/` directory, for example:\n\n```go\n// Generate crossplane-runtime methodsets (resource.Claim, etc)\n//go:generate go run ../vendor/github.com/crossplane/crossplane-tools/cmd/angryjet/main.go generate-methodsets ./...\n```\n\n### Reference Resolvers\n\nIn addition to functions that satisfy `resource.Managed`, you can use `angryjet`\nto generate a `ResolveReferences` method as well. In order to generate a resolution\ncall for given field, you need to add the following comment marker:\n```\n// +crossplane:generate:reference:type=\u003ctarget type\u003e\n```\n\n`\u003ctarget type\u003e` could either be just the type name of the CRD if it is in the same\npackage or `\u003cpackage path\u003e.\u003ctarget type\u003e` if it is in a different package, such\nas `github.com/crossplane/provider-aws/apis/ec2/v1beta1.VPC`.\n\nThe generated resolver will use the external name annotation of the target resource\nto fetch the value and it assumes that reference field is named as\n`FieldNameRef`/`FieldNameRefs if array` and selector field is named as \n`FieldNameSelector`. You can override these defaults by adding the optional comment\nmarkers, see the following example:\n```go\ntype SomeParameters struct {\n    // +crossplane:generate:reference:type=github.com/crossplane/provider-aws/apis/ec2/v1beta1.Subnet\n    // +crossplane:generate:reference:extractor=github.com/crossplane/provider-aws/apis/ec2/v1beta1.SubnetARN()\n    // +crossplane:generate:reference:refFieldName=SubnetIDRefs\n    // +crossplane:generate:reference:selectorFieldName=SubnetIDSelector\n    SubnetIDs []string `json:\"subnetIds,omitempty\"`\n    \n    SubnetIDRefs []xpv1.Reference `json:\"subnetIdRefs,omitempty\"`\n    \n    SubnetIDSelector *xpv1.Selector `json:\"subnetIdSelector,omitempty\"`\n}\n```\n\nNote that it doesn't make any change to the CRD struct; authors still need to\nadd `FieldNameRef` and `FieldNameSelector` fields on their own for the generated\ncode to compile.\n\n### Usage\n\n```console\n$ angryjet generate-methodsets --help\nusage: angryjet generate-methodsets [\u003cflags\u003e] [\u003cpackages\u003e]\n\nGenerate a Crossplane method sets.\n\nFlags:\n  --help                     Show context-sensitive help (also try --help-long and --help-man).\n  --header-file=HEADER-FILE  The contents of this file will be added to the top of all generated files.\n  --filename-managed=\"zz_generated.managed.go\"\n                             The filename of generated managed resource files.\n  --filename-resolvers=\"zz_generated.resolvers.go\"\n                             The filename of generated reference resolver files.\n  --filename-managed-list=\"zz_generated.managedlist.go\"\n                             The filename of generated managed list resource files.\n  --filename-pc=\"zz_generated.pc.go\"\n                             The filename of generated provider config files.\n  --filename-pcu=\"zz_generated.pcu.go\"\n                             The filename of generated provider config usage files.\n  --filename-pcu-list=\"zz_generated.pculist.go\"\n                             The filename of generated provider config usage files.\n\nArgs:\n  [\u003cpackages\u003e]  Package(s) for which to generate methods, for example github.com/crossplane/crossplane/apis/...\n```\n\n[Crossplane]: https://crossplane.io\n[`resource.Managed`]: https://godoc.org/github.com/crossplane/crossplane-runtime/pkg/resource#Managed\n[`ResourceSpec`]: https://godoc.org/github.com/crossplane/crossplane-runtime/apis/common/v1#ResourceSpec\n[`ResourceStatus`]: https://godoc.org/github.com/crossplane/crossplane-runtime/apis/common/v1#ResourceStatus\n[Provider Development Guide]: https://github.com/crossplane/crossplane/blob/master/contributing/guide-provider-development.md#defining-resource-kinds","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrossplane%2Fcrossplane-tools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcrossplane%2Fcrossplane-tools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrossplane%2Fcrossplane-tools/lists"}