clients

package
v0.14.4 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const ServerlessFlavor = "serverless"

Variables

This section is empty.

Functions

func NewAPIClientFuncFromSDK added in v0.14.3

func NewAPIClientFuncFromSDK(version string) func(context.Context, *schema.ResourceData) (any, diag.Diagnostics)

func ResourceIDFromStr added in v0.4.0

func ResourceIDFromStr(id string) (string, diag.Diagnostics)

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, diag.Diagnostics)

func CompositeIDFromStrFw added in v0.14.3

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

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 (*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, diag.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) GetESClient added in v0.14.4

func (e *ElasticsearchScopedClient) GetESClient() (*elasticsearch.Client, error)

GetESClient returns the underlying go-elasticsearch client. It satisfies the ESClient sink interface used by internal/clients/elasticsearch/ helpers.

func (*ElasticsearchScopedClient) ID added in v0.14.4

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

func (*ElasticsearchScopedClient) ServerFlavor added in v0.14.4

ServerFlavor returns the build flavor (e.g. "serverless", "default") of the Elasticsearch server, derived from the cluster Info API.

func (*ElasticsearchScopedClient) ServerVersion added in v0.14.4

ServerVersion returns the version of the Elasticsearch server, derived from the cluster Info API.

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

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, diag.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.

func (*KibanaScopedClient) GetFleetClient added in v0.14.4

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

GetFleetClient returns the Fleet client.

func (*KibanaScopedClient) GetKibanaOapiClient added in v0.14.4

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

GetKibanaOapiClient returns the Kibana OpenAPI client.

func (*KibanaScopedClient) ServerFlavor added in v0.14.4

func (k *KibanaScopedClient) ServerFlavor(ctx context.Context) (string, diag.Diagnostics)

ServerFlavor returns the flavor (e.g. "serverless", "default") of the Kibana server. Flavor is always derived from the Kibana status API. Returns an empty string when build_flavor is absent (older stateful deployments).

func (*KibanaScopedClient) ServerVersion added in v0.14.4

func (k *KibanaScopedClient) ServerVersion(ctx context.Context) (*version.Version, diag.Diagnostics)

ServerVersion returns the version of the Kibana server. Version is always derived from the Kibana status API; there is no Elasticsearch fallback.

type MinVersionEnforceable added in v0.11.18

type MinVersionEnforceable interface {
	EnforceMinVersion(ctx context.Context, minVersion *version.Version) (bool, diag.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 and SDK meta. 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 ConvertMetaToFactory added in v0.14.4

func ConvertMetaToFactory(meta any) (*ProviderClientFactory, diag.Diagnostics)

ConvertMetaToFactory converts the SDK meta value into a *ProviderClientFactory.

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) GetElasticsearchClientFromSDK added in v0.14.4

func (f *ProviderClientFactory) GetElasticsearchClientFromSDK(d *schema.ResourceData) (*ElasticsearchScopedClient, diag.Diagnostics)

GetElasticsearchClientFromSDK resolves the effective *ElasticsearchScopedClient for an SDK Elasticsearch entity. When the elasticsearch_connection block is absent from d the factory returns a typed client built from provider-level defaults. When the block is configured a new typed scoped client is returned with the Elasticsearch client rebuilt from the 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.

func (*ProviderClientFactory) GetKibanaClientFromSDK added in v0.14.4

func (f *ProviderClientFactory) GetKibanaClientFromSDK(d *schema.ResourceData) (*KibanaScopedClient, diag.Diagnostics)

GetKibanaClientFromSDK resolves the effective *KibanaScopedClient for an SDK Kibana or Fleet entity. When the kibana_connection block is absent from d the factory returns a typed client built from provider-level defaults. When the block is configured a new typed scoped client is returned with all Kibana-derived clients rebuilt from the scoped connection.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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