この紹介文は現在英語版のみです。
Cloudflare Go is the official Go client library for the Cloudflare API. It provides comprehensive support for all Cloudflare services including DNS, Firewall, Load Balancing, Workers, and more.
Key Features
- Complete Cloudflare API coverage
- Type-safe API calls
- Automatic retries and error handling
- Support for pagination and concurrent requests
- Comprehensive documentation and examples
Quick Start
package main
import (
"context"
"fmt"
"log"
"os"
"github.com/cloudflare/cloudflare-go"
)
func main() {
// Create API client
api, err := cloudflare.New(os.Getenv("CF_API_KEY"), os.Getenv("CF_API_EMAIL"))
if err != nil {
log.Fatal(err)
}
// Get account information
ctx := context.Background()
accounts, err := api.Accounts(ctx)
if err != nil {
log.Fatal(err)
}
// Print account information
for _, account := range accounts {
fmt.Printf("%s: %s\n", account.ID, account.Name)
}
}
Installation
go get github.com/cloudflare/cloudflare-go
Documentation
For complete API documentation, please refer to the Cloudflare API Documentation.
Contributing
Pull requests and issues are welcome. Before submitting, please ensure:
- Code follows Go standard formatting
- Necessary tests are added
- Documentation is updated accordingly
License
This project is licensed under the Apache License 2.0.