{
  "name": "Panorays_ConnectorDefinition",
  "apiVersion": "2023-04-01-preview",
  "type": "Microsoft.SecurityInsights/dataConnectorDefinitions",
  "kind": "Customizable",
  "properties": {
    "connectorUiConfig": {
      "id": "Panorays_ConnectorDefinition",
      "title": "Panorays",
      "publisher": "Panorays",
      "descriptionMarkdown": "The Panorays data connector allows ingesting company findings from the Panorays API into Microsoft Sentinel.",
      "graphQueriesTableName": "PanoraysCompanyFindingPOC_CL",
      "graphQueries": [
        {
          "metricName": "Total findings found",
          "legend": "Company Findings",
          "baseQuery": "PanoraysCompanyFindingPOC_CL"
        }
      ],
      "sampleQueries": [
        {
          "description": "Get Sample of Panorays Company Findings",
          "query": "PanoraysCompanyFindingPOC_CL | take 10"
        }
      ],
      "dataTypes": [
        {
          "name": "PanoraysCompanyFindingPOC_CL",
          "lastDataReceivedQuery": "PanoraysCompanyFindingPOC_CL | summarize Time = max(TimeGenerated) | where isnotempty(Time)"
        }
      ],
      "connectivityCriteria": [
        {
          "type": "HasDataConnectors"
        }
      ],
      "availability": {
        "status": 1,
        "isPreview": false
      },
      "permissions": {
        "resourceProvider": [
          {
            "provider": "Microsoft.OperationalInsights/workspaces",
            "permissionsDisplayText": "Read and Write permissions on the Log Analytics workspace are required. A valid Panorays API Token and API Base URL are required for data ingestion.",
            "ProviderDisplayName": "Log Analytics Workspace",
            "scope": "Workspace",
            "requiredPermissions": {
              "read": true,
              "write": true,
              "delete": true,
              "action": false             
            }
          }
        ]
      },
      "instructionSteps": [
        {
          "instructions": [
            {
              "type": "Markdown",
              "parameters": {
                "content": "#### Configuration steps for the Panorays API"
              }
            },
            {
              "type": "Textbox",
              "parameters": {
                "label": "API Token",
                "placeholder": "API Token",
                "type": "securestring",
                "name": "apitoken",
                "toolTip": "The API Token provided by Panorays to authenticate the connector.",
                "validations": 
                  {
                    "required": true,
                    "regex": "^.{1,1000}$",
                    "message": "The API Token is required."
                  }                
              }
            },
            {
              "type": "Textbox",
               "parameters": {
                "name": "panoraysAPIBaseUrl",
                "type": "text",
                "label": "Panorays API Base URL",
                "toolTip": "The base URL for the Panorays API.",
                "placeholder": "https://api.panoraysapp.com",
                "validations": 
                  {
                    "required": true,
                    "regex": "r'^https://.{1,500}$",
                    "validationMessage": "Please enter a valid URL starting with https://"
                }
              
              }
            },
             {
                            "type": "ConnectionToggleButton",
                            "parameters": {
                                "connectLabel": "Connect",
                                "disconnectLabel": "Disconnect",
                                "name": "connectionToggle"
                            }
                        }
          ]
        }
      ]
    }
  }
}