Documentation
¶
Overview ¶
Package model provides data structures and validation logic for the dehydrated-api-go application. It includes domain entry models, request/response structures, and protobuf conversion utilities.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsValidDomain ¶
IsValidDomain checks if a string is a valid domain name or wildcard domain. It validates the domain against a regular expression that enforces the following rules: - Domain parts can contain letters, numbers, and hyphens - Hyphens cannot be at the start or end of a part - At least one dot is required (except for wildcard domains) - Optional wildcard at the start of the first part - TLD must be at least 2 characters Returns true if the domain is valid, false otherwise.
func IsValidDomainEntry ¶
func IsValidDomainEntry(entry *DomainEntry) bool
IsValidDomainEntry checks if a DomainEntry is valid by validating its domain field. It ensures that the domain name follows the standard domain naming conventions. Returns true if the domain entry is valid, false otherwise.
Types ¶
type CreateDomainRequest ¶
type CreateDomainRequest struct {
// Domain is the primary domain name (required).
Domain string `json:"domain" validate:"required"`
// AlternativeNames is a list of additional domain names.
AlternativeNames []string `json:"alternative_names,omitempty"`
// Alias is an optional alternative identifier.
Alias string `json:"alias,omitempty"`
// Enabled indicates whether the domain should be active.
Enabled bool `json:"enabled"`
// Comment is an optional description.
Comment string `json:"comment,omitempty"`
}
CreateDomainRequest represents a request to create a new domain entry. It contains all the necessary fields to create a new domain configuration.
type DomainEntry ¶
type DomainEntry struct {
pb.DomainEntry
// Metadata contains additional information about the domain entry.
Metadata *pb.Metadata `json:"metadata,omitempty"`
}
DomainEntry represents a domain configuration entry in the dehydrated system. It contains all the necessary information for managing a domain's SSL certificate.
func (*DomainEntry) MarshalJSON ¶
func (e *DomainEntry) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface to ensure all fields are included
func (*DomainEntry) PathName ¶
func (e *DomainEntry) PathName() string
func (*DomainEntry) SetMetadata ¶ added in v0.0.14
func (e *DomainEntry) SetMetadata(m *pb.Metadata)
type DomainResponse ¶
type DomainResponse struct {
// Success indicates whether the operation was successful.
Success bool `json:"success"`
// Data contains the domain entry if the operation was successful.
Data *DomainEntry `json:"data,omitempty"`
// Error contains an error message if the operation failed.
Error string `json:"error,omitempty"`
}
DomainResponse represents a response containing a single domain entry. It includes a success flag, the domain data, and an optional error message.
type DomainsResponse ¶
type DomainsResponse struct {
// Success indicates whether the operation was successful.
Success bool `json:"success"`
// Data contains the list of domain entries if the operation was successful.
Data []*DomainEntry `json:"data,omitempty"`
// Error contains an error message if the operation failed.
Error string `json:"error,omitempty"`
}
DomainsResponse represents a response containing multiple domain entries. It includes a success flag, a list of domain data, and an optional error message.
type UpdateDomainRequest ¶
type UpdateDomainRequest struct {
// AlternativeNames is a list of additional domain names.
AlternativeNames *[]string `json:"alternative_names,omitempty"`
// Alias is an optional alternative identifier.
Alias *string `json:"alias,omitempty"`
// Enabled indicates whether the domain should be active.
Enabled *bool `json:"enabled,omitempty"`
// Comment is an optional description.
Comment *string `json:"comment,omitempty"`
}
UpdateDomainRequest represents a request to update an existing domain entry. It contains the fields that can be modified for an existing domain.