{
  "typeName" : "AWS::MediaConnect::FlowEntitlement",
  "description" : "Resource schema for AWS::MediaConnect::FlowEntitlement",
  "sourceUrl" : "https://github.com/aws-cloudformation/aws-cloudformation-resource-providers-mediaconnect.git",
  "definitions" : {
    "Tag" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "Key" : {
          "type" : "string"
        },
        "Value" : {
          "type" : "string"
        }
      },
      "required" : [ "Key", "Value" ]
    },
    "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" ],
          "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" : [ "Algorithm", "RoleArn" ]
    }
  },
  "properties" : {
    "FlowArn" : {
      "type" : "string",
      "description" : "The ARN of the flow."
    },
    "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."
    },
    "DataTransferSubscriberFeePercent" : {
      "type" : "integer",
      "default" : 0,
      "description" : "Percentage from 0-100 of the data transfer cost to be billed to the subscriber."
    },
    "Description" : {
      "type" : "string",
      "description" : "A description of the entitlement."
    },
    "Encryption" : {
      "$ref" : "#/definitions/Encryption",
      "description" : "The type of encryption that will be used on the output that is associated with this entitlement."
    },
    "EntitlementStatus" : {
      "type" : "string",
      "description" : " An indication of whether the entitlement is enabled.",
      "enum" : [ "ENABLED", "DISABLED" ]
    },
    "Name" : {
      "type" : "string",
      "description" : "The name of the entitlement."
    },
    "Subscribers" : {
      "type" : "array",
      "description" : "The AWS account IDs that you want to share your content with. The receiving accounts (subscribers) will be allowed to create their own flow using your content as the source.",
      "items" : {
        "type" : "string"
      }
    },
    "Tags" : {
      "type" : "array",
      "description" : "Key-value pairs that can be used to tag and organize this flow entitlement.",
      "uniqueItems" : true,
      "insertionOrder" : false,
      "items" : {
        "$ref" : "#/definitions/Tag"
      }
    }
  },
  "additionalProperties" : false,
  "required" : [ "FlowArn", "Name", "Subscribers", "Description" ],
  "createOnlyProperties" : [ "/properties/FlowArn", "/properties/DataTransferSubscriberFeePercent", "/properties/Name" ],
  "readOnlyProperties" : [ "/properties/EntitlementArn" ],
  "primaryIdentifier" : [ "/properties/EntitlementArn" ],
  "deprecatedProperties" : [ "/properties/Encryption/ResourceId", "/properties/Encryption/ConstantInitializationVector", "/properties/Encryption/DeviceId", "/properties/Encryption/Region", "/properties/Encryption/Url" ],
  "tagging" : {
    "taggable" : true,
    "tagOnCreate" : true,
    "tagUpdatable" : true,
    "cloudFormationSystemTags" : true,
    "tagProperty" : "/properties/Tags",
    "permissions" : [ "mediaconnect:TagResource", "mediaconnect:UntagResource", "mediaconnect:ListTagsForResource" ]
  },
  "handlers" : {
    "create" : {
      "permissions" : [ "iam:PassRole", "mediaconnect:GrantFlowEntitlements", "mediaconnect:DescribeFlow", "mediaconnect:TagResource", "mediaconnect:ListTagsForResource" ]
    },
    "read" : {
      "permissions" : [ "mediaconnect:DescribeFlow", "mediaconnect:ListFlows", "mediaconnect:ListTagsForResource" ]
    },
    "update" : {
      "permissions" : [ "iam:PassRole", "mediaconnect:DescribeFlow", "mediaconnect:UpdateFlowEntitlement", "mediaconnect:TagResource", "mediaconnect:UntagResource", "mediaconnect:ListTagsForResource" ]
    },
    "delete" : {
      "permissions" : [ "mediaconnect:DescribeFlow", "mediaconnect:ListFlows", "mediaconnect:RevokeFlowEntitlement" ]
    },
    "list" : {
      "permissions" : [ "mediaconnect:DescribeFlow", "mediaconnect:ListFlows" ],
      "handlerSchema" : {
        "properties" : {
          "FlowArn" : {
            "$ref" : "resource-schema.json#/properties/FlowArn"
          }
        },
        "required" : [ "FlowArn" ]
      }
    }
  }
}