credentials

package
v0.6.1 Latest Latest
Warning

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

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

Documentation

Overview

Package credentials resolves per-connector credentials into the environment- variable maps consumed by detonators and CLI tools. Shared between scenario execution and the test-connection endpoint so per-cloud resolution lives in exactly one place. Package credentials resolves connector secret groups into the environment variables a run needs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Resolver

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

Resolver builds the environment-variable map for a connector by combining its config JSON, linked secrets, and cloud-provider-specific credential flows (STS, WIF, kubeconfig generation, etc.).

func NewResolver

func NewResolver(connectorStore db.ConnectorStore, secretStore db.SecretStore, encryptor *crypto.Encryptor) *Resolver

NewResolver constructs a Resolver.

func (*Resolver) Build

func (r *Resolver) Build(ctx context.Context, connector *db.Connector) (map[string]string, error)

Build loads config and secrets from a connector and returns them as a credential map ready for environment injection.

func (*Resolver) BuildTargets

func (r *Resolver) BuildTargets(ctx context.Context, target map[string]string) (map[string]string, error)

BuildTargets resolves cloud credentials from a top-level target map. Each entry maps a cloud type (aws, gcp, azure) to a connector name. Returns a merged map of all credential env vars.

func (*Resolver) GetElasticAPIKey

func (r *Resolver) GetElasticAPIKey(ctx context.Context, secretGroupID *uuid.UUID) (string, error)

GetElasticAPIKey decrypts the SR_ELASTIC_API_KEY from a connector's linked secret group. Used by both ResolveElasticEnv and the result-export path.

func (*Resolver) LoadAllSecrets

func (r *Resolver) LoadAllSecrets(ctx context.Context) map[string]string

LoadAllSecrets decrypts all secret groups and returns a flat key→value map.

func (*Resolver) ResolveElasticEnv

func (r *Resolver) ResolveElasticEnv(ctx context.Context) map[string]string

ResolveElasticEnv resolves the first enabled elastic connector and returns SR_KIBANA_URL/SR_ELASTIC_URL/SR_ELASTIC_CLOUD_ID/SR_ELASTIC_API_KEY as a runEnv map. Returns nil if no enabled elastic connector exists.

Decryption errors on the linked secret group cause the function to return what config it has resolved — the API key just won't be present in the returned map (callers will get a clear "missing API key" error from the downstream Elastic client).

Jump to

Keyboard shortcuts

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