# Routes ## List tunnel routes `client.ZeroTrust.Networks.Routes.List(ctx, params) (*V4PagePaginationArray[Teamnet], error)` **get** `/accounts/{account_id}/teamnet/routes` Lists and filters private network routes in an account. ### Parameters - `params NetworkRouteListParams` - `AccountID param.Field[string]` Path param: Cloudflare account ID - `Comment param.Field[string]` Query param: Optional remark describing the route. - `ExistedAt param.Field[string]` Query param: If provided, include only resources that were created (and not deleted) before this time. URL encoded. - `IsDeleted param.Field[bool]` Query param: If `true`, only include deleted routes. If `false`, exclude deleted routes. If empty, all routes will be included. - `NetworkSubset param.Field[string]` Query param: If set, only list routes that are contained within this IP range. - `NetworkSuperset param.Field[string]` Query param: If set, only list routes that contain this IP range. - `Page param.Field[float64]` Query param: Page number of paginated results. - `PerPage param.Field[float64]` Query param: Number of results to display. - `RouteID param.Field[string]` Query param: UUID of the route. - `TunTypes param.Field[[]NetworkRouteListParamsTunType]` Query param: The types of tunnels to filter by, separated by commas. - `const NetworkRouteListParamsTunTypeCfdTunnel NetworkRouteListParamsTunType = "cfd_tunnel"` - `const NetworkRouteListParamsTunTypeWARPConnector NetworkRouteListParamsTunType = "warp_connector"` - `const NetworkRouteListParamsTunTypeWARP NetworkRouteListParamsTunType = "warp"` - `const NetworkRouteListParamsTunTypeMagic NetworkRouteListParamsTunType = "magic"` - `const NetworkRouteListParamsTunTypeIPSec NetworkRouteListParamsTunType = "ip_sec"` - `const NetworkRouteListParamsTunTypeGRE NetworkRouteListParamsTunType = "gre"` - `const NetworkRouteListParamsTunTypeCNI NetworkRouteListParamsTunType = "cni"` - `TunnelID param.Field[string]` Query param: UUID of the tunnel. - `VirtualNetworkID param.Field[string]` Query param: UUID of the virtual network. ### Returns - `type Teamnet struct{…}` - `ID string` UUID of the route. - `Comment string` Optional remark describing the route. - `CreatedAt Time` Timestamp of when the resource was created. - `DeletedAt Time` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `Network string` The private IPv4 or IPv6 range connected by the route, in CIDR notation. - `TunType TeamnetTunType` The type of tunnel. - `const TeamnetTunTypeCfdTunnel TeamnetTunType = "cfd_tunnel"` - `const TeamnetTunTypeWARPConnector TeamnetTunType = "warp_connector"` - `const TeamnetTunTypeWARP TeamnetTunType = "warp"` - `const TeamnetTunTypeMagic TeamnetTunType = "magic"` - `const TeamnetTunTypeIPSec TeamnetTunType = "ip_sec"` - `const TeamnetTunTypeGRE TeamnetTunType = "gre"` - `const TeamnetTunTypeCNI TeamnetTunType = "cni"` - `TunnelID string` UUID of the tunnel. - `TunnelName string` A user-friendly name for a tunnel. - `VirtualNetworkID string` UUID of the virtual network. - `VirtualNetworkName string` A user-friendly name for the virtual network. ### Example ```go package main import ( "context" "fmt" "github.com/stainless-sdks/cloudflare-go" "github.com/stainless-sdks/cloudflare-go/option" "github.com/stainless-sdks/cloudflare-go/zero_trust" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) page, err := client.ZeroTrust.Networks.Routes.List(context.TODO(), zero_trust.NetworkRouteListParams{ AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", 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": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "comment": "Example comment for this route.", "created_at": "2021-01-25T18:22:34.317854Z", "deleted_at": "2009-11-10T23:00:00.000000Z", "network": "172.16.0.0/16", "tun_type": "cfd_tunnel", "tunnel_id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "tunnel_name": "blog", "virtual_network_id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "virtual_network_name": "us-east-1-vpc" } ], "success": true, "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000 } } ``` ## Get tunnel route `client.ZeroTrust.Networks.Routes.Get(ctx, routeID, query) (*Route, error)` **get** `/accounts/{account_id}/teamnet/routes/{route_id}` Get a private network route in an account. ### Parameters - `routeID string` UUID of the route. - `query NetworkRouteGetParams` - `AccountID param.Field[string]` Cloudflare account ID ### Returns - `type Route struct{…}` - `ID string` UUID of the route. - `Comment string` Optional remark describing the route. - `CreatedAt Time` Timestamp of when the resource was created. - `DeletedAt Time` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `Network string` The private IPv4 or IPv6 range connected by the route, in CIDR notation. - `TunnelID string` UUID of the tunnel. - `VirtualNetworkID string` UUID of the virtual network. ### Example ```go package main import ( "context" "fmt" "github.com/stainless-sdks/cloudflare-go" "github.com/stainless-sdks/cloudflare-go/option" "github.com/stainless-sdks/cloudflare-go/zero_trust" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) route, err := client.ZeroTrust.Networks.Routes.Get( context.TODO(), "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", zero_trust.NetworkRouteGetParams{ AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", route.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": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "comment": "Example comment for this route.", "created_at": "2021-01-25T18:22:34.317854Z", "deleted_at": "2009-11-10T23:00:00.000000Z", "network": "172.16.0.0/16", "tunnel_id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "virtual_network_id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415" }, "success": true } ``` ## Create a tunnel route `client.ZeroTrust.Networks.Routes.New(ctx, params) (*Route, error)` **post** `/accounts/{account_id}/teamnet/routes` Routes a private network through a Cloudflare Tunnel. ### Parameters - `params NetworkRouteNewParams` - `AccountID param.Field[string]` Path param: Cloudflare account ID - `Network param.Field[string]` Body param: The private IPv4 or IPv6 range connected by the route, in CIDR notation. - `TunnelID param.Field[string]` Body param: UUID of the tunnel. - `Comment param.Field[string]` Body param: Optional remark describing the route. - `VirtualNetworkID param.Field[string]` Body param: UUID of the virtual network. ### Returns - `type Route struct{…}` - `ID string` UUID of the route. - `Comment string` Optional remark describing the route. - `CreatedAt Time` Timestamp of when the resource was created. - `DeletedAt Time` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `Network string` The private IPv4 or IPv6 range connected by the route, in CIDR notation. - `TunnelID string` UUID of the tunnel. - `VirtualNetworkID string` UUID of the virtual network. ### Example ```go package main import ( "context" "fmt" "github.com/stainless-sdks/cloudflare-go" "github.com/stainless-sdks/cloudflare-go/option" "github.com/stainless-sdks/cloudflare-go/zero_trust" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) route, err := client.ZeroTrust.Networks.Routes.New(context.TODO(), zero_trust.NetworkRouteNewParams{ AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), Network: cloudflare.F("172.16.0.0/16"), TunnelID: cloudflare.F("f70ff985-a4ef-4643-bbbc-4a0ed4fc8415"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", route.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": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "comment": "Example comment for this route.", "created_at": "2021-01-25T18:22:34.317854Z", "deleted_at": "2009-11-10T23:00:00.000000Z", "network": "172.16.0.0/16", "tunnel_id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "virtual_network_id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415" }, "success": true } ``` ## Update a tunnel route `client.ZeroTrust.Networks.Routes.Edit(ctx, routeID, params) (*Route, error)` **patch** `/accounts/{account_id}/teamnet/routes/{route_id}` Updates an existing private network route in an account. The fields that are meant to be updated should be provided in the body of the request. ### Parameters - `routeID string` UUID of the route. - `params NetworkRouteEditParams` - `AccountID param.Field[string]` Path param: Cloudflare account ID - `Comment param.Field[string]` Body param: Optional remark describing the route. - `Network param.Field[string]` Body param: The private IPv4 or IPv6 range connected by the route, in CIDR notation. - `TunnelID param.Field[string]` Body param: UUID of the tunnel. - `VirtualNetworkID param.Field[string]` Body param: UUID of the virtual network. ### Returns - `type Route struct{…}` - `ID string` UUID of the route. - `Comment string` Optional remark describing the route. - `CreatedAt Time` Timestamp of when the resource was created. - `DeletedAt Time` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `Network string` The private IPv4 or IPv6 range connected by the route, in CIDR notation. - `TunnelID string` UUID of the tunnel. - `VirtualNetworkID string` UUID of the virtual network. ### Example ```go package main import ( "context" "fmt" "github.com/stainless-sdks/cloudflare-go" "github.com/stainless-sdks/cloudflare-go/option" "github.com/stainless-sdks/cloudflare-go/zero_trust" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) route, err := client.ZeroTrust.Networks.Routes.Edit( context.TODO(), "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", zero_trust.NetworkRouteEditParams{ AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", route.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": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "comment": "Example comment for this route.", "created_at": "2021-01-25T18:22:34.317854Z", "deleted_at": "2009-11-10T23:00:00.000000Z", "network": "172.16.0.0/16", "tunnel_id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "virtual_network_id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415" }, "success": true } ``` ## Delete a tunnel route `client.ZeroTrust.Networks.Routes.Delete(ctx, routeID, body) (*Route, error)` **delete** `/accounts/{account_id}/teamnet/routes/{route_id}` Deletes a private network route from an account. ### Parameters - `routeID string` UUID of the route. - `body NetworkRouteDeleteParams` - `AccountID param.Field[string]` Cloudflare account ID ### Returns - `type Route struct{…}` - `ID string` UUID of the route. - `Comment string` Optional remark describing the route. - `CreatedAt Time` Timestamp of when the resource was created. - `DeletedAt Time` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `Network string` The private IPv4 or IPv6 range connected by the route, in CIDR notation. - `TunnelID string` UUID of the tunnel. - `VirtualNetworkID string` UUID of the virtual network. ### Example ```go package main import ( "context" "fmt" "github.com/stainless-sdks/cloudflare-go" "github.com/stainless-sdks/cloudflare-go/option" "github.com/stainless-sdks/cloudflare-go/zero_trust" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) route, err := client.ZeroTrust.Networks.Routes.Delete( context.TODO(), "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", zero_trust.NetworkRouteDeleteParams{ AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", route.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": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "comment": "Example comment for this route.", "created_at": "2021-01-25T18:22:34.317854Z", "deleted_at": "2009-11-10T23:00:00.000000Z", "network": "172.16.0.0/16", "tunnel_id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "virtual_network_id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415" }, "success": true } ``` ## Domain Types ### Network Route - `type NetworkRoute struct{…}` - `ID string` UUID of the route. - `Comment string` Optional remark describing the route. - `CreatedAt Time` Timestamp of when the resource was created. - `DeletedAt Time` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `Network string` The private IPv4 or IPv6 range connected by the route, in CIDR notation. - `TunnelID string` UUID of the tunnel. - `VirtualNetworkID string` UUID of the virtual network. ### Route - `type Route struct{…}` - `ID string` UUID of the route. - `Comment string` Optional remark describing the route. - `CreatedAt Time` Timestamp of when the resource was created. - `DeletedAt Time` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `Network string` The private IPv4 or IPv6 range connected by the route, in CIDR notation. - `TunnelID string` UUID of the tunnel. - `VirtualNetworkID string` UUID of the virtual network. ### Teamnet - `type Teamnet struct{…}` - `ID string` UUID of the route. - `Comment string` Optional remark describing the route. - `CreatedAt Time` Timestamp of when the resource was created. - `DeletedAt Time` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `Network string` The private IPv4 or IPv6 range connected by the route, in CIDR notation. - `TunType TeamnetTunType` The type of tunnel. - `const TeamnetTunTypeCfdTunnel TeamnetTunType = "cfd_tunnel"` - `const TeamnetTunTypeWARPConnector TeamnetTunType = "warp_connector"` - `const TeamnetTunTypeWARP TeamnetTunType = "warp"` - `const TeamnetTunTypeMagic TeamnetTunType = "magic"` - `const TeamnetTunTypeIPSec TeamnetTunType = "ip_sec"` - `const TeamnetTunTypeGRE TeamnetTunType = "gre"` - `const TeamnetTunTypeCNI TeamnetTunType = "cni"` - `TunnelID string` UUID of the tunnel. - `TunnelName string` A user-friendly name for a tunnel. - `VirtualNetworkID string` UUID of the virtual network. - `VirtualNetworkName string` A user-friendly name for the virtual network. # IPs ## Get tunnel route by IP `client.ZeroTrust.Networks.Routes.IPs.Get(ctx, ip, params) (*Teamnet, error)` **get** `/accounts/{account_id}/teamnet/routes/ip/{ip}` Fetches routes that contain the given IP address. ### Parameters - `ip string` - `params NetworkRouteIPGetParams` - `AccountID param.Field[string]` Path param: Cloudflare account ID - `DefaultVirtualNetworkFallback param.Field[bool]` Query param: When the virtual_network_id parameter is not provided the request filter will default search routes that are in the default virtual network for the account. If this parameter is set to false, the search will include routes that do not have a virtual network. - `VirtualNetworkID param.Field[string]` Query param: UUID of the virtual network. ### Returns - `type Teamnet struct{…}` - `ID string` UUID of the route. - `Comment string` Optional remark describing the route. - `CreatedAt Time` Timestamp of when the resource was created. - `DeletedAt Time` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `Network string` The private IPv4 or IPv6 range connected by the route, in CIDR notation. - `TunType TeamnetTunType` The type of tunnel. - `const TeamnetTunTypeCfdTunnel TeamnetTunType = "cfd_tunnel"` - `const TeamnetTunTypeWARPConnector TeamnetTunType = "warp_connector"` - `const TeamnetTunTypeWARP TeamnetTunType = "warp"` - `const TeamnetTunTypeMagic TeamnetTunType = "magic"` - `const TeamnetTunTypeIPSec TeamnetTunType = "ip_sec"` - `const TeamnetTunTypeGRE TeamnetTunType = "gre"` - `const TeamnetTunTypeCNI TeamnetTunType = "cni"` - `TunnelID string` UUID of the tunnel. - `TunnelName string` A user-friendly name for a tunnel. - `VirtualNetworkID string` UUID of the virtual network. - `VirtualNetworkName string` A user-friendly name for the virtual network. ### Example ```go package main import ( "context" "fmt" "github.com/stainless-sdks/cloudflare-go" "github.com/stainless-sdks/cloudflare-go/option" "github.com/stainless-sdks/cloudflare-go/zero_trust" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) teamnet, err := client.ZeroTrust.Networks.Routes.IPs.Get( context.TODO(), "10.1.0.137", zero_trust.NetworkRouteIPGetParams{ AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", teamnet.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": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "comment": "Example comment for this route.", "created_at": "2021-01-25T18:22:34.317854Z", "deleted_at": "2009-11-10T23:00:00.000000Z", "network": "172.16.0.0/16", "tun_type": "cfd_tunnel", "tunnel_id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "tunnel_name": "blog", "virtual_network_id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "virtual_network_name": "us-east-1-vpc" }, "success": true } ``` # Networks ## Create a tunnel route (CIDR Endpoint) `client.ZeroTrust.Networks.Routes.Networks.New(ctx, ipNetworkEncoded, params) (*Route, error)` **post** `/accounts/{account_id}/teamnet/routes/network/{ip_network_encoded}` Routes a private network through a Cloudflare Tunnel. The CIDR in `ip_network_encoded` must be written in URL-encoded format. ### Parameters - `ipNetworkEncoded string` IP/CIDR range in URL-encoded format - `params NetworkRouteNetworkNewParams` - `AccountID param.Field[string]` Path param: Cloudflare account ID - `TunnelID param.Field[string]` Body param: UUID of the tunnel. - `Comment param.Field[string]` Body param: Optional remark describing the route. - `VirtualNetworkID param.Field[string]` Body param: UUID of the virtual network. ### Returns - `type Route struct{…}` - `ID string` UUID of the route. - `Comment string` Optional remark describing the route. - `CreatedAt Time` Timestamp of when the resource was created. - `DeletedAt Time` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `Network string` The private IPv4 or IPv6 range connected by the route, in CIDR notation. - `TunnelID string` UUID of the tunnel. - `VirtualNetworkID string` UUID of the virtual network. ### Example ```go package main import ( "context" "fmt" "github.com/stainless-sdks/cloudflare-go" "github.com/stainless-sdks/cloudflare-go/option" "github.com/stainless-sdks/cloudflare-go/zero_trust" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) route, err := client.ZeroTrust.Networks.Routes.Networks.New( context.TODO(), "172.16.0.0%2F16", zero_trust.NetworkRouteNetworkNewParams{ AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), TunnelID: cloudflare.F("f70ff985-a4ef-4643-bbbc-4a0ed4fc8415"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", route.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": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "comment": "Example comment for this route.", "created_at": "2021-01-25T18:22:34.317854Z", "deleted_at": "2009-11-10T23:00:00.000000Z", "network": "172.16.0.0/16", "tunnel_id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "virtual_network_id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415" }, "success": true } ``` ## Update a tunnel route (CIDR Endpoint) `client.ZeroTrust.Networks.Routes.Networks.Edit(ctx, ipNetworkEncoded, body) (*Route, error)` **patch** `/accounts/{account_id}/teamnet/routes/network/{ip_network_encoded}` Updates an existing private network route in an account. The CIDR in `ip_network_encoded` must be written in URL-encoded format. ### Parameters - `ipNetworkEncoded string` IP/CIDR range in URL-encoded format - `body NetworkRouteNetworkEditParams` - `AccountID param.Field[string]` Cloudflare account ID ### Returns - `type Route struct{…}` - `ID string` UUID of the route. - `Comment string` Optional remark describing the route. - `CreatedAt Time` Timestamp of when the resource was created. - `DeletedAt Time` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `Network string` The private IPv4 or IPv6 range connected by the route, in CIDR notation. - `TunnelID string` UUID of the tunnel. - `VirtualNetworkID string` UUID of the virtual network. ### Example ```go package main import ( "context" "fmt" "github.com/stainless-sdks/cloudflare-go" "github.com/stainless-sdks/cloudflare-go/option" "github.com/stainless-sdks/cloudflare-go/zero_trust" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) route, err := client.ZeroTrust.Networks.Routes.Networks.Edit( context.TODO(), "172.16.0.0%2F16", zero_trust.NetworkRouteNetworkEditParams{ AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", route.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": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "comment": "Example comment for this route.", "created_at": "2021-01-25T18:22:34.317854Z", "deleted_at": "2009-11-10T23:00:00.000000Z", "network": "172.16.0.0/16", "tunnel_id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "virtual_network_id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415" }, "success": true } ``` ## Delete a tunnel route (CIDR Endpoint) `client.ZeroTrust.Networks.Routes.Networks.Delete(ctx, ipNetworkEncoded, params) (*Route, error)` **delete** `/accounts/{account_id}/teamnet/routes/network/{ip_network_encoded}` Deletes a private network route from an account. The CIDR in `ip_network_encoded` must be written in URL-encoded format. If no virtual_network_id is provided it will delete the route from the default vnet. If no tun_type is provided it will fetch the type from the tunnel_id or if that is missing it will assume Cloudflare Tunnel as default. If tunnel_id is provided it will delete the route from that tunnel, otherwise it will delete the route based on the vnet and tun_type. ### Parameters - `ipNetworkEncoded string` IP/CIDR range in URL-encoded format - `params NetworkRouteNetworkDeleteParams` - `AccountID param.Field[string]` Path param: Cloudflare account ID - `TunType param.Field[NetworkRouteNetworkDeleteParamsTunType]` Query param: The type of tunnel. - `const NetworkRouteNetworkDeleteParamsTunTypeCfdTunnel NetworkRouteNetworkDeleteParamsTunType = "cfd_tunnel"` - `const NetworkRouteNetworkDeleteParamsTunTypeWARPConnector NetworkRouteNetworkDeleteParamsTunType = "warp_connector"` - `const NetworkRouteNetworkDeleteParamsTunTypeWARP NetworkRouteNetworkDeleteParamsTunType = "warp"` - `const NetworkRouteNetworkDeleteParamsTunTypeMagic NetworkRouteNetworkDeleteParamsTunType = "magic"` - `const NetworkRouteNetworkDeleteParamsTunTypeIPSec NetworkRouteNetworkDeleteParamsTunType = "ip_sec"` - `const NetworkRouteNetworkDeleteParamsTunTypeGRE NetworkRouteNetworkDeleteParamsTunType = "gre"` - `const NetworkRouteNetworkDeleteParamsTunTypeCNI NetworkRouteNetworkDeleteParamsTunType = "cni"` - `TunnelID param.Field[string]` Query param: UUID of the tunnel. - `VirtualNetworkID param.Field[string]` Query param: UUID of the virtual network. ### Returns - `type Route struct{…}` - `ID string` UUID of the route. - `Comment string` Optional remark describing the route. - `CreatedAt Time` Timestamp of when the resource was created. - `DeletedAt Time` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `Network string` The private IPv4 or IPv6 range connected by the route, in CIDR notation. - `TunnelID string` UUID of the tunnel. - `VirtualNetworkID string` UUID of the virtual network. ### Example ```go package main import ( "context" "fmt" "github.com/stainless-sdks/cloudflare-go" "github.com/stainless-sdks/cloudflare-go/option" "github.com/stainless-sdks/cloudflare-go/zero_trust" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) route, err := client.ZeroTrust.Networks.Routes.Networks.Delete( context.TODO(), "172.16.0.0%2F16", zero_trust.NetworkRouteNetworkDeleteParams{ AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", route.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": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "comment": "Example comment for this route.", "created_at": "2021-01-25T18:22:34.317854Z", "deleted_at": "2009-11-10T23:00:00.000000Z", "network": "172.16.0.0/16", "tunnel_id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "virtual_network_id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415" }, "success": true } ```