{
  "additionalProperties" : false,
  "definitions" : {
    "FunctionConfig" : {
      "additionalProperties" : false,
      "properties" : {
        "Comment" : {
          "type" : "string",
          "description" : "A comment to describe the function."
        },
        "Runtime" : {
          "type" : "string",
          "description" : "The function's runtime environment version."
        },
        "KeyValueStoreAssociations" : {
          "items" : {
            "$ref" : "#/definitions/KeyValueStoreAssociation"
          },
          "type" : "array",
          "uniqueItems" : true,
          "description" : "The configuration for the key value store associations."
        }
      },
      "required" : [ "Comment", "Runtime" ],
      "type" : "object",
      "description" : "Contains configuration information about a CloudFront function."
    },
    "FunctionMetadata" : {
      "additionalProperties" : false,
      "properties" : {
        "FunctionARN" : {
          "type" : "string",
          "description" : "The Amazon Resource Name (ARN) of the function. The ARN uniquely identifies the function."
        }
      },
      "type" : "object",
      "description" : "Contains metadata about a CloudFront function."
    },
    "KeyValueStoreAssociation" : {
      "additionalProperties" : false,
      "properties" : {
        "KeyValueStoreARN" : {
          "type" : "string",
          "description" : "The Amazon Resource Name (ARN) of the key value store association."
        }
      },
      "required" : [ "KeyValueStoreARN" ],
      "type" : "object",
      "description" : "The key value store association."
    },
    "Tag" : {
      "additionalProperties" : false,
      "properties" : {
        "Key" : {
          "type" : "string",
          "maxLength" : 128,
          "minLength" : 1,
          "pattern" : "^([\\p{L}\\p{Z}\\p{N}_.:/=+\\-@]*)$",
          "description" : "A string that contains ``Tag`` key.\n The string length should be between 1 and 128 characters. Valid characters include ``a-z``, ``A-Z``, ``0-9``, space, and the special characters ``_ - . : / = + @``."
        },
        "Value" : {
          "type" : "string",
          "maxLength" : 256,
          "minLength" : 0,
          "pattern" : "^([\\p{L}\\p{Z}\\p{N}_.:/=+\\-@]*)$",
          "description" : "A string that contains an optional ``Tag`` value.\n The string length should be between 0 and 256 characters. Valid characters include ``a-z``, ``A-Z``, ``0-9``, space, and the special characters ``_ - . : / = + @``."
        }
      },
      "required" : [ "Key", "Value" ],
      "type" : "object",
      "description" : "A complex type that contains ``Tag`` key and ``Tag`` value."
    }
  },
  "description" : "Creates a CF function.\n 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.\n 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).\n 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.\n To automatically publish the function to the ``LIVE`` stage when it’s created, set the ``AutoPublish`` property to ``true``.",
  "handlers" : {
    "create" : {
      "permissions" : [ "cloudfront:CreateFunction", "cloudfront:PublishFunction", "cloudfront:DescribeFunction", "cloudfront:TagResource" ]
    },
    "delete" : {
      "permissions" : [ "cloudfront:DeleteFunction", "cloudfront:DescribeFunction" ]
    },
    "list" : {
      "permissions" : [ "cloudfront:ListFunctions" ]
    },
    "read" : {
      "permissions" : [ "cloudfront:DescribeFunction", "cloudfront:GetFunction", "cloudfront:ListTagsForResource" ]
    },
    "update" : {
      "permissions" : [ "cloudfront:UpdateFunction", "cloudfront:PublishFunction", "cloudfront:DescribeFunction", "cloudfront:TagResource", "cloudfront:UntagResource" ]
    }
  },
  "primaryIdentifier" : [ "/properties/FunctionARN" ],
  "properties" : {
    "AutoPublish" : {
      "type" : "boolean",
      "description" : "A flag that determines whether to automatically publish the function to the ``LIVE`` stage when it’s created. To automatically publish to the ``LIVE`` stage, set this property to ``true``."
    },
    "FunctionARN" : {
      "type" : "string",
      "description" : ""
    },
    "FunctionCode" : {
      "type" : "string",
      "description" : "The function code. For more information about writing a CloudFront function, see [Writing function code for CloudFront Functions](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/writing-function-code.html) in the *Amazon CloudFront Developer Guide*."
    },
    "FunctionConfig" : {
      "$ref" : "#/definitions/FunctionConfig",
      "description" : "Contains configuration information about a CloudFront function."
    },
    "FunctionMetadata" : {
      "$ref" : "#/definitions/FunctionMetadata",
      "description" : "Contains metadata about a CloudFront function."
    },
    "Name" : {
      "type" : "string",
      "description" : "A name to identify the function."
    },
    "Stage" : {
      "type" : "string",
      "description" : ""
    },
    "Tags" : {
      "type" : "array",
      "insertionOrder" : false,
      "items" : {
        "$ref" : "#/definitions/Tag"
      },
      "description" : "A complex type that contains zero or more ``Tag`` elements."
    }
  },
  "createOnlyProperties" : [ "/properties/Name" ],
  "readOnlyProperties" : [ "/properties/FunctionARN", "/properties/FunctionMetadata/FunctionARN", "/properties/Stage" ],
  "required" : [ "Name", "FunctionConfig", "FunctionCode" ],
  "tagging" : {
    "cloudFormationSystemTags" : false,
    "tagOnCreate" : true,
    "tagUpdatable" : true,
    "taggable" : true,
    "tagProperty" : "/properties/Tags",
    "permissions" : [ "cloudfront:TagResource", "cloudfront:UntagResource", "cloudfront:ListTagsForResource" ]
  },
  "typeName" : "AWS::CloudFront::Function",
  "writeOnlyProperties" : [ "/properties/AutoPublish" ]
}