0
0
mirror of https://github.com/bpg/terraform-provider-proxmox.git synced 2025-06-30 02:31:10 +00:00
terraform-provider-proxmox/proxmox/nodes/query_url_metadata.go
Pavel Boldyrev d46399024f
fix(file): better error message on download failure (#1923)
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2025-04-23 12:34:38 -04:00

35 lines
879 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 nodes
import (
"context"
"fmt"
"net/http"
"github.com/bpg/terraform-provider-proxmox/proxmox/api"
)
// GetQueryURLMetadata retrieves the URL filename details for a node.
func (c *Client) GetQueryURLMetadata(
ctx context.Context,
d *QueryURLMetadataGetRequestBody,
) (*QueryURLMetadataGetResponseData, error) {
resBody := &QueryURLMetadataGetResponseBody{}
err := c.DoRequest(ctx, http.MethodGet, c.ExpandPath("query-url-metadata"), d, resBody)
if err != nil {
return nil, fmt.Errorf("error retrieving URL metadata for %q: %w", d.URL, err)
}
if resBody.Data == nil {
return nil, api.ErrNoDataObjectInResponse
}
return resBody.Data, nil
}