/// Creates the tail and attaches it to a Worker.
///
/// If successful, the tail must be kept-alive before its expiration time.
Creates the tail and attaches it to a Worker.
If successful, the tail must be kept-alive before its expiration time.
Creates the tail and attaches it to a Worker . If successful the tail must be kept - alive before its expiration time .
pub async fn create(&mut self) -> Result<()> {
        match self.id {
            None => match http::cf_v4_api_client_async(&self.user)?
                .request(&CreateTail {
                    account_identifier: &self.account_id,
                    script_name: &self.script_name,
                    params: CreateTailParams {
                        url: self.url.clone().map(String::from),
                    },
                })
                .await
            {
                Ok(response) => {
                    let tail = response.result;
                    log::info!("Created tail: {:?}", tail);
                    self.id = Some(tail.id);
                    self.expires_at = to_instant(tail.expires_at);
                    self.url = Some(Url::parse(
                        &tail.url.expect("Expected a URL from tail response"),
                    )?);
                    Ok(())
                }
                Err(err) => {
                    anyhow::bail!("Failed to create tail: {}", http::format_error(err, None))
                }
            },
            _ => Ok(()),
        }
    }
pub async fn create ( & mut self ) -> Result < ( ) > { match self . id { None => match http :: cf_v4_api_client_async ( & self . user ) ? . request ( & CreateTail { account_identifier : & self . account_id , script_name : & self . script_name , params : CreateTailParams { url : self . url . clone ( ) . map ( String :: from ) , } , } ) . await { Ok ( response ) => { let tail = response . result ; log :: info ! ( " " tail ) ; self . id = Some ( tail . id ) ; self . expires_at = to_instant ( tail . expires_at ) ; self . url = Some ( Url :: parse ( & tail . url . expect ( " " ) , ) ? ) ; Ok ( ( ) ) } Err ( err ) => { anyhow :: bail ! ( " " http format_error ( err None ) ) } } , _ => Ok ( ( ) ) , } }
Creates the tail and attaches it to a Worker.
Creates the tail and attaches it to a Worker .
&mut self