add service monitors
This commit is contained in:
@@ -133,6 +133,26 @@ pub fn ingress_path(input: TokenStream) -> TokenStream {
|
||||
}
|
||||
}
|
||||
|
||||
/// Verify that a string is a valid http scheme
|
||||
/// Panics if not http or https
|
||||
#[proc_macro]
|
||||
pub fn http_scheme(input: TokenStream) -> TokenStream {
|
||||
let input = parse_macro_input!(input as LitStr);
|
||||
let scheme_str = input.value();
|
||||
|
||||
if scheme_str.to_lowercase() == "http" {
|
||||
let expanded = quote! {(#scheme_str.to_lowercase().to_string()) };
|
||||
return TokenStream::from(expanded);
|
||||
}
|
||||
|
||||
if scheme_str.to_lowercase() == "https" {
|
||||
let expanded = quote! {(#scheme_str.to_lowercase().to_string()) };
|
||||
return TokenStream::from(expanded);
|
||||
}
|
||||
|
||||
panic!("Invalid HTTP scheme")
|
||||
}
|
||||
|
||||
#[proc_macro]
|
||||
pub fn cidrv4(input: TokenStream) -> TokenStream {
|
||||
let input = parse_macro_input!(input as LitStr);
|
||||
|
||||
Reference in New Issue
Block a user