Documentation
¶
Index ¶
- Constants
- Variables
- func BuildApp(args BuildArgs) *cli.Command
- func CacheCleaner(ctx context.Context, c *cli.Command) error
- func CheckAPITokenPermission(ctx context.Context, permission ...APIPermissionName) error
- func DNSCleaner(ctx context.Context, c *cli.Command) error
- func DNSPurge(ctx context.Context, c *cli.Command) error
- func DeploymentsPaginate(params PagesDeploymentPaginationOptions) ([]cloudflare.PagesProjectDeployment, error)
- func DownloadDNS(ctx context.Context, c *cli.Command) error
- func GetLatestTunnelVersion(ctx context.Context, token string) (string, error)
- func GetWebOauthToken(ctx context.Context) (*oauth2.Token, error)
- func GetZoneID(ctx context.Context, c *cli.Command) error
- func PollForToken(ctx context.Context, registrationID string) (*oauth2.Token, error)
- func PollListBulkOperation(ctx context.Context, rc *cloudflare.ResourceContainer, ID string) error
- func PruneBranchDeployments(branch string, options pruneDeploymentOptions) []cloudflare.PagesProjectDeployment
- func PruneDeploymentsRoot(ctx context.Context, c *cli.Command) error
- func PruneDeploymentsScreen(ctx context.Context, c *cli.Command) error
- func PruneTimeDeployments(options pruneDeploymentOptions) (toDelete []cloudflare.PagesProjectDeployment)
- func PurgeDeploymentsScreen(ctx context.Context, c *cli.Command) error
- func RapidDNSDelete(rc *cloudflare.ResourceContainer, dnsRecords []cloudflare.DNSRecord) map[string]error
- func RapidPagesDeploymentDelete(options pruneDeploymentOptions) map[string]error
- func SetLogLevel(c *cli.Command, logger *logrus.Logger)
- func SyncList(ctx context.Context, c *cli.Command) error
- func TunnelVersionAction(ctx context.Context, c *cli.Command) error
- func UploadDNS(_ context.Context, c *cli.Command) error
- func VerifyAPIToken(ctx context.Context) (cloudflare.APIToken, error)
- type APIPermissionName
- type BuildArgs
- type DNSRecord
- type OAuthV1RegistrationResponse
- type OAuthV1Response
- type OauthStatus
- type PagesDeploymentPaginationOptions
- type RecordFile
Constants ¶
const ( // VersionContextKey is the context key under which the app version string is stored. VersionContextKey ctxKey = iota // SkipTokenContextKey is the context key on if the API token permission should be checked. SkipTokenContextKey )
Variables ¶
var (
APIClient *cloudflare.API
)
var (
ErrAPIPermissionError = errors.New("API Token does not have the required permissions")
)
Functions ¶
func CheckAPITokenPermission ¶
func CheckAPITokenPermission(ctx context.Context, permission ...APIPermissionName) error
func DNSCleaner ¶
DNSCleaner is the main action function for the dns-cleaner command. It checks if a DNS file exists. If there isn't a DNS file, then it downloads records, if there is a file there, then it uploads records.
func DeploymentsPaginate ¶
func DeploymentsPaginate(params PagesDeploymentPaginationOptions) ([]cloudflare.PagesProjectDeployment, error)
DeploymentsPaginate is a helper function to paginate through all deployments. This is necessary because we need to be able to adjust the per_page parameter for large projects.
func DownloadDNS ¶
DownloadDNS downloads current DNS records from Cloudflare.
func GetLatestTunnelVersion ¶
func PollForToken ¶
func PollListBulkOperation ¶
func PollListBulkOperation(ctx context.Context, rc *cloudflare.ResourceContainer, ID string) error
func PruneBranchDeployments ¶
func PruneBranchDeployments(branch string, options pruneDeploymentOptions) []cloudflare.PagesProjectDeployment
PruneBranchDeployments will return a list of deployments to delete based on the branch name.
func PruneDeploymentsRoot ¶
PruneDeploymentsRoot is the main function for pruning and purging deployments.
func PruneDeploymentsScreen ¶
PruneDeploymentsScreen is the entry point for the prune-deployments command. It handles parsing the CLI arguments and then calls PruneDeploymentsRoot.
func PruneTimeDeployments ¶
func PruneTimeDeployments(options pruneDeploymentOptions) (toDelete []cloudflare.PagesProjectDeployment)
PruneTimeDeployments will return a list of deployments to delete based on the time range.
func PurgeDeploymentsScreen ¶
PurgeDeploymentsScreen is the entry point for the purge-deployments command It just calls PruneDeploymentsRoot.
func RapidDNSDelete ¶
func RapidDNSDelete(rc *cloudflare.ResourceContainer, dnsRecords []cloudflare.DNSRecord) map[string]error
RapidDNSDelete is a helper function to delete DNS records quickly. Uses a pool of goroutines to delete records in parallel.
func RapidPagesDeploymentDelete ¶
RapidPagesDeploymentDelete is a helper function to delete Pages deployments quickly. Uses a pool of goroutines to delete deployments in parallel.
func SetLogLevel ¶
SetLogLevel sets the log level based on the CLI flags.
func VerifyAPIToken ¶
func VerifyAPIToken(ctx context.Context) (cloudflare.APIToken, error)
Types ¶
type APIPermissionName ¶
type APIPermissionName string
const ( DNSWrite APIPermissionName = "DNSWrite" PagesWrite APIPermissionName = "PagesWrite" TunnelRead APIPermissionName = "TunnelRead" TunnelWrite APIPermissionName = "TunnelWrite" ListsWrites APIPermissionName = "ListsWrite" CachePurge APIPermissionName = "CachePurge" )
type OAuthV1Response ¶
type OAuthV1Response struct {
Status OauthStatus `json:"status"`
AccessToken string `json:"access_token,omitempty"`
ExpiresAt int64 `json:"expires_at,omitempty"`
}
type OauthStatus ¶
type OauthStatus string
const ( OauthPending OauthStatus = "pending" OauthSuccess OauthStatus = "success" )
type RecordFile ¶
type RecordFile struct {
ZoneName string `yaml:"zone_name"`
ZoneID string `yaml:"zone_id"`
Records []DNSRecord `yaml:"records"`
}
RecordFile is the struct of the YAML DNS file.