{
  "typeName" : "AWS::Amplify::Domain",
  "description" : "The AWS::Amplify::Domain resource allows you to connect a custom domain to your app.",
  "additionalProperties" : false,
  "properties" : {
    "AppId" : {
      "type" : "string",
      "minLength" : 1,
      "maxLength" : 20,
      "pattern" : "d[a-z0-9]+"
    },
    "Arn" : {
      "type" : "string",
      "maxLength" : 1000,
      "pattern" : "(?s).*"
    },
    "AutoSubDomainCreationPatterns" : {
      "type" : "array",
      "uniqueItems" : false,
      "items" : {
        "type" : "string",
        "minLength" : 1,
        "maxLength" : 2048,
        "pattern" : "(?s).+"
      }
    },
    "AutoSubDomainIAMRole" : {
      "type" : "string",
      "pattern" : "^$|^arn:.+:iam::\\d{12}:role.+",
      "maxLength" : 1000
    },
    "CertificateRecord" : {
      "type" : "string",
      "maxLength" : 1000
    },
    "Certificate" : {
      "$ref" : "#/definitions/Certificate"
    },
    "CertificateSettings" : {
      "$ref" : "#/definitions/CertificateSettings"
    },
    "DomainName" : {
      "type" : "string",
      "pattern" : "^(((?!-)[A-Za-z0-9-]{0,62}[A-Za-z0-9])\\.)+((?!-)[A-Za-z0-9-]{1,62}[A-Za-z0-9])(\\.)?$",
      "maxLength" : 255
    },
    "DomainStatus" : {
      "type" : "string"
    },
    "UpdateStatus" : {
      "type" : "string"
    },
    "EnableAutoSubDomain" : {
      "type" : "boolean"
    },
    "StatusReason" : {
      "type" : "string",
      "maxLength" : 1000
    },
    "SubDomainSettings" : {
      "type" : "array",
      "uniqueItems" : false,
      "items" : {
        "$ref" : "#/definitions/SubDomainSetting"
      },
      "maxItems" : 255
    }
  },
  "definitions" : {
    "CertificateSettings" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "CertificateType" : {
          "type" : "string",
          "enum" : [ "AMPLIFY_MANAGED", "CUSTOM" ]
        },
        "CustomCertificateArn" : {
          "type" : "string",
          "pattern" : "^arn:aws:acm:[a-z0-9-]+:\\d{12}:certificate\\/.+$"
        }
      }
    },
    "Certificate" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "CertificateType" : {
          "type" : "string",
          "enum" : [ "AMPLIFY_MANAGED", "CUSTOM" ]
        },
        "CertificateArn" : {
          "type" : "string",
          "pattern" : "\"^arn:aws:acm:[a-z0-9-]+:\\d{12}:certificate\\/.+$\""
        },
        "CertificateVerificationDNSRecord" : {
          "type" : "string",
          "maxLength" : 1000
        }
      }
    },
    "SubDomainSetting" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "Prefix" : {
          "type" : "string",
          "maxLength" : 255,
          "pattern" : "(?s).*"
        },
        "BranchName" : {
          "type" : "string",
          "minLength" : 1,
          "maxLength" : 255,
          "pattern" : "(?s).+"
        }
      },
      "required" : [ "Prefix", "BranchName" ]
    }
  },
  "required" : [ "AppId", "DomainName", "SubDomainSettings" ],
  "primaryIdentifier" : [ "/properties/Arn" ],
  "createOnlyProperties" : [ "/properties/AppId", "/properties/DomainName" ],
  "readOnlyProperties" : [ "/properties/Arn", "/properties/DomainStatus", "/properties/StatusReason", "/properties/CertificateRecord", "/properties/Certificate", "/properties/UpdateStatus" ],
  "writeOnlyProperties" : [ "/properties/CertificateSettings" ],
  "handlers" : {
    "create" : {
      "permissions" : [ "amplify:GetDomainAssociation", "amplify:CreateDomainAssociation", "route53:ListHostedZones", "route53:ChangeResourceRecordSets", "iam:PassRole", "amplify:TagResource" ]
    },
    "delete" : {
      "permissions" : [ "amplify:GetDomainAssociation", "amplify:DeleteDomainAssociation", "route53:ListHostedZones", "iam:PassRole" ]
    },
    "list" : {
      "permissions" : [ "amplify:ListDomainAssociations", "iam:PassRole", "amplify:ListTagsForResource" ]
    },
    "read" : {
      "permissions" : [ "amplify:GetDomainAssociation", "route53:ListHostedZones", "iam:PassRole", "amplify:ListTagsForResource" ]
    },
    "update" : {
      "permissions" : [ "amplify:GetDomainAssociation", "amplify:UpdateDomainAssociation", "route53:ListHostedZones", "route53:ChangeResourceRecordSets", "iam:PassRole", "amplify:ListTagsForResource", "amplify:TagResource", "amplify:UntagResource" ]
    }
  }
}