terraform-coop / terraform-provider-foreman

Terraform provider for Foreman
https://registry.terraform.io/providers/terraform-coop/foreman
Mozilla Public License 2.0
34 stars 32 forks source link

Move API calls to a library of its own #4

Closed lhw closed 3 years ago

lhw commented 4 years ago

With a few modifications its possible to extract a swagger api definition from foreman. This would be a great base for a golang foreman api library. Which in turn could be used here.

adarobin commented 4 years ago

I started doing this for Satellite at https://github.com/umich-vci/gosatellite using go-swagger. The problem I ran into is that the API does not document any of its responses which makes the generated client useless.

adarobin commented 4 years ago

I put in an RFE - https://bugzilla.redhat.com/show_bug.cgi?id=1803138

lhw commented 4 years ago

I did some tests initially with go-swagger and pyswagger and as you described only ended up with unusable gibberish. The whole foreman/satellite API is a bit of a mess. It also returns results in an unpredictable manner on some endpoints. The swagger variant was an idea I had. But generally it could be useful to abstract the API out of the project so it could be used elsewhere.