{
  "typeName" : "AWS::Lightsail::Distribution",
  "description" : "Resource Type definition for AWS::Lightsail::Distribution",
  "sourceUrl" : "https://github.com/aws-cloudformation/aws-cloudformation-resource-providers-lightsail.git",
  "definitions" : {
    "Tag" : {
      "description" : "A key-value pair to associate with a resource.",
      "type" : "object",
      "properties" : {
        "Key" : {
          "type" : "string",
          "description" : "The key name of the tag. You can specify a value that is 1 to 128 Unicode characters in length and cannot be prefixed with aws:. You can use any of the following characters: the set of Unicode letters, digits, whitespace, _, ., /, =, +, and -.",
          "minLength" : 1,
          "maxLength" : 128
        },
        "Value" : {
          "type" : "string",
          "description" : "The value for the tag. You can specify a value that is 0 to 256 Unicode characters in length and cannot be prefixed with aws:. You can use any of the following characters: the set of Unicode letters, digits, whitespace, _, ., /, =, +, and -.",
          "minLength" : 0,
          "maxLength" : 256
        }
      },
      "required" : [ "Key" ],
      "additionalProperties" : false
    },
    "CacheBehaviorPerPath" : {
      "description" : "Describes the per-path cache behavior of an Amazon Lightsail content delivery network (CDN) distribution.",
      "type" : "object",
      "properties" : {
        "Behavior" : {
          "type" : "string",
          "description" : "The cache behavior for the specified path."
        },
        "Path" : {
          "type" : "string",
          "description" : "The path to a directory or file to cached, or not cache. Use an asterisk symbol to specify wildcard directories (path/to/assets/*), and file types (*.html, *jpg, *js). Directories and file paths are case-sensitive."
        }
      },
      "additionalProperties" : false
    },
    "CookieObject" : {
      "description" : "Describes whether an Amazon Lightsail content delivery network (CDN) distribution forwards cookies to the origin and, if so, which ones.",
      "type" : "object",
      "properties" : {
        "CookiesAllowList" : {
          "description" : "The specific cookies to forward to your distribution's origin.",
          "type" : "array",
          "uniqueItems" : true,
          "insertionOrder" : false,
          "items" : {
            "type" : "string"
          }
        },
        "Option" : {
          "type" : "string",
          "description" : "Specifies which cookies to forward to the distribution's origin for a cache behavior: all, none, or allow-list to forward only the cookies specified in the cookiesAllowList parameter."
        }
      },
      "additionalProperties" : false
    },
    "HeaderObject" : {
      "description" : "Describes the request headers that a Lightsail distribution bases caching on.",
      "type" : "object",
      "properties" : {
        "HeadersAllowList" : {
          "description" : "The specific headers to forward to your distribution's origin.",
          "type" : "array",
          "uniqueItems" : true,
          "insertionOrder" : false,
          "items" : {
            "type" : "string"
          }
        },
        "Option" : {
          "type" : "string",
          "description" : "The headers that you want your distribution to forward to your origin and base caching on."
        }
      },
      "additionalProperties" : false
    },
    "QueryStringObject" : {
      "description" : "Describes the query string parameters that an Amazon Lightsail content delivery network (CDN) distribution to bases caching on.",
      "type" : "object",
      "properties" : {
        "QueryStringsAllowList" : {
          "description" : "The specific query strings that the distribution forwards to the origin.",
          "type" : "array",
          "uniqueItems" : true,
          "insertionOrder" : false,
          "items" : {
            "type" : "string"
          }
        },
        "Option" : {
          "type" : "boolean",
          "description" : "Indicates whether the distribution forwards and caches based on query strings."
        }
      },
      "additionalProperties" : false
    },
    "CacheSettings" : {
      "description" : "Describes the cache settings of an Amazon Lightsail content delivery network (CDN) distribution.",
      "type" : "object",
      "properties" : {
        "AllowedHTTPMethods" : {
          "type" : "string",
          "description" : "The HTTP methods that are processed and forwarded to the distribution's origin."
        },
        "CachedHTTPMethods" : {
          "type" : "string",
          "description" : "The HTTP method responses that are cached by your distribution."
        },
        "DefaultTTL" : {
          "type" : "integer",
          "format" : "int64",
          "description" : "The default amount of time that objects stay in the distribution's cache before the distribution forwards another request to the origin to determine whether the content has been updated."
        },
        "MaximumTTL" : {
          "type" : "integer",
          "format" : "int64",
          "description" : "The maximum amount of time that objects stay in the distribution's cache before the distribution forwards another request to the origin to determine whether the object has been updated."
        },
        "MinimumTTL" : {
          "type" : "integer",
          "format" : "int64",
          "description" : "The minimum amount of time that objects stay in the distribution's cache before the distribution forwards another request to the origin to determine whether the object has been updated."
        },
        "ForwardedCookies" : {
          "$ref" : "#/definitions/CookieObject",
          "description" : "An object that describes the cookies that are forwarded to the origin. Your content is cached based on the cookies that are forwarded."
        },
        "ForwardedHeaders" : {
          "$ref" : "#/definitions/HeaderObject",
          "description" : "An object that describes the headers that are forwarded to the origin. Your content is cached based on the headers that are forwarded."
        },
        "ForwardedQueryStrings" : {
          "$ref" : "#/definitions/QueryStringObject",
          "description" : "An object that describes the query strings that are forwarded to the origin. Your content is cached based on the query strings that are forwarded."
        }
      },
      "additionalProperties" : false
    },
    "CacheBehavior" : {
      "description" : "Describes the default cache behavior of an Amazon Lightsail content delivery network (CDN) distribution.",
      "type" : "object",
      "properties" : {
        "Behavior" : {
          "type" : "string",
          "description" : "The cache behavior of the distribution."
        }
      },
      "additionalProperties" : false
    },
    "InputOrigin" : {
      "description" : "Describes the origin resource of an Amazon Lightsail content delivery network (CDN) distribution.",
      "type" : "object",
      "properties" : {
        "Name" : {
          "type" : "string",
          "description" : "The name of the origin resource."
        },
        "ProtocolPolicy" : {
          "type" : "string",
          "description" : "The protocol that your Amazon Lightsail distribution uses when establishing a connection with your origin to pull content."
        },
        "RegionName" : {
          "type" : "string",
          "description" : "The AWS Region name of the origin resource."
        }
      },
      "additionalProperties" : false
    }
  },
  "properties" : {
    "DistributionName" : {
      "description" : "The name for the distribution.",
      "type" : "string",
      "pattern" : "\\w[\\w\\-]*\\w"
    },
    "DistributionArn" : {
      "type" : "string"
    },
    "BundleId" : {
      "description" : "The bundle ID to use for the distribution.",
      "type" : "string"
    },
    "IpAddressType" : {
      "description" : "The IP address type for the distribution.",
      "type" : "string"
    },
    "CacheBehaviors" : {
      "description" : "An array of objects that describe the per-path cache behavior for the distribution.",
      "type" : "array",
      "uniqueItems" : true,
      "insertionOrder" : false,
      "items" : {
        "$ref" : "#/definitions/CacheBehaviorPerPath"
      }
    },
    "CacheBehaviorSettings" : {
      "description" : "An object that describes the cache behavior settings for the distribution.",
      "$ref" : "#/definitions/CacheSettings"
    },
    "DefaultCacheBehavior" : {
      "description" : "An object that describes the default cache behavior for the distribution.",
      "$ref" : "#/definitions/CacheBehavior"
    },
    "Origin" : {
      "description" : "An object that describes the origin resource for the distribution, such as a Lightsail instance or load balancer.",
      "$ref" : "#/definitions/InputOrigin"
    },
    "Status" : {
      "description" : "The status of the distribution.",
      "type" : "string"
    },
    "AbleToUpdateBundle" : {
      "description" : "Indicates whether the bundle that is currently applied to your distribution, specified using the distributionName parameter, can be changed to another bundle.",
      "type" : "boolean"
    },
    "IsEnabled" : {
      "description" : "Indicates whether the distribution is enabled.",
      "type" : "boolean"
    },
    "CertificateName" : {
      "description" : "The certificate attached to the Distribution.",
      "type" : "string"
    },
    "Tags" : {
      "description" : "An array of key-value pairs to apply to this resource.",
      "type" : "array",
      "uniqueItems" : true,
      "insertionOrder" : false,
      "items" : {
        "$ref" : "#/definitions/Tag"
      }
    }
  },
  "additionalProperties" : false,
  "required" : [ "DistributionName", "BundleId", "DefaultCacheBehavior", "Origin" ],
  "readOnlyProperties" : [ "/properties/DistributionArn", "/properties/Status", "/properties/AbleToUpdateBundle" ],
  "taggable" : true,
  "primaryIdentifier" : [ "/properties/DistributionName" ],
  "createOnlyProperties" : [ "/properties/DistributionName", "/properties/IpAddressType" ],
  "handlers" : {
    "create" : {
      "permissions" : [ "lightsail:AttachCertificateToDistribution", "lightsail:CreateDistribution", "lightsail:DetachCertificateFromDistribution", "lightsail:GetCertificates", "lightsail:GetCertificateDetails", "lightsail:GetDistributions", "lightsail:TagResource", "lightsail:UntagResource", "lightsail:UpdateDistribution", "lightsail:UpdateDistributionBundle" ]
    },
    "read" : {
      "permissions" : [ "lightsail:GetDistributions" ]
    },
    "update" : {
      "permissions" : [ "lightsail:AttachCertificateToDistribution", "lightsail:DetachCertificateFromDistribution", "lightsail:GetCertificates", "lightsail:GetCertificateDetails", "lightsail:GetDistributions", "lightsail:TagResource", "lightsail:UntagResource", "lightsail:UpdateDistribution", "lightsail:UpdateDistributionBundle" ]
    },
    "delete" : {
      "permissions" : [ "lightsail:DeleteDistribution", "lightsail:GetDistributions" ]
    },
    "list" : {
      "permissions" : [ "lightsail:GetDistributions" ]
    }
  }
}