cloudflare

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2022 License: MIT Imports: 2 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	ID                  string              `json:"id"`
	Status              string              `json:"status"`
	Name                string              `json:"name"`
	CloudflareAccountID string              `json:"cloudflare_account_id"`
	CreatedAt           connection.DateTime `json:"created_at"`
	UpdatedAt           connection.DateTime `json:"updated_at"`
}

Account represents a Cloudflare account

type AccountMember

type AccountMember struct {
	AccountID    string `json:"account_id"`
	EmailAddress string `json:"email_address"`
}

AccountMember represents a Cloudflare account member

type AccountNotFoundError

type AccountNotFoundError struct {
	ID string
}

AccountNotFoundError indicates an account was not found

func (*AccountNotFoundError) Error

func (e *AccountNotFoundError) Error() string

type CloudflareService

type CloudflareService interface {
	// Account
	GetAccounts(parameters connection.APIRequestParameters) ([]Account, error)
	GetAccountsPaginated(parameters connection.APIRequestParameters) (*connection.Paginated[Account], error)
	GetAccount(accountID string) (Account, error)
	CreateAccount(req CreateAccountRequest) (string, error)
	PatchAccount(accountID string, req PatchAccountRequest) error
	CreateAccountMember(accountID string, req CreateAccountMemberRequest) error

	// Orchestration
	CreateOrchestration(req CreateOrchestrationRequest) error

	// Spend plan
	GetSpendPlans(parameters connection.APIRequestParameters) ([]SpendPlan, error)
	GetSpendPlansPaginated(parameters connection.APIRequestParameters) (*connection.Paginated[SpendPlan], error)

	// Subscription
	GetSubscriptions(parameters connection.APIRequestParameters) ([]Subscription, error)
	GetSubscriptionsPaginated(parameters connection.APIRequestParameters) (*connection.Paginated[Subscription], error)

	// Zone
	GetZones(parameters connection.APIRequestParameters) ([]Zone, error)
	GetZonesPaginated(parameters connection.APIRequestParameters) (*connection.Paginated[Zone], error)
	GetZone(zoneID string) (Zone, error)
	CreateZone(req CreateZoneRequest) (string, error)
	PatchZone(zoneID string, req PatchZoneRequest) error
	DeleteZone(zoneID string) error

	// Spend
	GetTotalSpendMonthToDate() (TotalSpend, error)
}

CloudflareService is an interface for managing Cloudflare services

type CreateAccountMemberRequest

type CreateAccountMemberRequest struct {
	EmailAddress string `json:"email_address"`
}

CreateAccountMemberRequest represents a request to create an account member

type CreateAccountRequest

type CreateAccountRequest struct {
	Name string `json:"name"`
}

CreateAccountRequest represents a request to create an account

type CreateOrchestrationRequest

type CreateOrchestrationRequest struct {
	AccountMemberDeploymentID string `json:"account_member_deployment_id"`
	ZoneName                  string `json:"zone_name"`
	ZoneSubscriptionID        string `json:"zone_subscription_id"`
	AccountID                 string `json:"account_id"`
	AccountName               string `json:"account_name"`
	AdministratorEmailAddress string `json:"administrator_email_address"`
}

CreateOrchestrationRequest represents a request to create new orchestration

type CreateZoneRequest

type CreateZoneRequest struct {
	AccountID      string `json:"account_id"`
	Name           string `json:"name"`
	SubscriptionID string `json:"subscription_id"`
}

CreateRecordRequest represents a request to create a zone

type PatchAccountRequest

type PatchAccountRequest struct {
	Name string `json:"name,omitempty"`
}

PatchAccountRequest represents a request to patch an account

type PatchZoneRequest

type PatchZoneRequest struct {
	SubscriptionID string `json:"subscription_id,omitempty"`
}

PatchZoneRequest represents a request to patch a zone

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service implements CloudflareService for managing the Shared Exchange service

func NewService

func NewService(connection connection.Connection) *Service

NewService returns a new instance of CloudflareService

func (*Service) CreateAccount

func (s *Service) CreateAccount(req CreateAccountRequest) (string, error)

CreateAccount creates a new account

func (*Service) CreateAccountMember

func (s *Service) CreateAccountMember(accountID string, req CreateAccountMemberRequest) error

CreateAccount creates a new account member

func (*Service) CreateOrchestration

func (s *Service) CreateOrchestration(req CreateOrchestrationRequest) error

CreateOrchestration creates a new orchestration request

func (*Service) CreateZone

func (s *Service) CreateZone(req CreateZoneRequest) (string, error)

CreateZone creates a new zone

func (*Service) DeleteZone

func (s *Service) DeleteZone(zoneID string) error

DeleteZone removes a single zone by id

func (*Service) GetAccount

func (s *Service) GetAccount(accountID string) (Account, error)

GetAccount retrieves a single account by id

func (*Service) GetAccounts

func (s *Service) GetAccounts(parameters connection.APIRequestParameters) ([]Account, error)

GetAccounts retrieves a list of accounts

func (*Service) GetAccountsPaginated

func (s *Service) GetAccountsPaginated(parameters connection.APIRequestParameters) (*connection.Paginated[Account], error)

GetAccountsPaginated retrieves a paginated list of accounts

func (*Service) GetSpendPlans

func (s *Service) GetSpendPlans(parameters connection.APIRequestParameters) ([]SpendPlan, error)

GetSpendPlans retrieves a list of spend plans

func (*Service) GetSpendPlansPaginated

func (s *Service) GetSpendPlansPaginated(parameters connection.APIRequestParameters) (*connection.Paginated[SpendPlan], error)

GetSpendPlansPaginated retrieves a paginated list of spend plans

func (*Service) GetSubscriptions

func (s *Service) GetSubscriptions(parameters connection.APIRequestParameters) ([]Subscription, error)

GetSubscriptions retrieves a list of subscriptions

func (*Service) GetSubscriptionsPaginated

func (s *Service) GetSubscriptionsPaginated(parameters connection.APIRequestParameters) (*connection.Paginated[Subscription], error)

GetSubscriptionsPaginated retrieves a paginated list of subscriptions

func (*Service) GetTotalSpendMonthToDate

func (s *Service) GetTotalSpendMonthToDate() (TotalSpend, error)

GetTotalSpendMonthToDate retrieves a total spend for current month

func (*Service) GetZone

func (s *Service) GetZone(zoneID string) (Zone, error)

GetZone retrieves a single zone by id

func (*Service) GetZones

func (s *Service) GetZones(parameters connection.APIRequestParameters) ([]Zone, error)

GetZones retrieves a list of zones

func (*Service) GetZonesPaginated

func (s *Service) GetZonesPaginated(parameters connection.APIRequestParameters) (*connection.Paginated[Zone], error)

GetZonesPaginated retrieves a paginated list of zones

func (*Service) PatchAccount

func (s *Service) PatchAccount(accountID string, req PatchAccountRequest) error

PatchAccount updates an account

func (*Service) PatchZone

func (s *Service) PatchZone(zoneID string, req PatchZoneRequest) error

PatchZone updates a zone

type SpendPlan

type SpendPlan struct {
	ID        string              `json:"id"`
	Amount    float32             `json:"amount"`
	StartedAt connection.DateTime `json:"started_at"`
	EndedAt   connection.DateTime `json:"ended_at"`
	CreatedAt connection.DateTime `json:"created_at"`
	UpdatedAt connection.DateTime `json:"updated_at"`
}

SpendPlan represents a Cloudflare spend plan

type Subscription

type Subscription struct {
	ID                   string              `json:"id"`
	Name                 string              `json:"name"`
	Type                 string              `json:"type"`
	Description          string              `json:"description"`
	Price                float32             `json:"price"`
	CloudflareRatePlanID string              `json:"cloudflare_rate_plan_id"`
	CreatedAt            connection.DateTime `json:"created_at"`
	UpdatedAt            connection.DateTime `json:"updated_at"`
}

Subscription represents a Cloudflare subscription

type TotalSpend

type TotalSpend struct {
	SpendPlanAmount float32 `json:"spend_plan_amount"`
	TotalSpend      float32 `json:"total_spend"`
}

TotalSpend represents total spend

type Zone

type Zone struct {
	ID               string              `json:"id"`
	AccountID        string              `json:"account_id"`
	Name             string              `json:"name"`
	SubscriptionID   string              `json:"subscription_id"`
	CloudflareZoneID string              `json:"cloudflare_zone_id"`
	CreatedAt        connection.DateTime `json:"created_at"`
	UpdatedAt        connection.DateTime `json:"updated_at"`
}

Zone represents a Cloudflare zone

type ZoneNotFoundError

type ZoneNotFoundError struct {
	ID string
}

ZoneNotFoundError indicates an zone was not found

func (*ZoneNotFoundError) Error

func (e *ZoneNotFoundError) Error() string

Jump to

Keyboard shortcuts

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