MCPcopy Create free account
hub / github.com/devnullvoid/pvetui / PostWithResponse

Method PostWithResponse

pkg/api/client.go:88–106  ·  view source on GitHub ↗

PostWithResponse makes a POST request to the Proxmox API and returns the response with timeout.

(path string, data interface{}, result *map[string]interface{})

Source from the content-addressed store, hash-verified

86
87// PostWithResponse makes a POST request to the Proxmox API and returns the response with timeout.
88func (c *Client) PostWithResponse(path string, data interface{}, result *map[string]interface{}) error {
89 ctx, cancel := context.WithTimeout(context.Background(), DefaultAPITimeout)
90 defer cancel()
91
92 c.logger.Debug("API POST with response: %s", path)
93 // Convert data to map[string]interface{} if it's not nil
94 var postData interface{}
95
96 if data != nil {
97 var ok bool
98
99 postData, ok = data.(map[string]interface{})
100 if !ok {
101 return fmt.Errorf("data must be of type map[string]interface{}")
102 }
103 }
104
105 return c.httpClient.Post(ctx, path, postData, result)
106}
107
108// Delete makes a DELETE request to the Proxmox API with timeout.
109func (c *Client) Delete(path string) error {

Callers 15

PullStorageOCIImageMethod · 0.95
StartVMMethod · 0.95
StopVMMethod · 0.95
ShutdownVMMethod · 0.95
RestartVMMethod · 0.95
ResetVMMethod · 0.95
MigrateVMMethod · 0.95
CreateVMMethod · 0.95
CreateLXCMethod · 0.95

Calls 2

DebugMethod · 0.65
PostMethod · 0.45

Tested by

no test coverage detected