cloudflare

package
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 15, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const DNSRecordPayloadType = "cloudflare.dnsRecord"

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Token string

	BaseURL string
	// contains filtered or unexported fields
}

func NewClient

func NewClient(http core.HTTPContext, ctx core.IntegrationContext) (*Client, error)

func (*Client) CreateDNSRecord added in v0.6.0

func (c *Client) CreateDNSRecord(zoneID string, req CreateDNSRecordRequest) (*DNSRecord, error)

func (*Client) CreateRedirectRule

func (c *Client) CreateRedirectRule(zoneID, rulesetID string, req CreateRedirectRuleRequest) (*RedirectRule, error)

CreateRedirectRule creates a new redirect rule in a zone's ruleset

func (*Client) DeleteDNSRecord added in v0.6.0

func (c *Client) DeleteDNSRecord(zoneID, recordID string) (*DNSRecord, error)

DeleteDNSRecord deletes a DNS record by its ID within a zone. It returns the deleted DNS record (Cloudflare API returns it in result).

func (*Client) GetDNSRecord added in v0.6.0

func (c *Client) GetDNSRecord(zoneID, recordID string) (*DNSRecord, error)

GetDNSRecord retrieves a DNS record by ID from a zone

func (*Client) GetRulesetForPhase

func (c *Client) GetRulesetForPhase(zoneID, phase string) (*Ruleset, error)

GetRulesetForPhase gets the ruleset ID for a specific phase in a zone

func (*Client) ListDNSRecords added in v0.6.0

func (c *Client) ListDNSRecords(zoneID string) ([]DNSRecord, error)

ListDNSRecords retrieves all DNS records for a zone

func (*Client) ListRedirectRules

func (c *Client) ListRedirectRules(zoneID string) ([]RedirectRule, error)

ListRedirectRules retrieves all redirect rules for a zone

func (*Client) ListZones

func (c *Client) ListZones() ([]Zone, error)

ListZones retrieves all zones accessible with the API token

func (*Client) UpdateDNSRecord added in v0.6.0

func (c *Client) UpdateDNSRecord(zoneID, recordID string, req UpdateDNSRecordRequest) (*DNSRecord, error)

UpdateDNSRecord updates an existing DNS record in a zone.

func (*Client) UpdateRedirectRule

func (c *Client) UpdateRedirectRule(zoneID, rulesetID, ruleID string, req UpdateRedirectRuleRequest) (*RedirectRule, error)

UpdateRedirectRule updates a specific redirect rule in a zone's ruleset

type Cloudflare

type Cloudflare struct{}

func (*Cloudflare) Actions added in v0.6.0

func (c *Cloudflare) Actions() []core.Action

func (*Cloudflare) Cleanup added in v0.6.0

func (*Cloudflare) Components

func (c *Cloudflare) Components() []core.Component

func (*Cloudflare) Configuration

func (c *Cloudflare) Configuration() []configuration.Field

func (*Cloudflare) Description

func (c *Cloudflare) Description() string

func (*Cloudflare) HandleAction added in v0.6.0

func (c *Cloudflare) HandleAction(ctx core.IntegrationActionContext) error

func (*Cloudflare) HandleRequest

func (c *Cloudflare) HandleRequest(ctx core.HTTPRequestContext)

func (*Cloudflare) Icon

func (c *Cloudflare) Icon() string

func (*Cloudflare) Instructions

func (c *Cloudflare) Instructions() string

func (*Cloudflare) Label

func (c *Cloudflare) Label() string

func (*Cloudflare) ListResources

func (c *Cloudflare) ListResources(resourceType string, ctx core.ListResourcesContext) ([]core.IntegrationResource, error)

func (*Cloudflare) Name

func (c *Cloudflare) Name() string

func (*Cloudflare) Sync

func (c *Cloudflare) Sync(ctx core.SyncContext) error

func (*Cloudflare) Triggers

func (c *Cloudflare) Triggers() []core.Trigger

type CloudflareAPIError added in v0.6.0

type CloudflareAPIError struct {
	StatusCode int
	Errors     []CloudflareError
	Body       []byte
}

func (*CloudflareAPIError) Error added in v0.6.0

func (e *CloudflareAPIError) Error() string

type CloudflareError added in v0.6.0

type CloudflareError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

type Configuration

type Configuration struct {
	APIToken string `json:"apiToken"`
}

type CreateDNSRecord added in v0.6.0

type CreateDNSRecord struct{}

func (*CreateDNSRecord) Actions added in v0.6.0

func (c *CreateDNSRecord) Actions() []core.Action

func (*CreateDNSRecord) Cancel added in v0.6.0

func (c *CreateDNSRecord) Cancel(ctx core.ExecutionContext) error

func (*CreateDNSRecord) Cleanup added in v0.7.0

func (c *CreateDNSRecord) Cleanup(ctx core.SetupContext) error

func (*CreateDNSRecord) Color added in v0.6.0

func (c *CreateDNSRecord) Color() string

func (*CreateDNSRecord) Configuration added in v0.6.0

func (c *CreateDNSRecord) Configuration() []configuration.Field

func (*CreateDNSRecord) Description added in v0.6.0

func (c *CreateDNSRecord) Description() string

func (*CreateDNSRecord) Documentation added in v0.6.0

func (c *CreateDNSRecord) Documentation() string

func (*CreateDNSRecord) ExampleOutput added in v0.6.0

func (c *CreateDNSRecord) ExampleOutput() map[string]any

func (*CreateDNSRecord) Execute added in v0.6.0

func (c *CreateDNSRecord) Execute(ctx core.ExecutionContext) error

func (*CreateDNSRecord) HandleAction added in v0.6.0

func (c *CreateDNSRecord) HandleAction(ctx core.ActionContext) error

func (*CreateDNSRecord) HandleWebhook added in v0.6.0

func (c *CreateDNSRecord) HandleWebhook(ctx core.WebhookRequestContext) (int, error)

func (*CreateDNSRecord) Icon added in v0.6.0

func (c *CreateDNSRecord) Icon() string

func (*CreateDNSRecord) Label added in v0.6.0

func (c *CreateDNSRecord) Label() string

func (*CreateDNSRecord) Name added in v0.6.0

func (c *CreateDNSRecord) Name() string

func (*CreateDNSRecord) OutputChannels added in v0.6.0

func (c *CreateDNSRecord) OutputChannels(configuration any) []core.OutputChannel

func (*CreateDNSRecord) ProcessQueueItem added in v0.6.0

func (c *CreateDNSRecord) ProcessQueueItem(ctx core.ProcessQueueContext) (*uuid.UUID, error)

func (*CreateDNSRecord) Setup added in v0.6.0

func (c *CreateDNSRecord) Setup(ctx core.SetupContext) error

type CreateDNSRecordRequest added in v0.6.0

type CreateDNSRecordRequest struct {
	Type     string `json:"type"`
	Name     string `json:"name"`
	Content  string `json:"content"`
	TTL      *int   `json:"ttl,omitempty"`
	Proxied  *bool  `json:"proxied,omitempty"`
	Priority *int   `json:"priority,omitempty"`
}

type CreateDNSRecordSpec added in v0.6.0

type CreateDNSRecordSpec struct {
	Zone     string `json:"zone"`
	Type     string `json:"type"`
	Name     string `json:"name"`
	Content  string `json:"content"`
	TTL      *int   `json:"ttl"`
	Proxied  *bool  `json:"proxied"`
	Priority *int   `json:"priority"`
}

type CreateRedirectRuleRequest

type CreateRedirectRuleRequest struct {
	Action      string              `json:"action"`
	Expression  string              `json:"expression"`
	Description string              `json:"description,omitempty"`
	Enabled     bool                `json:"enabled"`
	ActionParam *RedirectActionData `json:"action_parameters,omitempty"`
}

CreateRedirectRuleRequest is the payload for creating a new redirect rule

type DNSRecord added in v0.6.0

type DNSRecord struct {
	ID       string `json:"id"`
	Type     string `json:"type"`
	Name     string `json:"name"`
	Content  string `json:"content"`
	TTL      int    `json:"ttl"`
	Proxied  bool   `json:"proxied"`
	Priority *int   `json:"priority,omitempty"`
}

DNSRecord represents a Cloudflare DNS record

type DeleteDNSRecord added in v0.6.0

type DeleteDNSRecord struct{}

func (*DeleteDNSRecord) Actions added in v0.6.0

func (c *DeleteDNSRecord) Actions() []core.Action

func (*DeleteDNSRecord) Cancel added in v0.6.0

func (c *DeleteDNSRecord) Cancel(ctx core.ExecutionContext) error

func (*DeleteDNSRecord) Cleanup added in v0.7.0

func (c *DeleteDNSRecord) Cleanup(ctx core.SetupContext) error

func (*DeleteDNSRecord) Color added in v0.6.0

func (c *DeleteDNSRecord) Color() string

func (*DeleteDNSRecord) Configuration added in v0.6.0

func (c *DeleteDNSRecord) Configuration() []configuration.Field

func (*DeleteDNSRecord) Description added in v0.6.0

func (c *DeleteDNSRecord) Description() string

func (*DeleteDNSRecord) Documentation added in v0.6.0

func (c *DeleteDNSRecord) Documentation() string

func (*DeleteDNSRecord) ExampleOutput added in v0.6.0

func (c *DeleteDNSRecord) ExampleOutput() map[string]any

func (*DeleteDNSRecord) Execute added in v0.6.0

func (c *DeleteDNSRecord) Execute(ctx core.ExecutionContext) error

func (*DeleteDNSRecord) HandleAction added in v0.6.0

func (c *DeleteDNSRecord) HandleAction(ctx core.ActionContext) error

func (*DeleteDNSRecord) HandleWebhook added in v0.6.0

func (c *DeleteDNSRecord) HandleWebhook(ctx core.WebhookRequestContext) (int, error)

func (*DeleteDNSRecord) Icon added in v0.6.0

func (c *DeleteDNSRecord) Icon() string

func (*DeleteDNSRecord) Label added in v0.6.0

func (c *DeleteDNSRecord) Label() string

func (*DeleteDNSRecord) Name added in v0.6.0

func (c *DeleteDNSRecord) Name() string

func (*DeleteDNSRecord) OutputChannels added in v0.6.0

func (c *DeleteDNSRecord) OutputChannels(configuration any) []core.OutputChannel

func (*DeleteDNSRecord) ProcessQueueItem added in v0.6.0

func (c *DeleteDNSRecord) ProcessQueueItem(ctx core.ProcessQueueContext) (*uuid.UUID, error)

func (*DeleteDNSRecord) Setup added in v0.6.0

func (c *DeleteDNSRecord) Setup(ctx core.SetupContext) error

type DeleteDNSRecordSpec added in v0.6.0

type DeleteDNSRecordSpec struct {
	Record string `json:"record"`
}

type Metadata

type Metadata struct {
	Zones []Zone `json:"zones"`
}

type RedirectActionData

type RedirectActionData struct {
	FromValue *RedirectFromValue `json:"from_value,omitempty"`
}

RedirectActionData contains the redirect configuration

type RedirectFromValue

type RedirectFromValue struct {
	StatusCode       int                `json:"status_code"`
	TargetURL        *RedirectTargetURL `json:"target_url,omitempty"`
	PreserveQueryStr bool               `json:"preserve_query_string,omitempty"`
}

RedirectFromValue defines the redirect target

type RedirectRule

type RedirectRule struct {
	ID          string              `json:"id,omitempty"`
	Action      string              `json:"action"`
	Expression  string              `json:"expression"`
	Description string              `json:"description,omitempty"`
	Enabled     bool                `json:"enabled"`
	ActionParam *RedirectActionData `json:"action_parameters,omitempty"`
}

RedirectRule represents a single redirect rule in a ruleset

type RedirectTargetURL

type RedirectTargetURL struct {
	Value      string `json:"value,omitempty"`
	Expression string `json:"expression,omitempty"`
}

RedirectTargetURL defines the target URL for redirect

type Ruleset

type Ruleset struct {
	ID          string         `json:"id"`
	Name        string         `json:"name"`
	Description string         `json:"description"`
	Kind        string         `json:"kind"`
	Phase       string         `json:"phase"`
	Rules       []RedirectRule `json:"rules"`
}

Ruleset represents a Cloudflare ruleset

type UpdateDNSRecord added in v0.6.0

type UpdateDNSRecord struct{}

func (*UpdateDNSRecord) Actions added in v0.6.0

func (c *UpdateDNSRecord) Actions() []core.Action

func (*UpdateDNSRecord) Cancel added in v0.6.0

func (c *UpdateDNSRecord) Cancel(ctx core.ExecutionContext) error

func (*UpdateDNSRecord) Cleanup added in v0.7.0

func (c *UpdateDNSRecord) Cleanup(ctx core.SetupContext) error

func (*UpdateDNSRecord) Color added in v0.6.0

func (c *UpdateDNSRecord) Color() string

func (*UpdateDNSRecord) Configuration added in v0.6.0

func (c *UpdateDNSRecord) Configuration() []configuration.Field

func (*UpdateDNSRecord) Description added in v0.6.0

func (c *UpdateDNSRecord) Description() string

func (*UpdateDNSRecord) Documentation added in v0.6.0

func (c *UpdateDNSRecord) Documentation() string

func (*UpdateDNSRecord) ExampleOutput added in v0.6.0

func (c *UpdateDNSRecord) ExampleOutput() map[string]any

func (*UpdateDNSRecord) Execute added in v0.6.0

func (c *UpdateDNSRecord) Execute(ctx core.ExecutionContext) error

func (*UpdateDNSRecord) HandleAction added in v0.6.0

func (c *UpdateDNSRecord) HandleAction(ctx core.ActionContext) error

func (*UpdateDNSRecord) HandleWebhook added in v0.6.0

func (c *UpdateDNSRecord) HandleWebhook(ctx core.WebhookRequestContext) (int, error)

func (*UpdateDNSRecord) Icon added in v0.6.0

func (c *UpdateDNSRecord) Icon() string

func (*UpdateDNSRecord) Label added in v0.6.0

func (c *UpdateDNSRecord) Label() string

func (*UpdateDNSRecord) Name added in v0.6.0

func (c *UpdateDNSRecord) Name() string

func (*UpdateDNSRecord) OutputChannels added in v0.6.0

func (c *UpdateDNSRecord) OutputChannels(configuration any) []core.OutputChannel

func (*UpdateDNSRecord) ProcessQueueItem added in v0.6.0

func (c *UpdateDNSRecord) ProcessQueueItem(ctx core.ProcessQueueContext) (*uuid.UUID, error)

func (*UpdateDNSRecord) Setup added in v0.6.0

func (c *UpdateDNSRecord) Setup(ctx core.SetupContext) error

type UpdateDNSRecordRequest added in v0.6.0

type UpdateDNSRecordRequest struct {
	Type    string `json:"type"`
	Name    string `json:"name"`
	Content string `json:"content"`
	TTL     int    `json:"ttl"`
	Proxied bool   `json:"proxied"`
}

UpdateDNSRecordRequest is the payload for updating a DNS record. Cloudflare's Update DNS Record endpoint expects a full record object (type, name, content, ttl, proxied).

type UpdateDNSRecordSpec added in v0.6.0

type UpdateDNSRecordSpec struct {
	Record string `json:"record"`

	Content string `json:"content"`
	TTL     int    `json:"ttl"`
	Proxied bool   `json:"proxied"`
}

type UpdateRedirectRule

type UpdateRedirectRule struct{}

func (*UpdateRedirectRule) Actions

func (c *UpdateRedirectRule) Actions() []core.Action

func (*UpdateRedirectRule) Cancel

func (*UpdateRedirectRule) Cleanup added in v0.7.0

func (c *UpdateRedirectRule) Cleanup(ctx core.SetupContext) error

func (*UpdateRedirectRule) Color

func (c *UpdateRedirectRule) Color() string

func (*UpdateRedirectRule) Configuration

func (c *UpdateRedirectRule) Configuration() []configuration.Field

func (*UpdateRedirectRule) Description

func (c *UpdateRedirectRule) Description() string

func (*UpdateRedirectRule) Documentation

func (c *UpdateRedirectRule) Documentation() string

func (*UpdateRedirectRule) ExampleOutput

func (c *UpdateRedirectRule) ExampleOutput() map[string]any

func (*UpdateRedirectRule) Execute

func (*UpdateRedirectRule) HandleAction

func (c *UpdateRedirectRule) HandleAction(ctx core.ActionContext) error

func (*UpdateRedirectRule) HandleWebhook

func (c *UpdateRedirectRule) HandleWebhook(ctx core.WebhookRequestContext) (int, error)

func (*UpdateRedirectRule) Icon

func (c *UpdateRedirectRule) Icon() string

func (*UpdateRedirectRule) Label

func (c *UpdateRedirectRule) Label() string

func (*UpdateRedirectRule) Name

func (c *UpdateRedirectRule) Name() string

func (*UpdateRedirectRule) OutputChannels

func (c *UpdateRedirectRule) OutputChannels(configuration any) []core.OutputChannel

func (*UpdateRedirectRule) ProcessQueueItem

func (c *UpdateRedirectRule) ProcessQueueItem(ctx core.ProcessQueueContext) (*uuid.UUID, error)

func (*UpdateRedirectRule) Setup

func (c *UpdateRedirectRule) Setup(ctx core.SetupContext) error

type UpdateRedirectRuleMetadata

type UpdateRedirectRuleMetadata struct {
	Zone *Zone `json:"zone"`
}

type UpdateRedirectRuleRequest

type UpdateRedirectRuleRequest struct {
	Action      string              `json:"action"`
	Expression  string              `json:"expression"`
	Description string              `json:"description,omitempty"`
	Enabled     bool                `json:"enabled"`
	ActionParam *RedirectActionData `json:"action_parameters,omitempty"`
}

UpdateRedirectRuleRequest is the payload for updating a redirect rule

type UpdateRedirectRuleSpec

type UpdateRedirectRuleSpec struct {
	Zone             string `json:"zone"`
	RuleID           string `json:"ruleId"`
	Description      string `json:"description"`
	MatchType        string `json:"matchType"`
	SourceURLPattern string `json:"sourceUrlPattern"`
	Expression       string `json:"expression"`
	TargetURL        string `json:"targetUrl"`
	StatusCode       string `json:"statusCode"`
	PreserveQueryStr bool   `json:"preserveQueryString"`
	Enabled          bool   `json:"enabled"`
}

type Zone

type Zone struct {
	ID     string `json:"id"`
	Name   string `json:"name"`
	Status string `json:"status"`
}

Zone represents a Cloudflare zone

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL