0
0
mirror of https://github.com/bpg/terraform-provider-proxmox.git synced 2025-07-01 02:52:58 +00:00
terraform-provider-proxmox/proxmox/virtual_environment_version.go
2019-12-07 21:15:59 +01:00

39 lines
1.1 KiB
Go

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
package proxmox
import (
"errors"
)
// VirtualEnvironmentVersionResponseBody contains the body from a version response.
type VirtualEnvironmentVersionResponseBody struct {
Data *VirtualEnvironmentVersionResponseData `json:"data,omitempty"`
}
// VirtualEnvironmentVersionResponseData contains the data from a version response.
type VirtualEnvironmentVersionResponseData struct {
Keyboard string `json:"keyboard"`
Release string `json:"release"`
RepositoryID string `json:"repoid"`
Version string `json:"version"`
}
// Version retrieves the version information.
func (c *VirtualEnvironmentClient) Version() (*VirtualEnvironmentVersionResponseData, error) {
resBody := &VirtualEnvironmentVersionResponseBody{}
err := c.DoRequest(hmGET, "version", nil, resBody)
if err != nil {
return nil, err
}
if resBody.Data == nil {
return nil, errors.New("The server did not include a data object in the response")
}
return resBody.Data, nil
}