{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://catalog.lintel.tools/schemas/schemastore/serverless-framework-configuration/_shared/latest--aws-rum-appmonitor.json",
  "title": "AWSRUMAppMonitorProperties",
  "description": "Resource Type definition for AWS::RUM::AppMonitor. Source:- <https://github.com/aws-cloudformation/aws-cloudformation-rpdk.git>",
  "x-lintel": {
    "source": "https://raw.githubusercontent.com/lalcebo/json-schema/master/serverless/resources/cloudformation-modified/aws-rum-appmonitor.json",
    "sourceSha256": "05e73aea45b83d24f34229a5c97513140d8063ed1a6bd3298df54ba2af63fb05"
  },
  "type": "object",
  "properties": {
    "Name": {
      "oneOf": [
        {
          "type": "string",
          "pattern": "[\\.\\-_/#A-Za-z0-9]+",
          "minLength": 1,
          "maxLength": 255
        },
        {
          "$ref": "https://catalog.lintel.tools/schemas/schemastore/serverless-framework-configuration/_shared/latest--cf.functions.json#/Aws_CF_FunctionString"
        }
      ],
      "description": "A name for the app monitor"
    },
    "Domain": {
      "oneOf": [
        {
          "type": "string",
          "pattern": "^(localhost)|^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$|^(?![-.])([A-Za-z0-9-\\.\\-]{0,63})((?![-])([a-zA-Z0-9]{1}|^[a-zA-Z0-9]{0,1}))\\.(?![-])[A-Za-z-0-9]{1,63}((?![-])([a-zA-Z0-9]{1}|^[a-zA-Z0-9]{0,1}))|^(\\*\\.)(?![-.])([A-Za-z0-9-\\.\\-]{0,63})((?![-])([a-zA-Z0-9]{1}|^[a-zA-Z0-9]{0,1}))\\.(?![-])[A-Za-z-0-9]{1,63}((?![-])([a-zA-Z0-9]{1}|^[a-zA-Z0-9]{0,1}))",
          "minLength": 1,
          "maxLength": 253
        },
        {
          "$ref": "https://catalog.lintel.tools/schemas/schemastore/serverless-framework-configuration/_shared/latest--cf.functions.json#/Aws_CF_FunctionString"
        }
      ],
      "description": "The top-level internet domain name for which your application has administrative authority."
    },
    "CwLogEnabled": {
      "description": "Data collected by RUM is kept by RUM for 30 days and then deleted. This parameter specifies whether RUM sends a copy of this telemetry data to CWLlong in your account. This enables you to keep the telemetry data for more than 30 days, but it does incur CWLlong charges. If you omit this parameter, the default is false",
      "type": "boolean"
    },
    "Tags": {
      "$ref": "#/$defs/TagDef"
    },
    "AppMonitorConfiguration": {
      "$ref": "#/$defs/AppMonitorConfiguration"
    },
    "CustomEvents": {
      "$ref": "#/$defs/CustomEvents"
    }
  },
  "typeName": "AWS::RUM::AppMonitor",
  "taggable": true,
  "sourceUrl": "https://github.com/aws-cloudformation/aws-cloudformation-rpdk.git",
  "additionalProperties": false,
  "required": [
    "Name",
    "Domain"
  ],
  "$defs": {
    "AppMonitorConfiguration": {
      "description": "AppMonitor configuration",
      "type": "object",
      "title": "AWSRUMAppMonitorAppMonitorConfigurationDefinition",
      "properties": {
        "IdentityPoolId": {
          "oneOf": [
            {
              "minLength": 1,
              "maxLength": 55,
              "pattern": "[\\w-]+:[0-9a-f-]+",
              "type": "string"
            },
            {
              "$ref": "https://catalog.lintel.tools/schemas/schemastore/serverless-framework-configuration/_shared/latest--cf.functions.json#/Aws_CF_FunctionString"
            }
          ],
          "description": "The ID of the identity pool that is used to authorize the sending of data to RUM."
        },
        "ExcludedPages": {
          "description": "A list of URLs in your website or application to exclude from RUM data collection. You can't include both ExcludedPages and IncludedPages in the same operation.",
          "$ref": "#/$defs/Pages"
        },
        "IncludedPages": {
          "description": "If this app monitor is to collect data from only certain pages in your application, this structure lists those pages. You can't include both ExcludedPages and IncludedPages in the same operation.",
          "$ref": "#/$defs/Pages"
        },
        "FavoritePages": {
          "description": "A list of pages in the RUM console that are to be displayed with a favorite icon.",
          "$ref": "#/$defs/FavoritePages"
        },
        "SessionSampleRate": {
          "description": "Specifies the percentage of user sessions to use for RUM data collection. Choosing a higher percentage gives you more data but also incurs more costs. The number you specify is the percentage of user sessions that will be used. If you omit this parameter, the default of 10 is used.",
          "type": "number",
          "minimum": 0,
          "maximum": 1
        },
        "GuestRoleArn": {
          "description": "The ARN of the guest IAM role that is attached to the identity pool that is used to authorize the sending of data to RUM.",
          "$ref": "#/$defs/Arn"
        },
        "AllowCookies": {
          "description": "If you set this to true, the RUM web client sets two cookies, a session cookie and a user cookie. The cookies allow the RUM web client to collect data relating to the number of users an application has and the behavior of the application across a sequence of events. Cookies are stored in the top-level domain of the current page.",
          "type": "boolean"
        },
        "Telemetries": {
          "description": "An array that lists the types of telemetry data that this app monitor is to collect.",
          "type": "array",
          "items": {
            "$ref": "#/$defs/Telemetry"
          },
          "insertionOrder": false
        },
        "EnableXRay": {
          "description": "If you set this to true, RUM enables xray tracing for the user sessions that RUM samples. RUM adds an xray trace header to allowed HTTP requests. It also records an xray segment for allowed HTTP requests. You can see traces and segments from these user sessions in the xray console and the CW ServiceLens console.",
          "type": "boolean"
        },
        "MetricDestinations": {
          "description": "An array of structures which define the destinations and the metrics that you want to send.",
          "type": "array",
          "minItems": 0,
          "maxItems": 20,
          "uniqueItems": true,
          "insertionOrder": false,
          "items": {
            "$ref": "#/$defs/MetricDestination"
          }
        }
      },
      "additionalProperties": false
    },
    "TagDef": {
      "description": "Assigns one or more tags (key-value pairs) to the app monitor. Tags can help you organize and categorize your resources. You can also use them to scope user permissions by granting a user permission to access or change only resources with certain tag values. Tags don't have any semantic meaning to AWS and are interpreted strictly as strings of characters.You can associate as many as 50 tags with an app monitor.",
      "type": "array",
      "uniqueItems": true,
      "insertionOrder": false,
      "items": {
        "$ref": "#/$defs/Tag"
      },
      "title": "AWSRUMAppMonitorTagDefDefinition"
    },
    "Tag": {
      "description": "A key-value pair to associate with a resource.",
      "title": "AWSRUMAppMonitorTagDefinition",
      "type": "object",
      "properties": {
        "Key": {
          "oneOf": [
            {
              "type": "string",
              "pattern": "^(?!aws:)[a-zA-Z+-=._:/]+$",
              "minLength": 1,
              "maxLength": 128
            },
            {
              "$ref": "https://catalog.lintel.tools/schemas/schemastore/serverless-framework-configuration/_shared/latest--cf.functions.json#/Aws_CF_FunctionString"
            }
          ],
          "description": "The key name of the tag. You can specify a value that is 1 to 128 Unicode characters in length and cannot be prefixed with aws:. You can use any of the following characters: the set of Unicode letters, digits, whitespace, _, ., /, =, +, and -. "
        },
        "Value": {
          "oneOf": [
            {
              "type": "string",
              "minLength": 0,
              "maxLength": 256
            },
            {
              "$ref": "https://catalog.lintel.tools/schemas/schemastore/serverless-framework-configuration/_shared/latest--cf.functions.json#/Aws_CF_FunctionString"
            }
          ],
          "description": "The value for the tag. You can specify a value that is 0 to 256 Unicode characters in length and cannot be prefixed with aws:. You can use any of the following characters: the set of Unicode letters, digits, whitespace, _, ., /, =, +, and -. "
        }
      },
      "required": [
        "Value",
        "Key"
      ],
      "additionalProperties": false
    },
    "Pages": {
      "type": "array",
      "description": "List of url pages",
      "minItems": 0,
      "maxItems": 50,
      "items": {
        "$ref": "#/$defs/Url"
      },
      "insertionOrder": false,
      "title": "AWSRUMAppMonitorPagesDefinition"
    },
    "FavoritePages": {
      "type": "array",
      "description": "List of favorite pages",
      "minItems": 0,
      "maxItems": 50,
      "items": {
        "type": "string"
      },
      "insertionOrder": false,
      "title": "AWSRUMAppMonitorFavoritePagesDefinition"
    },
    "Url": {
      "oneOf": [
        {
          "type": "string",
          "pattern": "https?:\\/\\/(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{1,256}\\.[a-zA-Z0-9()]{1,6}\\b([-a-zA-Z0-9()@:%_\\+.~#?&//=]*)",
          "minLength": 1,
          "maxLength": 1260
        },
        {
          "$ref": "https://catalog.lintel.tools/schemas/schemastore/serverless-framework-configuration/_shared/latest--cf.functions.json#/Aws_CF_FunctionString"
        }
      ],
      "description": "Page Url",
      "title": "AWSRUMAppMonitorUrlDefinition"
    },
    "Arn": {
      "oneOf": [
        {
          "type": "string",
          "pattern": "arn:[^:]*:[^:]*:[^:]*:[^:]*:.*"
        },
        {
          "$ref": "https://catalog.lintel.tools/schemas/schemastore/serverless-framework-configuration/_shared/latest--cf.functions.json#/Aws_CF_FunctionString"
        }
      ],
      "description": "Resource ARN",
      "title": "AWSRUMAppMonitorArnDefinition"
    },
    "Telemetry": {
      "oneOf": [
        {
          "type": "string",
          "enum": [
            "errors",
            "performance",
            "http"
          ]
        },
        {
          "$ref": "https://catalog.lintel.tools/schemas/schemastore/serverless-framework-configuration/_shared/latest--cf.functions.json#/Aws_CF_FunctionString"
        }
      ],
      "title": "AWSRUMAppMonitorTelemetryDefinition"
    },
    "MetricDestination": {
      "description": "An structure which defines the destination and the metrics that you want to send.",
      "title": "AWSRUMAppMonitorMetricDestinationDefinition",
      "type": "object",
      "properties": {
        "Destination": {
          "oneOf": [
            {
              "type": "string",
              "enum": [
                "CloudWatch",
                "Evidently"
              ]
            },
            {
              "$ref": "https://catalog.lintel.tools/schemas/schemastore/serverless-framework-configuration/_shared/latest--cf.functions.json#/Aws_CF_FunctionString"
            }
          ],
          "description": "Defines the destination to send the metrics to. Valid values are CloudWatch and Evidently. If you specify Evidently, you must also specify the ARN of the Evidently experiment that is to be the destination and an IAM role that has permission to write to the experiment."
        },
        "DestinationArn": {
          "oneOf": [
            {
              "type": "string",
              "pattern": "arn:[^:]*:[^:]*:[^:]*:[^:]*:.*"
            },
            {
              "$ref": "https://catalog.lintel.tools/schemas/schemastore/serverless-framework-configuration/_shared/latest--cf.functions.json#/Aws_CF_FunctionString"
            }
          ],
          "description": "Use this parameter only if Destination is Evidently. This parameter specifies the ARN of the Evidently experiment that will receive the extended metrics."
        },
        "IamRoleArn": {
          "oneOf": [
            {
              "type": "string",
              "pattern": "arn:[^:]*:[^:]*:[^:]*:[^:]*:.*"
            },
            {
              "$ref": "https://catalog.lintel.tools/schemas/schemastore/serverless-framework-configuration/_shared/latest--cf.functions.json#/Aws_CF_FunctionString"
            }
          ],
          "description": "This parameter is required if Destination is Evidently. If Destination is CloudWatch, do not use this parameter.\n\nThis parameter specifies the ARN of an IAM role that RUM will assume to write to the Evidently experiment that you are sending metrics to. This role must have permission to write to that experiment."
        },
        "MetricDefinitions": {
          "description": "An array of structures which define the metrics that you want to send.",
          "type": "array",
          "uniqueItems": true,
          "insertionOrder": false,
          "minItems": 0,
          "maxItems": 2000,
          "items": {
            "$ref": "#/$defs/MetricDefinition"
          }
        }
      },
      "required": [
        "Destination"
      ],
      "additionalProperties": false
    },
    "MetricDefinition": {
      "description": "A single metric definition",
      "title": "AWSRUMAppMonitorMetricDefinition",
      "type": "object",
      "properties": {
        "Name": {
          "oneOf": [
            {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            },
            {
              "$ref": "https://catalog.lintel.tools/schemas/schemastore/serverless-framework-configuration/_shared/latest--cf.functions.json#/Aws_CF_FunctionString"
            }
          ],
          "description": "The name for the metric that is defined in this structure. For extended metrics, valid values are the following:\n\nPerformanceNavigationDuration\n\nPerformanceResourceDuration\n\nNavigationSatisfiedTransaction\n\nNavigationToleratedTransaction\n\nNavigationFrustratedTransaction\n\nWebVitalsCumulativeLayoutShift\n\nWebVitalsFirstInputDelay\n\nWebVitalsLargestContentfulPaint\n\nJsErrorCount\n\nHttpErrorCount\n\nSessionCount"
        },
        "Namespace": {
          "oneOf": [
            {
              "type": "string",
              "pattern": "[a-zA-Z0-9-._/#:]+$",
              "minLength": 1,
              "maxLength": 237
            },
            {
              "$ref": "https://catalog.lintel.tools/schemas/schemastore/serverless-framework-configuration/_shared/latest--cf.functions.json#/Aws_CF_FunctionString"
            }
          ],
          "description": "The namespace used by CloudWatch Metrics for the metric that is defined in this structure"
        },
        "ValueKey": {
          "oneOf": [
            {
              "type": "string",
              "pattern": ".*",
              "minLength": 1,
              "maxLength": 256
            },
            {
              "$ref": "https://catalog.lintel.tools/schemas/schemastore/serverless-framework-configuration/_shared/latest--cf.functions.json#/Aws_CF_FunctionString"
            }
          ],
          "description": "The field within the event object that the metric value is sourced from.\n\nIf you omit this field, a hardcoded value of 1 is pushed as the metric value. This is useful if you just want to count the number of events that the filter catches.\n\nIf this metric is sent to Evidently, this field will be passed to Evidently raw and Evidently will handle data extraction from the event."
        },
        "UnitLabel": {
          "oneOf": [
            {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            },
            {
              "$ref": "https://catalog.lintel.tools/schemas/schemastore/serverless-framework-configuration/_shared/latest--cf.functions.json#/Aws_CF_FunctionString"
            }
          ],
          "description": "The CloudWatch metric unit to use for this metric. If you omit this field, the metric is recorded with no unit."
        },
        "DimensionKeys": {
          "description": "Use this field only if you are sending the metric to CloudWatch.\n\nThis field is a map of field paths to dimension names. It defines the dimensions to associate with this metric in CloudWatch. For extended metrics, valid values for the entries in this field are the following:\n\n\"metadata.pageId\": \"PageId\"\n\n\"metadata.browserName\": \"BrowserName\"\n\n\"metadata.deviceType\": \"DeviceType\"\n\n\"metadata.osName\": \"OSName\"\n\n\"metadata.countryCode\": \"CountryCode\"\n\n\"event_details.fileType\": \"FileType\"\n\nAll dimensions listed in this field must also be included in EventPattern.",
          "type": "object",
          "additionalProperties": false,
          "patternProperties": {
            "^(?!:).*[^\\s].*": {
              "type": "string",
              "pattern": ".*[^\\s].*",
              "minLength": 1,
              "maxLength": 255
            }
          }
        },
        "EventPattern": {
          "oneOf": [
            {
              "type": "string",
              "minLength": 1,
              "maxLength": 4000
            },
            {
              "$ref": "https://catalog.lintel.tools/schemas/schemastore/serverless-framework-configuration/_shared/latest--cf.functions.json#/Aws_CF_FunctionString"
            }
          ],
          "description": "The pattern that defines the metric, specified as a JSON object. RUM checks events that happen in a user's session against the pattern, and events that match the pattern are sent to the metric destination.\n\nWhen you define extended metrics, the metric definition is not valid if EventPattern is omitted.\n\nExample event patterns:\n\n'{ \"event_type\": [\"com.amazon.rum.js_error_event\"], \"metadata\": { \"browserName\": [ \"Chrome\", \"Safari\" ], } }'\n\n'{ \"event_type\": [\"com.amazon.rum.performance_navigation_event\"], \"metadata\": { \"browserName\": [ \"Chrome\", \"Firefox\" ] }, \"event_details\": { \"duration\": [{ \"numeric\": [ \"<\", 2000 ] }] } }'\n\n'{ \"event_type\": [\"com.amazon.rum.performance_navigation_event\"], \"metadata\": { \"browserName\": [ \"Chrome\", \"Safari\" ], \"countryCode\": [ \"US\" ] }, \"event_details\": { \"duration\": [{ \"numeric\": [ \">=\", 2000, \"<\", 8000 ] }] } }'\n\nIf the metrics destination' is CloudWatch and the event also matches a value in DimensionKeys, then the metric is published with the specified dimensions."
        }
      },
      "required": [
        "Name"
      ],
      "additionalProperties": false
    },
    "CustomEventsStatus": {
      "oneOf": [
        {
          "type": "string",
          "enum": [
            "ENABLED",
            "DISABLED"
          ]
        },
        {
          "$ref": "https://catalog.lintel.tools/schemas/schemastore/serverless-framework-configuration/_shared/latest--cf.functions.json#/Aws_CF_FunctionString"
        }
      ],
      "title": "AWSRUMAppMonitorCustomEventsStatusDefinition"
    },
    "CustomEvents": {
      "description": "AppMonitor custom events configuration",
      "type": "object",
      "title": "AWSRUMAppMonitorCustomEventsDefinition",
      "properties": {
        "Status": {
          "description": "Indicates whether AppMonitor accepts custom events.",
          "$ref": "#/$defs/CustomEventsStatus"
        }
      },
      "additionalProperties": false
    }
  },
  "createOnlyProperties": [
    "/properties/Name"
  ],
  "readOnlyProperties": [
    "/properties/Id"
  ],
  "primaryIdentifier": [
    "/properties/Name"
  ],
  "additionalIdentifiers": [
    [
      "/properties/Id"
    ]
  ]
}
