0
0
mirror of https://github.com/bpg/terraform-provider-proxmox.git synced 2025-07-05 13:33:58 +00:00
terraform-provider-proxmox/proxmox/nodes/storage/client.go
renovate[bot] 6a8f367c46
chore(deps): update golangci/golangci-lint (v2.1.6 → v2.2.1) (#2013)
* chore(deps): update golangci/golangci-lint (v2.1.6 → v2.2.1)

| datasource      | package                | from   | to     |
| --------------- | ---------------------- | ------ | ------ |
| github-releases | golangci/golangci-lint | v2.1.6 | v2.2.1 |

* chore: update rules & run linter

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>

---------

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2025-07-04 17:56:38 -04:00

43 lines
975 B
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 storage
import (
"fmt"
"github.com/bpg/terraform-provider-proxmox/proxmox/api"
"github.com/bpg/terraform-provider-proxmox/proxmox/nodes/tasks"
)
// Client is an interface for accessing the Proxmox node storage API.
type Client struct {
api.Client
StorageName string
}
func (c *Client) basePath() string {
return c.Client.ExpandPath("storage")
}
// ExpandPath expands a relative path to a full node storage API path.
func (c *Client) ExpandPath(path string) string {
ep := fmt.Sprintf("%s/%s", c.basePath(), c.StorageName)
if path != "" {
ep = fmt.Sprintf("%s/%s", ep, path)
}
return ep
}
// Tasks returns a client for managing node storage tasks.
func (c *Client) Tasks() *tasks.Client {
return &tasks.Client{
Client: c.Client,
}
}