Class CloudflareOperations
- Namespace
- Ando.Operations
- Assembly
- ando.dll
Provides Cloudflare CLI operations for build scripts. Methods register steps in the workflow rather than executing immediately.
public class CloudflareOperations : OperationsBase
- Inheritance
-
CloudflareOperations
- Inherited Members
Constructors
CloudflareOperations(StepRegistry, IBuildLogger, Func<ICommandExecutor>)
public CloudflareOperations(StepRegistry registry, IBuildLogger logger, Func<ICommandExecutor> executorFactory)
Parameters
registryStepRegistryloggerIBuildLoggerexecutorFactoryFunc<ICommandExecutor>
Methods
EnsureAuthenticated()
Registers a step to verify Cloudflare credentials are configured. If environment variables are not set, prompts the user for values interactively.
public void EnsureAuthenticated()
GetWranglerInstallInstructions()
Gets installation instructions for wrangler CLI.
public static string GetWranglerInstallInstructions()
Returns
- string
Installation command.
IsWranglerAvailable()
Checks if wrangler CLI is available on the system.
public static bool IsWranglerAvailable()
Returns
- bool
True if wrangler is available (via npx or globally), false otherwise.
PagesCreateProject(string, string)
Registers a step to create a new Cloudflare Pages project.
public void PagesCreateProject(string projectName, string productionBranch = "main")
Parameters
projectNamestringName for the new project.
productionBranchstringProduction branch name (defaults to "main").
PagesDeploy(DirectoryRef, Action<CloudflarePagesDeployOptions>)
Registers a step to deploy a directory to Cloudflare Pages. Use this overload when you need additional options like branch or commit metadata.
public void PagesDeploy(DirectoryRef directory, Action<CloudflarePagesDeployOptions> configure)
Parameters
directoryDirectoryRefDirectory to deploy (the build output folder).
configureAction<CloudflarePagesDeployOptions>Configuration for deployment options (must include project name).
PagesDeploy(DirectoryRef, string)
Registers a step to deploy a directory to Cloudflare Pages. The directory should be the build output (e.g., website / "dist").
public void PagesDeploy(DirectoryRef directory, string projectName)
Parameters
directoryDirectoryRefDirectory to deploy (the build output folder).
projectNamestringCloudflare Pages project name.
PagesListDeployments(string?)
Registers a step to list deployments for a Cloudflare Pages project.
public void PagesListDeployments(string? projectName = null)
Parameters
projectNamestringProject name. If null, uses CLOUDFLARE_PROJECT_NAME env var.
PagesListProjects()
Registers a step to list all Cloudflare Pages projects.
public void PagesListProjects()
PurgeCache(string?)
Registers a step to purge the entire Cloudflare cache for a zone. Accepts either a Zone ID or a domain name (e.g., "example.com"). If a domain name is provided, it will be resolved to a Zone ID via the API.
public void PurgeCache(string? zoneIdOrDomain = null)
Parameters
zoneIdOrDomainstringZone ID or domain name. If null, uses CLOUDFLARE_ZONE_ID env var.