terraform/vendor/github.com/cloudflare/cloudflare-go
Michael Warkentin 82288c6064 Fix #7690: Update vendored cloudflare-go library (#10910)
There was an upstream fix to allow updating of DNS record name fields.

A few other comment updates, but that's it.
2016-12-24 14:37:11 +00:00
..
LICENSE provider/cloudflare: Updated github.com/cloudflare/cloudflare-go (#9715) 2016-10-29 16:22:38 +01:00
README.md provider/cloudflare: Updated github.com/cloudflare/cloudflare-go (#9715) 2016-10-29 16:22:38 +01:00
cloudflare.go provider/cloudflare: Updated github.com/cloudflare/cloudflare-go (#9715) 2016-10-29 16:22:38 +01:00
cpage.go provider/cloudflare: Updated github.com/cloudflare/cloudflare-go (#9715) 2016-10-29 16:22:38 +01:00
dns.go Fix #7690: Update vendored cloudflare-go library (#10910) 2016-12-24 14:37:11 +00:00
errors.go
ips.go provider/cloudflare: Updated github.com/cloudflare/cloudflare-go (#9715) 2016-10-29 16:22:38 +01:00
keyless.go provider/cloudflare: Updated github.com/cloudflare/cloudflare-go (#9715) 2016-10-29 16:22:38 +01:00
options.go
organizations.go
pagerules.go
railgun.go Fix #7690: Update vendored cloudflare-go library (#10910) 2016-12-24 14:37:11 +00:00
ssl.go
user.go provider/cloudflare: Updated github.com/cloudflare/cloudflare-go (#9715) 2016-10-29 16:22:38 +01:00
virtualdns.go
waf.go provider/cloudflare: Updated github.com/cloudflare/cloudflare-go (#9715) 2016-10-29 16:22:38 +01:00
zone.go provider/cloudflare: Updated github.com/cloudflare/cloudflare-go (#9715) 2016-10-29 16:22:38 +01:00

README.md

cloudflare-go

GoDoc Build Status Go Report Card

Note: This library is under active development as we expand it to cover our (expanding!) API. Consider the public API of this package a little unstable as we work towards a v1.0.

A Go library for interacting with Cloudflare's API v4. This library allows you to:

  • Manage and automate changes to your DNS records within Cloudflare
  • Manage and automate changes to your zones (domains) on Cloudflare, including adding new zones to your account
  • List and modify the status of WAF (Web Application Firewall) rules for your zones
  • Fetch Cloudflare's IP ranges for automating your firewall whitelisting

A command-line client, flarectl, is also available as part of this project.

Features

The current feature list includes:

  • DNS Records
  • Zones
  • Web Application Firewall (WAF)
  • Cloudflare IPs
  • User Administration (partial)
  • Virtual DNS Management
  • Organization Administration
  • Railgun administration
  • Keyless SSL
  • Origin CA

Pull Requests are welcome, but please open an issue (or comment in an existing issue) to discuss any non-trivial changes before submitting code.

Installation

You need a working Go environment.

go get github.com/cloudflare/cloudflare-go

Getting Started

package main

import (
	"fmt"
	"log"
	"os"

	"github.com/cloudflare/cloudflare-go"
)

func main() {
	// Construct a new API object
	api, err := cloudflare.New(os.Getenv("CF_API_KEY"), os.Getenv("CF_API_EMAIL"))
	if err != nil {
		log.Fatal(err)
	}

	// Fetch user details on the account
	u, err := api.UserDetails()
	if err != nil {
		log.Fatal(err)
	}
	// Print user details
	fmt.Println(u)

	// Fetch the zone ID
	id, err := api.ZoneIDByName("example.com") // Assuming example.com exists in your Cloudflare account already
	if err != nil {
		log.Fatal(err)
	}

	// Fetch zone details
	zone, err := api.ZoneDetails(id)
	if err != nil {
		log.Fatal(err)
	}
	// Print zone details
	fmt.Println(zone)
}

Also refer to the API documentation for how to use this package in-depth.

License

BSD licensed. See the LICENSE file for details.