{"id":21051302,"url":"https://github.com/ovirt/go-ovirt","last_synced_at":"2025-05-15T21:35:16.921Z","repository":{"id":57486440,"uuid":"98250428","full_name":"oVirt/go-ovirt","owner":"oVirt","description":"Go SDK Source-Code for oVirt 4.x, generated by ovirt/ovirt-engine-sdk-go.","archived":false,"fork":false,"pushed_at":"2025-04-30T12:04:49.000Z","size":3879,"stargazers_count":31,"open_issues_count":0,"forks_count":13,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-04-30T12:58:48.075Z","etag":null,"topics":["go","go-library","ovirt","ovirt-api-metamodel","ovirt-engine","ovirt-management"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oVirt.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.adoc","contributing":null,"funding":null,"license":"LICENSE.txt","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,"zenodo":null}},"created_at":"2017-07-25T01:30:54.000Z","updated_at":"2025-04-30T12:04:53.000Z","dependencies_parsed_at":"2024-06-18T15:26:58.414Z","dependency_job_id":"58c63a11-424c-4316-b467-6bc4e489e1de","html_url":"https://github.com/oVirt/go-ovirt","commit_stats":null,"previous_names":["imjoey/go-ovirt"],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oVirt%2Fgo-ovirt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oVirt%2Fgo-ovirt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oVirt%2Fgo-ovirt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oVirt%2Fgo-ovirt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oVirt","download_url":"https://codeload.github.com/oVirt/go-ovirt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254425674,"owners_count":22069219,"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":["go","go-library","ovirt","ovirt-api-metamodel","ovirt-engine","ovirt-management"],"created_at":"2024-11-19T15:52:22.851Z","updated_at":"2025-05-15T21:35:11.902Z","avatar_url":"https://github.com/oVirt.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# oVirt Go SDK \n[![Build Status](https://travis-ci.org/oVirt/ovirt-engine-sdk-go.svg?branch=master)](https://travis-ci.org/oVirt/ovirt-engine-sdk-go)\n[![Go Report Card](https://goreportcard.com/badge/github.com/oVirt/go-ovirt)](https://goreportcard.com/report/github.com/oVirt/go-ovirt)\n\n## Introduction\n\nThe oVirt Go SDK is a Go package that simplifies access to the\noVirt Engine API.\n\n\u003e __IMPORTANT__: The code in this project is generated automatically by the [oVirt/ovirt-engine-sdk-go](https://github.com/oVirt/ovirt-engine-sdk-go). So if you want to know how to generate the code, please read the `README.md` in the  [oVirt/ovirt-engine-sdk-go](https://github.com/oVirt/ovirt-engine-sdk-go) repository instead.\n\n## Usage\n\nTo use the SDK you should import ovirtsdk package as follows:\n\n```go\nimport (\n    ovirtsdk4 \"github.com/ovirt/go-ovirt\"\n)\n```\n\n\u003e __IMPORTANT__: To make it easy to manage dependencies on stable go-ovirt releases, starting with go-ovirt `4.2.2`, we will move to semantic versioning. If you are still using `v4.0.x` via importing `gopkg.in/ovirt/go-ovirt.v4` or `4.2.1`, we highly recommend you to update to `4.2.2` or above. In product environment, please __NEVER__ adopt the master branch which will always be under heavy development. \n\u003e \n\nThat will give you access to all the classes of the SDK, and in particular\nto the `Connection` class. This is the entry point of the SDK,\nand gives you access to the root of the tree of services of the API:\n\n```go\nimport (\n    \"fmt\"\n    \"time\"\n    ovirtsdk4 \"github.com/ovirt/go-ovirt\"\n)\n\n// Create the connection to the api server\ninputRawURL := \"https://10.1.111.229/ovirt-engine/api\"\nconn, err := ovirtsdk4.NewConnectionBuilder().\n\tURL(inputRawURL).\n\tUsername(\"admin@internal\").\n\tPassword(\"qwer1234\").\n\tInsecure(true).\n\tCompress(true).\n\tTimeout(time.Second * 10).\n\tBuild()\nif err != nil {\n\tt.Fatalf(\"Make connection failed, reason: %s\", err.Error())\n}\n\n// Never forget to close connection\ndefer conn.Close()\n\n```\n\nThere are two ways of using the SDK, one is calling regular functions, which should check if error returned, the other is calling functions prefixed with `Must`, which is short and chain-function calling supported.\n\nCalling the regular functions is recommended, because it is  more accurate for catching errors.\n\n\u003e __IMPORTANT__: you should catch the panic errors by defining the recover-defer function.\n\n\n### Regular _Recommended_\n\n```go\nimport (\n    \"fmt\"\n    \"time\"\n    ovirtsdk4 \"github.com/ovirt/go-ovirt\"\n)\n\n// Create the connection to the api server\ninputRawURL := \"https://10.1.111.229/ovirt-engine/api\"\nconn, err := ovirtsdk4.NewConnectionBuilder().\n\tURL(inputRawURL).\n\tUsername(\"admin@internal\").\n\tPassword(\"qwer1234\").\n\tInsecure(true).\n\tCompress(true).\n\tTimeout(time.Second * 10).\n\tBuild()\nif err != nil {\n\tt.Fatalf(\"Make connection failed, reason: %s\", err.Error())\n}\n\ndefer conn.Close()\n\n// Get the reference to the \"clusters\" service\nclustersService := conn.SystemService().ClustersService()\n\n// Use the \"list\" method of the \"clusters\" service to list all the clusters of the system\nclustersResponse, err := clustersService.List().Send()\nif err != nil {\n\tfmt.Printf(\"Failed to get cluster list, reason: %v\\n\", err)\n\treturn\n}\n\nif clusters, ok := clustersResponse.Clusters(); ok {\n\t// Print the datacenter names and identifiers\n\tfmt.Printf(\"Cluster: (\")\n\tfor _, cluster := range clusters.Slice() {\n\t\tif clusterName, ok := cluster.Name(); ok {\n\t\t\tfmt.Printf(\" name: %v\", clusterName)\n\t\t}\n\t\tif clusterId, ok := cluster.Id(); ok {\n\t\t\tfmt.Printf(\" id: %v\", clusterId)\n\t\t}\n\t}\n\tfmt.Println(\")\")\n}\n\n```\n\n### Must _Not-Recommended_\n\n```go\nimport (\n    \"fmt\"\n    \"time\"\n    ovirtsdk4 \"github.com/ovirt/go-ovirt\"\n)\n\n// Create the connection to the api server\ninputRawURL := \"https://10.1.111.229/ovirt-engine/api\"\nconn, err := ovirtsdk4.NewConnectionBuilder().\n\tURL(inputRawURL).\n\tUsername(\"admin@internal\").\n\tPassword(\"qwer1234\").\n\tInsecure(true).\n\tCompress(true).\n\tTimeout(time.Second * 10).\n\tBuild()\nif err != nil {\n\tt.Fatalf(\"Make connection failed, reason: %s\", err.Error())\n}\n\ndefer conn.Close()\n\n// To use `Must` methods, you should recover it if panics\ndefer func() {\n\tif err := recover(); err != nil {\n\t\tfmt.Printf(\"Panics occurs %v, try the non-Must methods to find the reason\", err)\n\t}\n}()\n\n// Get the reference to the \"clusters\" service\nclustersService := conn.SystemService().ClustersService()\n\n// Use the \"list\" method of the \"clusters\" service to list all the clusters of the system\nclustersResponse := clustersService.List().MustSend()\n\nclusters := clustersResponse.MustClusters()\n\n// Print the datacenter names and identifiers\nfmt.Printf(\"Cluster: (\")\nfor _, cluster := range clusters.Slice() {\n\tfmt.Printf(\" name: %v\", cluster.MustName())\n\tfmt.Printf(\" id: %v\", cluster.MustId())\n}\nfmt.Println(\")\")\n\n```\n\n## More examples\n\nYou could refer to more examples under `examples/` directory.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fovirt%2Fgo-ovirt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fovirt%2Fgo-ovirt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fovirt%2Fgo-ovirt/lists"}