## Create PCAP request `client.MagicTransit.PCAPs.New(ctx, params) (*PCAPNewResponse, error)` **post** `/accounts/{account_id}/pcaps` Create new PCAP request for account. ### Parameters - `params PCAPNewParams` - `AccountID param.Field[string]` Path param: Identifier. - `PacketLimit param.Field[float64]` Body param: The limit of packets contained in a packet capture. - `System param.Field[PCAPNewParamsMagicVisibilityPCAPsPCAPsRequestSimpleSystem]` Body param: The system used to collect packet captures. - `const PCAPNewParamsMagicVisibilityPCAPsPCAPsRequestSimpleSystemMagicTransit PCAPNewParamsMagicVisibilityPCAPsPCAPsRequestSimpleSystem = "magic-transit"` - `TimeLimit param.Field[float64]` Body param: The packet capture duration in seconds. - `Type param.Field[PCAPNewParamsMagicVisibilityPCAPsPCAPsRequestSimpleType]` Body param: The type of packet capture. `Simple` captures sampled packets, and `full` captures entire payloads and non-sampled packets. - `const PCAPNewParamsMagicVisibilityPCAPsPCAPsRequestSimpleTypeSimple PCAPNewParamsMagicVisibilityPCAPsPCAPsRequestSimpleType = "simple"` - `const PCAPNewParamsMagicVisibilityPCAPsPCAPsRequestSimpleTypeFull PCAPNewParamsMagicVisibilityPCAPsPCAPsRequestSimpleType = "full"` - `FilterV1 param.Field[PCAPFilter]` Body param: The packet capture filter. When this field is empty, all packets are captured. - `OffsetTime param.Field[Time]` Body param: 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 - `type PCAPNewResponse interface{…}` - `type PCAP struct{…}` - `ID string` The ID for the packet capture. - `FilterV1 PCAPFilter` The packet capture filter. When this field is empty, all packets are captured. - `DestinationAddress string` The destination IP address of the packet. - `DestinationPort float64` The destination port of the packet. - `Protocol float64` The protocol number of the packet. - `SourceAddress string` The source IP address of the packet. - `SourcePort float64` The source port of the packet. - `OffsetTime Time` 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 PCAPStatus` The status of the packet capture request. - `const PCAPStatusUnknown PCAPStatus = "unknown"` - `const PCAPStatusSuccess PCAPStatus = "success"` - `const PCAPStatusPending PCAPStatus = "pending"` - `const PCAPStatusRunning PCAPStatus = "running"` - `const PCAPStatusConversionPending PCAPStatus = "conversion_pending"` - `const PCAPStatusConversionRunning PCAPStatus = "conversion_running"` - `const PCAPStatusComplete PCAPStatus = "complete"` - `const PCAPStatusFailed PCAPStatus = "failed"` - `Submitted string` The RFC 3339 timestamp when the packet capture was created. - `System PCAPSystem` The system used to collect packet captures. - `const PCAPSystemMagicTransit PCAPSystem = "magic-transit"` - `TimeLimit float64` The packet capture duration in seconds. - `Type PCAPType` The type of packet capture. `Simple` captures sampled packets, and `full` captures entire payloads and non-sampled packets. - `const PCAPTypeSimple PCAPType = "simple"` - `const PCAPTypeFull PCAPType = "full"` - `type PCAPNewResponseMagicVisibilityPCAPsPCAPsResponseFull struct{…}` - `ID string` The ID for the packet capture. - `ByteLimit float64` The maximum number of bytes to capture. This field only applies to `full` packet captures. - `ColoName string` 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. - `DestinationConf string` The full URI for the bucket. This field only applies to `full` packet captures. - `ErrorMessage string` An error message that describes why the packet capture failed. This field only applies to `full` packet captures. - `FilterV1 PCAPFilter` The packet capture filter. When this field is empty, all packets are captured. - `PacketsCaptured int64` The number of packets captured. - `Status PCAPNewResponseMagicVisibilityPCAPsPCAPsResponseFullStatus` The status of the packet capture request. - `const PCAPNewResponseMagicVisibilityPCAPsPCAPsResponseFullStatusUnknown PCAPNewResponseMagicVisibilityPCAPsPCAPsResponseFullStatus = "unknown"` - `const PCAPNewResponseMagicVisibilityPCAPsPCAPsResponseFullStatusSuccess PCAPNewResponseMagicVisibilityPCAPsPCAPsResponseFullStatus = "success"` - `const PCAPNewResponseMagicVisibilityPCAPsPCAPsResponseFullStatusPending PCAPNewResponseMagicVisibilityPCAPsPCAPsResponseFullStatus = "pending"` - `const PCAPNewResponseMagicVisibilityPCAPsPCAPsResponseFullStatusRunning PCAPNewResponseMagicVisibilityPCAPsPCAPsResponseFullStatus = "running"` - `const PCAPNewResponseMagicVisibilityPCAPsPCAPsResponseFullStatusConversionPending PCAPNewResponseMagicVisibilityPCAPsPCAPsResponseFullStatus = "conversion_pending"` - `const PCAPNewResponseMagicVisibilityPCAPsPCAPsResponseFullStatusConversionRunning PCAPNewResponseMagicVisibilityPCAPsPCAPsResponseFullStatus = "conversion_running"` - `const PCAPNewResponseMagicVisibilityPCAPsPCAPsResponseFullStatusComplete PCAPNewResponseMagicVisibilityPCAPsPCAPsResponseFullStatus = "complete"` - `const PCAPNewResponseMagicVisibilityPCAPsPCAPsResponseFullStatusFailed PCAPNewResponseMagicVisibilityPCAPsPCAPsResponseFullStatus = "failed"` - `StopRequested Time` The RFC 3339 timestamp when stopping the packet capture was requested. This field only applies to `full` packet captures. - `Submitted string` The RFC 3339 timestamp when the packet capture was created. - `System PCAPNewResponseMagicVisibilityPCAPsPCAPsResponseFullSystem` The system used to collect packet captures. - `const PCAPNewResponseMagicVisibilityPCAPsPCAPsResponseFullSystemMagicTransit PCAPNewResponseMagicVisibilityPCAPsPCAPsResponseFullSystem = "magic-transit"` - `TimeLimit float64` The packet capture duration in seconds. - `Type PCAPNewResponseMagicVisibilityPCAPsPCAPsResponseFullType` The type of packet capture. `Simple` captures sampled packets, and `full` captures entire payloads and non-sampled packets. - `const PCAPNewResponseMagicVisibilityPCAPsPCAPsResponseFullTypeSimple PCAPNewResponseMagicVisibilityPCAPsPCAPsResponseFullType = "simple"` - `const PCAPNewResponseMagicVisibilityPCAPsPCAPsResponseFullTypeFull PCAPNewResponseMagicVisibilityPCAPsPCAPsResponseFullType = "full"` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) pcap, err := client.MagicTransit.PCAPs.New(context.TODO(), magic_transit.PCAPNewParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Body: magic_transit.PCAPNewParamsBodyMagicVisibilityPCAPsPCAPsRequestSimple{ PacketLimit: cloudflare.F(10000.000000), System: cloudflare.F(magic_transit.PCAPNewParamsBodyMagicVisibilityPCAPsPCAPsRequestSimpleSystemMagicTransit), TimeLimit: cloudflare.F(300.000000), Type: cloudflare.F(magic_transit.PCAPNewParamsBodyMagicVisibilityPCAPsPCAPsRequestSimpleTypeSimple), }, }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", 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 } ```