{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/cloudfront/json-schema/cloudfront-create-function-request-schema.json",
  "title": "CreateFunctionRequest",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/cloudfront-functions-api-openapi.yml#/components/schemas/CreateFunctionRequest",
  "type": "object",
  "properties": {
    "Name": {
      "type": "string",
      "description": "A name to identify the function."
    },
    "FunctionConfig": {
      "$ref": "#/$defs/FunctionConfig"
    },
    "FunctionCode": {
      "type": "string",
      "format": "byte",
      "description": "The function code. For more information about writing a CloudFront function, see Writing function code for CloudFront Functions in the Amazon CloudFront Developer Guide."
    },
    "Tags": {
      "$ref": "#/$defs/Tags"
    }
  },
  "required": [
    "Name",
    "FunctionConfig",
    "FunctionCode"
  ],
  "$defs": {
    "FunctionConfig": {
      "type": "object",
      "properties": {
        "Comment": {
          "type": "string",
          "description": "A comment to describe the function."
        },
        "Runtime": {
          "type": "string",
          "enum": [
            "cloudfront-js-1.0",
            "cloudfront-js-2.0"
          ],
          "description": "The function's runtime environment version."
        },
        "KeyValueStoreAssociations": {
          "$ref": "#/$defs/KeyValueStoreAssociations"
        }
      },
      "required": [
        "Comment",
        "Runtime"
      ]
    },
    "KeyValueStoreAssociation": {
      "type": "object",
      "properties": {
        "KeyValueStoreARN": {
          "type": "string",
          "description": "The Amazon Resource Name (ARN) of the key value store association."
        }
      },
      "required": [
        "KeyValueStoreARN"
      ]
    },
    "KeyValueStoreAssociations": {
      "type": "object",
      "properties": {
        "Quantity": {
          "type": "integer",
          "description": "The quantity of key value store associations."
        },
        "Items": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/KeyValueStoreAssociation"
          },
          "description": "The items of the key value store association."
        }
      },
      "required": [
        "Quantity"
      ]
    },
    "Tag": {
      "type": "object",
      "properties": {
        "Key": {
          "type": "string",
          "description": "A string that contains Tag key. 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",
          "description": "A string that contains an optional Tag value. 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"
      ]
    },
    "Tags": {
      "type": "object",
      "properties": {
        "Items": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Tag"
          },
          "description": "A complex type that contains Tag elements."
        }
      }
    }
  }
}