/** * log10x_env_register — persist a full EnvironmentConfig document to an * on-prem env-config store (k8s ConfigMap, AWS SSM, GCP Secret Manager, * Azure App Configuration, or local file). * * Companion to `log10x_create_env`. Where create_env mints a new env on * the Log10x account (account-level identity + apiKey), env_register * writes the **cluster-side** descriptor that other tools resolve: where * the streamer is, where the retriever is, which SIEM the logs land in, * which offload destinations the Receiver may write to. The two tools * are independent — register can run against an env_id that originated * outside the Log10x account API, e.g. an on-prem-only customer who * never calls the SaaS backend. * * Behaviour: * * 1. Build the EnvironmentConfig from args (caller may pass * `offload_destinations`; absent → defaults to a single * `nickname: "primary"` placeholder so the document satisfies the * `min(1)` schema rule). * 2. Validate against `environmentConfigSchema` (zod). Validation * failures return BEFORE any store side effect — partial writes * are not allowed. * 3. Pick a store: * - if `target_store` is supplied, instantiate exactly that * backend and refuse if it's unavailable (no silent fallback — * if the caller asked for SSM, write to SSM or fail). * - otherwise probe the chain (k8s → aws_ssm → gcp_sm → azure_ac * → local) and use the first that reports `isAvailable: true`. * Local file is the dev fallback so the chain always terminates * on a writeable store. * 4. Call `store.write(config)`. Stamp `updated_at` to now if the * caller didn't supply one. * 5. Return the canonical persisted document + which store_kind we * wrote to + the availability probe trace so the agent can show * "wrote to k8s ConfigMap in namespace log10x". * * Idempotent: re-running with the same `env_id` overwrites in place * (k8s server-side-apply, SSM PutParameter, local file rewrite). The * tool DOES NOT diff against an existing document — callers who want * partial updates should read + merge + register again. */ import { z } from 'zod'; import { clusterIdentitySchema, siemDestinationSchema, streamerConfigSchema, retrieverConfigSchema, type OffloadDestination } from '../lib/env-config/types.js'; import type { StoreKind } from '../lib/env-config/store-interface.js'; import { type StructuredOutput } from '../lib/output-types.js'; export declare const envRegisterSchema: { env_id: z.ZodString; nickname: z.ZodString; cluster: z.ZodObject<{ type: z.ZodEnum<{ kind: "kind"; eks: "eks"; gke: "gke"; aks: "aks"; minikube: "minikube"; bare_metal: "bare_metal"; other: "other"; }>; region: z.ZodOptional; account: z.ZodOptional; project_id: z.ZodOptional; subscription: z.ZodOptional; context_name: z.ZodOptional; }, z.core.$strip>; destination: z.ZodObject<{ siem_vendor: z.ZodEnum<{ datadog: "datadog"; other: "other"; splunk: "splunk"; elasticsearch: "elasticsearch"; clickhouse: "clickhouse"; cloudwatch: "cloudwatch"; "azure-monitor": "azure-monitor"; "gcp-logging": "gcp-logging"; sumo: "sumo"; coralogix: "coralogix"; "elastic-serverless": "elastic-serverless"; }>; region: z.ZodOptional; log_group_prefix: z.ZodOptional; ingest_url: z.ZodOptional; }, z.core.$strip>; streamer: z.ZodObject<{ url: z.ZodString; target_path: z.ZodOptional; }, z.core.$strip>; retriever: z.ZodObject<{ url: z.ZodString; input_bucket: z.ZodString; input_prefix: z.ZodOptional; query_queues: z.ZodObject<{ index: z.ZodString; subquery: z.ZodString; stream: z.ZodString; query: z.ZodString; }, z.core.$strip>; query_log_group: z.ZodOptional; helm_release: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>; offload_destinations: z.ZodOptional; status: z.ZodDefault>; bucket: z.ZodOptional; prefix: z.ZodOptional; region: z.ZodOptional; project_id: z.ZodOptional; storage_account: z.ZodOptional; path: z.ZodOptional; auth: z.ZodOptional; role: z.ZodOptional; sa: z.ZodOptional; note: z.ZodOptional; }, z.core.$strip>>; archived_at: z.ZodOptional; first_used_at: z.ZodOptional; note: z.ZodOptional; }, z.core.$strip>>>; target_store: z.ZodOptional>; }; export type EnvRegisterArgs = { env_id: string; nickname: string; cluster: z.infer; destination: z.infer; streamer: z.infer; retriever: z.infer; offload_destinations?: OffloadDestination[]; target_store?: StoreKind; }; export declare function executeEnvRegister(args: EnvRegisterArgs): Promise;