{
  "typeName" : "AWS::MediaConnect::FlowSource",
  "description" : "Resource Type definition for AWS::MediaConnect::FlowSource",
  "sourceUrl" : "https://github.com/aws-cloudformation/aws-cloudformation-resource-providers-mediaconnect.git",
  "definitions" : {
    "Encryption" : {
      "type" : "object",
      "description" : "Information about the encryption of the flow.",
      "properties" : {
        "Algorithm" : {
          "type" : "string",
          "enum" : [ "aes128", "aes192", "aes256" ],
          "description" : "The type of algorithm that is used for the encryption (such as aes128, aes192, or aes256)."
        },
        "ConstantInitializationVector" : {
          "type" : "string",
          "description" : "A 128-bit, 16-byte hex value represented by a 32-character string, to be used with the key for encrypting content. This parameter is not valid for static key encryption."
        },
        "DeviceId" : {
          "type" : "string",
          "description" : "The value of one of the devices that you configured with your digital rights management (DRM) platform key provider. This parameter is required for SPEKE encryption and is not valid for static key encryption."
        },
        "KeyType" : {
          "type" : "string",
          "enum" : [ "speke", "static-key", "srt-password" ],
          "description" : "The type of key that is used for the encryption. If no keyType is provided, the service will use the default setting (static-key).",
          "default" : "static-key"
        },
        "Region" : {
          "type" : "string",
          "description" : "The AWS Region that the API Gateway proxy endpoint was created in. This parameter is required for SPEKE encryption and is not valid for static key encryption."
        },
        "ResourceId" : {
          "type" : "string",
          "description" : "An identifier for the content. The service sends this value to the key server to identify the current endpoint. The resource ID is also known as the content ID. This parameter is required for SPEKE encryption and is not valid for static key encryption."
        },
        "RoleArn" : {
          "type" : "string",
          "pattern" : "^arn:(aws[a-zA-Z-]*):iam::[0-9]{12}:role/[a-zA-Z0-9_+=,.@-]+$",
          "description" : "The ARN of the role that you created during setup (when you set up AWS Elemental MediaConnect as a trusted entity)."
        },
        "SecretArn" : {
          "type" : "string",
          "pattern" : "^arn:(aws[a-zA-Z-]*):secretsmanager:[a-z0-9-]+:[0-9]{12}:secret:[a-zA-Z0-9/_+=.@-]+$",
          "description" : " The ARN of the secret that you created in AWS Secrets Manager to store the encryption key. This parameter is required for static key encryption and is not valid for SPEKE encryption."
        },
        "Url" : {
          "type" : "string",
          "description" : "The URL from the API Gateway proxy that you set up to talk to your key server. This parameter is required for SPEKE encryption and is not valid for static key encryption."
        }
      },
      "additionalProperties" : false,
      "required" : [ "RoleArn" ]
    },
    "GatewayBridgeSource" : {
      "type" : "object",
      "description" : "The source configuration for cloud flows receiving a stream from a bridge.",
      "properties" : {
        "BridgeArn" : {
          "type" : "string",
          "pattern" : "^arn:(aws[a-zA-Z-]*):mediaconnect:[a-z0-9-]+:[0-9]{12}:bridge:[a-zA-Z0-9-]+:[a-zA-Z0-9_-]+$",
          "description" : "The ARN of the bridge feeding this flow."
        },
        "VpcInterfaceAttachment" : {
          "$ref" : "#/definitions/VpcInterfaceAttachment",
          "description" : "The name of the VPC interface attachment to use for this bridge source."
        }
      },
      "additionalProperties" : false,
      "required" : [ "BridgeArn" ]
    },
    "VpcInterfaceAttachment" : {
      "type" : "object",
      "description" : "The settings for attaching a VPC interface to an resource.",
      "properties" : {
        "VpcInterfaceName" : {
          "type" : "string",
          "description" : "The name of the VPC interface to use for this resource."
        }
      },
      "additionalProperties" : false
    },
    "Tag" : {
      "type" : "object",
      "properties" : {
        "Key" : {
          "type" : "string"
        },
        "Value" : {
          "type" : "string"
        }
      },
      "required" : [ "Key", "Value" ],
      "additionalProperties" : false
    }
  },
  "properties" : {
    "FlowArn" : {
      "type" : "string",
      "pattern" : "^arn:(aws[a-zA-Z-]*):mediaconnect:[a-z0-9-]+:[0-9]{12}:flow:[a-zA-Z0-9-]+:[a-zA-Z0-9_-]+$",
      "description" : "The ARN of the flow."
    },
    "SourceArn" : {
      "type" : "string",
      "pattern" : "^arn:(aws[a-zA-Z-]*):mediaconnect:[a-z0-9-]+:[0-9]{12}:source:[a-zA-Z0-9-]+:[a-zA-Z0-9_-]+$",
      "description" : "The ARN of the source."
    },
    "Decryption" : {
      "$ref" : "#/definitions/Encryption",
      "description" : "The type of encryption that is used on the content ingested from this source."
    },
    "EntitlementArn" : {
      "type" : "string",
      "pattern" : "^arn:(aws[a-zA-Z-]*):mediaconnect:[a-z0-9-]+:[0-9]{12}:entitlement:[a-zA-Z0-9-]+:[a-zA-Z0-9_-]+$",
      "description" : "The ARN of the entitlement that allows you to subscribe to content that comes from another AWS account. The entitlement is set by the content originator and the ARN is generated as part of the originator's flow."
    },
    "Description" : {
      "type" : "string",
      "description" : "A description for the source. This value is not used or seen outside of the current AWS Elemental MediaConnect account."
    },
    "GatewayBridgeSource" : {
      "$ref" : "#/definitions/GatewayBridgeSource",
      "description" : "The source configuration for cloud flows receiving a stream from a bridge."
    },
    "IngestIp" : {
      "type" : "string",
      "description" : "The IP address that the flow will be listening on for incoming content."
    },
    "IngestPort" : {
      "type" : "integer",
      "description" : "The port that the flow will be listening on for incoming content."
    },
    "MaxBitrate" : {
      "type" : "integer",
      "description" : "The smoothing max bitrate for RIST, RTP, and RTP-FEC streams."
    },
    "MaxLatency" : {
      "type" : "integer",
      "description" : "The maximum latency in milliseconds. This parameter applies only to RIST-based and Zixi-based streams."
    },
    "MinLatency" : {
      "type" : "integer",
      "description" : "The minimum latency in milliseconds."
    },
    "Name" : {
      "type" : "string",
      "description" : "The name of the source."
    },
    "Protocol" : {
      "type" : "string",
      "enum" : [ "zixi-push", "rtp-fec", "rtp", "rist", "srt-listener", "srt-caller" ],
      "description" : "The protocol that is used by the source."
    },
    "SenderIpAddress" : {
      "type" : "string",
      "description" : "The IP address that the flow communicates with to initiate connection with the sender for fujitsu-qos protocol."
    },
    "SenderControlPort" : {
      "type" : "integer",
      "description" : "The port that the flow uses to send outbound requests to initiate connection with the sender for fujitsu-qos protocol."
    },
    "StreamId" : {
      "type" : "string",
      "description" : "The stream ID that you want to use for this transport. This parameter applies only to Zixi-based streams."
    },
    "SourceIngestPort" : {
      "type" : "string",
      "description" : "The port that the flow will be listening on for incoming content.(ReadOnly)"
    },
    "SourceListenerAddress" : {
      "type" : "string",
      "description" : "Source IP or domain name for SRT-caller protocol."
    },
    "SourceListenerPort" : {
      "type" : "integer",
      "description" : "Source port for SRT-caller protocol."
    },
    "Tags" : {
      "type" : "array",
      "items" : {
        "$ref" : "#/definitions/Tag"
      },
      "description" : "Key-value pairs that can be used to tag and organize this flow source.",
      "insertionOrder" : false
    },
    "VpcInterfaceName" : {
      "type" : "string",
      "description" : "The name of the VPC Interface this Source is configured with."
    },
    "WhitelistCidr" : {
      "type" : "string",
      "description" : "The range of IP addresses that should be allowed to contribute content to your source. These IP addresses should be in the form of a Classless Inter-Domain Routing (CIDR) block; for example, 10.0.0.0/16."
    }
  },
  "additionalProperties" : false,
  "required" : [ "FlowArn", "Name", "Description" ],
  "readOnlyProperties" : [ "/properties/IngestIp", "/properties/SourceArn", "/properties/SourceIngestPort" ],
  "createOnlyProperties" : [ "/properties/FlowArn", "/properties/Name", "/properties/Protocol" ],
  "deprecatedProperties" : [ "/properties/EntitlementArn", "/properties/SenderIpAddress", "/properties/SenderControlPort", "/properties/Decryption/ResourceId", "/properties/Decryption/ConstantInitializationVector", "/properties/Decryption/DeviceId", "/properties/Decryption/Region", "/properties/Decryption/Url" ],
  "primaryIdentifier" : [ "/properties/SourceArn" ],
  "tagging" : {
    "taggable" : true,
    "tagOnCreate" : true,
    "tagUpdatable" : true,
    "cloudFormationSystemTags" : true,
    "tagProperty" : "/properties/Tags",
    "permissions" : [ "mediaconnect:TagResource", "mediaconnect:UntagResource", "mediaconnect:ListTagsForResource" ]
  },
  "handlers" : {
    "create" : {
      "permissions" : [ "mediaconnect:CreateFlow", "mediaconnect:DescribeFlow", "mediaconnect:AddFlowSources", "mediaconnect:TagResource", "mediaconnect:ListTagsForResource", "iam:PassRole" ]
    },
    "read" : {
      "permissions" : [ "mediaconnect:DescribeFlow", "mediaconnect:ListFlows", "mediaconnect:ListTagsForResource" ]
    },
    "update" : {
      "permissions" : [ "mediaconnect:DescribeFlow", "mediaconnect:UpdateFlowSource", "mediaconnect:TagResource", "mediaconnect:UntagResource", "mediaconnect:ListTagsForResource", "iam:PassRole" ]
    },
    "delete" : {
      "permissions" : [ "mediaconnect:DescribeFlow", "mediaconnect:ListFlows", "mediaconnect:RemoveFlowSource" ]
    },
    "list" : {
      "permissions" : [ "mediaconnect:DescribeFlow", "mediaconnect:ListFlows" ],
      "handlerSchema" : {
        "properties" : {
          "FlowArn" : {
            "$ref" : "resource-schema.json#/properties/FlowArn"
          }
        },
        "required" : [ "FlowArn" ]
      }
    }
  }
}