Skip to content

createCloudflareClient

createCloudflareClient(opts): object

Defined in: index.ts:42

Creates a Cloudflare API client with alerting, dns, pages, zones, tunnels, tokens and workers groups.

CloudflareClientOptions

object

alerting: object

policies: object

create: (accountId, input) => Promise<{ id: string; }>

string

CfNotificationPolicyInput

Promise<{ id: string; }>

list: (accountId) => Promise<CfNotificationPolicy[]>

string

Promise<CfNotificationPolicy[]>

update: (accountId, policyId, input) => Promise<{ id: string; }>

string

string

CfNotificationPolicyInput

Promise<{ id: string; }>

webhooks: object

create: (accountId, input) => Promise<{ id: string; }>

string

CfWebhookDestinationInput

Promise<{ id: string; }>

list: (accountId) => Promise<CfWebhookDestination[]>

string

Promise<CfWebhookDestination[]>

dns: object

create: (zoneId, record) => Promise<CfDnsRecord>

string

CfDnsRecordInput

Promise<CfDnsRecord>

delete: (zoneId, recordId) => Promise<{ id: string; }>

string

string

Promise<{ id: string; }>

list: (zoneId, query?) => Promise<CfDnsRecord[]>

string

string

string

Promise<CfDnsRecord[]>

update: (zoneId, recordId, record) => Promise<CfDnsRecord>

string

string

Partial<CfDnsRecordInput>

Promise<CfDnsRecord>

pages: object

addDomain: (accountId, projectName, hostname) => Promise<CfPagesDomain>

string

string

string

Promise<CfPagesDomain>

createDeployment: (accountId, projectName, branch) => Promise<CfPagesDeployment>

string

string

string

Promise<CfPagesDeployment>

createProject: (accountId, input) => Promise<CfPagesProject>

string

CfPagesProjectInput

Promise<CfPagesProject>

deleteDeployment: (accountId, projectName, deploymentId) => Promise<void>

string

string

string

Promise<void>

getDeployment: (accountId, projectName, deploymentId) => Promise<CfPagesDeployment>

string

string

string

Promise<CfPagesDeployment>

getProject: (accountId, name) => Promise<CfPagesProject>

string

string

Promise<CfPagesProject>

listDeployments: (accountId, projectName) => Promise<CfPagesDeployment[]>

string

string

Promise<CfPagesDeployment[]>

listDomains: (accountId, projectName) => Promise<CfPagesDomain[]>

string

string

Promise<CfPagesDomain[]>

listProjects: (accountId) => Promise<CfPagesProject[]>

string

Promise<CfPagesProject[]>

updateProject: (accountId, name, patch) => Promise<CfPagesProject>

string

string

Partial<Pick<CfPagesProject, "deployment_configs" | "production_branch">>

Promise<CfPagesProject>

tokens: object

create: (input) => Promise<CfCreatedToken>

POST /user/tokens: makes an API token and returns its value, once. Needs a token with API Tokens: Edit.

CfCreateTokenInput

Promise<CfCreatedToken>

delete: (id) => Promise<CfDeletedToken>

DELETE /user/tokens/{token_id}: destroys an API token. Needs a token with API Tokens: Write. The id goes into the path through encodeURIComponent. An unknown id is a ProviderApiError (404) the caller decides about.

string

Promise<CfDeletedToken>

permissionGroups: () => Promise<CfPermissionGroup[]>

GET /user/tokens/permission_groups: every permission a token can be given, with its id.

Promise<CfPermissionGroup[]>

verify: () => Promise<CfTokenVerification>

Promise<CfTokenVerification>

tunnels: object

create: (accountId, input) => Promise<CfTunnel>

string

string

Promise<CfTunnel>

delete: (accountId, tunnelId) => Promise<void>

string

string

Promise<void>

getConfig: (accountId, tunnelId) => Promise<{ config: CfTunnelConfig; }>

string

string

Promise<{ config: CfTunnelConfig; }>

list: (accountId) => Promise<CfTunnel[]>

string

Promise<CfTunnel[]>

putConfig: (accountId, tunnelId, config) => Promise<void>

string

string

CfTunnelConfig

Promise<void>

token: (accountId, tunnelId) => Promise<string>

string

string

Promise<string>

workers: object

createRoute: (zoneId, pattern, script) => Promise<CfWorkerRoute>

string

string

string

Promise<CfWorkerRoute>

deleteSecret: (accountId, scriptName, name) => Promise<void>

string

string

string

Promise<void>

listDeployments: (accountId, scriptName) => Promise<CfWorkerDeployment[]>

A script’s deployments, as Cloudflare lists them.

string

string

Promise<CfWorkerDeployment[]>

listRoutes: (zoneId) => Promise<CfWorkerRoute[]>

string

Promise<CfWorkerRoute[]>

listScripts: (accountId) => Promise<CfWorkerScript[]>

string

Promise<CfWorkerScript[]>

listSecrets: (accountId, scriptName) => Promise<CfWorkerSecret[]>

string

string

Promise<CfWorkerSecret[]>

putScript: (accountId, scriptName, script, options) => Promise<void>

Upload a script. Its secrets are kept by default, so a redeploy does not drop what was set earlier; pass keepSecrets: false to replace the script with no secrets bound.

string

string

string

boolean

Promise<void>

putSecret: (accountId, scriptName, name, value) => Promise<CfWorkerSecret>

string

string

string

string

Promise<CfWorkerSecret>

updateRoute: (zoneId, routeId, pattern, script) => Promise<CfWorkerRoute>

string

string

string

string

Promise<CfWorkerRoute>

zones: object

list: (query?) => Promise<CfZone[]>

string

number

Promise<CfZone[]>