{
  "typeName" : "AWS::SystemsManagerSAP::Application",
  "description" : "Resource schema for AWS::SystemsManagerSAP::Application",
  "properties" : {
    "ApplicationId" : {
      "type" : "string",
      "pattern" : "[\\w\\d\\.-]{1,60}"
    },
    "ApplicationType" : {
      "type" : "string",
      "enum" : [ "HANA", "SAP_ABAP" ]
    },
    "Arn" : {
      "description" : "The ARN of the SSM-SAP application",
      "type" : "string",
      "pattern" : "^arn:(.+:){2,4}.+$|^arn:(.+:){1,3}.+\\/.+$"
    },
    "Credentials" : {
      "type" : "array",
      "items" : {
        "$ref" : "#/definitions/Credential"
      },
      "minItems" : 1,
      "insertionOrder" : true
    },
    "Instances" : {
      "type" : "array",
      "items" : {
        "$ref" : "#/definitions/Instance"
      },
      "minItems" : 1,
      "insertionOrder" : true
    },
    "SapInstanceNumber" : {
      "type" : "string",
      "pattern" : "[0-9]{2}"
    },
    "Sid" : {
      "type" : "string",
      "pattern" : "[A-Z][A-Z0-9]{2}"
    },
    "Tags" : {
      "description" : "The tags of a SystemsManagerSAP application.",
      "type" : "array",
      "items" : {
        "$ref" : "#/definitions/Tag"
      },
      "insertionOrder" : true
    },
    "DatabaseArn" : {
      "description" : "The ARN of the SAP HANA database",
      "type" : "string",
      "pattern" : "^arn:(.+:){2,4}.+$|^arn:(.+:){1,3}.+\\/.+$"
    },
    "ComponentsInfo" : {
      "description" : "This is an optional parameter for component details to which the SAP ABAP application is attached, such as Web Dispatcher.",
      "type" : "array",
      "items" : {
        "$ref" : "#/definitions/ComponentInfo"
      },
      "minItems" : 1,
      "insertionOrder" : true
    }
  },
  "required" : [ "ApplicationId", "ApplicationType" ],
  "primaryIdentifier" : [ "/properties/Arn" ],
  "readOnlyProperties" : [ "/properties/Arn" ],
  "createOnlyProperties" : [ "/properties/Credentials", "/properties/Instances", "/properties/SapInstanceNumber", "/properties/Sid", "/properties/DatabaseArn", "/properties/ComponentsInfo" ],
  "writeOnlyProperties" : [ "/properties/Credentials", "/properties/Instances", "/properties/SapInstanceNumber", "/properties/Sid", "/properties/DatabaseArn", "/properties/ComponentsInfo" ],
  "additionalProperties" : false,
  "definitions" : {
    "Tag" : {
      "description" : "A key-value pair to associate with a resource.",
      "type" : "object",
      "properties" : {
        "Key" : {
          "description" : "The key name of the tag. You can specify a value that is 1 to 127 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 -. ",
          "type" : "string",
          "minLength" : 1,
          "maxLength" : 128
        },
        "Value" : {
          "description" : "The value for the tag. You can specify a value that is 1 to 255 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 -. ",
          "type" : "string",
          "minLength" : 0,
          "maxLength" : 256
        }
      },
      "required" : [ "Key", "Value" ],
      "additionalProperties" : false
    },
    "Credential" : {
      "type" : "object",
      "properties" : {
        "DatabaseName" : {
          "type" : "string",
          "pattern" : "^(?=.{1,100}$).*"
        },
        "CredentialType" : {
          "type" : "string",
          "enum" : [ "ADMIN" ]
        },
        "SecretId" : {
          "type" : "string",
          "pattern" : "^(?=.{1,100}$).*"
        }
      },
      "additionalProperties" : false
    },
    "Instance" : {
      "type" : "string",
      "pattern" : "^i-[\\w\\d]{8}$|^i-[\\w\\d]{17}$"
    },
    "ComponentInfo" : {
      "type" : "object",
      "properties" : {
        "ComponentType" : {
          "type" : "string",
          "enum" : [ "HANA", "HANA_NODE", "ABAP", "ASCS", "DIALOG", "WEBDISP", "WD", "ERS" ]
        },
        "Ec2InstanceId" : {
          "type" : "string",
          "pattern" : "^i-[\\w\\d]{8}$|^i-[\\w\\d]{17}$"
        },
        "Sid" : {
          "type" : "string",
          "pattern" : "[A-Z][A-Z0-9]{2}"
        }
      }
    }
  },
  "handlers" : {
    "create" : {
      "permissions" : [ "ssm-sap:RegisterApplication", "ssm-sap:GetApplication", "ssm-sap:TagResource", "ssm-sap:ListTagsForResource", "iam:CreateServiceLinkedRole" ]
    },
    "read" : {
      "permissions" : [ "ssm-sap:GetApplication", "ssm-sap:ListTagsForResource" ]
    },
    "update" : {
      "permissions" : [ "ssm-sap:TagResource", "ssm-sap:UntagResource", "ssm-sap:ListTagsForResource", "ssm-sap:GetApplication" ]
    },
    "delete" : {
      "permissions" : [ "ssm-sap:DeregisterApplication", "ssm-sap:GetApplication" ]
    },
    "list" : {
      "permissions" : [ "ssm-sap:ListApplications" ]
    }
  },
  "tagging" : {
    "taggable" : true,
    "tagOnCreate" : true,
    "tagUpdatable" : true,
    "cloudFormationSystemTags" : true,
    "tagProperty" : "/properties/Tags",
    "permissions" : [ "ssm-sap:UntagResource", "ssm-sap:TagResource", "ssm-sap:ListTagsForResource" ]
  }
}