You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cloudstack.apache.org by GitBox <gi...@apache.org> on 2021/08/30 12:46:35 UTC

[GitHub] [cloudstack-go] psycofdj opened a new pull request #7: WIP: Fix generator for map parameters that are lists of objects

psycofdj opened a new pull request #7:
URL: https://github.com/apache/cloudstack-go/pull/7


   This PR modifies the generator to handle some parameters that are list of objects and not list of key/values.
   For instance, when using the `deployVirtualMachines` endpoint while configuring multiple network interfaces, we want to pass the following `iptonetworklist` in the query string:
   ```
   iptonetworklist[0].ip=10.10.10.11
   iptonetworklist[0].ipv6=fc00:1234:5678::abcd
   iptonetworklist[0].networkid=uuid1
   iptonetworklist[1].ip=10.10.11.11
   iptonetworklist[1].ipv6=fc01:1234:5678::abcd
   iptonetworklist[1].networkid=uuid2
   ```
   
   In the current implementation, the `iptonetworklist` doesn't allow to pass multiple networks and a single interface is serialized as:
   ```
   iptonetworklist[0].key=ip
   iptonetworklist[0].value=10.10.10.11
   iptonetworklist[1].key=ipv6
   iptonetworklist[1].value=fc00:1234:5678::abcd
   iptonetworklist[2].key=networkid
   iptonetworklist[2].value=uuid1
   ```
   which is not what is expected on the cloudstack side.
   
   The same goes for other params like `dhcpoptionsnetworklist` and `nicnetworklist`.
   
   I don't known where the `listApis.json` is extract from and I assumed that it was automatically generated from the [apache/cloudstack](https://github.com/apache/cloudstack) repository so I could not disambiguate the `map` type from this file. 
   Instead, I took inspiration from `detailsRequireKeyValue` approach and implemented a kind of declarative list of parameters that should be serialized this way.
   
   The commit in the PR contains both the modification of the generator and the new generated golang code. However I had to revert unexpected changes in `cloudstack/HostService.go`. It appears that the file has been edited in d0a8e7d2a3623d00911b71b5e9ce514487658d6e and 46b776eaca4936a2f7995b26db779a8dd35b1ede without any modification of the generator.
   Q: is the generation part deprecated and should I remove it from my PR ?
   
   I'm currently testing the new client against a real-world cloudstack and I'll remvove the WIP flag if everything is ok
   
   Thanks


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack-go] psycofdj commented on pull request #7: Fix generator for map parameters that are lists of objects

Posted by GitBox <gi...@apache.org>.
psycofdj commented on pull request #7:
URL: https://github.com/apache/cloudstack-go/pull/7#issuecomment-918272979


   like a charm, thank you !
   
   ```
   go get github.com/apache/cloudstack-go/v2@v2.10.0
   go: downloading github.com/apache/cloudstack-go/v2 v2.10.0
   go get: upgraded github.com/apache/cloudstack-go/v2 v2.0.0-20210831123014-8290b0373f69 => v2.10.0
   ```
   
   ```diff
    module github.com/terraform-providers/terraform-provider-cloudstack
    
    require (
   -       github.com/apache/cloudstack-go/v2 v2.0.0-20210831123014-8290b0373f69
   +       github.com/apache/cloudstack-go/v2 v2.10.0
           github.com/hashicorp/go-multierror v1.1.1
           github.com/hashicorp/terraform-plugin-sdk v1.17.0
           github.com/smartystreets/goconvey v1.6.4 // indirect
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack-go] psycofdj commented on pull request #7: Fix generator for map parameters that are lists of objects

Posted by GitBox <gi...@apache.org>.
psycofdj commented on pull request #7:
URL: https://github.com/apache/cloudstack-go/pull/7#issuecomment-918260351


   yes, that's how gomodules works from my experience and from what I understand of the linked documentation.
   
   With the current tag, I have to use pseudo-versioning, like this:
   ```
    require (
          github.com/apache/cloudstack-go/v2 v2.0.0-20210831123014-8290b0373f69
   )
   ```
   
   many tools are will no longer be usable with pseudo-versions, eg. simple update command like `go get ...` or more sophiticated ones like github's dependabot.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack-go] psycofdj commented on pull request #7: Fix generator for map parameters that are lists of objects

Posted by GitBox <gi...@apache.org>.
psycofdj commented on pull request #7:
URL: https://github.com/apache/cloudstack-go/pull/7#issuecomment-918167857


   I was watting the release to bump it in https://github.com/orange-cloudfoundry/terraform-provider-cloudstack. I see that @rhtyd has already talked with my colleague @ArthurHlt [here](orange-cloudfoundry/terraform-provider-cloudstack#1)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack-go] psycofdj edited a comment on pull request #7: Fix generator for map parameters that are lists of objects

Posted by GitBox <gi...@apache.org>.
psycofdj edited a comment on pull request #7:
URL: https://github.com/apache/cloudstack-go/pull/7#issuecomment-918167857


   I was waiting the release to bump it in https://github.com/orange-cloudfoundry/terraform-provider-cloudstack. I see that @rhtyd has already talked with my colleague @ArthurHlt [here](orange-cloudfoundry/terraform-provider-cloudstack#1)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack-go] psycofdj commented on pull request #7: Fix generator for map parameters that are lists of objects

Posted by GitBox <gi...@apache.org>.
psycofdj commented on pull request #7:
URL: https://github.com/apache/cloudstack-go/pull/7#issuecomment-909104097


   Everything works fine on my production environment, I removed the WIP status.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack-go] psycofdj commented on pull request #7: Fix generator for map parameters that are lists of objects

Posted by GitBox <gi...@apache.org>.
psycofdj commented on pull request #7:
URL: https://github.com/apache/cloudstack-go/pull/7#issuecomment-917871907


   > Thanks for merging this PR. Would you mind tagging a new release which would ease bumping everyone's gomodules ?
   
   @pdion891 @rhtyd ?
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack-go] pdion891 commented on pull request #7: Fix generator for map parameters that are lists of objects

Posted by GitBox <gi...@apache.org>.
pdion891 commented on pull request #7:
URL: https://github.com/apache/cloudstack-go/pull/7#issuecomment-918280122


   nice, good to know ! 
   thanks ! 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack-go] psycofdj commented on pull request #7: Fix generator for map parameters that are lists of objects

Posted by GitBox <gi...@apache.org>.
psycofdj commented on pull request #7:
URL: https://github.com/apache/cloudstack-go/pull/7#issuecomment-918225329


   Thanks @pdion891 for the release
   
   Unless I'm mistaken, the release tag should be `v2.<x>.<y>` as long as the library declares itself as `module github.com/apache/cloudstack-go/v2`
   - https://go.dev/blog/publishing-go-modules
   - https://go.dev/blog/v2-go-modules
   
   Another way could be to modify the `go.mod` file and declare the library as `v4` but since the new release is mostly bugfixes I'm afraid that it will break the semantic meaning of the major version.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack-go] pdion891 commented on pull request #7: Fix generator for map parameters that are lists of objects

Posted by GitBox <gi...@apache.org>.
pdion891 commented on pull request #7:
URL: https://github.com/apache/cloudstack-go/pull/7#issuecomment-918125968


   Hi @psycofdj, we will create a new release this week ! 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack-go] psycofdj commented on pull request #7: Fix generator for map parameters that are lists of objects

Posted by GitBox <gi...@apache.org>.
psycofdj commented on pull request #7:
URL: https://github.com/apache/cloudstack-go/pull/7#issuecomment-918126448


   Thanks a lot


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack-go] psycofdj commented on pull request #7: Fix generator for map parameters that are lists of objects

Posted by GitBox <gi...@apache.org>.
psycofdj commented on pull request #7:
URL: https://github.com/apache/cloudstack-go/pull/7#issuecomment-909104097


   Everything works fine on my production environment, I removed the WIP status.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack-go] pdion891 commented on pull request #7: Fix generator for map parameters that are lists of objects

Posted by GitBox <gi...@apache.org>.
pdion891 commented on pull request #7:
URL: https://github.com/apache/cloudstack-go/pull/7#issuecomment-918268464


   release 4.15.1.0 deleted and a new one created https://github.com/apache/cloudstack-go/releases/tag/v2.10.0
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack-go] psycofdj commented on pull request #7: Fix generator for map parameters that are lists of objects

Posted by GitBox <gi...@apache.org>.
psycofdj commented on pull request #7:
URL: https://github.com/apache/cloudstack-go/pull/7#issuecomment-913017065


   Thanks for merging this PR. Would you mind tagging a new release which would ease bumping everyone's gomodules ?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack-go] rhtyd commented on pull request #7: Fix generator for map parameters that are lists of objects

Posted by GitBox <gi...@apache.org>.
rhtyd commented on pull request #7:
URL: https://github.com/apache/cloudstack-go/pull/7#issuecomment-918151370


   Thanks for volunteering @pdion891 - I suppose we'll also need to check/make a list of known users so we don't accidentally break them. The two I know are: https://github.com/apache/cloudstack-terraform-provider and https://github.com/apache/cloudstack-kubernetes-provider cc @davidjumani @Pearl1594 - anything to add/suggest?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack-go] pdion891 commented on pull request #7: Fix generator for map parameters that are lists of objects

Posted by GitBox <gi...@apache.org>.
pdion891 commented on pull request #7:
URL: https://github.com/apache/cloudstack-go/pull/7#issuecomment-918180372


   Release v4.15.1 build and available. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack-go] pdion891 commented on pull request #7: Fix generator for map parameters that are lists of objects

Posted by GitBox <gi...@apache.org>.
pdion891 commented on pull request #7:
URL: https://github.com/apache/cloudstack-go/pull/7#issuecomment-909192455


   @psycofdj , Thanks for the PR,
   
   I fixed some output issues in `cloudstack/HostService.go` recently, and I was not aware of the interaction with `generate/generate.go`. 
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack-go] pdion891 commented on pull request #7: Fix generator for map parameters that are lists of objects

Posted by GitBox <gi...@apache.org>.
pdion891 commented on pull request #7:
URL: https://github.com/apache/cloudstack-go/pull/7#issuecomment-918254644


   oh, so you think creating release version that match cloudstack version such as the one I did this morning is bad from a go lib perspective? we had a discussion in dev@cloudstack.apache.org about using versioning same as cloudstack releases, nobody raised that point.
   
   So from your perspective, we should use v2.x.y because our GO module  is v2 at the moment ?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack-go] pdion891 merged pull request #7: Fix generator for map parameters that are lists of objects

Posted by GitBox <gi...@apache.org>.
pdion891 merged pull request #7:
URL: https://github.com/apache/cloudstack-go/pull/7


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack-go] pdion891 merged pull request #7: Fix generator for map parameters that are lists of objects

Posted by GitBox <gi...@apache.org>.
pdion891 merged pull request #7:
URL: https://github.com/apache/cloudstack-go/pull/7


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack-go] pdion891 commented on pull request #7: Fix generator for map parameters that are lists of objects

Posted by GitBox <gi...@apache.org>.
pdion891 commented on pull request #7:
URL: https://github.com/apache/cloudstack-go/pull/7#issuecomment-909192455


   @psycofdj , Thanks for the PR,
   
   I fixed some output issues in `cloudstack/HostService.go` recently, and I was not aware of the interaction with `generate/generate.go`. 
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack-go] psycofdj commented on pull request #7: Fix generator for map parameters that are lists of objects

Posted by GitBox <gi...@apache.org>.
psycofdj commented on pull request #7:
URL: https://github.com/apache/cloudstack-go/pull/7#issuecomment-909104097


   Everything works fine on my production environment, I removed the WIP status.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack-go] pdion891 merged pull request #7: Fix generator for map parameters that are lists of objects

Posted by GitBox <gi...@apache.org>.
pdion891 merged pull request #7:
URL: https://github.com/apache/cloudstack-go/pull/7


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack-go] pdion891 commented on pull request #7: Fix generator for map parameters that are lists of objects

Posted by GitBox <gi...@apache.org>.
pdion891 commented on pull request #7:
URL: https://github.com/apache/cloudstack-go/pull/7#issuecomment-909192455


   @psycofdj , Thanks for the PR,
   
   I fixed some output issues in `cloudstack/HostService.go` recently, and I was not aware of the interaction with `generate/generate.go`. 
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org