36 lines
775 B
Go
36 lines
775 B
Go
package client
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"github.com/pkg/errors"
|
|
)
|
|
|
|
func (c *Client) DeleteAgentSpec(ctx context.Context, agentID AgentID, name string, version string, funcs ...OptionFunc) (string, string, error) {
|
|
payload := struct {
|
|
Name string `json:"name"`
|
|
Version string `json:"version"`
|
|
}{
|
|
Name: name,
|
|
Version: version,
|
|
}
|
|
|
|
response := withResponse[struct {
|
|
Name string `json:"name"`
|
|
Version string `json:"version"`
|
|
}]()
|
|
|
|
path := fmt.Sprintf("/api/v1/agents/%d/specs", agentID)
|
|
|
|
if err := c.apiDelete(ctx, path, payload, &response, funcs...); err != nil {
|
|
return "", "", errors.WithStack(err)
|
|
}
|
|
|
|
if response.Error != nil {
|
|
return "", "", errors.WithStack(response.Error)
|
|
}
|
|
|
|
return response.Data.Name, response.Data.Version, nil
|
|
}
|