mirror of
https://github.com/coder/coder.git
synced 2025-07-09 11:45:56 +00:00
feat(coderd): add support for sending batched agent metadata (#10223)
Part of #9782
This commit is contained in:
committed by
GitHub
parent
1b1ab97c24
commit
7eeba15d16
@ -69,11 +69,20 @@ func (c *Client) GitSSHKey(ctx context.Context) (GitSSHKey, error) {
|
||||
return gitSSHKey, json.NewDecoder(res.Body).Decode(&gitSSHKey)
|
||||
}
|
||||
|
||||
type Metadata struct {
|
||||
Key string `json:"key"`
|
||||
codersdk.WorkspaceAgentMetadataResult
|
||||
}
|
||||
|
||||
type PostMetadataRequest struct {
|
||||
Metadata []Metadata `json:"metadata"`
|
||||
}
|
||||
|
||||
// In the future, we may want to support sending back multiple values for
|
||||
// performance.
|
||||
type PostMetadataRequest = codersdk.WorkspaceAgentMetadataResult
|
||||
type PostMetadataRequestDeprecated = codersdk.WorkspaceAgentMetadataResult
|
||||
|
||||
func (c *Client) PostMetadata(ctx context.Context, key string, req PostMetadataRequest) error {
|
||||
func (c *Client) PostMetadata(ctx context.Context, key string, req PostMetadataRequestDeprecated) error {
|
||||
res, err := c.SDK.Request(ctx, http.MethodPost, "/api/v2/workspaceagents/me/metadata/"+key, req)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("execute request: %w", err)
|
||||
|
Reference in New Issue
Block a user