"use strict";
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.Function = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
 * Creates a CF function.
 *  To create a function, you provide the function code and some configuration information about the function. The response contains an Amazon Resource Name (ARN) that uniquely identifies the function, and the function’s stage.
 *  By default, when you create a function, it’s in the ``DEVELOPMENT`` stage. In this stage, you can [test the function](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/test-function.html) in the CF console (or with ``TestFunction`` in the CF API).
 *  When you’re ready to use your function with a CF distribution, publish the function to the ``LIVE`` stage. You can do this in the CF console, with ``PublishFunction`` in the CF API, or by updating the ``AWS::CloudFront::Function`` resource with the ``AutoPublish`` property set to ``true``. When the function is published to the ``LIVE`` stage, you can attach it to a distribution’s cache behavior, using the function’s ARN.
 *  To automatically publish the function to the ``LIVE`` stage when it’s created, set the ``AutoPublish`` property to ``true``.
 */
class Function extends pulumi.CustomResource {
    /**
     * Get an existing Function resource's state with the given name, ID, and optional extra
     * properties used to qualify the lookup.
     *
     * @param name The _unique_ name of the resulting resource.
     * @param id The _unique_ provider ID of the resource to lookup.
     * @param opts Optional settings to control the behavior of the CustomResource.
     */
    static get(name, id, opts) {
        return new Function(name, undefined, { ...opts, id: id });
    }
    /**
     * Returns true if the given object is an instance of Function.  This is designed to work even
     * when multiple copies of the Pulumi SDK have been loaded into the same process.
     */
    static isInstance(obj) {
        if (obj === undefined || obj === null) {
            return false;
        }
        return obj['__pulumiType'] === Function.__pulumiType;
    }
    /**
     * Create a Function resource with the given unique name, arguments, and options.
     *
     * @param name The _unique_ name of the resource.
     * @param args The arguments to use to populate this resource's properties.
     * @param opts A bag of options that control this resource's behavior.
     */
    constructor(name, args, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (!opts.id) {
            if (args?.functionCode === undefined && !opts.urn) {
                throw new Error("Missing required property 'functionCode'");
            }
            if (args?.functionConfig === undefined && !opts.urn) {
                throw new Error("Missing required property 'functionConfig'");
            }
            resourceInputs["autoPublish"] = args?.autoPublish;
            resourceInputs["functionCode"] = args?.functionCode;
            resourceInputs["functionConfig"] = args?.functionConfig;
            resourceInputs["functionMetadata"] = args?.functionMetadata;
            resourceInputs["name"] = args?.name;
            resourceInputs["functionArn"] = undefined /*out*/;
            resourceInputs["stage"] = undefined /*out*/;
        }
        else {
            resourceInputs["autoPublish"] = undefined /*out*/;
            resourceInputs["functionArn"] = undefined /*out*/;
            resourceInputs["functionCode"] = undefined /*out*/;
            resourceInputs["functionConfig"] = undefined /*out*/;
            resourceInputs["functionMetadata"] = undefined /*out*/;
            resourceInputs["name"] = undefined /*out*/;
            resourceInputs["stage"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        const replaceOnChanges = { replaceOnChanges: ["name"] };
        opts = pulumi.mergeOptions(opts, replaceOnChanges);
        super(Function.__pulumiType, name, resourceInputs, opts);
    }
}
exports.Function = Function;
/** @internal */
Function.__pulumiType = 'aws-native:cloudfront:Function';
//# sourceMappingURL=function.js.map