-
Notifications
You must be signed in to change notification settings - Fork 292
Feature merge: Go SDK #5679
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature merge: Go SDK #5679
Conversation
Signed-off-by: Luca Zhang <feiya.zhang@cloud.com>
CP-47350: Add mustache template for Record/Ref/Class Types CP-47365: Add mustache template for API messages/errors CP-47363: Add mustache template for file header Signed-off-by: Luca Zhang <feiya.zhang@cloud.com>
Signed-off-by: Luca Zhang <feiya.zhang@cloud.com>
Signed-off-by: Luca Zhang <feiya.zhang@cloud.com>
Signed-off-by: Luca Zhang <feiya.zhang@cloud.com>
Signed-off-by: Luca Zhang <feiya.zhang@cloud.com>
Signed-off-by: Luca Zhang <feiya.zhang@cloud.com>
…ed JSON is wanted Signed-off-by: Luca Zhang <feiya.zhang@cloud.com>
…mmonFunctions` Signed-off-by: Luca Zhang <feiya.zhang@cloud.com>
…files Signed-off-by: Luca Zhang <feiya.zhang@cloud.com>
Signed-off-by: Luca Zhang <feiya.zhang@cloud.com>
Before we got the enums alongside objs, the readability of code is so poor. We separate to get them now. Signed-off-by: Luca Zhang <feiya.zhang@cloud.com>
Just check the fields only we need instead of generalized recursive functions Signed-off-by: Luca Zhang <feiya.zhang@cloud.com>
Signed-off-by: Luca Zhang <feiya.zhang@cloud.com>
Generate Golang codes for SDK
…unctions Signed-off-by: xueqingz <xueqing.zhang@citrix.com> Signed-off-by: Luca Zhang <feiya.zhang@cloud.com>
Signed-off-by: Luca Zhang <feiya.zhang@cloud.com>
Signed-off-by: xueqingz <xueqing.zhang@citrix.com> Signed-off-by: Luca Zhang <feiya.zhang@cloud.com>
changed templates: APIVersions.mustache,APIErrors.mustache, Record.mustache Signed-off-by: Luca Zhang <feiya.zhang@cloud.com>
Signed-off-by: xueqingz <xueqing.zhang@citrix.com> Signed-off-by: Luca Zhang <feiya.zhang@cloud.com>
Signed-off-by: Luca Zhang <feiya.zhang@cloud.com>
…lass messages Signed-off-by: Luca Zhang <feiya.zhang@cloud.com>
Signed-off-by: Luca Zhang <feiya.zhang@cloud.com>
…h_enums` Signed-off-by: Luca Zhang <feiya.zhang@cloud.com>
Signed-off-by: Luca Zhang <feiya.zhang@cloud.com>
Signed-off-by: Luca Zhang <feiya.zhang@cloud.com>
CP-48855: fix go lint var-name warnings
Signed-off-by: Luca Zhang <feiya.zhang@cloud.com>
Signed-off-by: Luca Zhang <feiya.zhang@cloud.com>
…_feature Merge master to Go SDK feature branch
* CP-49707: Go SDK: Add JSON tag for structs This aims to allow a Go SDK client to unmarshal JSON to Go structs with the function in Go json pacakge instead of using Go SDK. The unmarshalling in Go SDK contains two steps: JSON -> map -> struct. This is because some special cases need to be handled explicitly. But for sake of safety, this unmarshalling is not exposed to clients. Signed-off-by: Ming Lu <ming.lu@cloud.com> * CP-49349: Go SDK: Append UTC timezone to unix timestamp The date time in Go requires a date time with timezone info. But XAPI may return a UNIX timestamp to clients. This commit blindly adds a UTC timezone for UNIX timestamps returned from XAPI server. Signed-off-by: Ming Lu <ming.lu@cloud.com> * CP-49349: Go SDK: Allow spaces in special value of float type Some special values of float standing in JSON are handled specifically. This commit allows the special values contain spaces. Signed-off-by: Ming Lu <ming.lu@cloud.com> * Go SDK: Disable golangci tagliatelle This check complains the struct json tag naming style. It expects the Caml style, but Go SDK has to use Snake. Signed-off-by: Ming Lu <ming.lu@cloud.com> --------- Signed-off-by: Ming Lu <ming.lu@cloud.com>
Signed-off-by: Xihuan Yang <xihuan.yang@cloud.com>
…_test CP-47928: Add component test for Go SDK
Signed-off-by: xueqingz <xueqing.zhang@citrix.com>
…_feature Merge master branch to go_sdk feature branch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ocaml/sdk-gen/go/README.md
Outdated
|
|
||
| A. Navigate to the extracted `XenServer-SDK\XenServerGo\src` directory and copy the whole folder `src` into your Go project directory. | ||
|
|
||
| B. To use XenServer Go SDK as a local Go module, update one line into the `go.mod` file under your Go project: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"update one line into" => Shouldn't this be "include the following line into"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"To use XenServer Go SDK as a local Go module" => "To use the XenServer SDK for Go as a local Go module"
ocaml/sdk-gen/go/README.md
Outdated
| ``` | ||
| replace xenapi => ./src | ||
| ``` | ||
| You can then import this XenServer SDK Go module with the following command: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"this XenServer SDK Go module" => "the XenServer SDK for Go" or "the XenServer module for Go"
|
I've just noticed that the mustache templates do not have the BSD 2-clause licence disclaimer at the top. All the autogenerated source files for all the SDK languages should include this. Is it added somehow by the generation code? If not, the simplest is to just hardcode it at the top of the mustache file (see other mustache files for the other langauges). |
I think this should be included in the FQP and test report. |
|
All fixes are in #5687 |
Signed-off-by: Ming Lu <ming.lu@cloud.com>
Signed-off-by: Ming Lu <ming.lu@cloud.com>
Signed-off-by: Ming Lu <ming.lu@cloud.com>
Prior to this change, the function parameter list is generated by Mustache template. As a result, a template boolean variable 'first' has to be used to determine if a leading comma is presented or not. E.g. when the 'first' is true, a parameter would be rendered as "a string', and then the next parameter with the 'first' being false would be rendered as ", b string". Putting them together would result in "a string, b string". This could work but is difficult to be understood. In this commit, it is changed to construct the whole function parameter list as a string in OCaml code and bind it to the template variable 'func_params'. Similar changes apply to the template variable 'is_session_id'. It is removed in this commit and the expected values are generated by OCaml code. Signed-off-by: Ming Lu <ming.lu@cloud.com>
Signed-off-by: Ming Lu <ming.lu@cloud.com>
|
Looks fine to me, waiting on tina to review this. This is because she didn't approve the fixup PR |
|
Koji build base on branch feature/go_sdk latest commit "cca5a6e250b56a98294987a95b7ee53870188c41" https://koji.eng.citrite.net/koji/buildinfo?buildID=20734. |
This is to merge Go SDK feature (including backwards compatibility support) into master branch.
Basically, the changes in feature include:
Most of the changes are under "ocaml/sdk-gen/". One exception is 612b73b, in which the Api.errors (strings) have to be collected in the way.