/** * 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<["eks", "gke", "aks", "kind", "minikube", "bare_metal", "other"]>; region: z.ZodOptional; account: z.ZodOptional; project_id: z.ZodOptional; subscription: z.ZodOptional; context_name: z.ZodOptional; }, "strip", z.ZodTypeAny, { type: "kind" | "eks" | "gke" | "aks" | "minikube" | "bare_metal" | "other"; region?: string | undefined; project_id?: string | undefined; account?: string | undefined; subscription?: string | undefined; context_name?: string | undefined; }, { type: "kind" | "eks" | "gke" | "aks" | "minikube" | "bare_metal" | "other"; region?: string | undefined; project_id?: string | undefined; account?: string | undefined; subscription?: string | undefined; context_name?: string | undefined; }>; destination: z.ZodObject<{ siem_vendor: z.ZodEnum<["splunk", "datadog", "elasticsearch", "clickhouse", "cloudwatch", "azure-monitor", "gcp-logging", "sumo", "coralogix", "elastic-serverless", "other"]>; region: z.ZodOptional; log_group_prefix: z.ZodOptional; ingest_url: z.ZodOptional; }, "strip", z.ZodTypeAny, { siem_vendor: "datadog" | "other" | "splunk" | "elasticsearch" | "clickhouse" | "cloudwatch" | "azure-monitor" | "gcp-logging" | "sumo" | "coralogix" | "elastic-serverless"; region?: string | undefined; log_group_prefix?: string | undefined; ingest_url?: string | undefined; }, { siem_vendor: "datadog" | "other" | "splunk" | "elasticsearch" | "clickhouse" | "cloudwatch" | "azure-monitor" | "gcp-logging" | "sumo" | "coralogix" | "elastic-serverless"; region?: string | undefined; log_group_prefix?: string | undefined; ingest_url?: string | undefined; }>; streamer: z.ZodObject<{ url: z.ZodString; target_path: z.ZodOptional; }, "strip", z.ZodTypeAny, { url: string; target_path?: string | undefined; }, { url: string; target_path?: string | undefined; }>; 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; }, "strip", z.ZodTypeAny, { query: string; index: string; subquery: string; stream: string; }, { query: string; index: string; subquery: string; stream: string; }>; query_log_group: z.ZodOptional; helm_release: z.ZodOptional; }, "strip", z.ZodTypeAny, { name: string; namespace: string; chart_version?: string | undefined; }, { name: string; namespace: string; chart_version?: string | undefined; }>>; }, "strip", z.ZodTypeAny, { url: string; input_bucket: string; query_queues: { query: string; index: string; subquery: string; stream: string; }; input_prefix?: string | undefined; query_log_group?: string | undefined; helm_release?: { name: string; namespace: string; chart_version?: string | undefined; } | undefined; }, { url: string; input_bucket: string; query_queues: { query: string; index: string; subquery: string; stream: string; }; input_prefix?: string | undefined; query_log_group?: string | undefined; helm_release?: { name: string; namespace: string; chart_version?: string | undefined; } | undefined; }>; 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; }, "strip", z.ZodTypeAny, { method: "none" | "irsa" | "iam_role" | "workload_identity" | "service_principal" | "access_key" | "connection_string"; role?: string | undefined; sa?: string | undefined; note?: string | undefined; }, { method: "none" | "irsa" | "iam_role" | "workload_identity" | "service_principal" | "access_key" | "connection_string"; role?: string | undefined; sa?: string | undefined; note?: string | undefined; }>>; archived_at: z.ZodOptional; first_used_at: z.ZodOptional; note: z.ZodOptional; }, "strip", z.ZodTypeAny, { status: "failed" | "active" | "draining" | "archived"; type: "s3" | "gcs" | "azure_blob" | "file"; nickname: string; auth?: { method: "none" | "irsa" | "iam_role" | "workload_identity" | "service_principal" | "access_key" | "connection_string"; role?: string | undefined; sa?: string | undefined; note?: string | undefined; } | undefined; region?: string | undefined; path?: string | undefined; bucket?: string | undefined; prefix?: string | undefined; project_id?: string | undefined; storage_account?: string | undefined; note?: string | undefined; archived_at?: string | undefined; first_used_at?: string | undefined; }, { type: "s3" | "gcs" | "azure_blob" | "file"; nickname: string; status?: "failed" | "active" | "draining" | "archived" | undefined; auth?: { method: "none" | "irsa" | "iam_role" | "workload_identity" | "service_principal" | "access_key" | "connection_string"; role?: string | undefined; sa?: string | undefined; note?: string | undefined; } | undefined; region?: string | undefined; path?: string | undefined; bucket?: string | undefined; prefix?: string | undefined; project_id?: string | undefined; storage_account?: string | undefined; note?: string | undefined; archived_at?: string | undefined; first_used_at?: string | undefined; }>, "many">>; 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;