import * as iam from "../../aws-iam";
import { CfnResource } from "../../core";
import { InitElement } from './cfn-init-elements';
import { OperatingSystemType } from './machine-image';
import { InitElementConfig } from './private/cfn-init-internal';
import { UserData } from './user-data';
import { Construct } from 'constructs';
/**
 * (experimental) A CloudFormation-init configuration.
 *
 * @experimental
 */
export declare class CloudFormationInit {
    /**
     * (experimental) Build a new config from a set of Init Elements.
     *
     * @experimental
     */
    static fromElements(...elements: InitElement[]): CloudFormationInit;
    /**
     * (experimental) Use an existing InitConfig object as the default and only config.
     *
     * @experimental
     */
    static fromConfig(config: InitConfig): CloudFormationInit;
    /**
     * (experimental) Build a CloudFormationInit from config sets.
     *
     * @experimental
     */
    static fromConfigSets(props: ConfigSetProps): CloudFormationInit;
    private readonly _configSets;
    private readonly _configs;
    private constructor();
    /**
     * (experimental) Add a config with the given name to this CloudFormationInit object.
     *
     * @experimental
     */
    addConfig(configName: string, config: InitConfig): void;
    /**
     * (experimental) Add a config set with the given name to this CloudFormationInit object.
     *
     * The new configset will reference the given configs in the given order.
     *
     * @experimental
     */
    addConfigSet(configSetName: string, configNames?: string[]): void;
    /**
     * (experimental) Attach the CloudFormation Init config to the given resource.
     *
     * As an app builder, use `instance.applyCloudFormationInit()` or
     * `autoScalingGroup.applyCloudFormationInit()` to trigger this method.
     *
     * This method does the following:
     *
     * - Renders the `AWS::CloudFormation::Init` object to the given resource's
     *    metadata, potentially adding a `AWS::CloudFormation::Authentication` object
     *    next to it if required.
     * - Updates the instance role policy to be able to call the APIs required for
     *    `cfn-init` and `cfn-signal` to work, and potentially add permissions to download
     *    referenced asset and bucket resources.
     * - Updates the given UserData with commands to execute the `cfn-init` script.
     *
     * @experimental
     */
    attach(attachedResource: CfnResource, attachOptions: AttachInitOptions): void;
    private bind;
}
/**
 * (experimental) A collection of configuration elements.
 *
 * @experimental
 */
export declare class InitConfig {
    private readonly elements;
    /**
     * @experimental
     */
    constructor(elements: InitElement[]);
    /**
     * (experimental) Whether this configset has elements or not.
     *
     * @experimental
     */
    isEmpty(): boolean;
    /**
     * (experimental) Add one or more elements to the config.
     *
     * @experimental
     */
    add(...elements: InitElement[]): void;
    /**
     * Called when the config is applied to an instance.
     * Creates the CloudFormation representation of the Init config and handles any permissions and assets.
     * @internal
     */
    _bind(scope: Construct, options: AttachInitOptions): InitElementConfig;
    private bindForType;
    private initPlatformFromOSType;
}
/**
 * (experimental) Options for CloudFormationInit.withConfigSets.
 *
 * @experimental
 */
export interface ConfigSetProps {
    /**
     * (experimental) The definitions of each config set.
     *
     * @experimental
     */
    readonly configSets: Record<string, string[]>;
    /**
     * (experimental) The sets of configs to pick from.
     *
     * @experimental
     */
    readonly configs: Record<string, InitConfig>;
}
/**
 * (experimental) Options for attaching a CloudFormationInit to a resource.
 *
 * @experimental
 */
export interface AttachInitOptions {
    /**
     * (experimental) Instance role of the consuming instance or fleet.
     *
     * @experimental
     */
    readonly instanceRole: iam.IRole;
    /**
     * (experimental) OS Platform the init config will be used for.
     *
     * @experimental
     */
    readonly platform: OperatingSystemType;
    /**
     * (experimental) UserData to add commands to.
     *
     * @experimental
     */
    readonly userData: UserData;
    /**
     * (experimental) ConfigSet to activate.
     *
     * @default ['default']
     * @experimental
     */
    readonly configSets?: string[];
    /**
     * (experimental) Whether to embed a hash into the userData.
     *
     * If `true` (the default), a hash of the config will be embedded into the
     * UserData, so that if the config changes, the UserData changes and
     * the instance will be replaced.
     *
     * If `false`, no such hash will be embedded, and if the CloudFormation Init
     * config changes nothing will happen to the running instance.
     *
     * @default true
     * @experimental
     */
    readonly embedFingerprint?: boolean;
    /**
     * (experimental) Print the results of running cfn-init to the Instance System Log.
     *
     * By default, the output of running cfn-init is written to a log file
     * on the instance. Set this to `true` to print it to the System Log
     * (visible from the EC2 Console), `false` to not print it.
     *
     * (Be aware that the system log is refreshed at certain points in
     * time of the instance life cycle, and successful execution may
     * not always show up).
     *
     * @default true
     * @experimental
     */
    readonly printLog?: boolean;
    /**
     * (experimental) Don't fail the instance creation when cfn-init fails.
     *
     * You can use this to prevent CloudFormation from rolling back when
     * instances fail to start up, to help in debugging.
     *
     * @default false
     * @experimental
     */
    readonly ignoreFailures?: boolean;
}
