Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cloudflare tunnel endpoints #260

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

ArturoGuerra
Copy link

Breaking changes

  • Removes route dns endpoints as its not documented
    use crate::framework::endpoint::{EndpointSpec, Method};
    use super::RouteResult;
    use serde::Serialize;
    use uuid::Uuid;
    /// Route for a Named Argo Tunnel
    /// This creates a new route for the identified Tunnel. More than 1 route may co-exist for the same
    /// Tunnel.
    /// Note that this modifies only metadata on Cloudflare side to route traffic to the Tunnel, but
    /// it is still up to the user to run the Tunnel to receive that traffic.
    #[derive(Debug)]
    pub struct RouteTunnel<'a> {
    pub zone_tag: &'a str,
    pub tunnel_id: Uuid,
    pub params: Params<'a>,
    }
    impl<'a> EndpointSpec<RouteResult> for RouteTunnel<'a> {
    fn method(&self) -> Method {
    Method::PUT
    }
    fn path(&self) -> String {
    format!("zones/{}/tunnels/{}/routes", self.zone_tag, self.tunnel_id)
    }
    #[inline]
    fn body(&self) -> Option<String> {
    let body = serde_json::to_string(&self.params).unwrap();
    Some(body)
    }
    }
    /// Params for routing a Named Argo Tunnel
    #[derive(Serialize, Clone, Debug)]
    #[serde(tag = "type", rename_all = "lowercase")]
    pub enum Params<'a> {
    Dns { user_hostname: &'a str },
    Lb { lb_name: &'a str, lb_pool: &'a str },
    }

Changes the following endpoints to align with the api spec

Features

Implements missing endpoints in cfd_tunnels

Closes #247

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add CfdTunnel endpoints
1 participant