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

Method Post

pkg/api/client.go:67–85  ·  view source on GitHub ↗

Post makes a POST request to the Proxmox API with timeout.

(path string, data interface{})

Source from the content-addressed store, hash-verified

65
66// Post makes a POST request to the Proxmox API with timeout.
67func (c *Client) Post(path string, data interface{}) error {
68 ctx, cancel := context.WithTimeout(context.Background(), DefaultAPITimeout)
69 defer cancel()
70
71 c.logger.Debug("API POST: %s", path)
72 // Convert data to map[string]interface{} if it's not nil
73 var postData interface{}
74
75 if data != nil {
76 var ok bool
77
78 postData, ok = data.(map[string]interface{})
79 if !ok {
80 return fmt.Errorf("data must be of type map[string]interface{}")
81 }
82 }
83
84 return c.httpClient.Post(ctx, path, postData, nil)
85}
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 {

Callers 7

UpdateVMConfigMethod · 0.45
UpdateVMResourcesMethod · 0.45
CreateSnapshotMethod · 0.45
RollbackToSnapshotMethod · 0.45
PostWithResponseMethod · 0.45
CreateBackupMethod · 0.45
RestoreBackupMethod · 0.45

Calls 1

DebugMethod · 0.65

Tested by

no test coverage detected