1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
package api
import (
"context"
"net/http"
"gitlab.com/gitlab-org/cluster-integration/gitlab-agent/v16/internal/gitlab"
"gitlab.com/gitlab-org/cluster-integration/gitlab-agent/v16/pkg/agentcfg"
)
const (
AgentConfigurationAPIPath = "/api/v4/internal/kubernetes/agent_configuration"
)
func PostAgentConfiguration(ctx context.Context, client gitlab.ClientInterface, agentID int64,
config *agentcfg.ConfigurationFile, opts ...gitlab.DoOption) error {
return client.Do(ctx,
joinOpts(opts,
gitlab.WithMethod(http.MethodPost),
gitlab.WithPath(AgentConfigurationAPIPath),
gitlab.WithJWT(true),
gitlab.WithProtoJSONRequestBody(&AgentConfigurationRequest{
AgentId: agentID,
AgentConfig: config,
}),
gitlab.WithResponseHandler(gitlab.NoContentResponseHandler()),
)...,
)
}
|