{
  "typeName" : "AWS::Logs::SubscriptionFilter",
  "$schema" : "https://raw.githubusercontent.com/aws-cloudformation/cloudformation-cli/master/src/rpdk/core/data/schema/provider.definition.schema.v1.json",
  "description" : "The ``AWS::Logs::SubscriptionFilter`` resource specifies a subscription filter and associates it with the specified log group. Subscription filters allow you to subscribe to a real-time stream of log events and have them delivered to a specific destination. Currently, the supported destinations are:\n  +  An Amazon Kinesis data stream belonging to the same account as the subscription filter, for same-account delivery.\n  +  A logical destination that belongs to a different account, for cross-account delivery.\n  +  An Amazon Kinesis Firehose delivery stream that belongs to the same account as the subscription filter, for same-account delivery.\n  +  An LAMlong function that belongs to the same account as the subscription filter, for same-account delivery.\n  \n There can be as many as two subscription filters associated with a log group.",
  "sourceUrl" : "https://github.com/aws-cloudformation/aws-cloudformation-resource-providers-logs",
  "tagging" : {
    "taggable" : false,
    "tagOnCreate" : false,
    "tagUpdatable" : false,
    "cloudFormationSystemTags" : false
  },
  "replacementStrategy" : "delete_then_create",
  "properties" : {
    "FilterName" : {
      "description" : "The name of the subscription filter.",
      "type" : "string"
    },
    "DestinationArn" : {
      "description" : "The Amazon Resource Name (ARN) of the destination.",
      "type" : "string"
    },
    "FilterPattern" : {
      "description" : "The filtering expressions that restrict what gets delivered to the destination AWS resource. For more information about the filter pattern syntax, see [Filter and Pattern Syntax](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html).",
      "type" : "string"
    },
    "LogGroupName" : {
      "description" : "The log group to associate with the subscription filter. All log events that are uploaded to this log group are filtered and delivered to the specified AWS resource if the filter pattern matches the log events.",
      "type" : "string"
    },
    "RoleArn" : {
      "description" : "The ARN of an IAM role that grants CWL permissions to deliver ingested log events to the destination stream. You don't need to provide the ARN when you are working with a logical destination for cross-account delivery.",
      "type" : "string"
    },
    "Distribution" : {
      "description" : "The method used to distribute log data to the destination, which can be either random or grouped by log stream.",
      "type" : "string",
      "enum" : [ "Random", "ByLogStream" ]
    },
    "ApplyOnTransformedLogs" : {
      "description" : "This parameter is valid only for log groups that have an active log transformer. For more information about log transformers, see [PutTransformer](https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutTransformer.html).\n If this value is ``true``, the subscription filter is applied on the transformed version of the log events instead of the original ingested log events.",
      "type" : "boolean"
    },
    "FieldSelectionCriteria" : {
      "description" : "The filter expression that specifies which log events are processed by this subscription filter based on system fields. Returns the ``fieldSelectionCriteria`` value if it was specified when the subscription filter was created.",
      "type" : "string",
      "minLength" : 0,
      "maxLength" : 2000
    },
    "EmitSystemFields" : {
      "description" : "The list of system fields that are included in the log events sent to the subscription destination. Returns the ``emitSystemFields`` value if it was specified when the subscription filter was created.",
      "type" : "array",
      "insertionOrder" : false,
      "items" : {
        "type" : "string"
      }
    }
  },
  "handlers" : {
    "create" : {
      "permissions" : [ "iam:PassRole", "logs:PutSubscriptionFilter", "logs:DescribeSubscriptionFilters" ]
    },
    "read" : {
      "permissions" : [ "logs:DescribeSubscriptionFilters" ]
    },
    "update" : {
      "permissions" : [ "iam:PassRole", "logs:PutSubscriptionFilter", "logs:DescribeSubscriptionFilters" ]
    },
    "delete" : {
      "permissions" : [ "logs:DeleteSubscriptionFilter" ]
    },
    "list" : {
      "permissions" : [ "logs:DescribeSubscriptionFilters" ],
      "handlerSchema" : {
        "properties" : {
          "LogGroupName" : {
            "$ref" : "resource-schema.json#/properties/LogGroupName"
          }
        },
        "required" : [ "LogGroupName" ]
      }
    }
  },
  "required" : [ "DestinationArn", "FilterPattern", "LogGroupName" ],
  "createOnlyProperties" : [ "/properties/FilterName", "/properties/LogGroupName" ],
  "primaryIdentifier" : [ "/properties/FilterName", "/properties/LogGroupName" ],
  "additionalProperties" : false
}