Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReadErrorBody ¶
ReadErrorBody reads and returns the response body as a string for error messages.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a base HTTP client for the Grafana Fleet Management API. All operations use POST (gRPC/Connect style JSON-over-HTTP).
func LoadClient ¶
LoadClient loads cloud configuration and constructs a Fleet Management client using Basic auth ({instanceID}:{apiToken}). Returns the client, the resolved namespace, and any error. Fails with a descriptive error if AgentManagementInstanceURL or AgentManagementInstanceID is not available for the stack.
func NewClient ¶
func NewClient(baseURL, instanceID, apiToken string, useBasicAuth bool, httpClient *http.Client) *Client
NewClient creates a new Fleet Management base client. When useBasicAuth is true, requests use Basic auth with instanceID:apiToken. Otherwise, requests use Bearer token auth. If httpClient is nil, providers.ExternalHTTPClient() is used.
type ClientResult ¶
ClientResult holds the results of LoadClient including the fleet base client, resolved namespace, and the full stack info for deriving backend URLs and prom headers.
func LoadClientWithStack ¶
func LoadClientWithStack(ctx context.Context, loader ConfigLoader) (*ClientResult, error)
LoadClientWithStack is like LoadClient but also returns the full stack info, needed by instrumentation commands to derive backend URLs and prom headers.
type ConfigLoader ¶
type ConfigLoader interface {
LoadCloudConfig(ctx context.Context) (providers.CloudRESTConfig, error)
}
ConfigLoader can load Grafana Cloud configuration from the active context. This mirrors the interface in internal/providers/fleet/ to avoid a circular import.