Documentation
¶
Index ¶
- Constants
- func NewAPIClientFuncFromSDK(version string) func(context.Context, *schema.ResourceData) (any, diag.Diagnostics)
- func ResourceIDFromStr(id string) (string, diag.Diagnostics)
- type CompositeID
- type ElasticsearchScopedClient
- func (e *ElasticsearchScopedClient) ClusterID(ctx context.Context) (*string, diag.Diagnostics)
- func (e *ElasticsearchScopedClient) EnforceMinVersion(ctx context.Context, minVersion *version.Version) (bool, diag.Diagnostics)
- func (e *ElasticsearchScopedClient) GetESClient() (*elasticsearch.Client, error)
- func (e *ElasticsearchScopedClient) ID(ctx context.Context, resourceID string) (*CompositeID, diag.Diagnostics)
- func (e *ElasticsearchScopedClient) ServerFlavor(ctx context.Context) (string, diag.Diagnostics)
- func (e *ElasticsearchScopedClient) ServerVersion(ctx context.Context) (*version.Version, diag.Diagnostics)
- type KibanaScopedClient
- func (k *KibanaScopedClient) EnforceMinVersion(ctx context.Context, minVersion *version.Version) (bool, diag.Diagnostics)
- func (k *KibanaScopedClient) GetFleetClient() (*fleetclient.Client, error)
- func (k *KibanaScopedClient) GetKibanaOapiClient() (*kibanaoapi.Client, error)
- func (k *KibanaScopedClient) ServerFlavor(ctx context.Context) (string, diag.Diagnostics)
- func (k *KibanaScopedClient) ServerVersion(ctx context.Context) (*version.Version, diag.Diagnostics)
- type MinVersionEnforceable
- type ProviderClientFactory
- func ConvertMetaToFactory(meta any) (*ProviderClientFactory, diag.Diagnostics)
- func ConvertProviderDataToFactory(providerData any) (*ProviderClientFactory, fwdiags.Diagnostics)
- func NewProviderClientFactory(defaultClient *apiClient) *ProviderClientFactory
- func NewProviderClientFactoryFromFramework(ctx context.Context, cfg config.ProviderConfiguration, version string) (*ProviderClientFactory, fwdiags.Diagnostics)
- func (f *ProviderClientFactory) GetElasticsearchClient(ctx context.Context, esConnList types.List) (*ElasticsearchScopedClient, fwdiags.Diagnostics)
- func (f *ProviderClientFactory) GetElasticsearchClientFromSDK(d *schema.ResourceData) (*ElasticsearchScopedClient, diag.Diagnostics)
- func (f *ProviderClientFactory) GetKibanaClient(ctx context.Context, kibanaConnList types.List) (*KibanaScopedClient, fwdiags.Diagnostics)
- func (f *ProviderClientFactory) GetKibanaClientFromSDK(d *schema.ResourceData) (*KibanaScopedClient, diag.Diagnostics)
Constants ¶
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
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
func (e *ElasticsearchScopedClient) ClusterID(ctx context.Context) (*string, diag.Diagnostics)
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
func (e *ElasticsearchScopedClient) ID(ctx context.Context, resourceID string) (*CompositeID, diag.Diagnostics)
ID returns a CompositeID combining the cluster UUID and the given resourceID.
func (*ElasticsearchScopedClient) ServerFlavor ¶ added in v0.14.4
func (e *ElasticsearchScopedClient) ServerFlavor(ctx context.Context) (string, diag.Diagnostics)
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
func (e *ElasticsearchScopedClient) ServerVersion(ctx context.Context) (*version.Version, diag.Diagnostics)
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 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.