clients

package
v0.16.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const ServerlessFlavor = "serverless"

Variables

This section is empty.

Functions

func AcceptanceServerInfo added in v0.16.1

AcceptanceServerInfo returns the connected Elasticsearch server version and a boolean indicating whether the cluster is serverless. It is exposed only for acceptance-test skip plumbing in internal/versionutils. Production code SHALL NOT call this.

Types

type CompositeID added in v0.14.3

type CompositeID struct {
	ClusterID  string
	ResourceID string
}

func CompositeIDFromStr added in v0.14.3

func CompositeIDFromStr(id string) (*CompositeID, fwdiags.Diagnostics)

CompositeIDFromStr parses an ID as <cluster_uuid>/<resource_identifier>. Only the first "/" separates cluster from resource, so resource_identifier may contain further slashes (for example ML calendar events "<calendar_id>/<event_id>" after the cluster segment).

For backward compatibility, an ID with an empty cluster segment and a non-empty resource segment (for example "/<synthetics_monitor_id>" from legacy CompositeID.String formatting) is accepted; an empty resource segment (including a trailing slash after the cluster) is rejected.

func (*CompositeID) String added in v0.14.3

func (c *CompositeID) String() string

type ElasticsearchScopedClient added in v0.14.4

type ElasticsearchScopedClient struct {
	// contains filtered or unexported fields
}

ElasticsearchScopedClient is a typed client surface for Elasticsearch operations. It exposes the underlying go-elasticsearch client plus all Elasticsearch-derived helper behavior that resources need: composite ID generation, cluster identity lookup, version checks, flavor checks, and minimum-version enforcement.

It deliberately does not expose Kibana or Fleet state so that all version and identity checks always resolve against the scoped Elasticsearch connection.

func NewAcceptanceTestingElasticsearchScopedClient added in v0.14.4

func NewAcceptanceTestingElasticsearchScopedClient() (*ElasticsearchScopedClient, error)

NewAcceptanceTestingElasticsearchScopedClient builds an ElasticsearchScopedClient for acceptance tests by reusing the acceptance testing APIClient.

func NewElasticsearchScopedClientForTest added in v0.15.0

func NewElasticsearchScopedClientForTest(typedClient *elasticsearch.TypedClient, endpoints []string) *ElasticsearchScopedClient

NewElasticsearchScopedClientForTest creates an ElasticsearchScopedClient backed by the given typed client and endpoints. It is intended for unit tests.

func (*ElasticsearchScopedClient) ClusterID added in v0.14.4

ClusterID returns the UUID of the connected Elasticsearch cluster. It is cached after the first call.

func (*ElasticsearchScopedClient) EnforceMinVersion added in v0.14.4

func (e *ElasticsearchScopedClient) EnforceMinVersion(ctx context.Context, minVersion *version.Version) (bool, fwdiag.Diagnostics)

EnforceMinVersion returns true when the server version is greater than or equal to minVersion, or when the server is running in serverless mode. If minVersion is nil, no minimum is enforced and the method returns true.

func (*ElasticsearchScopedClient) EnforceVersionCheck added in v0.16.1

func (e *ElasticsearchScopedClient) EnforceVersionCheck(ctx context.Context, check func(*version.Version) bool) (bool, fwdiag.Diagnostics)

EnforceVersionCheck returns true when the given version check function returns true, or when the server is running in serverless mode.

func (*ElasticsearchScopedClient) GetESClient added in v0.14.4

GetESClient returns the strongly-typed Elasticsearch client.

The client is built from the provider's configured Elasticsearch transport and endpoints. A product check may run on the typed client's first request, adding marginal latency on first use.

Endpoint presence is validated by ProviderClientFactory.GetElasticsearchClient before a scoped client is returned.

func (*ElasticsearchScopedClient) ID added in v0.14.4

ID returns a CompositeID combining the cluster UUID and the given resourceID.

func (*ElasticsearchScopedClient) IsServerless added in v0.16.1

IsServerless returns true when the connected Elasticsearch cluster is running in serverless mode.

type KibanaScopedClient added in v0.14.4

type KibanaScopedClient struct {
	// contains filtered or unexported fields
}

KibanaScopedClient is a typed client surface for Kibana and Fleet operations. It exposes: Kibana OpenAPI client, Fleet client, and Kibana-derived version/flavor checks.

It deliberately does NOT expose provider-level Elasticsearch identity so that version and identity checks always resolve against the scoped Kibana connection rather than the provider-level Elasticsearch cluster.

func NewAcceptanceTestingKibanaScopedClient added in v0.14.4

func NewAcceptanceTestingKibanaScopedClient() (*KibanaScopedClient, error)

NewAcceptanceTestingKibanaScopedClient builds a KibanaScopedClient for acceptance tests by reusing the acceptance testing APIClient.

func NewKibanaScopedClientFromFactory added in v0.14.4

func NewKibanaScopedClientFromFactory(f *ProviderClientFactory) (*KibanaScopedClient, fwdiags.Diagnostics)

NewKibanaScopedClientFromFactory returns a *KibanaScopedClient built from the factory's provider-level defaults. This is the typed Kibana surface equivalent of calling GetKibanaClient with an empty connection list.

func (*KibanaScopedClient) EnforceMinVersion added in v0.14.4

func (k *KibanaScopedClient) EnforceMinVersion(ctx context.Context, minVersion *version.Version) (bool, fwdiag.Diagnostics)

EnforceMinVersion returns true when the Kibana server version is greater than or equal to minVersion, or when the server is running in serverless mode. If minVersion is nil, no minimum is enforced and the method returns true.

func (*KibanaScopedClient) EnforceVersionCheck added in v0.15.0

func (k *KibanaScopedClient) EnforceVersionCheck(ctx context.Context, check func(*version.Version) bool) (bool, fwdiag.Diagnostics)

EnforceVersionCheck returns true when the given version check function returns true, or when the server is running in serverless mode.

func (*KibanaScopedClient) GetFleetClient added in v0.14.4

func (k *KibanaScopedClient) GetFleetClient() *fleetclient.Client

GetFleetClient returns the Fleet client.

Endpoint presence is validated by ProviderClientFactory.GetKibanaClient before a scoped client is returned.

func (*KibanaScopedClient) GetKibanaOapiClient added in v0.14.4

func (k *KibanaScopedClient) GetKibanaOapiClient() *kibanaoapi.Client

GetKibanaOapiClient returns the Kibana OpenAPI client.

Endpoint presence is validated by ProviderClientFactory.GetKibanaClient before a scoped client is returned.

type MinVersionEnforceable added in v0.11.18

type MinVersionEnforceable interface {
	EnforceMinVersion(ctx context.Context, minVersion *version.Version) (bool, fwdiags.Diagnostics)
}

type ProviderClientFactory added in v0.14.4

type ProviderClientFactory struct {
	// contains filtered or unexported fields
}

ProviderClientFactory is the provider-scoped client-resolution surface injected into Plugin Framework ProviderData. Resources and data sources use the factory to obtain typed clients rather than consuming a broad *apiClient directly.

The factory exposes typed resolution methods for all supported connection types:

  • Typed Kibana/Fleet resolution methods returning *KibanaScopedClient
  • Typed Elasticsearch resolution methods returning *ElasticsearchScopedClient

func ConvertProviderDataToFactory added in v0.14.4

func ConvertProviderDataToFactory(providerData any) (*ProviderClientFactory, fwdiags.Diagnostics)

ConvertProviderDataToFactory converts the providerData value injected by Framework into a *ProviderClientFactory. It returns an error diagnostic when providerData is set but is not the expected type.

func NewProviderClientFactory added in v0.14.4

func NewProviderClientFactory(defaultClient *apiClient) *ProviderClientFactory

NewProviderClientFactory constructs a ProviderClientFactory wrapping the provided default client. This is called by the provider Configure method.

func NewProviderClientFactoryFromFramework added in v0.14.4

func NewProviderClientFactoryFromFramework(ctx context.Context, cfg config.ProviderConfiguration, version string) (*ProviderClientFactory, fwdiags.Diagnostics)

NewProviderClientFactoryFromFramework builds a ProviderClientFactory from the supplied framework configuration. It is the canonical entry point for external packages (e.g. xpprovider) that need to construct a factory without referencing the unexported apiClient type.

func (*ProviderClientFactory) GetElasticsearchClient added in v0.14.4

func (f *ProviderClientFactory) GetElasticsearchClient(ctx context.Context, esConnList types.List) (*ElasticsearchScopedClient, fwdiags.Diagnostics)

GetElasticsearchClient resolves the effective *ElasticsearchScopedClient for a Plugin Framework Elasticsearch entity. When esConnList is empty or null the factory returns a typed client built from provider-level defaults. When the list contains a connection block, the factory returns a new typed scoped client whose Elasticsearch client is rebuilt from that scoped connection.

func (*ProviderClientFactory) GetKibanaClient added in v0.14.4

func (f *ProviderClientFactory) GetKibanaClient(ctx context.Context, kibanaConnList types.List) (*KibanaScopedClient, fwdiags.Diagnostics)

GetKibanaClient resolves the effective *KibanaScopedClient for a Plugin Framework Kibana or Fleet entity. When kibanaConnList is empty or null the factory returns a typed client built from provider-level defaults. When the list contains a connection block, the factory returns a new typed scoped client whose Kibana OpenAPI client and Fleet client are rebuilt from that scoped connection.

Directories

Path Synopsis
Package kibanaoapi provides HTTP response helpers for the Kibana API client.
Package kibanaoapi provides HTTP response helpers for the Kibana API client.
Package kibanautil provides shared helpers for Kibana API clients.
Package kibanautil provides shared helpers for Kibana API clients.

Jump to

Keyboard shortcuts

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