# Configs ## List account configuration `client.MagicNetworkMonitoring.Configs.Get(ctx, query) (*Configuration, error)` **get** `/accounts/{account_id}/mnm/config` Lists default sampling, router IPs and warp devices for account. ### Parameters - `query ConfigGetParams` - `AccountID param.Field[string]` ### Returns - `type Configuration struct{…}` - `DefaultSampling float64` Fallback sampling rate of flow messages being sent in packets per second. This should match the packet sampling rate configured on the router. - `Name string` The account name. - `RouterIPs []string` - `WARPDevices []ConfigurationWARPDevice` - `ID string` Unique identifier for the warp device. - `Name string` Name of the warp device. - `RouterIP string` IPv4 CIDR of the router sourcing flow data associated with this warp device. Only /32 addresses are currently supported. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_network_monitoring" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) configuration, err := client.MagicNetworkMonitoring.Configs.Get(context.TODO(), magic_network_monitoring.ConfigGetParams{ AccountID: cloudflare.F("6f91088a406011ed95aed352566e8d4c"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", configuration.DefaultSampling) } ``` #### 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": { "default_sampling": 1, "name": "cloudflare user's account", "router_ips": [ "203.0.113.1" ], "warp_devices": [ { "id": "5360368d-b351-4791-abe1-93550dabd351", "name": "My warp device", "router_ip": "203.0.113.1" } ] }, "success": true } ``` ## Create account configuration `client.MagicNetworkMonitoring.Configs.New(ctx, params) (*Configuration, error)` **post** `/accounts/{account_id}/mnm/config` Create a new network monitoring configuration. ### Parameters - `params ConfigNewParams` - `AccountID param.Field[string]` Path param - `DefaultSampling param.Field[float64]` Body param: Fallback sampling rate of flow messages being sent in packets per second. This should match the packet sampling rate configured on the router. - `Name param.Field[string]` Body param: The account name. - `RouterIPs param.Field[[]string]` Body param - `WARPDevices param.Field[[]ConfigNewParamsWARPDevice]` Body param - `ID string` Unique identifier for the warp device. - `Name string` Name of the warp device. - `RouterIP string` IPv4 CIDR of the router sourcing flow data associated with this warp device. Only /32 addresses are currently supported. ### Returns - `type Configuration struct{…}` - `DefaultSampling float64` Fallback sampling rate of flow messages being sent in packets per second. This should match the packet sampling rate configured on the router. - `Name string` The account name. - `RouterIPs []string` - `WARPDevices []ConfigurationWARPDevice` - `ID string` Unique identifier for the warp device. - `Name string` Name of the warp device. - `RouterIP string` IPv4 CIDR of the router sourcing flow data associated with this warp device. Only /32 addresses are currently supported. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_network_monitoring" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) configuration, err := client.MagicNetworkMonitoring.Configs.New(context.TODO(), magic_network_monitoring.ConfigNewParams{ AccountID: cloudflare.F("6f91088a406011ed95aed352566e8d4c"), DefaultSampling: cloudflare.F(1.000000), Name: cloudflare.F("cloudflare user's account"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", configuration.DefaultSampling) } ``` #### 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": { "default_sampling": 1, "name": "cloudflare user's account", "router_ips": [ "203.0.113.1" ], "warp_devices": [ { "id": "5360368d-b351-4791-abe1-93550dabd351", "name": "My warp device", "router_ip": "203.0.113.1" } ] }, "success": true } ``` ## Update an entire account configuration `client.MagicNetworkMonitoring.Configs.Update(ctx, params) (*Configuration, error)` **put** `/accounts/{account_id}/mnm/config` Update an existing network monitoring configuration, requires the entire configuration to be updated at once. ### Parameters - `params ConfigUpdateParams` - `AccountID param.Field[string]` Path param - `DefaultSampling param.Field[float64]` Body param: Fallback sampling rate of flow messages being sent in packets per second. This should match the packet sampling rate configured on the router. - `Name param.Field[string]` Body param: The account name. - `RouterIPs param.Field[[]string]` Body param - `WARPDevices param.Field[[]ConfigUpdateParamsWARPDevice]` Body param - `ID string` Unique identifier for the warp device. - `Name string` Name of the warp device. - `RouterIP string` IPv4 CIDR of the router sourcing flow data associated with this warp device. Only /32 addresses are currently supported. ### Returns - `type Configuration struct{…}` - `DefaultSampling float64` Fallback sampling rate of flow messages being sent in packets per second. This should match the packet sampling rate configured on the router. - `Name string` The account name. - `RouterIPs []string` - `WARPDevices []ConfigurationWARPDevice` - `ID string` Unique identifier for the warp device. - `Name string` Name of the warp device. - `RouterIP string` IPv4 CIDR of the router sourcing flow data associated with this warp device. Only /32 addresses are currently supported. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_network_monitoring" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) configuration, err := client.MagicNetworkMonitoring.Configs.Update(context.TODO(), magic_network_monitoring.ConfigUpdateParams{ AccountID: cloudflare.F("6f91088a406011ed95aed352566e8d4c"), DefaultSampling: cloudflare.F(1.000000), Name: cloudflare.F("cloudflare user's account"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", configuration.DefaultSampling) } ``` #### 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": { "default_sampling": 1, "name": "cloudflare user's account", "router_ips": [ "203.0.113.1" ], "warp_devices": [ { "id": "5360368d-b351-4791-abe1-93550dabd351", "name": "My warp device", "router_ip": "203.0.113.1" } ] }, "success": true } ``` ## Update account configuration fields `client.MagicNetworkMonitoring.Configs.Edit(ctx, params) (*Configuration, error)` **patch** `/accounts/{account_id}/mnm/config` Update fields in an existing network monitoring configuration. ### Parameters - `params ConfigEditParams` - `AccountID param.Field[string]` Path param - `DefaultSampling param.Field[float64]` Body param: Fallback sampling rate of flow messages being sent in packets per second. This should match the packet sampling rate configured on the router. - `Name param.Field[string]` Body param: The account name. - `RouterIPs param.Field[[]string]` Body param - `WARPDevices param.Field[[]ConfigEditParamsWARPDevice]` Body param - `ID string` Unique identifier for the warp device. - `Name string` Name of the warp device. - `RouterIP string` IPv4 CIDR of the router sourcing flow data associated with this warp device. Only /32 addresses are currently supported. ### Returns - `type Configuration struct{…}` - `DefaultSampling float64` Fallback sampling rate of flow messages being sent in packets per second. This should match the packet sampling rate configured on the router. - `Name string` The account name. - `RouterIPs []string` - `WARPDevices []ConfigurationWARPDevice` - `ID string` Unique identifier for the warp device. - `Name string` Name of the warp device. - `RouterIP string` IPv4 CIDR of the router sourcing flow data associated with this warp device. Only /32 addresses are currently supported. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_network_monitoring" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) configuration, err := client.MagicNetworkMonitoring.Configs.Edit(context.TODO(), magic_network_monitoring.ConfigEditParams{ AccountID: cloudflare.F("6f91088a406011ed95aed352566e8d4c"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", configuration.DefaultSampling) } ``` #### 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": { "default_sampling": 1, "name": "cloudflare user's account", "router_ips": [ "203.0.113.1" ], "warp_devices": [ { "id": "5360368d-b351-4791-abe1-93550dabd351", "name": "My warp device", "router_ip": "203.0.113.1" } ] }, "success": true } ``` ## Delete account configuration `client.MagicNetworkMonitoring.Configs.Delete(ctx, body) (*Configuration, error)` **delete** `/accounts/{account_id}/mnm/config` Delete an existing network monitoring configuration. ### Parameters - `body ConfigDeleteParams` - `AccountID param.Field[string]` ### Returns - `type Configuration struct{…}` - `DefaultSampling float64` Fallback sampling rate of flow messages being sent in packets per second. This should match the packet sampling rate configured on the router. - `Name string` The account name. - `RouterIPs []string` - `WARPDevices []ConfigurationWARPDevice` - `ID string` Unique identifier for the warp device. - `Name string` Name of the warp device. - `RouterIP string` IPv4 CIDR of the router sourcing flow data associated with this warp device. Only /32 addresses are currently supported. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_network_monitoring" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) configuration, err := client.MagicNetworkMonitoring.Configs.Delete(context.TODO(), magic_network_monitoring.ConfigDeleteParams{ AccountID: cloudflare.F("6f91088a406011ed95aed352566e8d4c"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", configuration.DefaultSampling) } ``` #### 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": { "default_sampling": 1, "name": "cloudflare user's account", "router_ips": [ "203.0.113.1" ], "warp_devices": [ { "id": "5360368d-b351-4791-abe1-93550dabd351", "name": "My warp device", "router_ip": "203.0.113.1" } ] }, "success": true } ``` ## Domain Types ### Configuration - `type Configuration struct{…}` - `DefaultSampling float64` Fallback sampling rate of flow messages being sent in packets per second. This should match the packet sampling rate configured on the router. - `Name string` The account name. - `RouterIPs []string` - `WARPDevices []ConfigurationWARPDevice` - `ID string` Unique identifier for the warp device. - `Name string` Name of the warp device. - `RouterIP string` IPv4 CIDR of the router sourcing flow data associated with this warp device. Only /32 addresses are currently supported. # Full ## List rules and account configuration `client.MagicNetworkMonitoring.Configs.Full.Get(ctx, query) (*Configuration, error)` **get** `/accounts/{account_id}/mnm/config/full` Lists default sampling, router IPs, warp devices, and rules for account. ### Parameters - `query ConfigFullGetParams` - `AccountID param.Field[string]` ### Returns - `type Configuration struct{…}` - `DefaultSampling float64` Fallback sampling rate of flow messages being sent in packets per second. This should match the packet sampling rate configured on the router. - `Name string` The account name. - `RouterIPs []string` - `WARPDevices []ConfigurationWARPDevice` - `ID string` Unique identifier for the warp device. - `Name string` Name of the warp device. - `RouterIP string` IPv4 CIDR of the router sourcing flow data associated with this warp device. Only /32 addresses are currently supported. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_network_monitoring" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) configuration, err := client.MagicNetworkMonitoring.Configs.Full.Get(context.TODO(), magic_network_monitoring.ConfigFullGetParams{ AccountID: cloudflare.F("6f91088a406011ed95aed352566e8d4c"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", configuration.DefaultSampling) } ``` #### 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": { "default_sampling": 1, "name": "cloudflare user's account", "router_ips": [ "203.0.113.1" ], "warp_devices": [ { "id": "5360368d-b351-4791-abe1-93550dabd351", "name": "My warp device", "router_ip": "203.0.113.1" } ] }, "success": true } ```