Skip to content

Go SDK for CacheFly Public API

License

cachefly/cachefly-sdk-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Go SDK for CacheFly Public API

Topics

Resources

License

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •  

Languages