provider/cloudflare: Updated github.com/cloudflare/cloudflare-go (#9715)
To avoid the issue #8011 I have updated the used client library, with this update I don't get the mentioned issues like `unexpected EOF` anymore. Fixes #8011
This commit is contained in:
parent
eb1a58d966
commit
998899c2fe
|
@ -1,4 +1,4 @@
|
|||
Copyright (c) 2015-2016, CloudFlare. All rights reserved.
|
||||
Copyright (c) 2015-2016, Cloudflare. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
|
|
@ -7,14 +7,14 @@
|
|||
> **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](https://api.cloudflare.com/). This library
|
||||
A Go library for interacting with [Cloudflare's API v4](https://api.cloudflare.com/). 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
|
||||
* 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
|
||||
* Fetch Cloudflare's IP ranges for automating your firewall whitelisting
|
||||
|
||||
A command-line client, [flarectl](cmd/flarectl), is also available as part of this project.
|
||||
|
||||
|
@ -25,7 +25,7 @@ The current feature list includes:
|
|||
- [x] DNS Records
|
||||
- [x] Zones
|
||||
- [x] Web Application Firewall (WAF)
|
||||
- [x] CloudFlare IPs
|
||||
- [x] Cloudflare IPs
|
||||
- [x] User Administration (partial)
|
||||
- [x] Virtual DNS Management
|
||||
- [ ] Organization Administration
|
||||
|
@ -73,7 +73,7 @@ func main() {
|
|||
fmt.Println(u)
|
||||
|
||||
// Fetch the zone ID
|
||||
id, err := api.ZoneIDByName("example.com") // Assuming example.com exists in your CloudFlare account already
|
||||
id, err := api.ZoneIDByName("example.com") // Assuming example.com exists in your Cloudflare account already
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Package cloudflare implements the CloudFlare v4 API.
|
||||
// Package cloudflare implements the Cloudflare v4 API.
|
||||
package cloudflare
|
||||
|
||||
import (
|
||||
|
@ -7,7 +7,6 @@ import (
|
|||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
@ -24,7 +23,7 @@ type API struct {
|
|||
httpClient *http.Client
|
||||
}
|
||||
|
||||
// New creates a new CloudFlare v4 API client.
|
||||
// New creates a new Cloudflare v4 API client.
|
||||
func New(key, email string, opts ...Option) (*API, error) {
|
||||
if key == "" || email == "" {
|
||||
return nil, errors.New(errEmptyCredentials)
|
||||
|
@ -98,6 +97,9 @@ func (api *API) makeRequest(method, uri string, params interface{}) ([]byte, err
|
|||
return nil, errors.Errorf("HTTP status %d: invalid credentials", resp.StatusCode)
|
||||
case http.StatusForbidden:
|
||||
return nil, errors.Errorf("HTTP status %d: insufficient permissions", resp.StatusCode)
|
||||
case http.StatusServiceUnavailable, http.StatusBadGateway, http.StatusGatewayTimeout,
|
||||
522, 523, 524:
|
||||
return nil, errors.Errorf("HTTP status %d: service failure", resp.StatusCode)
|
||||
default:
|
||||
var s string
|
||||
if body != nil {
|
||||
|
@ -119,7 +121,7 @@ func (api *API) request(method, uri string, reqBody io.Reader) (*http.Response,
|
|||
}
|
||||
|
||||
// Apply any user-defined headers first.
|
||||
req.Header = api.headers
|
||||
req.Header = cloneHeader(api.headers)
|
||||
req.Header.Set("X-Auth-Key", api.APIKey)
|
||||
req.Header.Set("X-Auth-Email", api.APIEmail)
|
||||
|
||||
|
@ -131,6 +133,16 @@ func (api *API) request(method, uri string, reqBody io.Reader) (*http.Response,
|
|||
return resp, nil
|
||||
}
|
||||
|
||||
// cloneHeader returns a shallow copy of the header.
|
||||
// copied from https://godoc.org/github.com/golang/gddo/httputil/header#Copy
|
||||
func cloneHeader(header http.Header) http.Header {
|
||||
h := make(http.Header)
|
||||
for k, vs := range header {
|
||||
h[k] = vs
|
||||
}
|
||||
return h
|
||||
}
|
||||
|
||||
// ResponseInfo contains a code and message returned by the API as errors or
|
||||
// informational messages inside the response.
|
||||
type ResponseInfo struct {
|
||||
|
@ -153,165 +165,3 @@ type ResultInfo struct {
|
|||
Count int `json:"count"`
|
||||
Total int `json:"total_count"`
|
||||
}
|
||||
|
||||
// User describes a user account.
|
||||
type User struct {
|
||||
ID string `json:"id"`
|
||||
Email string `json:"email"`
|
||||
FirstName string `json:"first_name"`
|
||||
LastName string `json:"last_name"`
|
||||
Username string `json:"username"`
|
||||
Telephone string `json:"telephone"`
|
||||
Country string `json:"country"`
|
||||
Zipcode string `json:"zipcode"`
|
||||
CreatedOn time.Time `json:"created_on"`
|
||||
ModifiedOn time.Time `json:"modified_on"`
|
||||
APIKey string `json:"api_key"`
|
||||
TwoFA bool `json:"two_factor_authentication_enabled"`
|
||||
Betas []string `json:"betas"`
|
||||
Organizations []Organization `json:"organizations"`
|
||||
}
|
||||
|
||||
// UserResponse wraps a response containing User accounts.
|
||||
type UserResponse struct {
|
||||
Response
|
||||
Result User `json:"result"`
|
||||
}
|
||||
|
||||
// Owner describes the resource owner.
|
||||
type Owner struct {
|
||||
ID string `json:"id"`
|
||||
Email string `json:"email"`
|
||||
OwnerType string `json:"owner_type"`
|
||||
}
|
||||
|
||||
// DNSRecord represents a DNS record in a zone.
|
||||
type DNSRecord struct {
|
||||
ID string `json:"id,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Content string `json:"content,omitempty"`
|
||||
Proxiable bool `json:"proxiable,omitempty"`
|
||||
Proxied bool `json:"proxied,omitempty"`
|
||||
TTL int `json:"ttl,omitempty"`
|
||||
Locked bool `json:"locked,omitempty"`
|
||||
ZoneID string `json:"zone_id,omitempty"`
|
||||
ZoneName string `json:"zone_name,omitempty"`
|
||||
CreatedOn time.Time `json:"created_on,omitempty"`
|
||||
ModifiedOn time.Time `json:"modified_on,omitempty"`
|
||||
Data interface{} `json:"data,omitempty"` // data returned by: SRV, LOC
|
||||
Meta interface{} `json:"meta,omitempty"`
|
||||
Priority int `json:"priority,omitempty"`
|
||||
}
|
||||
|
||||
// DNSRecordResponse represents the response from the DNS endpoint.
|
||||
type DNSRecordResponse struct {
|
||||
Response
|
||||
Result DNSRecord `json:"result"`
|
||||
}
|
||||
|
||||
// DNSListResponse represents the response from the list DNS records endpoint.
|
||||
type DNSListResponse struct {
|
||||
Response
|
||||
Result []DNSRecord `json:"result"`
|
||||
}
|
||||
|
||||
// KeylessSSL represents Keyless SSL configuration.
|
||||
type KeylessSSL struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Host string `json:"host"`
|
||||
Port int `json:"port"`
|
||||
Status string `json:"success"`
|
||||
Enabled bool `json:"enabled"`
|
||||
Permissions []string `json:"permissions"`
|
||||
CreatedOn time.Time `json:"created_on"`
|
||||
ModifiedOn time.Time `json:"modifed_on"`
|
||||
}
|
||||
|
||||
// KeylessSSLResponse represents the response from the Keyless SSL endpoint.
|
||||
type KeylessSSLResponse struct {
|
||||
Response
|
||||
Result []KeylessSSL `json:"result"`
|
||||
}
|
||||
|
||||
// CustomPage represents a custom page configuration.
|
||||
type CustomPage struct {
|
||||
CreatedOn string `json:"created_on"`
|
||||
ModifiedOn time.Time `json:"modified_on"`
|
||||
URL string `json:"url"`
|
||||
State string `json:"state"`
|
||||
RequiredTokens []string `json:"required_tokens"`
|
||||
PreviewTarget string `json:"preview_target"`
|
||||
Description string `json:"description"`
|
||||
}
|
||||
|
||||
// CustomPageResponse represents the response from the custom pages endpoint.
|
||||
type CustomPageResponse struct {
|
||||
Response
|
||||
Result []CustomPage `json:"result"`
|
||||
}
|
||||
|
||||
// WAFPackage represents a WAF package configuration.
|
||||
type WAFPackage struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
ZoneID string `json:"zone_id"`
|
||||
DetectionMode string `json:"detection_mode"`
|
||||
Sensitivity string `json:"sensitivity"`
|
||||
ActionMode string `json:"action_mode"`
|
||||
}
|
||||
|
||||
// WAFPackagesResponse represents the response from the WAF packages endpoint.
|
||||
type WAFPackagesResponse struct {
|
||||
Response
|
||||
Result []WAFPackage `json:"result"`
|
||||
ResultInfo ResultInfo `json:"result_info"`
|
||||
}
|
||||
|
||||
// WAFRule represents a WAF rule.
|
||||
type WAFRule struct {
|
||||
ID string `json:"id"`
|
||||
Description string `json:"description"`
|
||||
Priority string `json:"priority"`
|
||||
PackageID string `json:"package_id"`
|
||||
Group struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
} `json:"group"`
|
||||
Mode string `json:"mode"`
|
||||
DefaultMode string `json:"default_mode"`
|
||||
AllowedModes []string `json:"allowed_modes"`
|
||||
}
|
||||
|
||||
// WAFRulesResponse represents the response from the WAF rule endpoint.
|
||||
type WAFRulesResponse struct {
|
||||
Response
|
||||
Result []WAFRule `json:"result"`
|
||||
ResultInfo ResultInfo `json:"result_info"`
|
||||
}
|
||||
|
||||
// PurgeCacheRequest represents the request format made to the purge endpoint.
|
||||
type PurgeCacheRequest struct {
|
||||
Everything bool `json:"purge_everything,omitempty"`
|
||||
Files []string `json:"files,omitempty"`
|
||||
Tags []string `json:"tags,omitempty"`
|
||||
}
|
||||
|
||||
// PurgeCacheResponse represents the response from the purge endpoint.
|
||||
type PurgeCacheResponse struct {
|
||||
Response
|
||||
}
|
||||
|
||||
// IPRanges contains lists of IPv4 and IPv6 CIDRs
|
||||
type IPRanges struct {
|
||||
IPv4CIDRs []string `json:"ipv4_cidrs"`
|
||||
IPv6CIDRs []string `json:"ipv6_cidrs"`
|
||||
}
|
||||
|
||||
// IPsResponse is the API response containing a list of IPs
|
||||
type IPsResponse struct {
|
||||
Response
|
||||
Result IPRanges `json:"result"`
|
||||
}
|
||||
|
|
|
@ -1,5 +1,24 @@
|
|||
package cloudflare
|
||||
|
||||
import "time"
|
||||
|
||||
// CustomPage represents a custom page configuration.
|
||||
type CustomPage struct {
|
||||
CreatedOn string `json:"created_on"`
|
||||
ModifiedOn time.Time `json:"modified_on"`
|
||||
URL string `json:"url"`
|
||||
State string `json:"state"`
|
||||
RequiredTokens []string `json:"required_tokens"`
|
||||
PreviewTarget string `json:"preview_target"`
|
||||
Description string `json:"description"`
|
||||
}
|
||||
|
||||
// CustomPageResponse represents the response from the custom pages endpoint.
|
||||
type CustomPageResponse struct {
|
||||
Response
|
||||
Result []CustomPage `json:"result"`
|
||||
}
|
||||
|
||||
// https://api.cloudflare.com/#custom-pages-for-a-zone-available-custom-pages
|
||||
// GET /zones/:zone_identifier/custom_pages
|
||||
|
||||
|
|
|
@ -3,10 +3,42 @@ package cloudflare
|
|||
import (
|
||||
"encoding/json"
|
||||
"net/url"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// DNSRecord represents a DNS record in a zone.
|
||||
type DNSRecord struct {
|
||||
ID string `json:"id,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Content string `json:"content,omitempty"`
|
||||
Proxiable bool `json:"proxiable,omitempty"`
|
||||
Proxied bool `json:"proxied,omitempty"`
|
||||
TTL int `json:"ttl,omitempty"`
|
||||
Locked bool `json:"locked,omitempty"`
|
||||
ZoneID string `json:"zone_id,omitempty"`
|
||||
ZoneName string `json:"zone_name,omitempty"`
|
||||
CreatedOn time.Time `json:"created_on,omitempty"`
|
||||
ModifiedOn time.Time `json:"modified_on,omitempty"`
|
||||
Data interface{} `json:"data,omitempty"` // data returned by: SRV, LOC
|
||||
Meta interface{} `json:"meta,omitempty"`
|
||||
Priority int `json:"priority,omitempty"`
|
||||
}
|
||||
|
||||
// DNSRecordResponse represents the response from the DNS endpoint.
|
||||
type DNSRecordResponse struct {
|
||||
Response
|
||||
Result DNSRecord `json:"result"`
|
||||
}
|
||||
|
||||
// DNSListResponse represents the response from the list DNS records endpoint.
|
||||
type DNSListResponse struct {
|
||||
Response
|
||||
Result []DNSRecord `json:"result"`
|
||||
}
|
||||
|
||||
// CreateDNSRecord creates a DNS record for the zone identifier.
|
||||
// API reference:
|
||||
// https://api.cloudflare.com/#dns-records-for-a-zone-create-dns-record
|
||||
|
|
|
@ -8,8 +8,20 @@ import (
|
|||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// IPRanges contains lists of IPv4 and IPv6 CIDRs
|
||||
type IPRanges struct {
|
||||
IPv4CIDRs []string `json:"ipv4_cidrs"`
|
||||
IPv6CIDRs []string `json:"ipv6_cidrs"`
|
||||
}
|
||||
|
||||
// IPsResponse is the API response containing a list of IPs
|
||||
type IPsResponse struct {
|
||||
Response
|
||||
Result IPRanges `json:"result"`
|
||||
}
|
||||
|
||||
/*
|
||||
IPs gets a list of CloudFlare's IP ranges
|
||||
IPs gets a list of Cloudflare's IP ranges
|
||||
|
||||
This does not require logging in to the API.
|
||||
|
||||
|
|
|
@ -1,5 +1,26 @@
|
|||
package cloudflare
|
||||
|
||||
import "time"
|
||||
|
||||
// KeylessSSL represents Keyless SSL configuration.
|
||||
type KeylessSSL struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Host string `json:"host"`
|
||||
Port int `json:"port"`
|
||||
Status string `json:"success"`
|
||||
Enabled bool `json:"enabled"`
|
||||
Permissions []string `json:"permissions"`
|
||||
CreatedOn time.Time `json:"created_on"`
|
||||
ModifiedOn time.Time `json:"modifed_on"`
|
||||
}
|
||||
|
||||
// KeylessSSLResponse represents the response from the Keyless SSL endpoint.
|
||||
type KeylessSSLResponse struct {
|
||||
Response
|
||||
Result []KeylessSSL `json:"result"`
|
||||
}
|
||||
|
||||
// CreateKeyless creates a new Keyless SSL configuration for the zone.
|
||||
// API reference:
|
||||
// https://api.cloudflare.com/#keyless-ssl-for-a-zone-create-a-keyless-ssl-configuration
|
||||
|
|
|
@ -209,7 +209,7 @@ type RailgunDiagnosis struct {
|
|||
ConnectionClose bool `json:"connection_close"`
|
||||
Cloudflare string `json:"cloudflare"`
|
||||
CFRay string `json:"cf-ray"`
|
||||
// NOTE: CloudFlare's online API documentation does not yet have definitions
|
||||
// NOTE: Cloudflare's online API documentation does not yet have definitions
|
||||
// for the following fields. See: https://api.cloudflare.com/#railgun-connections-for-a-zone-test-railgun-connection/
|
||||
CFWANError string `json:"cf-wan-error"`
|
||||
CFCacheStatus string `json:"cf-cache-status"`
|
||||
|
|
|
@ -2,10 +2,35 @@ package cloudflare
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// User describes a user account.
|
||||
type User struct {
|
||||
ID string `json:"id"`
|
||||
Email string `json:"email"`
|
||||
FirstName string `json:"first_name"`
|
||||
LastName string `json:"last_name"`
|
||||
Username string `json:"username"`
|
||||
Telephone string `json:"telephone"`
|
||||
Country string `json:"country"`
|
||||
Zipcode string `json:"zipcode"`
|
||||
CreatedOn time.Time `json:"created_on"`
|
||||
ModifiedOn time.Time `json:"modified_on"`
|
||||
APIKey string `json:"api_key"`
|
||||
TwoFA bool `json:"two_factor_authentication_enabled"`
|
||||
Betas []string `json:"betas"`
|
||||
Organizations []Organization `json:"organizations"`
|
||||
}
|
||||
|
||||
// UserResponse wraps a response containing User accounts.
|
||||
type UserResponse struct {
|
||||
Response
|
||||
Result User `json:"result"`
|
||||
}
|
||||
|
||||
// UserDetails provides information about the logged-in user.
|
||||
// API reference:
|
||||
// https://api.cloudflare.com/#user-user-details
|
||||
|
|
|
@ -6,6 +6,46 @@ import (
|
|||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// WAFPackage represents a WAF package configuration.
|
||||
type WAFPackage struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
ZoneID string `json:"zone_id"`
|
||||
DetectionMode string `json:"detection_mode"`
|
||||
Sensitivity string `json:"sensitivity"`
|
||||
ActionMode string `json:"action_mode"`
|
||||
}
|
||||
|
||||
// WAFPackagesResponse represents the response from the WAF packages endpoint.
|
||||
type WAFPackagesResponse struct {
|
||||
Response
|
||||
Result []WAFPackage `json:"result"`
|
||||
ResultInfo ResultInfo `json:"result_info"`
|
||||
}
|
||||
|
||||
// WAFRule represents a WAF rule.
|
||||
type WAFRule struct {
|
||||
ID string `json:"id"`
|
||||
Description string `json:"description"`
|
||||
Priority string `json:"priority"`
|
||||
PackageID string `json:"package_id"`
|
||||
Group struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
} `json:"group"`
|
||||
Mode string `json:"mode"`
|
||||
DefaultMode string `json:"default_mode"`
|
||||
AllowedModes []string `json:"allowed_modes"`
|
||||
}
|
||||
|
||||
// WAFRulesResponse represents the response from the WAF rule endpoint.
|
||||
type WAFRulesResponse struct {
|
||||
Response
|
||||
Result []WAFRule `json:"result"`
|
||||
ResultInfo ResultInfo `json:"result_info"`
|
||||
}
|
||||
|
||||
// ListWAFPackages returns a slice of the WAF packages for the given zone.
|
||||
func (api *API) ListWAFPackages(zoneID string) ([]WAFPackage, error) {
|
||||
var p WAFPackagesResponse
|
||||
|
|
|
@ -9,24 +9,31 @@ import (
|
|||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// Zone describes a CloudFlare zone.
|
||||
// Owner describes the resource owner.
|
||||
type Owner struct {
|
||||
ID string `json:"id"`
|
||||
Email string `json:"email"`
|
||||
OwnerType string `json:"owner_type"`
|
||||
}
|
||||
|
||||
// Zone describes a Cloudflare zone.
|
||||
type Zone struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
DevMode int `json:"development_mode"`
|
||||
OriginalNS []string `json:"original_name_servers"`
|
||||
OriginalRegistrar string `json:"original_registrar"`
|
||||
OriginalDNSHost string `json:"original_dnshost"`
|
||||
CreatedOn string `json:"created_on"`
|
||||
ModifiedOn string `json:"modified_on"`
|
||||
NameServers []string `json:"name_servers"`
|
||||
Owner Owner `json:"owner"`
|
||||
Permissions []string `json:"permissions"`
|
||||
Plan ZonePlan `json:"plan"`
|
||||
PlanPending ZonePlan `json:"plan_pending,omitempty"`
|
||||
Status string `json:"status"`
|
||||
Paused bool `json:"paused"`
|
||||
Type string `json:"type"`
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
DevMode int `json:"development_mode"`
|
||||
OriginalNS []string `json:"original_name_servers"`
|
||||
OriginalRegistrar string `json:"original_registrar"`
|
||||
OriginalDNSHost string `json:"original_dnshost"`
|
||||
CreatedOn time.Time `json:"created_on"`
|
||||
ModifiedOn time.Time `json:"modified_on"`
|
||||
NameServers []string `json:"name_servers"`
|
||||
Owner Owner `json:"owner"`
|
||||
Permissions []string `json:"permissions"`
|
||||
Plan ZonePlan `json:"plan"`
|
||||
PlanPending ZonePlan `json:"plan_pending,omitempty"`
|
||||
Status string `json:"status"`
|
||||
Paused bool `json:"paused"`
|
||||
Type string `json:"type"`
|
||||
Host struct {
|
||||
Name string
|
||||
Website string
|
||||
|
@ -182,6 +189,18 @@ type ZoneAnalyticsOptions struct {
|
|||
Continuous *bool
|
||||
}
|
||||
|
||||
// PurgeCacheRequest represents the request format made to the purge endpoint.
|
||||
type PurgeCacheRequest struct {
|
||||
Everything bool `json:"purge_everything,omitempty"`
|
||||
Files []string `json:"files,omitempty"`
|
||||
Tags []string `json:"tags,omitempty"`
|
||||
}
|
||||
|
||||
// PurgeCacheResponse represents the response from the purge endpoint.
|
||||
type PurgeCacheResponse struct {
|
||||
Response
|
||||
}
|
||||
|
||||
// newZone describes a new zone.
|
||||
type newZone struct {
|
||||
Name string `json:"name"`
|
||||
|
@ -282,7 +301,7 @@ func (api *API) ListZones(z ...string) ([]Zone, error) {
|
|||
//
|
||||
// API reference: https://api.cloudflare.com/#zone-zone-details
|
||||
func (api *API) ZoneDetails(zoneID string) (Zone, error) {
|
||||
res, err := api.makeRequest("GET", "/zones"+zoneID, nil)
|
||||
res, err := api.makeRequest("GET", "/zones/"+zoneID, nil)
|
||||
if err != nil {
|
||||
return Zone{}, errors.Wrap(err, errMakeRequestError)
|
||||
}
|
||||
|
@ -303,7 +322,7 @@ type ZoneOptions struct {
|
|||
Plan *ZonePlan `json:"plan,omitempty"`
|
||||
}
|
||||
|
||||
// ZoneSetPaused pauses CloudFlare service for the entire zone, sending all
|
||||
// ZoneSetPaused pauses Cloudflare service for the entire zone, sending all
|
||||
// traffic direct to the origin.
|
||||
func (api *API) ZoneSetPaused(zoneID string, paused bool) (Zone, error) {
|
||||
zoneopts := ZoneOptions{Paused: paused}
|
||||
|
@ -396,7 +415,7 @@ func (api *API) PurgeCache(zoneID string, pcr PurgeCacheRequest) (PurgeCacheResp
|
|||
//
|
||||
// API reference: https://api.cloudflare.com/#zone-delete-a-zone
|
||||
func (api *API) DeleteZone(zoneID string) (ZoneID, error) {
|
||||
res, err := api.makeRequest("DELETE", "/zones"+zoneID, nil)
|
||||
res, err := api.makeRequest("DELETE", "/zones/"+zoneID, nil)
|
||||
if err != nil {
|
||||
return ZoneID{}, errors.Wrap(err, errMakeRequestError)
|
||||
}
|
||||
|
|
|
@ -811,10 +811,10 @@
|
|||
"revision": "4dc77674aceaabba2c7e3da25d4c823edfb73f99"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "JJWLM3YJwgJD4vOLZnOYi1C2k0E=",
|
||||
"checksumSHA1": "L0fG0Aej27fMmhJwshFsqgVY4dM=",
|
||||
"path": "github.com/cloudflare/cloudflare-go",
|
||||
"revision": "746075f034254832ead032aee02ac072636ff25a",
|
||||
"revisionTime": "2016-06-01T21:42:51Z"
|
||||
"revision": "06a204ed25dc2873323f27d0e134ed4fdbd1c1ec",
|
||||
"revisionTime": "2016-10-05T09:59:54Z"
|
||||
},
|
||||
{
|
||||
"comment": "v2.3.0-alpha.0-652-ge552791",
|
||||
|
|
Loading…
Reference in New Issue