cachefly-sdk-go

module
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 6, 2026 License: MIT

README

CacheFly Logo

Go implementation of CacheFly API (2.6.0)


CacheFly SDK for Go

A Golang SDK for interacting with the CacheFly CDN API v2.6.

v2.6 is the current target.

This SDK is designed to abstract the HTTP API layer and simplify working with CacheFly resources and can be used independently as golang package in your project or as the backend foundation for managing CacheFly resources.

🏷️ v1.1.0 latest

CacheFly

CacheFly CDN is the only CDN built for throughput, delivering rich-media content up to 158% more than other major CDNs.

✨ Features

  • Accounts
    Manage your CacheFly account and child accounts, including 2FA settings.

  • Services
    Create, list, update, activate/deactivate services and control access/origin logging.

  • Service Domains
    Add, list, update, delete domains and signal readiness for validation.

  • Service Rules
    List and update routing/cache rules and fetch the JSON schema for custom rules.

  • Service Options
    View and save basic settings, manage legacy and ProtectServe API keys, and configure FTP.

  • Image Optimization
    Fetch, create, update and toggle image‐optimization configurations.

  • Certificates
    List, create, retrieve, and delete TLS certificates.

  • Origins
    Add, list, update, and remove origin servers.

  • Users
    Create, list, update, deactivate users and manage permissions + 2FA.

  • Script Configs
    Manage custom scripts: list, create, update, delete.

  • TLS Profiles
    Create and manage TLS profiles for your services.

  • Delivery Regions
    Discover available CDN delivery regions for service provisioning.

  • Log Targets
    Manage log target configurations and assign them to services for access/origin logging.

Installation

go get github.com/cachefly/cachefly-sdk-go@v1.1.0

Quick Start

Copy the snippet below into your project to get started:

client := cachefly.NewClient(cachefly.WithToken("YOUR_API_TOKEN"))
resp, _ := client.Accounts.List(ctx, api.ListAccountsOptions{Offset: 0, Limit: 5})
for _, a := range resp.Accounts {
    fmt.Println(a.ID, a.CompanyName)
}

Example Usage

Below is an example of how to use the CacheFly SDK in your Go project:

  1. Create a .env file in your project root containing:

    CACHEFLY_API_TOKEN=your_real_api_token_here
    
  2. Run with:

    go run examples/<resource>/<example>.go
    

Accounts

Services

Service Domains

Service Rules

Service Options

Service Options – Referer Rules

Image Optimization

Certificates

Origins

Users

User Security

Script Configs

Script Config Definitions

TLS Profiles

Tests

The SDK includes unit tests at pkg/cachefly/api/v2_6.

go test -v -count=1 ./pkg/cachefly/api/v2_6

License

This project is licensed under the MIT License - see the LICENSE file for details.

Directories

Path Synopsis
examples
accounts/activate command
Example usage to demonstrates how to activate a CacheFly child account using the SDK.
Example usage to demonstrates how to activate a CacheFly child account using the SDK.
accounts/createchild command
Create a new CacheFly child account using the SDK.
Create a new CacheFly child account using the SDK.
accounts/deactivate command
Example usage to demonstrates how to deactivate a CacheFly child account using the SDK.
Example usage to demonstrates how to deactivate a CacheFly child account using the SDK.
accounts/disable2fa command
Example demonstrates disabling two-factor authentication for the current CacheFly account.
Example demonstrates disabling two-factor authentication for the current CacheFly account.
accounts/enable2fa command
Example demonstrates enabling two-factor authentication for the current CacheFly account.
Example demonstrates enabling two-factor authentication for the current CacheFly account.
accounts/get command
Example demonstrates retrieving the current CacheFly account information.
Example demonstrates retrieving the current CacheFly account information.
accounts/getchildauthtoken command
Example demonstrates retrieving an authentication token for a CacheFly child account.
Example demonstrates retrieving an authentication token for a CacheFly child account.
accounts/list command
accounts/update command
availability/domains command
Example demonstrates checking domain name availability.
Example demonstrates checking domain name availability.
origins/create command
origins/delete command
origins/getbyid command
origins/list command
origins/update command
saml/activate command
Example demonstrates activating a SAML configuration.
Example demonstrates activating a SAML configuration.
saml/deactivate command
Example demonstrates deactivating a SAML configuration.
Example demonstrates deactivating a SAML configuration.
script_definitions/getbyid command
Example demonstrates retrieving a specific script definition from CacheFly.
Example demonstrates retrieving a specific script definition from CacheFly.
script_definitions/list command
Example demonstrates working with Script Definitions via the CacheFly SDK.
Example demonstrates working with Script Definitions via the CacheFly SDK.
service_options/get_option command
Get basic service options for a CacheFly service.
Get basic service options for a CacheFly service.
service_options/save command
Example demonstrates updating service options for a CacheFly service with validation.
Example demonstrates updating service options for a CacheFly service with validation.
services/create command
services/list command
services/purge command
Example demonstrates purging cached content for a CacheFly service.
Example demonstrates purging cached content for a CacheFly service.
users/activate command
users/create command
users/delete command
users/enable2fa command
users/getbyid command
users/list command
users/me command
users/update command
users/update_me command
internal
pkg
cachefly
Package cachefly provides the main client interface for CacheFly SDK.
Package cachefly provides the main client interface for CacheFly SDK.
cachefly/api
Package api provides the internal API client implementations for the CacheFly SDK.
Package api provides the internal API client implementations for the CacheFly SDK.
cachefly/api/v2_6
package v2_6 implements CacheFly API v2.6 service interfaces.
package v2_6 implements CacheFly API v2.6 service interfaces.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL