mirror of
https://github.com/cloudflare/cloudflared.git
synced 2025-05-11 21:16:36 +00:00

## Summary Previously the force flag in the tunnel delete command was only explicitly deleting the connections of a tunnel. Therefore, we are changing it to use the cascade query parameter supported by the API. That parameter will delegate to the server the deletion of the tunnel dependencies implicitly instead of the client doing it explicitly. This means that not only the connections will get deleted, but also the tunnel routes, ensuring that no dependencies are left without a non-deleted tunnel.
42 lines
1.3 KiB
Go
42 lines
1.3 KiB
Go
package cfapi
|
|
|
|
import (
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
type TunnelClient interface {
|
|
CreateTunnel(name string, tunnelSecret []byte) (*TunnelWithToken, error)
|
|
GetTunnel(tunnelID uuid.UUID) (*Tunnel, error)
|
|
GetTunnelToken(tunnelID uuid.UUID) (string, error)
|
|
GetManagementToken(tunnelID uuid.UUID) (string, error)
|
|
DeleteTunnel(tunnelID uuid.UUID, cascade bool) error
|
|
ListTunnels(filter *TunnelFilter) ([]*Tunnel, error)
|
|
ListActiveClients(tunnelID uuid.UUID) ([]*ActiveClient, error)
|
|
CleanupConnections(tunnelID uuid.UUID, params *CleanupParams) error
|
|
}
|
|
|
|
type HostnameClient interface {
|
|
RouteTunnel(tunnelID uuid.UUID, route HostnameRoute) (HostnameRouteResult, error)
|
|
}
|
|
|
|
type IPRouteClient interface {
|
|
ListRoutes(filter *IpRouteFilter) ([]*DetailedRoute, error)
|
|
AddRoute(newRoute NewRoute) (Route, error)
|
|
DeleteRoute(id uuid.UUID) error
|
|
GetByIP(params GetRouteByIpParams) (DetailedRoute, error)
|
|
}
|
|
|
|
type VnetClient interface {
|
|
CreateVirtualNetwork(newVnet NewVirtualNetwork) (VirtualNetwork, error)
|
|
ListVirtualNetworks(filter *VnetFilter) ([]*VirtualNetwork, error)
|
|
DeleteVirtualNetwork(id uuid.UUID, force bool) error
|
|
UpdateVirtualNetwork(id uuid.UUID, updates UpdateVirtualNetwork) error
|
|
}
|
|
|
|
type Client interface {
|
|
TunnelClient
|
|
HostnameClient
|
|
IPRouteClient
|
|
VnetClient
|
|
}
|