0
0
mirror of https://github.com/bpg/terraform-provider-proxmox.git synced 2025-06-30 18:42:58 +00:00
terraform-provider-proxmox/proxmox/virtual_environment_access_groups.go
2019-12-07 21:15:59 +01:00

37 lines
1.2 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"
)
// VirtualEnvironmentAccessGroupListResponseBody contains the body from an access group list response.
type VirtualEnvironmentAccessGroupListResponseBody struct {
Data []*VirtualEnvironmentAccessGroupListResponseData `json:"data,omitempty"`
}
// VirtualEnvironmentAccessGroupListResponseData contains the data from an access group list response.
type VirtualEnvironmentAccessGroupListResponseData struct {
Comment string `json:"comment"`
ID string `json:"groupid"`
}
// ListAccessGroups retrieves a list of access groups.
func (c *VirtualEnvironmentClient) ListAccessGroups() ([]*VirtualEnvironmentAccessGroupListResponseData, error) {
resBody := &VirtualEnvironmentAccessGroupListResponseBody{}
err := c.DoRequest(hmGET, "access/groups", 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
}