MCPcopy Create free account
hub / github.com/Thunder-Compute/thunder-cli / ModifyInstance

Method ModifyInstance

api/client.go:269–285  ·  view source on GitHub ↗

ModifyInstance modifies an existing instance configuration.

(instanceID string, req InstanceModifyRequest)

Source from the content-addressed store, hash-verified

267
268// ModifyInstance modifies an existing instance configuration.
269func (c *Client) ModifyInstance(instanceID string, req InstanceModifyRequest) (*InstanceModifyResponse, error) {
270 var resp InstanceModifyResponse
271 err := c.doRequest(context.Background(), "POST", fmt.Sprintf("/v1/instances/%s/modify", instanceID), req, &resp)
272 if err != nil {
273 var apiErr *APIError
274 if errors.As(err, &apiErr) {
275 switch apiErr.StatusCode {
276 case 404:
277 return nil, fmt.Errorf("instance not found")
278 case 409:
279 return nil, fmt.Errorf("instance cannot be modified (may not be in RUNNING state)")
280 }
281 }
282 return nil, err
283 }
284 return &resp, nil
285}
286
287// UpdatePorts atomically adds and removes forwarded HTTP ports on an instance.
288func (c *Client) UpdatePorts(instanceID string, addPorts, removePorts []int) (*PortAddResponse, error) {

Callers 2

runModifyFunction · 0.80
modifyInstanceCmdFunction · 0.80

Calls 1

doRequestMethod · 0.95

Tested by

no test coverage detected