Documentation ¶
Index ¶
- type Client
- type Firewall
- type FirewallConfiguration
- type Firewalls
- type Options
- type Record
- type Records
- func (records *Records) Create(ctx context.Context, record *Record) (err error)
- func (records *Records) Delete(ctx context.Context, zoneID, recordID string) (err error)
- func (records *Records) Details(ctx context.Context, zoneID, recordID string) (record *Record, err error)
- func (records *Records) List(ctx context.Context, zoneID string) ([]*Record, error)
- func (records *Records) Patch(ctx context.Context, record *Record) (err error)
- type Response
- type ResponseError
- type ResultInfo
- type Zone
- type ZoneMeta
- type ZoneOwner
- type ZonePatch
- type ZonePlan
- type Zones
- func (zones *Zones) Create(ctx context.Context, domain string) (zone *Zone, err error)
- func (zones *Zones) Delete(ctx context.Context, id string) (err error)
- func (zones *Zones) Details(ctx context.Context, id string) (zone *Zone, err error)
- func (zones *Zones) List(ctx context.Context) ([]*Zone, error)
- func (zones *Zones) Patch(ctx context.Context, id string, patch *ZonePatch) (err error)
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { // Zones - Zones API Client. *Zones // Records - Records API Client. *Records // Firewalls - Firewalls API Client. *Firewalls // Options - API Client options. *Options }
Client - Cloudflare API Client.
type Firewall ¶
type Firewall struct { ID string `json:"id,omitempty"` Notes string `json:"notes,omitempty"` AllowedModes []string `json:"allowed_modes,omitempty"` Mode string `json:"mode,omitempty"` Configuration *FirewallConfiguration `json:"configuration,omitempty"` Scope *ZoneOwner `json:"scope,omitempty"` CreatedOn time.Time `json:"created_on,omitempty"` ModifiedOn time.Time `json:"modified_on,omitempty"` }
Firewall - Firewall for zone.
type FirewallConfiguration ¶
type FirewallConfiguration struct { Target string `json:"target,omitempty"` Value string `json:"value,omitempty"` }
FirewallConfiguration - Firewall configuration for the zone.
type Firewalls ¶
type Firewalls struct { // Options - Client options. *Options }
Firewalls - Cloudflare Fireall Zones API Client.
func (*Firewalls) Create ¶
func (firewalls *Firewalls) Create(ctx context.Context, id string, firewall *Firewall) (fw *Firewall, err error)
Create - Creates a firewall rule for zone.
func (*Firewalls) List ¶
List - Lists all firewall rules for zone.
Example ¶
ExampleFirewalls_List - Lists all firewall rules for a zone.
var client *Client ctx := context.Background() zones, err := client.Zones.List(ctx) if err != nil { log.Fatal(err) } else if len(zones) == 0 { log.Fatal("No zones were found") } rules, err := client.Firewalls.List(ctx, zones[0].ID) if err != nil { log.Fatal(err) } for _, rule := range rules { log.Printf("%#v", rule) }
Output:
type Record ¶
type Record 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"` Locked bool `json:"locked,omitempty"` TTL int `json:"ttl,omitempty"` Priority int `json:"priority,omitempty"` CreatedOn time.Time `json:"created_on,omitempty"` ModifiedOn time.Time `json:"modified_on,omitempty"` ZoneID string `json:"zone_id,omitempty"` ZoneName string `json:"zone_name,omitempty"` }
Record - Cloudflare DNS Record.
type Records ¶
type Records struct { // Options - Client options. *Options }
Records - Cloudflare Records API Client.
func (*Records) Create ¶
Create - Creates a zone DNS record. Required parameters of a record are - `type`, `name` and `content`. Optional parameters of a record are - `ttl`.
func (*Records) Details ¶
func (records *Records) Details(ctx context.Context, zoneID, recordID string) (record *Record, err error)
Details - Requests zone DNS record details by zone ID and record ID.
func (*Records) List ¶
List - Lists all zone DNS records.
Example ¶
ExampleRecords_List - Lists all zone DNS records.
var client *Client ctx := context.Background() zones, err := client.Zones.List(ctx) if err != nil { log.Fatal(err) } else if len(zones) == 0 { log.Fatal("No zones were found") } records, err := client.Records.List(ctx, zones[0].ID) if err != nil { log.Fatal(err) } for _, record := range records { log.Printf("%#v", record) }
Output:
type Response ¶
type Response struct { Result json.RawMessage `json:"result"` ResultInfo *ResultInfo `json:"result_info"` Errors []*ResponseError `json:"errors"` Success bool `json:"success"` }
Response - Cloudflare API Response.
type ResponseError ¶
type ResponseError struct { Code int `json:"code,omitempty"` Message string `json:"message,omitempty"` }
ResponseError - Cloudflare API Response error.
func (*ResponseError) Error ¶
func (err *ResponseError) Error() string
Error - Returns response error message.
type ResultInfo ¶
type ResultInfo struct { Page int `json:"page,omitempty"` PerPage int `json:"per_page,omitempty"` TotalPages int `json:"total_pages,omitempty"` Count int `json:"count,omitempty"` TotalCount int `json:"total_count,omitempty"` }
ResultInfo - Cloudflare API Response Result Info.
type Zone ¶
type Zone struct { ID string `json:"id,omitempty"` Name string `json:"name,omitempty"` Status string `json:"status,omitempty"` Paused bool `json:"paused,omitempty"` Type string `json:"type,omitempty"` DevelopmentMode int `json:"development_mode,omitempty"` NameServers []string `json:"name_servers,omitempty"` OriginalNameServers []string `json:"original_name_servers,omitempty"` ModifiedOn time.Time `json:"modified_on,omitempty"` CreatedOn time.Time `json:"created_on,omitempty"` CheckedOn time.Time `json:"checked_on,omitempty"` Meta *ZoneMeta `json:"meta,omitempty"` Owner *ZoneOwner `json:"owner,omitempty"` Plan *ZonePlan `json:"plan,omitempty"` Permissions []string `json:"permissions,omitempty"` }
Zone - Cloudflare Zone.
type ZoneMeta ¶
type ZoneMeta struct { Step int `json:"step,omitempty"` PageRuleQuota int `json:"page_rule_quota,omitempty"` CustomCertificateQuota int `json:"custom_certificate_quota,omitempty"` WildcardProxiable bool `json:"wildcard_proxiable,omitempty"` PhishingDetected bool `json:"phishing_detected,omitempty"` MultipleRailgunsAllowed bool `json:"multiple_railguns_allowed,omitempty"` }
ZoneMeta -
type ZoneOwner ¶
type ZoneOwner struct { Type string `json:"type,omitempty"` ID string `json:"id,omitempty"` Email string `json:"email,omitempty"` }
ZoneOwner -
type ZonePatch ¶
type ZonePatch struct { Plan *ZonePlan `json:"plan,omitempty"` Paused bool `json:"paused,omitempty"` VanityNameServers []string `json:"vanity_name_servers,omitempty"` }
ZonePatch -
type ZonePlan ¶
type ZonePlan struct { ID string `json:"id,omitempty"` Name string `json:"name,omitempty"` Price int `json:"price,omitempty"` Currency string `json:"currency,omitempty"` Frequency string `json:"frequency,omitempty"` LegacyID string `json:"legacy_id,omitempty"` IsSubscribed bool `json:"is_subscribed,omitempty"` CanSubscribe bool `json:"can_subscribe,omitempty"` ExternallyManaged bool `json:"externally_managed,omitempty"` }
ZonePlan -
type Zones ¶
type Zones struct { // Options - Client options. *Options }
Zones - Cloudflare Zones API Client.
func (*Zones) Delete ¶
Delete - Deletes zone by id.
Example ¶
ExampleZones_Delete - Deletes zone by ID.
var client *Client ctx := context.Background() zones, err := client.Zones.List(ctx) if err != nil { log.Fatal(err) } else if len(zones) == 0 { log.Fatal("No zones were found") } err = client.Zones.Delete(ctx, zones[0].ID) if err != nil { log.Fatal(err) } log.Printf("Deleted %s", zones[0].ID)
Output:
func (*Zones) Details ¶
Details - Requests Zone details by ID.
Example ¶
ExampleZones_Details - Gets zone details by ID.
var client *Client ctx := context.Background() zones, err := client.Zones.List(ctx) if err != nil { log.Fatal(err) } else if len(zones) == 0 { log.Fatal("No zones were found") } zone, err := client.Zones.Details(ctx, zones[0].ID) if err != nil { log.Fatal(err) } log.Printf("Got %s = %#v", zones[0].ID, zone)
Output:
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Godeps
|
|
_workspace/src/github.com/codegangsta/cli
Package cli provides a minimal framework for creating and organizing command line Go applications.
|
Package cli provides a minimal framework for creating and organizing command line Go applications. |
_workspace/src/github.com/olekukonko/tablewriter
Create & Generate text based table
|
Create & Generate text based table |
_workspace/src/golang.org/x/net/context
Package context defines the Context type, which carries deadlines, cancelation signals, and other request-scoped values across API boundaries and between processes.
|
Package context defines the Context type, which carries deadlines, cancelation signals, and other request-scoped values across API boundaries and between processes. |
_workspace/src/golang.org/x/net/context/ctxhttp
Package ctxhttp provides helper functions for performing context-aware HTTP requests.
|
Package ctxhttp provides helper functions for performing context-aware HTTP requests. |
cmd
Package cmd implements cloudflare cli commands.
|
Package cmd implements cloudflare cli commands. |