Skip to content

Commit

Permalink
make cloudflare-derive-macros work externally
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasqueirozb committed Jan 22, 2024
1 parent 857e502 commit 9f21ac9
Show file tree
Hide file tree
Showing 4 changed files with 155 additions and 4 deletions.
6 changes: 2 additions & 4 deletions cloudflare-derive-macros/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
extern crate proc_macro;

use proc_macro::TokenStream;
use quote::quote;
use syn::{parse_macro_input, DeriveInput};
Expand All @@ -10,7 +8,7 @@ pub fn api_result_derive(input: TokenStream) -> TokenStream {
let name = &ast.ident;

let gen = quote! {
impl crate::framework::response::ApiResult for #name {}
impl ::cloudflare::framework::response::ApiResult for #name {}
};

gen.into()
Expand All @@ -22,7 +20,7 @@ pub fn vec_api_result_derive(input: TokenStream) -> TokenStream {
let name = &ast.ident;

let gen = quote! {
impl crate::framework::response::ApiResult for Vec<#name> {}
impl ::cloudflare::framework::response::ApiResult for Vec<#name> {}
};

gen.into()
Expand Down
1 change: 1 addition & 0 deletions cloudflare/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![forbid(unsafe_code)]
extern crate self as cloudflare;

pub mod endpoints;
pub mod framework;
15 changes: 15 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
let
moz_overlay = import (builtins.fetchTarball https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz);
nixpkgs = import <nixpkgs> { overlays = [ moz_overlay ]; };
ruststable = (nixpkgs.latest.rustChannels.stable.rust.override { extensions = [ "rust-src" "rls-preview" "rust-analysis" "rustfmt-preview" ];});
in
with nixpkgs;
stdenv.mkDerivation {
name = "rust";
buildInputs = [ openssl ];

shellHook = ''
export OPENSSL_DIR="${openssl.dev}"
export OPENSSL_LIB_DIR="${openssl.out}/lib"
'';
}
137 changes: 137 additions & 0 deletions zone.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
{
"result": [
{
"id": "809555c6eba4f1cd7adb67bf0777ddf1",
"name": "shotmas.com",
"status": "active",
"paused": false,
"type": "full",
"development_mode": 0,
"name_servers": ["dan.ns.cloudflare.com", "monroe.ns.cloudflare.com"],
"original_name_servers": [
"dns1.registrar-servers.com",
"dns2.registrar-servers.com"
],
"original_registrar": "namecheap, inc. (id: 1068)",
"original_dnshost": null,
"modified_on": "2023-01-27T02:43:06.152947Z",
"created_on": "2023-01-27T02:36:44.522800Z",
"activated_on": "2023-01-27T02:43:06.152947Z",
"meta": {
"step": 2,
"custom_certificate_quota": 0,
"page_rule_quota": 3,
"phishing_detected": false,
"multiple_railguns_allowed": false
},
"owner": { "id": null, "type": "user", "email": null },
"account": {
"id": "e9b3e29e20022cef9cf1b498df074af0",
"name": "[email protected]'s Account"
},
"tenant": { "id": null, "name": null },
"tenant_unit": { "id": null },
"permissions": [
"#lb:edit",
"#lb:read",
"#waf:read",
"#waf:edit",
"#organization:read",
"#organization:edit",
"#vectorize:read",
"#vectorize:edit",
"#query_cache:read",
"#query_cache:edit",
"#integration:edit",
"#access:read",
"#access:edit",
"#integration:read",
"#integration:install",
"#waitingroom:read",
"#waitingroom:edit",
"#magic:read",
"#magic:edit",
"#dex:read",
"#analytics:read",
"#dex:edit",
"#zone_settings:read",
"#zone_settings:edit",
"#dns_records:read",
"#dns_records:edit",
"#worker:edit",
"#zone_versioning:read",
"#zone_versioning:edit",
"#ssl:edit",
"#zaraz:publish",
"#ssl:read",
"#worker:read",
"#logs:edit",
"#billing:read",
"#fbm:edit",
"#fbm:read",
"#fbm_acc:edit",
"#logs:read",
"#http_applications:read",
"#http_applications:edit",
"#blocks:read",
"#blocks:edit",
"#api_gateway:read",
"#api_gateway:edit",
"#zaraz:edit",
"#zaraz:read",
"#stream:read",
"#stream:edit",
"#teams:read",
"#teams:edit",
"#healthchecks:read",
"#web3:read",
"#web3:edit",
"#r2_bucket:read",
"#r2_bucket:edit",
"#image:read",
"#image:edit",
"#healthchecks:edit",
"#dash_sso:edit",
"#dash_sso:read",
"#teams:pii",
"#page_shield:read",
"#page_shield:edit",
"#zone:edit",
"#zone:read",
"#billing:edit",
"#teams:report",
"#subscription:edit",
"#app:edit",
"#subscription:read",
"#cache_purge:edit",
"#auditlogs:read",
"#member:edit",
"#member:read",
"#legal:read",
"#legal:edit"
],
"plan": {
"id": "0feeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"name": "Free Website",
"price": 0,
"currency": "USD",
"frequency": "",
"is_subscribed": false,
"can_subscribe": false,
"legacy_id": "free",
"legacy_discount": false,
"externally_managed": false
}
}
],
"result_info": {
"page": 1,
"per_page": 20,
"total_pages": 1,
"count": 1,
"total_count": 1
},
"success": true,
"errors": [],
"messages": []
}

0 comments on commit 9f21ac9

Please sign in to comment.