feat: resources segregation by tenant
This commit is contained in:
27
pkg/client/claim_agent.go
Normal file
27
pkg/client/claim_agent.go
Normal file
@ -0,0 +1,27 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
func (c *Client) ClaimAgent(ctx context.Context, agentThumbprint string, funcs ...OptionFunc) (*Agent, error) {
|
||||
response := withResponse[struct {
|
||||
Agent *Agent `json:"agent"`
|
||||
}]()
|
||||
|
||||
payload := map[string]any{
|
||||
"thumbprint": agentThumbprint,
|
||||
}
|
||||
|
||||
if err := c.apiPost(ctx, "/api/v1/agents/claim", payload, &response, funcs...); err != nil {
|
||||
return nil, errors.WithStack(err)
|
||||
}
|
||||
|
||||
if response.Error != nil {
|
||||
return nil, errors.WithStack(response.Error)
|
||||
}
|
||||
|
||||
return response.Data.Agent, nil
|
||||
}
|
Reference in New Issue
Block a user