type Cloudflare = {
token: string;
email: string;
key: string;
};
/**
* Delete a zone ruleset
* Deletes all versions of an existing zone ruleset.
*/
export async function main(
auth: Cloudflare,
ruleset_id: string,
zone_id: string
) {
const url = new URL(
`https://api.cloudflare.com/client/v4/zones/${zone_id}/rulesets/${ruleset_id}`
);
const response = await fetch(url, {
method: "DELETE",
headers: {
"X-AUTH-EMAIL": auth.email,
"X-AUTH-KEY": auth.key,
Authorization: "Bearer " + auth.token,
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.text();
}
Submitted by hugo697 86 days ago
type Cloudflare = {
token: string;
email: string;
key: string;
};
/**
* Delete a zone ruleset
* Deletes all versions of an existing zone ruleset.
*/
export async function main(
auth: Cloudflare,
ruleset_id: string,
zone_id: string
) {
const url = new URL(
`https://api.cloudflare.com/client/v4/zones/${zone_id}/rulesets/${ruleset_id}`
);
const response = await fetch(url, {
method: "DELETE",
headers: {
"X-AUTH-EMAIL": auth.email,
"X-AUTH-KEY": auth.key,
Authorization: "Bearer " + auth.token,
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.text();
}
Submitted by hugo697 624 days ago