import { FunctionConfiguration, LambdaClient, Runtime, TagResourceCommandInput, UntagResourceCommandInput, UpdateFunctionConfigurationCommandInput } from "@aws-sdk/client-lambda";
import { CloudWatchLogsClient, CreateLogGroupCommandInput, DeleteSubscriptionFilterCommandInput, PutSubscriptionFilterCommandInput } from "@aws-sdk/client-cloudwatch-logs";
import { FromIniInit } from "@aws-sdk/credential-provider-ini";
import { AwsCredentialIdentity } from "@aws-sdk/types";
import { Writable } from "stream";

//#region src/constants.d.ts
declare const LAYER_LOOKUP: {
  readonly extension: "Datadog-Extension";
  readonly dotnet6: "dd-trace-dotnet";
  readonly dotnet8: "dd-trace-dotnet";
  readonly dotnet10: "dd-trace-dotnet";
  readonly java11: "dd-trace-java";
  readonly java17: "dd-trace-java";
  readonly java21: "dd-trace-java";
  readonly java25: "dd-trace-java";
  readonly 'java8.al2': "dd-trace-java";
  readonly 'nodejs16.x': "Datadog-Node16-x";
  readonly 'nodejs18.x': "Datadog-Node18-x";
  readonly 'nodejs20.x': "Datadog-Node20-x";
  readonly 'nodejs22.x': "Datadog-Node22-x";
  readonly 'nodejs24.x': "Datadog-Node24-x";
  readonly 'python3.8': "Datadog-Python38";
  readonly 'python3.9': "Datadog-Python39";
  readonly 'python3.10': "Datadog-Python310";
  readonly 'python3.11': "Datadog-Python311";
  readonly 'python3.12': "Datadog-Python312";
  readonly 'python3.13': "Datadog-Python313";
  readonly 'python3.14': "Datadog-Python314";
  readonly 'ruby3.2': "Datadog-Ruby3-2";
  readonly 'ruby3.3': "Datadog-Ruby3-3";
  readonly 'ruby3.4': "Datadog-Ruby3-4";
  readonly 'ruby4.0': "Datadog-Ruby4-0";
};
type LayerKey = keyof typeof LAYER_LOOKUP;
//#endregion
//#region src/interfaces.d.ts
/**
 * Configuration comprised by a Lambda Function ARN,
 * its configuration from AWS, its library layer ARN,
 * the changes in logs, tags, and the update request.
 */
interface FunctionConfiguration$1 {
  functionARN: string;
  lambdaConfig: FunctionConfiguration;
  logGroupConfiguration?: LogGroupConfiguration;
  tagConfiguration?: TagConfiguration;
  updateFunctionConfigurationCommandInput?: UpdateFunctionConfigurationCommandInput;
}
interface InstrumentedConfigurationGroup {
  cloudWatchLogsClient: CloudWatchLogsClient;
  configs: FunctionConfiguration$1[];
  lambdaClient: LambdaClient;
  region: string;
}
type Version = number | 'latest' | 'none';
/**
 * Basic settings to use in every specified
 * lambda to be instrumented.
 */
interface InstrumentationSettings extends InstrumentationTags {
  apmFlushDeadline?: string;
  appsecEnabled?: boolean;
  captureLambdaPayload?: boolean;
  extensionVersion: Version;
  lambdaFips?: boolean;
  flushMetricsToLogs: boolean;
  forwarderARN?: string;
  interactive?: boolean;
  layerAWSAccount?: string;
  layerVersion: Version;
  loggingEnabled?: boolean;
  logLevel?: string;
  mergeXrayTraces: boolean;
  tracingEnabled: boolean;
  llmobsEnabled?: boolean;
  llmobsMlApp?: string;
}
/**
 * Interface for Unified Service Tagging.
 *
 * See more at: https://docs.datadoghq.com/getting_started/tagging/unified_service_tagging/?tab=kubernetes#overview
 */
interface InstrumentationTags {
  environment?: string;
  extraTags?: string;
  service?: string;
  version?: string;
}
interface LogGroupConfiguration {
  createLogGroupCommandInput?: CreateLogGroupCommandInput;
  deleteSubscriptionFilterCommandInput?: DeleteSubscriptionFilterCommandInput;
  logGroupName: string;
  putSubscriptionFilterCommandInput?: PutSubscriptionFilterCommandInput;
}
interface TagConfiguration {
  tagResourceCommandInput?: TagResourceCommandInput;
  untagResourceCommandInput?: UntagResourceCommandInput;
}
//#endregion
//#region src/functions/commons.d.ts
/**
 * Returns an array of merged layer ARNs if given a Full Layer ARN,
 * if not, it justs returns the layer ARNs provided.
 *
 * @param fullLayerARN a complete layer ARN.
 * @param partialLayerARN a partial layer ARN.
 * @param layerARNs an array of layer ARNs.
 * @returns an array of layer ARNs.
 */
declare const addLayerArn: (fullLayerArn: string | undefined, previousLayerName: string, layerARNs: string[]) => string[];
/**
 * Returns a coerced boolean given string booleans or booleans in
 * an spread array. Every other value will be ignored.
 *
 * @param fallback default value if none of the provided `values` comply.
 * @param values an spread array of string booleans or booleans.
 * @returns a coerced boolean.
 */
declare const coerceBoolean: (fallback: boolean, ...values: any[]) => boolean;
/**
 * Returns an array of functions grouped by its region, it
 * throws an error if there are functions without a region.
 *
 * @param functions an array of strings comprised by
 * Functions ARNs, Partial ARNs, or Function Names.
 * @param defaultRegion a fallback region
 * @returns an array of functions grouped by region
 */
declare const collectFunctionsByRegion: (functions: string[], defaultRegion: string | undefined) => {
  [key: string]: string[];
};
/**
 * Get the latest layer version from the layer-versions.json file for a given runtime
 *
 * @param layer the layer key (runtime or 'extension')
 * @returns the latest version number for that layer
 */
declare const getLatestLayerVersion: (layer: LayerKey) => number;
declare const getAWSFileCredentialsParams: (profile: string) => FromIniInit;
/**
 * Returns the loaded AWS Credentials from the given profile.
 *
 * Note: the AWS SDK loads credentials automatically in
 * node environments.
 *
 * @param {string} profile the AWS Credentials profile
 * @returns {AwsCredentialIdentity} credentials object.
 */
declare const getAWSProfileCredentials: (profile: string) => Promise<AwsCredentialIdentity | undefined>;
declare const getAWSCredentials: () => Promise<AwsCredentialIdentity | undefined>;
declare const isMissingAnyDatadogApiKeyEnvVar: () => boolean;
declare const isMissingDatadogEnvVars: () => boolean;
declare const getAllLambdaFunctionConfigs: (lambdaClient: LambdaClient) => Promise<FunctionConfiguration[]>;
declare const checkRuntimeTypesAreUniform: (configList: FunctionConfiguration$1[]) => boolean;
/**
 * Given a Lambda instance and a regular expression,
 * returns all the Function Configurations that match.
 *
 * @param lambda an instance of Lambda from aws-sdk.
 * @param pattern a regular expression
 * @returns an array of Lambda FunctionConfiguration's that match the pattern above.
 */
declare const getLambdaFunctionConfigsFromRegex: (lambdaClient: LambdaClient, pattern: string) => Promise<FunctionConfiguration[]>;
/**
 * Given a Lambda instance and an array of Lambda names,
 * return all the Lambda Function Configurations.
 *
 * @param lambda an instance of Lambda from aws-sdk.
 * @param functionARNs an array of strings comprised by
 * Functions ARNs, Partial ARNs, or Function Names.
 * @returns an array of Lambda FunctionConfiguration's.
 */
declare const getLambdaFunctionConfigs: (lambdaClient: LambdaClient, functionARNs: string[]) => Promise<FunctionConfiguration[]>;
/**
 * Returns the correct ARN of a **Specific Runtime Layer** given its configuration, region,
 * and settings (optional).
 *
 * @param config a Lambda FunctionConfiguration.
 * @param layer a Lambda layer.
 * @param region a region where the layer is hosted.
 * @param settings instrumentation settings, mainly used to change the AWS account that contains the Layer.
 * @returns the ARN of a **Specific Runtime Layer** with the correct region, account, architecture, and name.
 */
declare const getLayerArn: (config: FunctionConfiguration, layer: LayerKey, region: string, settings?: InstrumentationSettings) => string;
declare const getLayerNameWithVersion: (layerArn: string) => string | undefined;
declare const getLayers: (config: FunctionConfiguration) => string[];
/**
 * Call the aws-sdk Lambda api to get a Function given
 * an ARN and then return its Configuration.
 *
 * @param lambdaClient an instance of LambdaClient.
 * @param functionARN a string, can be Function ARN, Partial ARN, or a Function Name.
 * @returns the Lambda FunctionConfiguration of the given ARN.
 */
declare const getLambdaFunctionConfig: (lambdaClient: LambdaClient, functionARN: string) => Promise<FunctionConfiguration>;
/**
 * Given a Function ARN, return its region by splitting the string,
 * can return undefined if it doesn't exist.
 *
 * @param functionARN a string, can be Function ARN, Partial ARN, or a Function Name.
 * @returns the region of an ARN.
 */
declare const getRegion: (functionARN: string) => string | undefined;
/**
 * Returns whether the runtime given is supported by the Datadog CI Lambda.
 *
 * @param runtime a string representing a Lambda FunctionConfiguration Runtime.
 * @returns if a runtime is supported.
 */
declare const isSupportedRuntime: (runtime?: string) => runtime is Runtime;
declare const isLayerRuntime: (runtime: string) => runtime is "extension" | "dotnet6" | "dotnet8" | "dotnet10" | "java11" | "java17" | "java21" | "java25" | "java8.al2" | "nodejs16.x" | "nodejs18.x" | "nodejs20.x" | "nodejs22.x" | "nodejs24.x" | "python3.8" | "python3.9" | "python3.10" | "python3.11" | "python3.12" | "python3.13" | "python3.14" | "ruby3.2" | "ruby3.3" | "ruby3.4" | "ruby4.0";
declare const sentenceMatchesRegEx: (sentence: string, regex: RegExp) => RegExpMatchArray | null;
declare const supportsInTracerAppsec: (runtime: Runtime, layerVersion: number | undefined) => boolean;
declare const updateLambdaFunctionConfig: (lambdaClient: LambdaClient, cloudWatchLogsClient: CloudWatchLogsClient, config: FunctionConfiguration$1) => Promise<void>;
declare const updateFunctionConfiguration: (client: LambdaClient, input: UpdateFunctionConfigurationCommandInput) => Promise<void>;
declare const handleLambdaFunctionUpdates: (configGroups: InstrumentedConfigurationGroup[], stdout: Writable) => Promise<void>;
declare const willUpdateFunctionConfigs: (configs: FunctionConfiguration$1[]) => boolean;
/**
 * Masks environment variables in a Lambda function configuration.
 * Makes a copy as to not modify the config in place.
 * @param config
 * @returns masked config
 */
declare const maskConfig: (config: any) => any;
//#endregion
export { addLayerArn, checkRuntimeTypesAreUniform, coerceBoolean, collectFunctionsByRegion, getAWSCredentials, getAWSFileCredentialsParams, getAWSProfileCredentials, getAllLambdaFunctionConfigs, getLambdaFunctionConfig, getLambdaFunctionConfigs, getLambdaFunctionConfigsFromRegex, getLatestLayerVersion, getLayerArn, getLayerNameWithVersion, getLayers, getRegion, handleLambdaFunctionUpdates, isLayerRuntime, isMissingAnyDatadogApiKeyEnvVar, isMissingDatadogEnvVars, isSupportedRuntime, maskConfig, sentenceMatchesRegEx, supportsInTracerAppsec, updateFunctionConfiguration, updateLambdaFunctionConfig, willUpdateFunctionConfigs };
//# sourceMappingURL=commons.d.ts.map