Documentation ¶
Index ¶
- type Account
- type AccountMember
- type AccountNotFoundError
- type CloudflareService
- type CreateAccountMemberRequest
- type CreateAccountRequest
- type CreateOrchestrationRequest
- type CreateZoneRequest
- type PatchAccountRequest
- type PatchZoneRequest
- type Service
- func (s *Service) CreateAccount(req CreateAccountRequest) (string, error)
- func (s *Service) CreateAccountMember(accountID string, req CreateAccountMemberRequest) error
- func (s *Service) CreateOrchestration(req CreateOrchestrationRequest) error
- func (s *Service) CreateZone(req CreateZoneRequest) (string, error)
- func (s *Service) DeleteZone(zoneID string) error
- func (s *Service) GetAccount(accountID string) (Account, error)
- func (s *Service) GetAccounts(parameters connection.APIRequestParameters) ([]Account, error)
- func (s *Service) GetAccountsPaginated(parameters connection.APIRequestParameters) (*connection.Paginated[Account], error)
- func (s *Service) GetSpendPlans(parameters connection.APIRequestParameters) ([]SpendPlan, error)
- func (s *Service) GetSpendPlansPaginated(parameters connection.APIRequestParameters) (*connection.Paginated[SpendPlan], error)
- func (s *Service) GetSubscriptions(parameters connection.APIRequestParameters) ([]Subscription, error)
- func (s *Service) GetSubscriptionsPaginated(parameters connection.APIRequestParameters) (*connection.Paginated[Subscription], error)
- func (s *Service) GetTotalSpendMonthToDate() (TotalSpend, error)
- func (s *Service) GetZone(zoneID string) (Zone, error)
- func (s *Service) GetZones(parameters connection.APIRequestParameters) ([]Zone, error)
- func (s *Service) GetZonesPaginated(parameters connection.APIRequestParameters) (*connection.Paginated[Zone], error)
- func (s *Service) PatchAccount(accountID string, req PatchAccountRequest) error
- func (s *Service) PatchZone(zoneID string, req PatchZoneRequest) error
- type SpendPlan
- type Subscription
- type TotalSpend
- type Zone
- type ZoneNotFoundError
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 ¶
DeleteZone removes a single zone by id
func (*Service) GetAccount ¶
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) 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
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