{
 "additionalProperties": false,
 "createOnlyProperties": [
  "/properties/Configuration/Standard/NetworkInterfaceArn",
  "/properties/Configuration/Merge/NetworkInterfaceArn",
  "/properties/Configuration/Failover/NetworkInterfaceArn",
  "/properties/AvailabilityZone",
  "/properties/RegionName"
 ],
 "definitions": {
  "AutomaticEncryptionKeyConfiguration": {
   "additionalProperties": false,
   "type": "object"
  },
  "Day": {
   "enum": [
    "MONDAY",
    "TUESDAY",
    "WEDNESDAY",
    "THURSDAY",
    "FRIDAY",
    "SATURDAY",
    "SUNDAY"
   ],
   "type": "string"
  },
  "DefaultMaintenanceConfiguration": {
   "additionalProperties": false,
   "type": "object"
  },
  "FailoverInputSourcePriorityMode": {
   "enum": [
    "NO_PRIORITY",
    "PRIMARY_SECONDARY"
   ],
   "type": "string"
  },
  "FailoverRouterInputConfiguration": {
   "additionalProperties": false,
   "properties": {
    "NetworkInterfaceArn": {
     "pattern": "^arn:(aws[a-zA-Z-]*):mediaconnect:[a-z0-9-]+:[0-9]{12}:routerNetworkInterface:[a-z0-9]{12}$",
     "type": "string"
    },
    "PrimarySourceIndex": {
     "maximum": 1,
     "minimum": 0,
     "type": "integer"
    },
    "ProtocolConfigurations": {
     "items": {
      "$ref": "#/definitions/FailoverRouterInputProtocolConfiguration"
     },
     "type": "array"
    },
    "SourcePriorityMode": {
     "$ref": "#/definitions/FailoverInputSourcePriorityMode"
    }
   },
   "required": [
    "NetworkInterfaceArn",
    "ProtocolConfigurations",
    "SourcePriorityMode"
   ],
   "type": "object"
  },
  "FailoverRouterInputProtocolConfiguration": {
   "oneOf": [
    {
     "additionalProperties": false,
     "properties": {
      "Rtp": {
       "$ref": "#/definitions/RtpRouterInputConfiguration"
      }
     },
     "required": [
      "Rtp"
     ],
     "title": "Rtp",
     "type": "object"
    },
    {
     "additionalProperties": false,
     "properties": {
      "Rist": {
       "$ref": "#/definitions/RistRouterInputConfiguration"
      }
     },
     "required": [
      "Rist"
     ],
     "title": "Rist",
     "type": "object"
    },
    {
     "additionalProperties": false,
     "properties": {
      "SrtListener": {
       "$ref": "#/definitions/SrtListenerRouterInputConfiguration"
      }
     },
     "required": [
      "SrtListener"
     ],
     "title": "SrtListener",
     "type": "object"
    },
    {
     "additionalProperties": false,
     "properties": {
      "SrtCaller": {
       "$ref": "#/definitions/SrtCallerRouterInputConfiguration"
      }
     },
     "required": [
      "SrtCaller"
     ],
     "title": "SrtCaller",
     "type": "object"
    }
   ]
  },
  "FlowTransitEncryption": {
   "additionalProperties": false,
   "properties": {
    "EncryptionKeyConfiguration": {
     "$ref": "#/definitions/FlowTransitEncryptionKeyConfiguration"
    },
    "EncryptionKeyType": {
     "$ref": "#/definitions/FlowTransitEncryptionKeyType"
    }
   },
   "required": [
    "EncryptionKeyConfiguration"
   ],
   "type": "object"
  },
  "FlowTransitEncryptionKeyConfiguration": {
   "oneOf": [
    {
     "additionalProperties": false,
     "properties": {
      "SecretsManager": {
       "$ref": "#/definitions/SecretsManagerEncryptionKeyConfiguration"
      }
     },
     "required": [
      "SecretsManager"
     ],
     "title": "SecretsManager",
     "type": "object"
    },
    {
     "additionalProperties": false,
     "properties": {
      "Automatic": {
       "$ref": "#/definitions/AutomaticEncryptionKeyConfiguration"
      }
     },
     "required": [
      "Automatic"
     ],
     "title": "Automatic",
     "type": "object"
    }
   ]
  },
  "FlowTransitEncryptionKeyType": {
   "enum": [
    "SECRETS_MANAGER",
    "AUTOMATIC"
   ],
   "type": "string"
  },
  "ForwardErrorCorrectionState": {
   "enum": [
    "ENABLED",
    "DISABLED"
   ],
   "type": "string"
  },
  "MaintenanceConfiguration": {
   "oneOf": [
    {
     "additionalProperties": false,
     "properties": {
      "PreferredDayTime": {
       "$ref": "#/definitions/PreferredDayTimeMaintenanceConfiguration"
      }
     },
     "required": [
      "PreferredDayTime"
     ],
     "title": "PreferredDayTime",
     "type": "object"
    },
    {
     "additionalProperties": false,
     "properties": {
      "Default": {
       "$ref": "#/definitions/DefaultMaintenanceConfiguration"
      }
     },
     "required": [
      "Default"
     ],
     "title": "Default",
     "type": "object"
    }
   ]
  },
  "MaintenanceType": {
   "enum": [
    "PREFERRED_DAY_TIME",
    "DEFAULT"
   ],
   "type": "string"
  },
  "MediaConnectFlowRouterInputConfiguration": {
   "additionalProperties": false,
   "properties": {
    "FlowArn": {
     "pattern": "^arn:(aws[a-zA-Z-]*):mediaconnect:[a-z0-9-]+:[0-9]{12}:flow:[a-zA-Z0-9-]+:[a-zA-Z0-9_-]+$",
     "type": "string"
    },
    "FlowOutputArn": {
     "pattern": "^arn:(aws[a-zA-Z-]*):mediaconnect:[a-z0-9-]+:[0-9]{12}:output:[a-zA-Z0-9-]+:[a-zA-Z0-9_-]+$",
     "type": "string"
    },
    "SourceTransitDecryption": {
     "$ref": "#/definitions/FlowTransitEncryption"
    }
   },
   "required": [
    "SourceTransitDecryption"
   ],
   "type": "object"
  },
  "MergeRouterInputConfiguration": {
   "additionalProperties": false,
   "properties": {
    "MergeRecoveryWindowMilliseconds": {
     "type": "integer"
    },
    "NetworkInterfaceArn": {
     "pattern": "^arn:(aws[a-zA-Z-]*):mediaconnect:[a-z0-9-]+:[0-9]{12}:routerNetworkInterface:[a-z0-9]{12}$",
     "type": "string"
    },
    "ProtocolConfigurations": {
     "items": {
      "$ref": "#/definitions/MergeRouterInputProtocolConfiguration"
     },
     "type": "array"
    }
   },
   "required": [
    "MergeRecoveryWindowMilliseconds",
    "NetworkInterfaceArn",
    "ProtocolConfigurations"
   ],
   "type": "object"
  },
  "MergeRouterInputProtocolConfiguration": {
   "oneOf": [
    {
     "additionalProperties": false,
     "properties": {
      "Rtp": {
       "$ref": "#/definitions/RtpRouterInputConfiguration"
      }
     },
     "required": [
      "Rtp"
     ],
     "title": "Rtp",
     "type": "object"
    },
    {
     "additionalProperties": false,
     "properties": {
      "Rist": {
       "$ref": "#/definitions/RistRouterInputConfiguration"
      }
     },
     "required": [
      "Rist"
     ],
     "title": "Rist",
     "type": "object"
    }
   ]
  },
  "PreferredDayTimeMaintenanceConfiguration": {
   "additionalProperties": false,
   "properties": {
    "Day": {
     "$ref": "#/definitions/Day"
    },
    "Time": {
     "type": "string"
    }
   },
   "required": [
    "Day",
    "Time"
   ],
   "type": "object"
  },
  "RistRouterInputConfiguration": {
   "additionalProperties": false,
   "properties": {
    "Port": {
     "maximum": 30000,
     "minimum": 3000,
     "type": "integer"
    },
    "RecoveryLatencyMilliseconds": {
     "maximum": 10000,
     "minimum": 10,
     "type": "integer"
    }
   },
   "required": [
    "Port",
    "RecoveryLatencyMilliseconds"
   ],
   "type": "object"
  },
  "RouterInputConfiguration": {
   "oneOf": [
    {
     "additionalProperties": false,
     "properties": {
      "Standard": {
       "$ref": "#/definitions/StandardRouterInputConfiguration"
      }
     },
     "required": [
      "Standard"
     ],
     "title": "Standard",
     "type": "object"
    },
    {
     "additionalProperties": false,
     "properties": {
      "Failover": {
       "$ref": "#/definitions/FailoverRouterInputConfiguration"
      }
     },
     "required": [
      "Failover"
     ],
     "title": "Failover",
     "type": "object"
    },
    {
     "additionalProperties": false,
     "properties": {
      "Merge": {
       "$ref": "#/definitions/MergeRouterInputConfiguration"
      }
     },
     "required": [
      "Merge"
     ],
     "title": "Merge",
     "type": "object"
    },
    {
     "additionalProperties": false,
     "properties": {
      "MediaConnectFlow": {
       "$ref": "#/definitions/MediaConnectFlowRouterInputConfiguration"
      }
     },
     "required": [
      "MediaConnectFlow"
     ],
     "title": "MediaConnectFlow",
     "type": "object"
    }
   ]
  },
  "RouterInputProtocol": {
   "enum": [
    "RTP",
    "RIST",
    "SRT_CALLER",
    "SRT_LISTENER"
   ],
   "type": "string"
  },
  "RouterInputProtocolConfiguration": {
   "oneOf": [
    {
     "additionalProperties": false,
     "properties": {
      "Rtp": {
       "$ref": "#/definitions/RtpRouterInputConfiguration"
      }
     },
     "required": [
      "Rtp"
     ],
     "title": "Rtp",
     "type": "object"
    },
    {
     "additionalProperties": false,
     "properties": {
      "Rist": {
       "$ref": "#/definitions/RistRouterInputConfiguration"
      }
     },
     "required": [
      "Rist"
     ],
     "title": "Rist",
     "type": "object"
    },
    {
     "additionalProperties": false,
     "properties": {
      "SrtListener": {
       "$ref": "#/definitions/SrtListenerRouterInputConfiguration"
      }
     },
     "required": [
      "SrtListener"
     ],
     "title": "SrtListener",
     "type": "object"
    },
    {
     "additionalProperties": false,
     "properties": {
      "SrtCaller": {
       "$ref": "#/definitions/SrtCallerRouterInputConfiguration"
      }
     },
     "required": [
      "SrtCaller"
     ],
     "title": "SrtCaller",
     "type": "object"
    }
   ]
  },
  "RouterInputState": {
   "enum": [
    "CREATING",
    "STANDBY",
    "STARTING",
    "ACTIVE",
    "STOPPING",
    "DELETING",
    "UPDATING",
    "ERROR",
    "RECOVERING",
    "MIGRATING"
   ],
   "type": "string"
  },
  "RouterInputTier": {
   "enum": [
    "INPUT_100",
    "INPUT_50",
    "INPUT_20"
   ],
   "type": "string"
  },
  "RouterInputTransitEncryption": {
   "additionalProperties": false,
   "properties": {
    "EncryptionKeyConfiguration": {
     "$ref": "#/definitions/RouterInputTransitEncryptionKeyConfiguration"
    },
    "EncryptionKeyType": {
     "$ref": "#/definitions/RouterInputTransitEncryptionKeyType"
    }
   },
   "required": [
    "EncryptionKeyConfiguration"
   ],
   "type": "object"
  },
  "RouterInputTransitEncryptionKeyConfiguration": {
   "oneOf": [
    {
     "additionalProperties": false,
     "properties": {
      "SecretsManager": {
       "$ref": "#/definitions/SecretsManagerEncryptionKeyConfiguration"
      }
     },
     "required": [
      "SecretsManager"
     ],
     "title": "SecretsManager",
     "type": "object"
    },
    {
     "additionalProperties": false,
     "properties": {
      "Automatic": {
       "$ref": "#/definitions/AutomaticEncryptionKeyConfiguration"
      }
     },
     "required": [
      "Automatic"
     ],
     "title": "Automatic",
     "type": "object"
    }
   ]
  },
  "RouterInputTransitEncryptionKeyType": {
   "enum": [
    "SECRETS_MANAGER",
    "AUTOMATIC"
   ],
   "type": "string"
  },
  "RouterInputType": {
   "enum": [
    "STANDARD",
    "FAILOVER",
    "MERGE",
    "MEDIACONNECT_FLOW"
   ],
   "type": "string"
  },
  "RoutingScope": {
   "enum": [
    "REGIONAL",
    "GLOBAL"
   ],
   "type": "string"
  },
  "RtpRouterInputConfiguration": {
   "additionalProperties": false,
   "properties": {
    "ForwardErrorCorrection": {
     "$ref": "#/definitions/ForwardErrorCorrectionState"
    },
    "Port": {
     "maximum": 30000,
     "minimum": 3000,
     "type": "integer"
    }
   },
   "required": [
    "Port"
   ],
   "type": "object"
  },
  "SecretsManagerEncryptionKeyConfiguration": {
   "additionalProperties": false,
   "properties": {
    "RoleArn": {
     "format": "AWS::IAM::Role.Arn",
     "pattern": "^arn:(aws[a-zA-Z-]*):iam::[0-9]{12}:role/[a-zA-Z0-9_+=,.@-]+$",
     "type": "string"
    },
    "SecretArn": {
     "pattern": "^arn:(aws[a-zA-Z-]*):secretsmanager:[a-z0-9-]+:[0-9]{12}:secret:[a-zA-Z0-9/_+=.@-]+$",
     "type": "string"
    }
   },
   "required": [
    "RoleArn",
    "SecretArn"
   ],
   "type": "object"
  },
  "SrtCallerRouterInputConfiguration": {
   "additionalProperties": false,
   "properties": {
    "DecryptionConfiguration": {
     "$ref": "#/definitions/SrtDecryptionConfiguration"
    },
    "MinimumLatencyMilliseconds": {
     "maximum": 10000,
     "minimum": 10,
     "type": "integer"
    },
    "SourceAddress": {
     "type": "string"
    },
    "SourcePort": {
     "maximum": 65535,
     "minimum": 0,
     "type": "integer"
    },
    "StreamId": {
     "type": "string"
    }
   },
   "required": [
    "MinimumLatencyMilliseconds",
    "SourceAddress",
    "SourcePort"
   ],
   "type": "object"
  },
  "SrtDecryptionConfiguration": {
   "additionalProperties": false,
   "properties": {
    "EncryptionKey": {
     "$ref": "#/definitions/SecretsManagerEncryptionKeyConfiguration"
    }
   },
   "required": [
    "EncryptionKey"
   ],
   "type": "object"
  },
  "SrtListenerRouterInputConfiguration": {
   "additionalProperties": false,
   "properties": {
    "DecryptionConfiguration": {
     "$ref": "#/definitions/SrtDecryptionConfiguration"
    },
    "MinimumLatencyMilliseconds": {
     "maximum": 10000,
     "minimum": 10,
     "type": "integer"
    },
    "Port": {
     "maximum": 30000,
     "minimum": 3000,
     "type": "integer"
    }
   },
   "required": [
    "MinimumLatencyMilliseconds",
    "Port"
   ],
   "type": "object"
  },
  "StandardRouterInputConfiguration": {
   "additionalProperties": false,
   "properties": {
    "NetworkInterfaceArn": {
     "pattern": "^arn:(aws[a-zA-Z-]*):mediaconnect:[a-z0-9-]+:[0-9]{12}:routerNetworkInterface:[a-z0-9]{12}$",
     "type": "string"
    },
    "Protocol": {
     "$ref": "#/definitions/RouterInputProtocol"
    },
    "ProtocolConfiguration": {
     "$ref": "#/definitions/RouterInputProtocolConfiguration"
    }
   },
   "required": [
    "NetworkInterfaceArn",
    "ProtocolConfiguration"
   ],
   "type": "object"
  },
  "Tag": {
   "additionalProperties": false,
   "properties": {
    "Key": {
     "type": "string"
    },
    "Value": {
     "type": "string"
    }
   },
   "required": [
    "Key",
    "Value"
   ],
   "type": "object"
  },
  "Unit": {
   "additionalProperties": false,
   "type": "object"
  }
 },
 "primaryIdentifier": [
  "/properties/Arn"
 ],
 "properties": {
  "Arn": {
   "pattern": "^arn:(aws[a-zA-Z-]*):mediaconnect:[a-z0-9-]+:[0-9]{12}:routerInput:[a-z0-9]{12}$",
   "type": "string"
  },
  "AvailabilityZone": {
   "type": "string"
  },
  "Configuration": {
   "$ref": "#/definitions/RouterInputConfiguration"
  },
  "CreatedAt": {
   "format": "date-time",
   "type": "string"
  },
  "Id": {
   "type": "string"
  },
  "InputType": {
   "$ref": "#/definitions/RouterInputType"
  },
  "IpAddress": {
   "type": "string"
  },
  "MaintenanceConfiguration": {
   "$ref": "#/definitions/MaintenanceConfiguration"
  },
  "MaintenanceType": {
   "$ref": "#/definitions/MaintenanceType"
  },
  "MaximumBitrate": {
   "type": "integer"
  },
  "Name": {
   "maxLength": 128,
   "minLength": 1,
   "type": "string"
  },
  "RegionName": {
   "type": "string"
  },
  "RoutedOutputs": {
   "type": "integer"
  },
  "RoutingScope": {
   "$ref": "#/definitions/RoutingScope"
  },
  "State": {
   "$ref": "#/definitions/RouterInputState"
  },
  "Tags": {
   "insertionOrder": false,
   "items": {
    "$ref": "#/definitions/Tag"
   },
   "type": "array"
  },
  "Tier": {
   "$ref": "#/definitions/RouterInputTier"
  },
  "TransitEncryption": {
   "$ref": "#/definitions/RouterInputTransitEncryption"
  },
  "UpdatedAt": {
   "format": "date-time",
   "type": "string"
  }
 },
 "propertyTransform": {
  "/properties/MaintenanceConfiguration/PreferredDayTime/Time": "($groups := $match(Time, /^([0-9]{2}):([0-9]{2})(?::([0-9]{2})(?:\\.[0-9]+)?)?(?:Z|([+\\-][0-9]{2}:[0-9]{2}))?$/).groups;$seconds := $groups[2] ? $groups[2] : \"00\";$timezone := $groups[3] ? $groups[3] : \"+00:00\";$join([$groups[0], \":\", $groups[1], \":\", $seconds, \"Z\"]);)"
 },
 "readOnlyProperties": [
  "/properties/Arn",
  "/properties/CreatedAt",
  "/properties/Id",
  "/properties/InputType",
  "/properties/IpAddress",
  "/properties/MaintenanceType",
  "/properties/RoutedOutputs",
  "/properties/State",
  "/properties/UpdatedAt"
 ],
 "required": [
  "Configuration",
  "MaximumBitrate",
  "Name",
  "RoutingScope",
  "Tier"
 ],
 "tagging": {
  "cloudFormationSystemTags": true,
  "tagOnCreate": true,
  "tagProperty": "/properties/Tags",
  "tagUpdatable": true,
  "taggable": true
 },
 "typeName": "AWS::MediaConnect::RouterInput"
}
