# PCAPs ## List packet capture requests `magic_transit.pcaps.list(PCAPListParams**kwargs) -> SyncSinglePage[PCAPListResponse]` **get** `/accounts/{account_id}/pcaps` Lists all packet capture requests for an account. ### Parameters - `account_id: str` Identifier. ### Returns - `PCAPListResponse` - `class PCAP: …` - `id: Optional[str]` The ID for the packet capture. - `filter_v1: Optional[PCAPFilter]` The packet capture filter. When this field is empty, all packets are captured. - `destination_address: Optional[str]` The destination IP address of the packet. - `destination_port: Optional[float]` The destination port of the packet. - `protocol: Optional[float]` The protocol number of the packet. - `source_address: Optional[str]` The source IP address of the packet. - `source_port: Optional[float]` The source port of the packet. - `offset_time: Optional[datetime]` The RFC 3339 offset timestamp from which to query backwards for packets. Must be within the last 24h. When this field is empty, defaults to time of request. - `status: Optional[Literal["unknown", "success", "pending", 5 more]]` The status of the packet capture request. - `"unknown"` - `"success"` - `"pending"` - `"running"` - `"conversion_pending"` - `"conversion_running"` - `"complete"` - `"failed"` - `submitted: Optional[str]` The RFC 3339 timestamp when the packet capture was created. - `system: Optional[Literal["magic-transit"]]` The system used to collect packet captures. - `"magic-transit"` - `time_limit: Optional[float]` The packet capture duration in seconds. - `type: Optional[Literal["simple", "full"]]` The type of packet capture. `Simple` captures sampled packets, and `full` captures entire payloads and non-sampled packets. - `"simple"` - `"full"` - `class MagicVisibilityPCAPsPCAPsResponseFull: …` - `id: Optional[str]` The ID for the packet capture. - `byte_limit: Optional[float]` The maximum number of bytes to capture. This field only applies to `full` packet captures. - `colo_name: Optional[str]` The name of the data center used for the packet capture. This can be a specific colo (ord02) or a multi-colo name (ORD). This field only applies to `full` packet captures. - `destination_conf: Optional[str]` The full URI for the bucket. This field only applies to `full` packet captures. - `error_message: Optional[str]` An error message that describes why the packet capture failed. This field only applies to `full` packet captures. - `filter_v1: Optional[PCAPFilter]` The packet capture filter. When this field is empty, all packets are captured. - `packets_captured: Optional[int]` The number of packets captured. - `status: Optional[Literal["unknown", "success", "pending", 5 more]]` The status of the packet capture request. - `"unknown"` - `"success"` - `"pending"` - `"running"` - `"conversion_pending"` - `"conversion_running"` - `"complete"` - `"failed"` - `stop_requested: Optional[datetime]` The RFC 3339 timestamp when stopping the packet capture was requested. This field only applies to `full` packet captures. - `submitted: Optional[str]` The RFC 3339 timestamp when the packet capture was created. - `system: Optional[Literal["magic-transit"]]` The system used to collect packet captures. - `"magic-transit"` - `time_limit: Optional[float]` The packet capture duration in seconds. - `type: Optional[Literal["simple", "full"]]` The type of packet capture. `Simple` captures sampled packets, and `full` captures entire payloads and non-sampled packets. - `"simple"` - `"full"` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) page = client.magic_transit.pcaps.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) page = page.result[0] print(page) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": [ { "id": "66802ca5668e47a2b82c2e6746e45037", "filter_v1": { "destination_address": "1.2.3.4", "destination_port": 80, "protocol": 6, "source_address": "1.2.3.4", "source_port": 123 }, "offset_time": "2020-01-01T08:00:00Z", "status": "success", "submitted": "2020-01-01T08:00:00Z", "system": "magic-transit", "time_limit": 300, "type": "simple" } ], "success": true, "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000 } } ``` ## Get PCAP request `magic_transit.pcaps.get(strpcap_id, PCAPGetParams**kwargs) -> PCAPGetResponse` **get** `/accounts/{account_id}/pcaps/{pcap_id}` Get information for a PCAP request by id. ### Parameters - `account_id: str` Identifier. - `pcap_id: str` Identifier. ### Returns - `PCAPGetResponse` - `class PCAP: …` - `id: Optional[str]` The ID for the packet capture. - `filter_v1: Optional[PCAPFilter]` The packet capture filter. When this field is empty, all packets are captured. - `destination_address: Optional[str]` The destination IP address of the packet. - `destination_port: Optional[float]` The destination port of the packet. - `protocol: Optional[float]` The protocol number of the packet. - `source_address: Optional[str]` The source IP address of the packet. - `source_port: Optional[float]` The source port of the packet. - `offset_time: Optional[datetime]` The RFC 3339 offset timestamp from which to query backwards for packets. Must be within the last 24h. When this field is empty, defaults to time of request. - `status: Optional[Literal["unknown", "success", "pending", 5 more]]` The status of the packet capture request. - `"unknown"` - `"success"` - `"pending"` - `"running"` - `"conversion_pending"` - `"conversion_running"` - `"complete"` - `"failed"` - `submitted: Optional[str]` The RFC 3339 timestamp when the packet capture was created. - `system: Optional[Literal["magic-transit"]]` The system used to collect packet captures. - `"magic-transit"` - `time_limit: Optional[float]` The packet capture duration in seconds. - `type: Optional[Literal["simple", "full"]]` The type of packet capture. `Simple` captures sampled packets, and `full` captures entire payloads and non-sampled packets. - `"simple"` - `"full"` - `class MagicVisibilityPCAPsPCAPsResponseFull: …` - `id: Optional[str]` The ID for the packet capture. - `byte_limit: Optional[float]` The maximum number of bytes to capture. This field only applies to `full` packet captures. - `colo_name: Optional[str]` The name of the data center used for the packet capture. This can be a specific colo (ord02) or a multi-colo name (ORD). This field only applies to `full` packet captures. - `destination_conf: Optional[str]` The full URI for the bucket. This field only applies to `full` packet captures. - `error_message: Optional[str]` An error message that describes why the packet capture failed. This field only applies to `full` packet captures. - `filter_v1: Optional[PCAPFilter]` The packet capture filter. When this field is empty, all packets are captured. - `packets_captured: Optional[int]` The number of packets captured. - `status: Optional[Literal["unknown", "success", "pending", 5 more]]` The status of the packet capture request. - `"unknown"` - `"success"` - `"pending"` - `"running"` - `"conversion_pending"` - `"conversion_running"` - `"complete"` - `"failed"` - `stop_requested: Optional[datetime]` The RFC 3339 timestamp when stopping the packet capture was requested. This field only applies to `full` packet captures. - `submitted: Optional[str]` The RFC 3339 timestamp when the packet capture was created. - `system: Optional[Literal["magic-transit"]]` The system used to collect packet captures. - `"magic-transit"` - `time_limit: Optional[float]` The packet capture duration in seconds. - `type: Optional[Literal["simple", "full"]]` The type of packet capture. `Simple` captures sampled packets, and `full` captures entire payloads and non-sampled packets. - `"simple"` - `"full"` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) pcap = client.magic_transit.pcaps.get( pcap_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(pcap) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "id": "66802ca5668e47a2b82c2e6746e45037", "filter_v1": { "destination_address": "1.2.3.4", "destination_port": 80, "protocol": 6, "source_address": "1.2.3.4", "source_port": 123 }, "offset_time": "2020-01-01T08:00:00Z", "status": "success", "submitted": "2020-01-01T08:00:00Z", "system": "magic-transit", "time_limit": 300, "type": "simple" }, "success": true } ``` ## Create PCAP request `magic_transit.pcaps.create(PCAPCreateParams**kwargs) -> PCAPCreateResponse` **post** `/accounts/{account_id}/pcaps` Create new PCAP request for account. ### Parameters - `account_id: str` Identifier. - `packet_limit: float` The limit of packets contained in a packet capture. - `system: Literal["magic-transit"]` The system used to collect packet captures. - `"magic-transit"` - `time_limit: float` The packet capture duration in seconds. - `type: Literal["simple", "full"]` The type of packet capture. `Simple` captures sampled packets, and `full` captures entire payloads and non-sampled packets. - `"simple"` - `"full"` - `filter_v1: Optional[PCAPFilterParam]` The packet capture filter. When this field is empty, all packets are captured. - `destination_address: Optional[str]` The destination IP address of the packet. - `destination_port: Optional[float]` The destination port of the packet. - `protocol: Optional[float]` The protocol number of the packet. - `source_address: Optional[str]` The source IP address of the packet. - `source_port: Optional[float]` The source port of the packet. - `offset_time: Optional[Union[str, datetime]]` The RFC 3339 offset timestamp from which to query backwards for packets. Must be within the last 24h. When this field is empty, defaults to time of request. ### Returns - `PCAPCreateResponse` - `class PCAP: …` - `id: Optional[str]` The ID for the packet capture. - `filter_v1: Optional[PCAPFilter]` The packet capture filter. When this field is empty, all packets are captured. - `destination_address: Optional[str]` The destination IP address of the packet. - `destination_port: Optional[float]` The destination port of the packet. - `protocol: Optional[float]` The protocol number of the packet. - `source_address: Optional[str]` The source IP address of the packet. - `source_port: Optional[float]` The source port of the packet. - `offset_time: Optional[datetime]` The RFC 3339 offset timestamp from which to query backwards for packets. Must be within the last 24h. When this field is empty, defaults to time of request. - `status: Optional[Literal["unknown", "success", "pending", 5 more]]` The status of the packet capture request. - `"unknown"` - `"success"` - `"pending"` - `"running"` - `"conversion_pending"` - `"conversion_running"` - `"complete"` - `"failed"` - `submitted: Optional[str]` The RFC 3339 timestamp when the packet capture was created. - `system: Optional[Literal["magic-transit"]]` The system used to collect packet captures. - `"magic-transit"` - `time_limit: Optional[float]` The packet capture duration in seconds. - `type: Optional[Literal["simple", "full"]]` The type of packet capture. `Simple` captures sampled packets, and `full` captures entire payloads and non-sampled packets. - `"simple"` - `"full"` - `class MagicVisibilityPCAPsPCAPsResponseFull: …` - `id: Optional[str]` The ID for the packet capture. - `byte_limit: Optional[float]` The maximum number of bytes to capture. This field only applies to `full` packet captures. - `colo_name: Optional[str]` The name of the data center used for the packet capture. This can be a specific colo (ord02) or a multi-colo name (ORD). This field only applies to `full` packet captures. - `destination_conf: Optional[str]` The full URI for the bucket. This field only applies to `full` packet captures. - `error_message: Optional[str]` An error message that describes why the packet capture failed. This field only applies to `full` packet captures. - `filter_v1: Optional[PCAPFilter]` The packet capture filter. When this field is empty, all packets are captured. - `packets_captured: Optional[int]` The number of packets captured. - `status: Optional[Literal["unknown", "success", "pending", 5 more]]` The status of the packet capture request. - `"unknown"` - `"success"` - `"pending"` - `"running"` - `"conversion_pending"` - `"conversion_running"` - `"complete"` - `"failed"` - `stop_requested: Optional[datetime]` The RFC 3339 timestamp when stopping the packet capture was requested. This field only applies to `full` packet captures. - `submitted: Optional[str]` The RFC 3339 timestamp when the packet capture was created. - `system: Optional[Literal["magic-transit"]]` The system used to collect packet captures. - `"magic-transit"` - `time_limit: Optional[float]` The packet capture duration in seconds. - `type: Optional[Literal["simple", "full"]]` The type of packet capture. `Simple` captures sampled packets, and `full` captures entire payloads and non-sampled packets. - `"simple"` - `"full"` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) pcap = client.magic_transit.pcaps.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", packet_limit=10000, system="magic-transit", time_limit=300, type="simple", ) print(pcap) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "id": "66802ca5668e47a2b82c2e6746e45037", "filter_v1": { "destination_address": "1.2.3.4", "destination_port": 80, "protocol": 6, "source_address": "1.2.3.4", "source_port": 123 }, "offset_time": "2020-01-01T08:00:00Z", "status": "success", "submitted": "2020-01-01T08:00:00Z", "system": "magic-transit", "time_limit": 300, "type": "simple" }, "success": true } ``` ## Stop full PCAP `magic_transit.pcaps.stop(strpcap_id, PCAPStopParams**kwargs)` **put** `/accounts/{account_id}/pcaps/{pcap_id}/stop` Stop full PCAP. ### Parameters - `account_id: str` Identifier. - `pcap_id: str` Identifier. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) client.magic_transit.pcaps.stop( pcap_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) ``` ## Domain Types ### PCAP - `class PCAP: …` - `id: Optional[str]` The ID for the packet capture. - `filter_v1: Optional[PCAPFilter]` The packet capture filter. When this field is empty, all packets are captured. - `destination_address: Optional[str]` The destination IP address of the packet. - `destination_port: Optional[float]` The destination port of the packet. - `protocol: Optional[float]` The protocol number of the packet. - `source_address: Optional[str]` The source IP address of the packet. - `source_port: Optional[float]` The source port of the packet. - `offset_time: Optional[datetime]` The RFC 3339 offset timestamp from which to query backwards for packets. Must be within the last 24h. When this field is empty, defaults to time of request. - `status: Optional[Literal["unknown", "success", "pending", 5 more]]` The status of the packet capture request. - `"unknown"` - `"success"` - `"pending"` - `"running"` - `"conversion_pending"` - `"conversion_running"` - `"complete"` - `"failed"` - `submitted: Optional[str]` The RFC 3339 timestamp when the packet capture was created. - `system: Optional[Literal["magic-transit"]]` The system used to collect packet captures. - `"magic-transit"` - `time_limit: Optional[float]` The packet capture duration in seconds. - `type: Optional[Literal["simple", "full"]]` The type of packet capture. `Simple` captures sampled packets, and `full` captures entire payloads and non-sampled packets. - `"simple"` - `"full"` ### PCAP Filter - `class PCAPFilter: …` The packet capture filter. When this field is empty, all packets are captured. - `destination_address: Optional[str]` The destination IP address of the packet. - `destination_port: Optional[float]` The destination port of the packet. - `protocol: Optional[float]` The protocol number of the packet. - `source_address: Optional[str]` The source IP address of the packet. - `source_port: Optional[float]` The source port of the packet. ### PCAP List Response - `PCAPListResponse` - `class PCAP: …` - `id: Optional[str]` The ID for the packet capture. - `filter_v1: Optional[PCAPFilter]` The packet capture filter. When this field is empty, all packets are captured. - `destination_address: Optional[str]` The destination IP address of the packet. - `destination_port: Optional[float]` The destination port of the packet. - `protocol: Optional[float]` The protocol number of the packet. - `source_address: Optional[str]` The source IP address of the packet. - `source_port: Optional[float]` The source port of the packet. - `offset_time: Optional[datetime]` The RFC 3339 offset timestamp from which to query backwards for packets. Must be within the last 24h. When this field is empty, defaults to time of request. - `status: Optional[Literal["unknown", "success", "pending", 5 more]]` The status of the packet capture request. - `"unknown"` - `"success"` - `"pending"` - `"running"` - `"conversion_pending"` - `"conversion_running"` - `"complete"` - `"failed"` - `submitted: Optional[str]` The RFC 3339 timestamp when the packet capture was created. - `system: Optional[Literal["magic-transit"]]` The system used to collect packet captures. - `"magic-transit"` - `time_limit: Optional[float]` The packet capture duration in seconds. - `type: Optional[Literal["simple", "full"]]` The type of packet capture. `Simple` captures sampled packets, and `full` captures entire payloads and non-sampled packets. - `"simple"` - `"full"` - `class MagicVisibilityPCAPsPCAPsResponseFull: …` - `id: Optional[str]` The ID for the packet capture. - `byte_limit: Optional[float]` The maximum number of bytes to capture. This field only applies to `full` packet captures. - `colo_name: Optional[str]` The name of the data center used for the packet capture. This can be a specific colo (ord02) or a multi-colo name (ORD). This field only applies to `full` packet captures. - `destination_conf: Optional[str]` The full URI for the bucket. This field only applies to `full` packet captures. - `error_message: Optional[str]` An error message that describes why the packet capture failed. This field only applies to `full` packet captures. - `filter_v1: Optional[PCAPFilter]` The packet capture filter. When this field is empty, all packets are captured. - `packets_captured: Optional[int]` The number of packets captured. - `status: Optional[Literal["unknown", "success", "pending", 5 more]]` The status of the packet capture request. - `"unknown"` - `"success"` - `"pending"` - `"running"` - `"conversion_pending"` - `"conversion_running"` - `"complete"` - `"failed"` - `stop_requested: Optional[datetime]` The RFC 3339 timestamp when stopping the packet capture was requested. This field only applies to `full` packet captures. - `submitted: Optional[str]` The RFC 3339 timestamp when the packet capture was created. - `system: Optional[Literal["magic-transit"]]` The system used to collect packet captures. - `"magic-transit"` - `time_limit: Optional[float]` The packet capture duration in seconds. - `type: Optional[Literal["simple", "full"]]` The type of packet capture. `Simple` captures sampled packets, and `full` captures entire payloads and non-sampled packets. - `"simple"` - `"full"` ### PCAP Get Response - `PCAPGetResponse` - `class PCAP: …` - `id: Optional[str]` The ID for the packet capture. - `filter_v1: Optional[PCAPFilter]` The packet capture filter. When this field is empty, all packets are captured. - `destination_address: Optional[str]` The destination IP address of the packet. - `destination_port: Optional[float]` The destination port of the packet. - `protocol: Optional[float]` The protocol number of the packet. - `source_address: Optional[str]` The source IP address of the packet. - `source_port: Optional[float]` The source port of the packet. - `offset_time: Optional[datetime]` The RFC 3339 offset timestamp from which to query backwards for packets. Must be within the last 24h. When this field is empty, defaults to time of request. - `status: Optional[Literal["unknown", "success", "pending", 5 more]]` The status of the packet capture request. - `"unknown"` - `"success"` - `"pending"` - `"running"` - `"conversion_pending"` - `"conversion_running"` - `"complete"` - `"failed"` - `submitted: Optional[str]` The RFC 3339 timestamp when the packet capture was created. - `system: Optional[Literal["magic-transit"]]` The system used to collect packet captures. - `"magic-transit"` - `time_limit: Optional[float]` The packet capture duration in seconds. - `type: Optional[Literal["simple", "full"]]` The type of packet capture. `Simple` captures sampled packets, and `full` captures entire payloads and non-sampled packets. - `"simple"` - `"full"` - `class MagicVisibilityPCAPsPCAPsResponseFull: …` - `id: Optional[str]` The ID for the packet capture. - `byte_limit: Optional[float]` The maximum number of bytes to capture. This field only applies to `full` packet captures. - `colo_name: Optional[str]` The name of the data center used for the packet capture. This can be a specific colo (ord02) or a multi-colo name (ORD). This field only applies to `full` packet captures. - `destination_conf: Optional[str]` The full URI for the bucket. This field only applies to `full` packet captures. - `error_message: Optional[str]` An error message that describes why the packet capture failed. This field only applies to `full` packet captures. - `filter_v1: Optional[PCAPFilter]` The packet capture filter. When this field is empty, all packets are captured. - `packets_captured: Optional[int]` The number of packets captured. - `status: Optional[Literal["unknown", "success", "pending", 5 more]]` The status of the packet capture request. - `"unknown"` - `"success"` - `"pending"` - `"running"` - `"conversion_pending"` - `"conversion_running"` - `"complete"` - `"failed"` - `stop_requested: Optional[datetime]` The RFC 3339 timestamp when stopping the packet capture was requested. This field only applies to `full` packet captures. - `submitted: Optional[str]` The RFC 3339 timestamp when the packet capture was created. - `system: Optional[Literal["magic-transit"]]` The system used to collect packet captures. - `"magic-transit"` - `time_limit: Optional[float]` The packet capture duration in seconds. - `type: Optional[Literal["simple", "full"]]` The type of packet capture. `Simple` captures sampled packets, and `full` captures entire payloads and non-sampled packets. - `"simple"` - `"full"` ### PCAP Create Response - `PCAPCreateResponse` - `class PCAP: …` - `id: Optional[str]` The ID for the packet capture. - `filter_v1: Optional[PCAPFilter]` The packet capture filter. When this field is empty, all packets are captured. - `destination_address: Optional[str]` The destination IP address of the packet. - `destination_port: Optional[float]` The destination port of the packet. - `protocol: Optional[float]` The protocol number of the packet. - `source_address: Optional[str]` The source IP address of the packet. - `source_port: Optional[float]` The source port of the packet. - `offset_time: Optional[datetime]` The RFC 3339 offset timestamp from which to query backwards for packets. Must be within the last 24h. When this field is empty, defaults to time of request. - `status: Optional[Literal["unknown", "success", "pending", 5 more]]` The status of the packet capture request. - `"unknown"` - `"success"` - `"pending"` - `"running"` - `"conversion_pending"` - `"conversion_running"` - `"complete"` - `"failed"` - `submitted: Optional[str]` The RFC 3339 timestamp when the packet capture was created. - `system: Optional[Literal["magic-transit"]]` The system used to collect packet captures. - `"magic-transit"` - `time_limit: Optional[float]` The packet capture duration in seconds. - `type: Optional[Literal["simple", "full"]]` The type of packet capture. `Simple` captures sampled packets, and `full` captures entire payloads and non-sampled packets. - `"simple"` - `"full"` - `class MagicVisibilityPCAPsPCAPsResponseFull: …` - `id: Optional[str]` The ID for the packet capture. - `byte_limit: Optional[float]` The maximum number of bytes to capture. This field only applies to `full` packet captures. - `colo_name: Optional[str]` The name of the data center used for the packet capture. This can be a specific colo (ord02) or a multi-colo name (ORD). This field only applies to `full` packet captures. - `destination_conf: Optional[str]` The full URI for the bucket. This field only applies to `full` packet captures. - `error_message: Optional[str]` An error message that describes why the packet capture failed. This field only applies to `full` packet captures. - `filter_v1: Optional[PCAPFilter]` The packet capture filter. When this field is empty, all packets are captured. - `packets_captured: Optional[int]` The number of packets captured. - `status: Optional[Literal["unknown", "success", "pending", 5 more]]` The status of the packet capture request. - `"unknown"` - `"success"` - `"pending"` - `"running"` - `"conversion_pending"` - `"conversion_running"` - `"complete"` - `"failed"` - `stop_requested: Optional[datetime]` The RFC 3339 timestamp when stopping the packet capture was requested. This field only applies to `full` packet captures. - `submitted: Optional[str]` The RFC 3339 timestamp when the packet capture was created. - `system: Optional[Literal["magic-transit"]]` The system used to collect packet captures. - `"magic-transit"` - `time_limit: Optional[float]` The packet capture duration in seconds. - `type: Optional[Literal["simple", "full"]]` The type of packet capture. `Simple` captures sampled packets, and `full` captures entire payloads and non-sampled packets. - `"simple"` - `"full"` # Ownership ## List PCAPs Bucket Ownership `magic_transit.pcaps.ownership.get(OwnershipGetParams**kwargs) -> SyncSinglePage[Ownership]` **get** `/accounts/{account_id}/pcaps/ownership` List all buckets configured for use with PCAPs API. ### Parameters - `account_id: str` Identifier. ### Returns - `class Ownership: …` - `id: str` The bucket ID associated with the packet captures API. - `destination_conf: str` The full URI for the bucket. This field only applies to `full` packet captures. - `filename: str` The ownership challenge filename stored in the bucket. - `status: Literal["pending", "success", "failed"]` The status of the ownership challenge. Can be pending, success or failed. - `"pending"` - `"success"` - `"failed"` - `submitted: str` The RFC 3339 timestamp when the bucket was added to packet captures API. - `validated: Optional[str]` The RFC 3339 timestamp when the bucket was validated. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) page = client.magic_transit.pcaps.ownership.get( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) page = page.result[0] print(page.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": [ { "id": "9883874ecac311ec8475433579a6bf5f", "destination_conf": "s3://pcaps-bucket?region=us-east-1", "filename": "ownership-challenge-9883874ecac311ec8475433579a6bf5f.txt", "status": "success", "submitted": "2020-01-01T08:00:00Z", "validated": "2020-01-01T08:00:00Z" } ], "success": true, "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000 } } ``` ## Add buckets for full packet captures `magic_transit.pcaps.ownership.create(OwnershipCreateParams**kwargs) -> Ownership` **post** `/accounts/{account_id}/pcaps/ownership` Adds an AWS or GCP bucket to use with full packet captures. ### Parameters - `account_id: str` Identifier. - `destination_conf: str` The full URI for the bucket. This field only applies to `full` packet captures. ### Returns - `class Ownership: …` - `id: str` The bucket ID associated with the packet captures API. - `destination_conf: str` The full URI for the bucket. This field only applies to `full` packet captures. - `filename: str` The ownership challenge filename stored in the bucket. - `status: Literal["pending", "success", "failed"]` The status of the ownership challenge. Can be pending, success or failed. - `"pending"` - `"success"` - `"failed"` - `submitted: str` The RFC 3339 timestamp when the bucket was added to packet captures API. - `validated: Optional[str]` The RFC 3339 timestamp when the bucket was validated. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) ownership = client.magic_transit.pcaps.ownership.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", destination_conf="s3://pcaps-bucket?region=us-east-1", ) print(ownership.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "id": "9883874ecac311ec8475433579a6bf5f", "destination_conf": "s3://pcaps-bucket?region=us-east-1", "filename": "ownership-challenge-9883874ecac311ec8475433579a6bf5f.txt", "status": "success", "submitted": "2020-01-01T08:00:00Z", "validated": "2020-01-01T08:00:00Z" }, "success": true } ``` ## Delete buckets for full packet captures `magic_transit.pcaps.ownership.delete(strownership_id, OwnershipDeleteParams**kwargs)` **delete** `/accounts/{account_id}/pcaps/ownership/{ownership_id}` Deletes buckets added to the packet captures API. ### Parameters - `account_id: str` Identifier. - `ownership_id: str` Identifier. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) client.magic_transit.pcaps.ownership.delete( ownership_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) ``` ## Validate buckets for full packet captures `magic_transit.pcaps.ownership.validate(OwnershipValidateParams**kwargs) -> Ownership` **post** `/accounts/{account_id}/pcaps/ownership/validate` Validates buckets added to the packet captures API. ### Parameters - `account_id: str` Identifier. - `destination_conf: str` The full URI for the bucket. This field only applies to `full` packet captures. - `ownership_challenge: str` The ownership challenge filename stored in the bucket. ### Returns - `class Ownership: …` - `id: str` The bucket ID associated with the packet captures API. - `destination_conf: str` The full URI for the bucket. This field only applies to `full` packet captures. - `filename: str` The ownership challenge filename stored in the bucket. - `status: Literal["pending", "success", "failed"]` The status of the ownership challenge. Can be pending, success or failed. - `"pending"` - `"success"` - `"failed"` - `submitted: str` The RFC 3339 timestamp when the bucket was added to packet captures API. - `validated: Optional[str]` The RFC 3339 timestamp when the bucket was validated. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) ownership = client.magic_transit.pcaps.ownership.validate( account_id="023e105f4ecef8ad9ca31a8372d0c353", destination_conf="s3://pcaps-bucket?region=us-east-1", ownership_challenge="ownership-challenge-9883874ecac311ec8475433579a6bf5f.txt", ) print(ownership.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "id": "9883874ecac311ec8475433579a6bf5f", "destination_conf": "s3://pcaps-bucket?region=us-east-1", "filename": "ownership-challenge-9883874ecac311ec8475433579a6bf5f.txt", "status": "success", "submitted": "2020-01-01T08:00:00Z", "validated": "2020-01-01T08:00:00Z" }, "success": true } ``` ## Domain Types ### Ownership - `class Ownership: …` - `id: str` The bucket ID associated with the packet captures API. - `destination_conf: str` The full URI for the bucket. This field only applies to `full` packet captures. - `filename: str` The ownership challenge filename stored in the bucket. - `status: Literal["pending", "success", "failed"]` The status of the ownership challenge. Can be pending, success or failed. - `"pending"` - `"success"` - `"failed"` - `submitted: str` The RFC 3339 timestamp when the bucket was added to packet captures API. - `validated: Optional[str]` The RFC 3339 timestamp when the bucket was validated. # Download ## Download Simple PCAP `magic_transit.pcaps.download.get(strpcap_id, DownloadGetParams**kwargs) -> BinaryResponseContent` **get** `/accounts/{account_id}/pcaps/{pcap_id}/download` Download PCAP information into a file. Response is a binary PCAP file. ### Parameters - `account_id: str` Identifier. - `pcap_id: str` Identifier. ### Returns - `BinaryResponseContent` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) download = client.magic_transit.pcaps.download.get( pcap_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(download) content = download.read() print(content) ```