fleet

package
v0.16.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 23, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateAgentDownloadSource added in v0.14.5

CreateAgentDownloadSource creates a new agent binary download source.

func CreateAgentPolicy

func CreateAgentPolicy(ctx context.Context, client *Client, req kbapi.PostFleetAgentPoliciesJSONRequestBody, sysMonitoring bool, spaceID string) (*kbapi.AgentPolicy, diag.Diagnostics)

CreateAgentPolicy creates a new agent policy.

func CreateDefendPackagePolicy added in v0.14.4

func CreateDefendPackagePolicy(ctx context.Context, client *Client, spaceID string, req kbapi.PackagePolicyRequestTypedInputs) (*kbapi.PackagePolicy, diag.Diagnostics)

CreateDefendPackagePolicy creates a new Elastic Defend package policy using the typed-input request body without requesting the simplified format. This is used for the Defend bootstrap create step.

func CreateFleetServerHost

func CreateFleetServerHost(ctx context.Context, client *Client, spaceID string, req kbapi.PostFleetFleetServerHostsJSONRequestBody) (*kbapi.ServerHost, diag.Diagnostics)

CreateFleetServerHost creates a new fleet server host.

func CreateOutput

func CreateOutput(ctx context.Context, client *Client, spaceID string, req kbapi.NewOutputUnion) (*kbapi.OutputUnion, diag.Diagnostics)

CreateOutput creates a new output.

func CreatePackagePolicy added in v0.10.0

func CreatePackagePolicy(ctx context.Context, client *Client, spaceID string, req kbapi.PackagePolicyRequest) (*kbapi.PackagePolicy, diag.Diagnostics)

CreatePackagePolicy creates a new package policy.

func CreateProxy added in v0.15.0

CreateProxy creates a new Fleet proxy.

func DeleteAgentDownloadSource added in v0.14.5

func DeleteAgentDownloadSource(ctx context.Context, client *Client, id string, spaceID string) diag.Diagnostics

DeleteAgentDownloadSource deletes an existing agent binary download source.

func DeleteAgentPolicy

func DeleteAgentPolicy(ctx context.Context, client *Client, id string, spaceID string) diag.Diagnostics

DeleteAgentPolicy deletes an existing agent policy.

func DeleteFleetServerHost

func DeleteFleetServerHost(ctx context.Context, client *Client, id string, spaceID string) diag.Diagnostics

DeleteFleetServerHost deletes an existing fleet server host.

func DeleteKibanaAssets added in v0.15.0

func DeleteKibanaAssets(ctx context.Context, client *Client, name, version string, spaceID string, force bool) diag.Diagnostics

DeleteKibanaAssets removes Kibana assets for a package from a specific space.

func DeleteOutput

func DeleteOutput(ctx context.Context, client *Client, id string, spaceID string) diag.Diagnostics

DeleteOutput deletes an existing output.

func DeletePackagePolicy added in v0.10.0

func DeletePackagePolicy(ctx context.Context, client *Client, id string, spaceID string, force bool) diag.Diagnostics

DeletePackagePolicy deletes an existing package policy.

func DeleteProxy added in v0.15.0

func DeleteProxy(ctx context.Context, client *Client, spaceID, proxyID string) diag.Diagnostics

DeleteProxy deletes an existing Fleet proxy.

func GetAgentDownloadSource added in v0.14.5

func GetAgentDownloadSource(ctx context.Context, client *Client, id string, spaceID string) (*kbapi.GetFleetAgentDownloadSourcesSourceidResponse, diag.Diagnostics)

GetAgentDownloadSource reads a specific agent binary download source from the API.

func GetAgentPolicy added in v0.11.12

func GetAgentPolicy(ctx context.Context, client *Client, id string, spaceID string) (*kbapi.AgentPolicy, diag.Diagnostics)

GetAgentPolicy reads a specific agent policy from the API.

func GetDefendPackagePolicy added in v0.14.4

func GetDefendPackagePolicy(ctx context.Context, client *Client, id string, spaceID string) (*kbapi.PackagePolicy, diag.Diagnostics)

GetDefendPackagePolicy reads a specific Elastic Defend package policy from the Fleet API without requesting the simplified format. This preserves the typed input shape, input config payloads, and the top-level version token required for subsequent update operations.

func GetEnrollmentTokens added in v0.11.12

func GetEnrollmentTokens(ctx context.Context, client *Client, spaceID string) ([]kbapi.EnrollmentApiKey, diag.Diagnostics)

GetEnrollmentTokens reads all enrollment tokens from the API.

func GetEnrollmentTokensByPolicy added in v0.11.5

func GetEnrollmentTokensByPolicy(ctx context.Context, client *Client, policyID string) ([]kbapi.EnrollmentApiKey, diag.Diagnostics)

GetEnrollmentTokensByPolicy Get enrollment tokens by given policy ID.

func GetEnrollmentTokensByPolicyInSpace added in v0.12.2

func GetEnrollmentTokensByPolicyInSpace(ctx context.Context, client *Client, policyID string, spaceID string) ([]kbapi.EnrollmentApiKey, diag.Diagnostics)

GetEnrollmentTokensByPolicyInSpace Get enrollment tokens by policy ID within a specific Kibana space.

func GetFleetServerHost added in v0.11.12

func GetFleetServerHost(ctx context.Context, client *Client, id string, spaceID string) (*kbapi.ServerHost, diag.Diagnostics)

GetFleetServerHost reads a specific fleet server host from the API.

func GetOutput added in v0.11.12

func GetOutput(ctx context.Context, client *Client, id string, spaceID string) (*kbapi.OutputUnion, diag.Diagnostics)

GetOutput reads a specific output from the API.

func GetOutputs added in v0.14.4

func GetOutputs(ctx context.Context, client *Client, spaceID string) ([]kbapi.OutputUnion, diag.Diagnostics)

GetOutputs reads all outputs from the API.

func GetPackage added in v0.11.12

func GetPackage(ctx context.Context, client *Client, name, version, spaceID string) (*kbapi.PackageInfo, diag.Diagnostics)

GetPackage reads a specific package from the API.

func GetPackagePolicy added in v0.11.12

func GetPackagePolicy(ctx context.Context, client *Client, id string, spaceID string) (*kbapi.PackagePolicy, diag.Diagnostics)

GetPackagePolicy reads a specific package policy from the API.

func GetPackages added in v0.11.12

func GetPackages(ctx context.Context, client *Client, prerelease bool, spaceID string) ([]kbapi.PackageListItem, diag.Diagnostics)

func GetProxy added in v0.15.0

func GetProxy(ctx context.Context, client *Client, spaceID, proxyID string) (*kbapi.FleetProxyItem, diag.Diagnostics)

GetProxy reads a specific Fleet proxy from the API. Returns (nil, nil) on HTTP 404.

func InstallKibanaAssets added in v0.15.0

func InstallKibanaAssets(ctx context.Context, client *Client, name, version string, spaceID string, force bool) diag.Diagnostics

InstallKibanaAssets installs Kibana assets for an already-installed package into a specific space.

func InstallPackage added in v0.10.0

func InstallPackage(ctx context.Context, client *Client, name, version string, opts InstallPackageOptions) diag.Diagnostics

InstallPackage installs a package.

func ListAgentDownloadSources added in v0.14.5

func ListAgentDownloadSources(ctx context.Context, client *Client, spaceID string) (*kbapi.GetFleetAgentDownloadSourcesResponse, diag.Diagnostics)

ListAgentDownloadSources reads all agent binary download sources from the API.

func Uninstall added in v0.10.0

func Uninstall(ctx context.Context, client *Client, name, version string, spaceID string, force bool) diag.Diagnostics

Uninstall uninstalls a package.

func UpdateAgentDownloadSource added in v0.14.5

UpdateAgentDownloadSource updates an existing agent binary download source.

func UpdateAgentPolicy

UpdateAgentPolicy updates an existing agent policy.

func UpdateDefendPackagePolicy added in v0.14.4

func UpdateDefendPackagePolicy(ctx context.Context, client *Client, id string, spaceID string, req kbapi.PackagePolicyRequestTypedInputs) (*kbapi.PackagePolicy, diag.Diagnostics)

UpdateDefendPackagePolicy updates an existing Elastic Defend package policy using the typed-input request body without requesting the simplified format. The request body must include the top-level "version" token from the last successful read so Kibana can perform optimistic concurrency control.

func UpdateFleetServerHost

func UpdateFleetServerHost(ctx context.Context, client *Client, id string, spaceID string, req kbapi.PutFleetFleetServerHostsItemidJSONRequestBody) (*kbapi.ServerHost, diag.Diagnostics)

UpdateFleetServerHost updates an existing fleet server host.

func UpdateOutput

func UpdateOutput(ctx context.Context, client *Client, id string, spaceID string, req kbapi.UpdateOutputUnion) (*kbapi.OutputUnion, diag.Diagnostics)

UpdateOutput updates an existing output.

func UpdatePackagePolicy added in v0.10.0

func UpdatePackagePolicy(ctx context.Context, client *Client, id string, spaceID string, req kbapi.PackagePolicyRequest) (*kbapi.PackagePolicy, diag.Diagnostics)

UpdatePackagePolicy updates an existing package policy.

func UpdateProxy added in v0.15.0

func UpdateProxy(ctx context.Context, client *Client, spaceID, proxyID string, body kbapi.PutFleetProxiesItemidJSONRequestBody) (*kbapi.FleetProxyItem, diag.Diagnostics)

UpdateProxy updates an existing Fleet proxy.

Types

type Client

type Client = kibanaoapi.Client

Client provides an API client for Elastic Fleet. It is identical in structure to kibanaoapi.Client and is kept as a type alias so that both packages share a single implementation.

func NewClient

func NewClient(cfg Config) (*Client, error)

NewClient creates a new Elastic Fleet API client.

type Config

type Config = kibanaoapi.Config

Config is the configuration for the fleet client. It is identical in structure to kibanaoapi.Config and is kept as a type alias so that both packages share a single implementation.

type InstallPackageOptions added in v0.14.0

type InstallPackageOptions struct {
	SpaceID                   string
	Force                     bool
	Prerelease                bool
	IgnoreMappingUpdateErrors *bool
	SkipDataStreamRollover    *bool
	IgnoreConstraints         bool
}

InstallPackageOptions holds the options for installing a package.

type UploadPackageOptions added in v0.15.0

type UploadPackageOptions struct {
	// PackagePath is the path to the package archive to upload (.zip or .tar.gz/.tgz).
	PackagePath string
	// ContentType is the MIME type of the package file (e.g. "application/zip").
	ContentType string
	// IgnoreMappingUpdateErrors suppresses mapping update errors during install.
	IgnoreMappingUpdateErrors bool
	// SkipDataStreamRollover skips data stream rollover during install.
	SkipDataStreamRollover bool
	// SpaceID scopes the request to a specific Kibana space.
	SpaceID string
}

UploadPackageOptions holds the options for uploading a custom integration package.

type UploadPackageResult added in v0.15.0

type UploadPackageResult struct {
	// PackageName is the name of the uploaded package as returned by Fleet.
	PackageName string
	// PackageVersion is the installed version resolved from the package list.
	PackageVersion string
}

UploadPackageResult holds the result of uploading a custom integration package.

func UploadPackage added in v0.15.0

func UploadPackage(ctx context.Context, client *Client, opts UploadPackageOptions) (*UploadPackageResult, diag.Diagnostics)

UploadPackage uploads a custom integration package to Fleet and returns the resolved package name and installed version. It opens the file at opts.PackagePath, posts it to the Fleet EPM packages endpoint, extracts the package name from the response, and then queries the package list to resolve the installed version.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL