{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/azure-networking-services/json-schema/azure-networking-services-flow-log-schema.json",
  "title": "FlowLog",
  "description": "A flow log resource.",
  "x-generated": "2026-11-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/azure-networking-services-flowlogs-api-openapi.yml#/components/schemas/FlowLog",
  "type": "object",
  "properties": {
    "properties": {
      "$ref": "#/$defs/FlowLogPropertiesFormat",
      "description": "Properties of the flow log.",
      "x-ms-client-flatten": true
    },
    "etag": {
      "type": "string",
      "description": "A unique read-only string that changes whenever the resource is updated.",
      "readOnly": true
    },
    "identity": {
      "$ref": "#/$defs/ManagedServiceIdentity",
      "description": "FlowLog resource Managed Identity"
    }
  },
  "allOf": [
    {
      "$ref": "#/$defs/Resource"
    }
  ],
  "$defs": {
    "FlowLogFormatParameters": {
      "type": "object",
      "description": "Parameters that define the flow log format.",
      "properties": {
        "type": {
          "$ref": "#/$defs/FlowLogFormatType",
          "description": "The file type of flow log."
        },
        "version": {
          "type": "integer",
          "format": "int32",
          "description": "The version (revision) of the flow log.",
          "default": 0
        }
      }
    },
    "FlowLogFormatType": {
      "type": "string",
      "description": "The file type of flow log.",
      "enum": [
        "JSON"
      ],
      "x-ms-enum": {
        "name": "FlowLogFormatType",
        "modelAsString": true,
        "values": [
          {
            "name": "JSON",
            "value": "JSON",
            "description": "JSON"
          }
        ]
      }
    },
    "FlowLogPropertiesFormat": {
      "type": "object",
      "description": "Parameters that define the configuration of flow log.",
      "properties": {
        "targetResourceId": {
          "type": "string",
          "description": "ID of network security group to which flow log will be applied."
        },
        "targetResourceGuid": {
          "type": "string",
          "description": "Guid of network security group to which flow log will be applied.",
          "readOnly": true
        },
        "storageId": {
          "type": "string",
          "description": "ID of the storage account which is used to store the flow log."
        },
        "enabledFilteringCriteria": {
          "type": "string",
          "description": "Optional field to filter network traffic logs based on SrcIP, SrcPort, DstIP, DstPort, Protocol, Encryption, Direction and Action. If not specified, all network traffic will be logged."
        },
        "recordTypes": {
          "type": "string",
          "description": "Optional field to filter network traffic logs based on flow states. Value of this field could be any comma separated combination string of letters B,C,E or D. B represents Begin, when a flow is created. C represents Continue for an ongoing flow generated at every five-minute interval. E represents End, when a flow is terminated. D represents Deny, when a flow is denied. If not specified, all network traffic will be logged."
        },
        "enabled": {
          "type": "boolean",
          "description": "Flag to enable/disable flow logging."
        },
        "retentionPolicy": {
          "$ref": "#/$defs/RetentionPolicyParameters",
          "description": "Parameters that define the retention policy for flow log."
        },
        "format": {
          "$ref": "#/$defs/FlowLogFormatParameters",
          "description": "Parameters that define the flow log format."
        },
        "flowAnalyticsConfiguration": {
          "$ref": "#/$defs/TrafficAnalyticsProperties",
          "description": "Parameters that define the configuration of traffic analytics."
        },
        "provisioningState": {
          "$ref": "#/$defs/ProvisioningState",
          "description": "The provisioning state of the flow log.",
          "readOnly": true
        }
      },
      "required": [
        "targetResourceId",
        "storageId"
      ]
    },
    "ManagedServiceIdentity": {
      "type": "object",
      "description": "Identity for the resource.",
      "properties": {
        "principalId": {
          "type": "string",
          "description": "The principal id of the system assigned identity. This property will only be provided for a system assigned identity.",
          "readOnly": true
        },
        "tenantId": {
          "type": "string",
          "description": "The tenant id of the system assigned identity. This property will only be provided for a system assigned identity.",
          "readOnly": true
        },
        "type": {
          "$ref": "#/$defs/ResourceIdentityType",
          "description": "The type of identity used for the resource. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove any identities from the virtual machine."
        },
        "userAssignedIdentities": {
          "type": "object",
          "description": "The list of user identities associated with resource. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.",
          "additionalProperties": {
            "$ref": "#/$defs/ManagedServiceIdentityUserAssignedIdentities"
          }
        }
      }
    },
    "ManagedServiceIdentityUserAssignedIdentities": {
      "type": "object",
      "description": "Referenced by this document but never defined in it. API Evangelist added this empty placeholder so the document resolves; the shape is unknown and is NOT a claim about the API.",
      "x-ae-placeholder": true
    },
    "ProvisioningState": {
      "type": "string",
      "description": "Provisioning states of a resource.",
      "enum": [
        "Failed",
        "Succeeded",
        "Canceled",
        "Creating",
        "Updating",
        "Deleting"
      ],
      "x-ms-enum": {
        "name": "ProvisioningState",
        "modelAsString": true,
        "values": [
          {
            "name": "Failed",
            "value": "Failed",
            "description": "Failed"
          },
          {
            "name": "Succeeded",
            "value": "Succeeded",
            "description": "Succeeded"
          },
          {
            "name": "Canceled",
            "value": "Canceled",
            "description": "Canceled"
          },
          {
            "name": "Creating",
            "value": "Creating",
            "description": "Creating"
          },
          {
            "name": "Updating",
            "value": "Updating",
            "description": "Updating"
          },
          {
            "name": "Deleting",
            "value": "Deleting",
            "description": "Deleting"
          }
        ]
      }
    },
    "Resource": {
      "type": "object",
      "description": "Common resource representation.",
      "properties": {
        "id": {
          "type": "string",
          "description": "Resource ID."
        },
        "name": {
          "type": "string",
          "description": "Resource name.",
          "readOnly": true
        },
        "type": {
          "type": "string",
          "description": "Resource type.",
          "readOnly": true
        },
        "location": {
          "type": "string",
          "description": "Resource location."
        },
        "tags": {
          "type": "object",
          "description": "Resource tags.",
          "additionalProperties": {
            "type": "string"
          }
        }
      },
      "x-ms-azure-resource": true
    },
    "ResourceIdentityType": {
      "type": "object",
      "description": "Referenced by this document but never defined in it. API Evangelist added this empty placeholder so the document resolves; the shape is unknown and is NOT a claim about the API.",
      "x-ae-placeholder": true
    },
    "RetentionPolicyParameters": {
      "type": "object",
      "description": "Parameters that define the retention policy for flow log.",
      "properties": {
        "days": {
          "type": "integer",
          "format": "int32",
          "description": "Number of days to retain flow log records.",
          "default": 0
        },
        "enabled": {
          "type": "boolean",
          "description": "Flag to enable/disable retention.",
          "default": false
        }
      }
    },
    "TrafficAnalyticsConfigurationProperties": {
      "type": "object",
      "description": "Parameters that define the configuration of traffic analytics.",
      "properties": {
        "enabled": {
          "type": "boolean",
          "description": "Flag to enable/disable traffic analytics."
        },
        "workspaceId": {
          "type": "string",
          "description": "The resource guid of the attached workspace."
        },
        "workspaceRegion": {
          "type": "string",
          "description": "The location of the attached workspace."
        },
        "workspaceResourceId": {
          "type": "string",
          "description": "Resource Id of the attached workspace."
        },
        "trafficAnalyticsInterval": {
          "type": "integer",
          "format": "int32",
          "description": "The interval in minutes which would decide how frequently TA service should do flow analytics."
        }
      }
    },
    "TrafficAnalyticsProperties": {
      "type": "object",
      "description": "Parameters that define the configuration of traffic analytics.",
      "properties": {
        "networkWatcherFlowAnalyticsConfiguration": {
          "$ref": "#/$defs/TrafficAnalyticsConfigurationProperties",
          "description": "Parameters that define the configuration of traffic analytics."
        }
      }
    }
  }
}