UNPKG

@pulumi/aws-native

Version:

The Pulumi AWS Cloud Control Provider enables you to build, deploy, and manage [any AWS resource that's supported by the AWS Cloud Control API](https://github.com/pulumi/pulumi-aws-native/blob/master/provider/cmd/pulumi-gen-aws-native/supported-types.txt)

78 lines 4.45 kB
"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, Object.assign(Object.assign({}, 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 || args.functionCode === undefined) && !opts.urn) { throw new Error("Missing required property 'functionCode'"); } if ((!args || args.functionConfig === undefined) && !opts.urn) { throw new Error("Missing required property 'functionConfig'"); } resourceInputs["autoPublish"] = args ? args.autoPublish : undefined; resourceInputs["functionCode"] = args ? args.functionCode : undefined; resourceInputs["functionConfig"] = args ? args.functionConfig : undefined; resourceInputs["functionMetadata"] = args ? args.functionMetadata : undefined; resourceInputs["name"] = args ? args.name : undefined; 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); super(Function.__pulumiType, name, resourceInputs, opts); } } exports.Function = Function; /** @internal */ Function.__pulumiType = 'aws-native:cloudfront:Function'; //# sourceMappingURL=function.js.map