{"id":18339462,"url":"https://github.com/terra-farm/go-xen-api-client","last_synced_at":"2025-04-06T05:32:05.491Z","repository":{"id":45986940,"uuid":"49087517","full_name":"terra-farm/go-xen-api-client","owner":"terra-farm","description":"Go XenAPI client","archived":false,"fork":false,"pushed_at":"2023-09-08T15:19:38.000Z","size":515,"stargazers_count":25,"open_issues_count":3,"forks_count":25,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-21T18:07:49.464Z","etag":null,"topics":["golang","xapi","xenapi","xenapi-client"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/terra-farm.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":"2016-01-05T19:23:04.000Z","updated_at":"2024-08-01T14:44:25.000Z","dependencies_parsed_at":"2024-11-05T20:19:41.456Z","dependency_job_id":"a2a29d5c-38a2-4d11-b7ba-708fe08b5d8c","html_url":"https://github.com/terra-farm/go-xen-api-client","commit_stats":null,"previous_names":["ringods/go-xen-api-client"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terra-farm%2Fgo-xen-api-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terra-farm%2Fgo-xen-api-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terra-farm%2Fgo-xen-api-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terra-farm%2Fgo-xen-api-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/terra-farm","download_url":"https://codeload.github.com/terra-farm/go-xen-api-client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247440396,"owners_count":20939220,"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":["golang","xapi","xenapi","xenapi-client"],"created_at":"2024-11-05T20:17:56.941Z","updated_at":"2025-04-06T05:32:03.674Z","avatar_url":"https://github.com/terra-farm.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Continuous Integration](https://github.com/terra-farm/go-xen-api-client/workflows/Continuous%20Integration/badge.svg)\n\n# Go XenAPI client library\n\nThis is a client library for the Xapi toolstack\n(http://xapi-project.github.io/).\n\nThis library covers the entire [XenAPI](https://xapi-project.github.io/xen-api/)\nand I have successfully used it to implement a Terraform plugin that interfaces\nCitrix XenServer. That being said, this library is not production-ready yet.\nUse it at your own risk, and don't expect everything in this library to work\nout of the box.\n\n## Usage example\n\nThe following example demonstrates how to instruct XenServer to start a VM with\na given name label:\n\n```go\npackage main\n\nimport (\n    \"fmt\"\n    \"github.com/terra-farm/go-xen-api-client\"\n)\n\nconst XEN_API_URL string = \"https://IP.OF.XEN.SERVER\"\nconst XEN_API_USERNAME string = \"USERNAME\"\nconst XEN_API_PASSWORD string = \"PASSWORD\"\nconst VM_NAME_LABEL = \"VM NAME LABEL\"\n\nfunc main() {\n    xapi, err := xenapi.NewClient(XEN_API_URL, nil)\n    if err != nil {\n        panic(err)\n    }\n\n    session, err := xapi.Session.LoginWithPassword(XEN_API_USERNAME, XEN_API_PASSWORD, \"1.0\", \"example\")\n    if err != nil {\n        panic(err)\n    }\n\n    vms, err := xapi.VM.GetByNameLabel(session, VM_NAME_LABEL)\n    if err != nil {\n        panic(err)\n    }\n\n    if len(vms) == 0 {\n        panic(fmt.Errorf(\"No VM template with name label %q has been found\", VM_NAME_LABEL))\n    }\n\n    if len(vms) \u003e 1 {\n        panic(fmt.Errorf(\"More than one VM with name label %q has been found\", VM_NAME_LABEL))\n    }\n\n    vm := vms[0]\n\n    xapi.VM.Start(session, vm, false, false)\n    if err != nil {\n        panic(err)\n    }\n\n    err = xapi.Session.Logout(session)\n    if err != nil {\n        panic(err)\n    }\n}\n```\n\n## Project status\n\nThe most important missing pieces before this library is production-ready are:\n\n- A strategy how to handle the differences in the XenAPI versions.\n- Tests, at least for the various data type conversions.\n- Embed XenAPI documentation as GoDoc in the generated code.\n- Better error messages.\n- Usage examples.\n\nContributions welcome!\n\nPlease note that I want to keep this library lean. I envision it to merely\nprovide a one-to-one mapping of XenAPI functions to Go functions. Because of\nthis, I will likely not accept pull requests that implement higher level\nfunctionality.\n\n## Implementation notes\n\nMost of the code in this library is generated from a description of the XenAPI.\nThis description is the file `xenapi.json`, the source of which is the XenAPI\ndocumentation at http://xapi-project.github.io/:\n\n- https://github.com/xapi-project/xapi-project.github.io/tree/master/_data\n\nThe list of error code constants in `error.go` is borrowed from xapi-projects\nOCaml client:\n\n- https://github.com/xapi-project/xen-api/blob/master/ocaml/idl/api_errors.ml\n\nThe JSON file contains the lifecycle of published classes, fields and messages.\nEach of the release names can be mapped back to a version listed here:\n\n- https://xapi-project.github.io/xen-api/releases.html\n\n## Regenerating API after xenapi.json update\nIf XenAPI was updated, it is required to regenerate all of files with a new API description. In order to do that one needs to follow these steps:\n- Get newest `xenapi.json` from the link above.\n- Delete old generated APIs using `rm *_gen.go`\n- Generate new API with `go generate`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fterra-farm%2Fgo-xen-api-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fterra-farm%2Fgo-xen-api-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fterra-farm%2Fgo-xen-api-client/lists"}