skyscrapr / cloudability-sdk-go

Cloudability SDK for golang
MIT License
7 stars 3 forks source link

Problem with API v1 response - try to code account groups #9

Closed alexandre-rassinoux closed 4 years ago

alexandre-rassinoux commented 4 years ago

Hello,

I am currently trying to code locally the account_groups resource with the provider.

When I run terraform apply, the resource is provisioned in Cloudability but, when I try to get the created Id of the resource (contained in the HTTP response) I get this error:

Error: {"error":"Couldn't find Account Group with id 0."}

I suspect that the problem resides here: type resultTemplate struct { Result interface{} json:"result" }

The v1 API doesn't have such pattern, the response is directly inside brackets, that is why I couldn't get an ID.

Is it possible to distinguish v1 and v3 endpoints in order to not apply the resultTemplate on v1 HTTP responses ?

I remain available if you need, Alexandre

skyscrapr commented 4 years ago

Thanks for finding the bug. I’ll update and add a test to cover.

skyscrapr commented 4 years ago

HI, I've updated the sdk with the fixes required to support the different result structures in the API versions. I also added support for account groups with tests. But i have not run this against a live cloud ability instance. I'm guessing there will be some issues. I have not added support for account groups in the terraform provider yet. If you have already done this. Can you please test the account groups endpoint and feedback?