validator

package
v0.1.20 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidRequest = errors.New("invalid request")

Functions

This section is empty.

Types

type BootstrapRequest

type BootstrapRequest struct {
	OrganizationName string `json:"organization_name"`
	OrganizationSlug string `json:"organization_slug"`
}

func ValidateBootstrapRequest

func ValidateBootstrapRequest(request BootstrapRequest) (BootstrapRequest, error)

type DNSCredentialRequest added in v0.1.19

type DNSCredentialRequest struct {
	Name     string `json:"name"`
	Provider string `json:"provider"`
	Secret   string `json:"secret"`
}

func ValidateDNSCredentialRequest added in v0.1.19

func ValidateDNSCredentialRequest(request DNSCredentialRequest, secretRequired bool) (DNSCredentialRequest, error)

type DNSInstanceRequest added in v0.1.20

type DNSInstanceRequest struct {
	ManagedRecordID        string         `json:"managed_record_id"`
	Name                   string         `json:"name"`
	Priority               int            `json:"priority"`
	Enabled                bool           `json:"enabled"`
	NodeGroupIDs           []string       `json:"node_group_ids"`
	AnswerCount            int            `json:"answer_count"`
	Condition              map[string]any `json:"condition"`
	Action                 map[string]any `json:"action"`
	NotificationChannelIDs []string       `json:"notification_channel_ids"`
}

func ValidateDNSInstanceRequest added in v0.1.20

func ValidateDNSInstanceRequest(request DNSInstanceRequest) (DNSInstanceRequest, error)

type DNSManagedRecordRequest added in v0.1.20

type DNSManagedRecordRequest struct {
	DNSCredentialID  string `json:"dns_credential_id"`
	CredentialZoneID string `json:"credential_zone_id"`
	RecordHost       string `json:"record_host"`
	RecordName       string `json:"record_name"`
	RecordType       string `json:"record_type"`
	TTL              int    `json:"ttl"`
	Proxied          bool   `json:"proxied"`
}

func ValidateDNSManagedRecordRequest added in v0.1.20

func ValidateDNSManagedRecordRequest(request DNSManagedRecordRequest) (DNSManagedRecordRequest, error)

type GroupRequest

type GroupRequest struct {
	Name        string `json:"name"`
	Description string `json:"description"`
}

func ValidateGroupRequest

func ValidateGroupRequest(request GroupRequest) (GroupRequest, error)

type HealthCheckRequest added in v0.1.19

type HealthCheckRequest struct {
	Name            string                    `json:"name"`
	ProbeType       string                    `json:"probe_type"`
	IntervalSeconds int                       `json:"interval_seconds"`
	TimeoutSeconds  int                       `json:"timeout_seconds"`
	Enabled         bool                      `json:"enabled"`
	TargetScope     HealthTargetScopeRequest  `json:"target_scope"`
	MonitorScope    HealthMonitorScopeRequest `json:"monitor_scope"`
	Config          map[string]any            `json:"config"`
}

func ValidateHealthCheckRequest added in v0.1.19

func ValidateHealthCheckRequest(request HealthCheckRequest) (HealthCheckRequest, error)

type HealthMonitorScopeRequest added in v0.1.19

type HealthMonitorScopeRequest struct {
	Type           string `json:"type"`
	MonitorID      string `json:"monitor_id"`
	MonitorGroupID string `json:"monitor_group_id"`
}

type HealthTargetScopeRequest added in v0.1.19

type HealthTargetScopeRequest struct {
	Type          string   `json:"type"`
	TargetIDs     []string `json:"target_ids"`
	TargetGroupID string   `json:"target_group_id"`
}

type MemberRequest

type MemberRequest struct {
	Email   string   `json:"email"`
	RoleIDs []string `json:"role_ids"`
	Status  string   `json:"status"`
}

func ValidateMemberRequest

func ValidateMemberRequest(request MemberRequest) (MemberRequest, error)

type MemberUpdateRequest

type MemberUpdateRequest struct {
	RoleIDs *[]string `json:"role_ids"`
	Status  string    `json:"status"`
}

func ValidateMemberUpdateRequest

func ValidateMemberUpdateRequest(request MemberUpdateRequest) (MemberUpdateRequest, error)

type MonitorPatchRequest

type MonitorPatchRequest struct {
	Name     *string   `json:"name"`
	GroupIDs *[]string `json:"group_ids"`
}

func ValidateMonitorPatchRequest

func ValidateMonitorPatchRequest(request MonitorPatchRequest) (MonitorPatchRequest, error)

type MonitorRequest

type MonitorRequest struct {
	Name     string   `json:"name"`
	GroupIDs []string `json:"group_ids"`
}

func ValidateMonitorRequest

func ValidateMonitorRequest(request MonitorRequest) (MonitorRequest, error)

type NodeDNSPublishAddress added in v0.1.20

type NodeDNSPublishAddress struct {
	AddressType string `json:"address_type"`
	Address     string `json:"address"`
	Enabled     bool   `json:"enabled"`
}

func (*NodeDNSPublishAddress) UnmarshalJSON added in v0.1.20

func (address *NodeDNSPublishAddress) UnmarshalJSON(data []byte) error

type NodeListenIP

type NodeListenIP struct {
	ListenIP    string `json:"listen_ip"`
	DisplayName string `json:"display_name"`
}

type NodePatchRequest

type NodePatchRequest struct {
	Name                *string                  `json:"name"`
	GroupIDs            *[]string                `json:"group_ids"`
	ListenIPs           *[]NodeListenIP          `json:"listen_ips"`
	PortRanges          *[]NodePortRange         `json:"port_ranges"`
	DNSPublishAddresses *[]NodeDNSPublishAddress `json:"dns_publish_addresses"`
	PublicDescription   *string                  `json:"public_description"`
}

func ValidateNodePatchRequest

func ValidateNodePatchRequest(request NodePatchRequest) (NodePatchRequest, error)

type NodePortRange

type NodePortRange struct {
	Protocol  string `json:"protocol"`
	StartPort int    `json:"start_port"`
	EndPort   int    `json:"end_port"`
}

type NodeRequest

type NodeRequest struct {
	Name                string                  `json:"name"`
	GroupIDs            []string                `json:"group_ids"`
	ListenIPs           []NodeListenIP          `json:"listen_ips"`
	PortRanges          []NodePortRange         `json:"port_ranges"`
	DNSPublishAddresses []NodeDNSPublishAddress `json:"dns_publish_addresses"`
	PublicDescription   string                  `json:"public_description"`
}

func ValidateNodeRequest

func ValidateNodeRequest(request NodeRequest) (NodeRequest, error)

type NotificationChannelRequest added in v0.1.20

type NotificationChannelRequest struct {
	Name        string         `json:"name"`
	ChannelType string         `json:"channel_type"`
	Config      map[string]any `json:"config"`
	Secret      string         `json:"secret"`
	Enabled     bool           `json:"enabled"`
}

func ValidateNotificationChannelRequest added in v0.1.20

func ValidateNotificationChannelRequest(request NotificationChannelRequest, secretRequired bool) (NotificationChannelRequest, error)

type OrganizationRequest

type OrganizationRequest struct {
	Name string `json:"name"`
	Slug string `json:"slug"`
}

func ValidateOrganizationRequest

func ValidateOrganizationRequest(request OrganizationRequest) (OrganizationRequest, error)

type ProxyProtocolRequest

type ProxyProtocolRequest struct {
	In  string `json:"in"`
	Out string `json:"out"`
}

type RegistrationTokenRequest

type RegistrationTokenRequest struct {
	TTLHours int `json:"ttl_hours"`
}

func ValidateRegistrationTokenRequest

func ValidateRegistrationTokenRequest(request RegistrationTokenRequest) (RegistrationTokenRequest, error)

type ResourceScopeRequest

type ResourceScopeRequest struct {
	ResourceType string `json:"resource_type"`
	ResourceID   string `json:"resource_id"`
	AccessLevel  string `json:"access_level"`
}

type RoleRequest

type RoleRequest struct {
	Name           string                 `json:"name"`
	Description    string                 `json:"description"`
	Permissions    []string               `json:"permissions"`
	ResourceScopes []ResourceScopeRequest `json:"resource_scopes"`
}

func ValidateRoleRequest

func ValidateRoleRequest(request RoleRequest) (RoleRequest, error)

type RuleBatchRequest

type RuleBatchRequest struct {
	Action  string   `json:"action"`
	RuleIDs []string `json:"rule_ids"`
}

func ValidateRuleBatchRequest

func ValidateRuleBatchRequest(request RuleBatchRequest) (RuleBatchRequest, error)

type RuleCopyRequest

type RuleCopyRequest struct {
	Name string    `json:"name"`
	Tags *[]string `json:"tags"`
}

func ValidateRuleCopyRequest

func ValidateRuleCopyRequest(request RuleCopyRequest) (RuleCopyRequest, error)

type RuleImportRequest

type RuleImportRequest struct {
	DryRun bool `json:"dry_run"`
}

type RuleMatchRequest

type RuleMatchRequest struct {
	Type        string `json:"type"`
	SNIHostname string `json:"sni_hostname"`
}

type RuleRequest

type RuleRequest struct {
	Name           string               `json:"name"`
	Tags           []string             `json:"tags"`
	NodeGroupID    string               `json:"node_group_id"`
	ListenIP       string               `json:"listen_ip"`
	FailurePolicy  string               `json:"failure_policy"`
	ForwardingType string               `json:"forwarding_type"`
	Protocol       string               `json:"protocol"`
	Port           int                  `json:"port"`
	Match          RuleMatchRequest     `json:"match"`
	ProxyProtocol  ProxyProtocolRequest `json:"proxy_protocol"`
	Upstream       RuleUpstreamRequest  `json:"upstream"`
	Enabled        bool                 `json:"enabled"`
}

func ValidateRuleRequest

func ValidateRuleRequest(request RuleRequest) (RuleRequest, error)

type RuleUpstreamRequest

type RuleUpstreamRequest struct {
	Type          string `json:"type"`
	TargetID      string `json:"target_id"`
	TargetGroupID string `json:"target_group_id"`
}

type TargetGroupMemberRequest

type TargetGroupMemberRequest struct {
	TargetID string `json:"target_id"`
	Priority int    `json:"priority"`
	Enabled  bool   `json:"enabled"`
}

type TargetGroupRequest

type TargetGroupRequest struct {
	Name        string                     `json:"name"`
	Description string                     `json:"description"`
	Scheduler   string                     `json:"scheduler"`
	Members     []TargetGroupMemberRequest `json:"members"`
}

func ValidateTargetGroupRequest

func ValidateTargetGroupRequest(request TargetGroupRequest) (TargetGroupRequest, error)

type TargetRequest

type TargetRequest struct {
	Name           string    `json:"name"`
	Host           string    `json:"host"`
	Port           int       `json:"port"`
	Enabled        bool      `json:"enabled"`
	TargetGroupIDs *[]string `json:"target_group_ids"`
}

func ValidateTargetRequest

func ValidateTargetRequest(request TargetRequest) (TargetRequest, error)

type ValidationError

type ValidationError struct {
	Message string
	Details map[string]any
}

func (*ValidationError) Error

func (err *ValidationError) Error() string

func (*ValidationError) Unwrap

func (err *ValidationError) Unwrap() error

Jump to

Keyboard shortcuts

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