{
  "typeName" : "AWS::InspectorV2::CisScanConfiguration",
  "description" : "CIS Scan Configuration resource schema",
  "sourceUrl" : "https://github.com/aws-cloudformation/aws-cloudformation-resource-providers-inspector.git",
  "definitions" : {
    "CisSecurityLevel" : {
      "type" : "string",
      "enum" : [ "LEVEL_1", "LEVEL_2" ]
    },
    "Schedule" : {
      "description" : "Choose a Schedule cadence",
      "properties" : {
        "OneTime" : {
          "$ref" : "#/definitions/OneTimeSchedule"
        },
        "Daily" : {
          "$ref" : "#/definitions/DailySchedule"
        },
        "Weekly" : {
          "$ref" : "#/definitions/WeeklySchedule"
        },
        "Monthly" : {
          "$ref" : "#/definitions/MonthlySchedule"
        }
      }
    },
    "OneTimeSchedule" : {
      "type" : "object"
    },
    "DailySchedule" : {
      "type" : "object",
      "properties" : {
        "StartTime" : {
          "$ref" : "#/definitions/Time"
        }
      },
      "required" : [ "StartTime" ],
      "additionalProperties" : false
    },
    "WeeklySchedule" : {
      "type" : "object",
      "properties" : {
        "StartTime" : {
          "$ref" : "#/definitions/Time"
        },
        "Days" : {
          "$ref" : "#/definitions/DaysList"
        }
      },
      "required" : [ "StartTime", "Days" ],
      "additionalProperties" : false
    },
    "MonthlySchedule" : {
      "type" : "object",
      "properties" : {
        "StartTime" : {
          "$ref" : "#/definitions/Time"
        },
        "Day" : {
          "$ref" : "#/definitions/Day"
        }
      },
      "required" : [ "StartTime", "Day" ],
      "additionalProperties" : false
    },
    "Time" : {
      "type" : "object",
      "properties" : {
        "TimeOfDay" : {
          "type" : "string",
          "pattern" : "^([0-1]?[0-9]|2[0-3]):[0-5][0-9]$"
        },
        "TimeZone" : {
          "type" : "string"
        }
      },
      "required" : [ "TimeOfDay", "TimeZone" ],
      "additionalProperties" : false
    },
    "DaysList" : {
      "type" : "array",
      "minItems" : 1,
      "maxItems" : 7,
      "items" : {
        "$ref" : "#/definitions/Day"
      },
      "uniqueItems" : true
    },
    "Day" : {
      "type" : "string",
      "enum" : [ "MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN" ]
    },
    "CisTargets" : {
      "properties" : {
        "AccountIds" : {
          "type" : "array",
          "minItems" : 1,
          "maxItems" : 10000,
          "items" : {
            "type" : "string",
            "pattern" : "^\\d{12}|ALL_ACCOUNTS|SELF$"
          },
          "uniqueItems" : true
        },
        "TargetResourceTags" : {
          "$ref" : "#/definitions/TargetResourceTags"
        }
      },
      "additionalProperties" : false,
      "required" : [ "AccountIds", "TargetResourceTags" ]
    },
    "TargetResourceTags" : {
      "patternProperties" : {
        "^.+$" : {
          "$ref" : "#/definitions/TagValueList"
        }
      },
      "maxProperties" : 5,
      "additionalProperties" : false
    },
    "TagValueList" : {
      "type" : "array",
      "minItems" : 1,
      "maxItems" : 5,
      "items" : {
        "type" : "string"
      },
      "uniqueItems" : true
    },
    "CisTagMap" : {
      "type" : "object",
      "patternProperties" : {
        "^.{2,127}$" : {
          "type" : "string",
          "pattern" : "^.{1,255}$"
        }
      },
      "additionalProperties" : false
    }
  },
  "properties" : {
    "ScanName" : {
      "description" : "Name of the scan",
      "type" : "string",
      "minLength" : 1
    },
    "SecurityLevel" : {
      "$ref" : "#/definitions/CisSecurityLevel"
    },
    "Schedule" : {
      "$ref" : "#/definitions/Schedule"
    },
    "Targets" : {
      "$ref" : "#/definitions/CisTargets"
    },
    "Arn" : {
      "type" : "string",
      "description" : "CIS Scan configuration unique identifier"
    },
    "Tags" : {
      "$ref" : "#/definitions/CisTagMap"
    }
  },
  "required" : [ "ScanName", "SecurityLevel", "Schedule", "Targets" ],
  "additionalProperties" : false,
  "readOnlyProperties" : [ "/properties/Arn" ],
  "primaryIdentifier" : [ "/properties/Arn" ],
  "tagging" : {
    "taggable" : true,
    "tagOnCreate" : true,
    "tagUpdatable" : true,
    "cloudFormationSystemTags" : true,
    "tagProperty" : "/properties/Tags",
    "permissions" : [ "inspector2:TagResource", "inspector2:UntagResource" ]
  },
  "handlers" : {
    "create" : {
      "permissions" : [ "inspector2:CreateCisScanConfiguration", "inspector2:ListCisScanConfigurations", "inspector2:TagResource" ]
    },
    "read" : {
      "permissions" : [ "inspector2:ListCisScanConfigurations", "inspector2:ListTagsForResource" ]
    },
    "update" : {
      "permissions" : [ "inspector2:ListCisScanConfigurations", "inspector2:UpdateCisScanConfiguration", "inspector2:TagResource", "inspector2:UntagResource", "inspector2:ListTagsForResource" ]
    },
    "delete" : {
      "permissions" : [ "inspector2:ListCisScanConfigurations", "inspector2:DeleteCisScanConfiguration", "inspector2:UntagResource" ]
    },
    "list" : {
      "permissions" : [ "inspector2:ListCisScanConfigurations", "inspector2:ListTagsForResource" ]
    }
  }
}