Documentation
¶
Index ¶
- Constants
- Variables
- func GetOAuth2Config(o *happydns.Options, provider *oidc.Provider) *oauth2.Config
- func GetOIDCProvider(o *happydns.Options, ctx context.Context) (*oidc.Provider, error)
- func ShowVersion(c *gin.Context)
- type AuthUserController
- type DNSMsg
- type DNSQuestion
- type DomainController
- func (dc *DomainController) AddDomain(c *gin.Context)
- func (dc *DomainController) DelDomain(c *gin.Context)
- func (dc *DomainController) GetDomain(c *gin.Context)
- func (dc *DomainController) GetDomains(c *gin.Context)
- func (dc *DomainController) ImportZone(c *gin.Context)
- func (dc *DomainController) RetrieveZone(c *gin.Context)
- func (dc *DomainController) UpdateDomain(c *gin.Context)
- type DomainLogController
- type LoginController
- type NewsletterController
- type OIDCProvider
- type ProviderController
- func (pc *ProviderController) AddProvider(c *gin.Context)
- func (pc *ProviderController) CreateDomainOnProvider(c *gin.Context)
- func (pc *ProviderController) DeleteProvider(c *gin.Context)
- func (pc *ProviderController) GetDomainsHostedByProvider(c *gin.Context)
- func (pc *ProviderController) GetProvider(c *gin.Context)
- func (pc *ProviderController) ListProviders(c *gin.Context)
- func (pc *ProviderController) UpdateProvider(c *gin.Context)
- type ProviderSettingsController
- type ProviderSpecsController
- type RecordController
- type RegistrationController
- type ResolverController
- type ServiceController
- type ServiceSpecsController
- type SessionController
- func (sc *SessionController) ClearSession(c *gin.Context)
- func (sc *SessionController) ClearUserSessions(c *gin.Context)
- func (sc *SessionController) CreateSession(c *gin.Context)
- func (sc *SessionController) DeleteSession(c *gin.Context)
- func (sc *SessionController) GetSession(c *gin.Context)
- func (sc *SessionController) GetSessions(c *gin.Context)
- func (sc *SessionController) SessionHandler(c *gin.Context)
- func (sc *SessionController) UpdateSession(c *gin.Context)
- type UserController
- type UserRecoveryController
- type ZoneController
- func (zc *ZoneController) AddRecords(c *gin.Context)
- func (zc *ZoneController) ApplyZoneCorrections(c *gin.Context)
- func (zc *ZoneController) DeleteRecords(c *gin.Context)
- func (zc *ZoneController) DiffZones(c *gin.Context)
- func (zc *ZoneController) ExportZone(c *gin.Context)
- func (zc *ZoneController) GetZone(c *gin.Context)
- func (zc *ZoneController) GetZoneSubdomain(c *gin.Context)
- func (zc *ZoneController) UpdateRecord(c *gin.Context)
Constants ¶
const (
SESSION_KEY_OIDC_STATE = "oidc-state"
)
Variables ¶
var (
HDVersion happydns.VersionResponse
)
Functions ¶
func GetOAuth2Config ¶
func GetOIDCProvider ¶
func ShowVersion ¶
showVersion returns the current happyDomain version.
@Summary Get happyDomain version
@Schemes
@Description Retrieve the current happyDomain version.
@Tags version
@Accept json
@Produce json
@Success 200 {object} happydns.VersionResponse
@Router /version [get]
Types ¶
type AuthUserController ¶
type AuthUserController struct {
// contains filtered or unexported fields
}
func NewAuthUserController ¶
func NewAuthUserController(auService happydns.AuthUserUsecase, lc *LoginController) *AuthUserController
func (*AuthUserController) ChangePassword ¶
func (ac *AuthUserController) ChangePassword(c *gin.Context)
changePassword changes the password of the given account.
@Summary Change password
@Schemes
@Description Change the password of the given account.
@Tags users
@Accept json
@Produce json
@Security securitydefinitions.basic
@Param userId path string true "User identifier"
@Param body body happydns.ChangePasswordForm true "Password confirmation"
@Success 204 {null} null
@Failure 400 {object} happydns.ErrorResponse "Invalid input"
@Failure 401 {object} happydns.ErrorResponse "Authentication failure"
@Failure 403 {object} happydns.ErrorResponse "Bad current password"
@Failure 500 {object} happydns.ErrorResponse
@Router /users/{userId}/new_password [post]
func (*AuthUserController) DeleteAuthUser ¶
func (ac *AuthUserController) DeleteAuthUser(c *gin.Context)
DeleteAuthUser delete the account related to the given user.
@Summary Drop account
@Schemes
@Description Delete the account related to the given user.
@Tags users
@Accept json
@Produce json
@Security securitydefinitions.basic
@Param userId path string true "User identifier"
@Param body body happydns.ChangePasswordForm true "Password confirmation"
@Success 204 {null} null
@Failure 400 {object} happydns.ErrorResponse "Invalid input"
@Failure 401 {object} happydns.ErrorResponse "Authentication failure"
@Failure 403 {object} happydns.ErrorResponse "Bad current password"
@Failure 500 {object} happydns.ErrorResponse
@Router /users/{userId}/delete [post]
type DNSMsg ¶
type DNSMsg struct {
// Question is the Question section of the DNS response.
Question []DNSQuestion
// Answer is the list of Answer records in the DNS response.
Answer []interface{} `swaggertype:"object"`
// Ns is the list of Authoritative records in the DNS response.
Ns []interface{} `swaggertype:"object"`
// Extra is the list of extra records in the DNS response.
Extra []interface{} `swaggertype:"object"`
}
DNSMsg is the documentation struct corresponding to dns.Msg
type DNSQuestion ¶
type DomainController ¶
type DomainController struct {
// contains filtered or unexported fields
}
func NewDomainController ¶
func NewDomainController(domainService happydns.DomainUsecase, remoteZoneImporter happydns.RemoteZoneImporterUsecase, zoneImporter happydns.ZoneImporterUsecase) *DomainController
func (*DomainController) AddDomain ¶
func (dc *DomainController) AddDomain(c *gin.Context)
addDomain appends a new domain to those managed.
@Summary Manage a new domain
@Schemes
@Description Append a new domain to those managed.
@Tags domains
@Accept json
@Produce json
@Param body body happydns.DomainCreationInput true "Domain object that you want to manage through happyDomain."
@Security securitydefinitions.basic
@Success 200 {object} happydns.Domain
@Failure 400 {object} happydns.ErrorResponse "Error in received data"
@Failure 401 {object} happydns.ErrorResponse "Authentication failure"
@Failure 500 {object} happydns.ErrorResponse "Unable to retrieve current user's domains"
@Router /domains [post]
func (*DomainController) DelDomain ¶
func (dc *DomainController) DelDomain(c *gin.Context)
delDomain removes a domain from the database.
@Summary Stop managing a Domain.
@Schemes
@Description Delete all the information in the database about the given Domain. This only stops happyDomain from managing the Domain, it doesn't do anything on the Provider.
@Tags domains
@Accept json
@Produce json
@Param domainId path string true "Domain identifier"
@Security securitydefinitions.basic
@Success 204 "Domain deleted"
@Failure 400 {object} happydns.ErrorResponse "Invalid input"
@Failure 401 {object} happydns.ErrorResponse "Authentication failure"
@Failure 404 {object} happydns.ErrorResponse "Domain not found"
@Failure 500 {object} happydns.ErrorResponse "Database writing error"
@Router /domains/{domainId} [delete]
func (*DomainController) GetDomain ¶
func (dc *DomainController) GetDomain(c *gin.Context)
GetDomain retrieves information about a given Domain owned by the user.
@Summary Retrieve Domain local information.
@Schemes
@Description Retrieve information in the database about a given Domain owned by the user.
@Tags domains
@Accept json
@Produce json
@Param domainId path string true "Domain identifier"
@Security securitydefinitions.basic
@Success 200 {object} happydns.DomainWithZoneMetadata
@Failure 401 {object} happydns.ErrorResponse "Authentication failure"
@Failure 404 {object} happydns.ErrorResponse "Domain not found"
@Router /domains/{domainId} [get]
func (*DomainController) GetDomains ¶
func (dc *DomainController) GetDomains(c *gin.Context)
GetDomains retrieves all domains belonging to the user.
@Summary Retrieve user's domains
@Schemes
@Description Retrieve all domains belonging to the user.
@Tags domains
@Accept json
@Produce json
@Security securitydefinitions.basic
@Success 200 {array} happydns.Domain
@Failure 401 {object} happydns.ErrorResponse "Authentication failure"
@Failure 404 {object} happydns.ErrorResponse "Unable to retrieve user's domains"
@Router /domains [get]
func (*DomainController) ImportZone ¶
func (dc *DomainController) ImportZone(c *gin.Context)
ImportZone imports a zone from a BIND-style zone file.
@Summary Import zone from file.
@Schemes
@Description Import a zone from a BIND-style zone file upload.
@Tags zones
@Accept multipart/form-data
@Produce json
@Security securitydefinitions.basic
@Param domainId path string true "Domain identifier"
@Param zone formData file true "Zone file to import"
@Success 200 {object} happydns.Zone
@Failure 400 {object} happydns.ErrorResponse "Invalid input or unable to read zone file"
@Failure 401 {object} happydns.ErrorResponse "Authentication failure"
@Failure 404 {object} happydns.ErrorResponse "Domain not found"
@Failure 500 {object} happydns.ErrorResponse
@Router /domains/{domainId}/zone [post]
func (*DomainController) RetrieveZone ¶
func (dc *DomainController) RetrieveZone(c *gin.Context)
RetrieveZone retrieves the current zone deployed on the NS Provider.
@Summary Retrieve the zone on the Provider.
@Schemes
@Description Retrieve the current zone deployed on the NS Provider.
@Tags zones
@Accept json
@Produce json
@Security securitydefinitions.basic
@Param domainId path string true "Domain identifier"
@Success 200 {object} happydns.ZoneMeta "The new zone metadata"
@Failure 401 {object} happydns.ErrorResponse "Authentication failure"
@Failure 404 {object} happydns.ErrorResponse "Domain not found"
@Router /domains/{domainId}/retrieve_zone [post]
func (*DomainController) UpdateDomain ¶
func (dc *DomainController) UpdateDomain(c *gin.Context)
UpdateDomain updates the information about a given Domain owned by the user.
@Summary Update Domain local information.
@Schemes
@Description Updates the information about a given Domain owned by the user.
@Tags domains
@Accept json
@Produce json
@Param domainId path string true "Domain identifier"
@Param body body happydns.Domain true "The new object overriding the current domain"
@Security securitydefinitions.basic
@Success 200 {object} happydns.Domain
@Failure 400 {object} happydns.ErrorResponse "Invalid input"
@Failure 400 {object} happydns.ErrorResponse "Identifier changed"
@Failure 401 {object} happydns.ErrorResponse "Authentication failure"
@Failure 404 {object} happydns.ErrorResponse "Domain not found"
@Failure 500 {object} happydns.ErrorResponse "Database writing error"
@Router /domains/{domainId} [put]
type DomainLogController ¶
type DomainLogController struct {
// contains filtered or unexported fields
}
func NewDomainLogController ¶
func NewDomainLogController(domainLogService happydns.DomainLogUsecase) *DomainLogController
func (*DomainLogController) GetDomainLogs ¶
func (dlc *DomainLogController) GetDomainLogs(c *gin.Context)
GetDomainLogs retrieves actions recorded for the domain.
@Summary Retrieve Domain actions history.
@Schemes
@Description Retrieve information about the actions performed on the domain by users of happyDomain.
@Tags domains
@Accept json
@Produce json
@Param domainId path string true "Domain identifier"
@Security securitydefinitions.basic
@Success 200 {object} []happydns.DomainLog
@Failure 401 {object} happydns.ErrorResponse "Authentication failure"
@Failure 404 {object} happydns.ErrorResponse "Domain not found"
@Router /domains/{domainId}/logs [get]
type LoginController ¶
type LoginController struct {
// contains filtered or unexported fields
}
func NewLoginController ¶
func NewLoginController(authService happydns.AuthenticationUsecase) *LoginController
func (*LoginController) GetLoggedUser ¶
func (lc *LoginController) GetLoggedUser(c *gin.Context)
getLoggedUser retrieves the currently logged-in user.
@Summary Get the current user.
@Schemes
@Description Retrieve information about the currently logged-in user.
@Tags authentication
@Accept json
@Produce json
@Security securitydefinitions.basic
@Success 200 {object} happydns.User
@Failure 401 {object} happydns.ErrorResponse "Authentication failure"
@Router /auth/user [get]
func (*LoginController) Login ¶
func (lc *LoginController) Login(c *gin.Context)
login authenticates a user with username and password.
@Summary Log in a user.
@Schemes
@Description Authenticate a user with email and password, creating a new session.
@Tags authentication
@Accept json
@Produce json
@Param body body happydns.LoginRequest true "Login credentials"
@Success 200 {object} happydns.User
@Failure 400 {object} happydns.ErrorResponse "Invalid input"
@Failure 401 {object} happydns.ErrorResponse "Invalid username or password"
@Router /auth/login [post]
func (*LoginController) Logout ¶
func (lc *LoginController) Logout(c *gin.Context)
logout clears the current user's session.
@Summary Log out the current user.
@Schemes
@Description Clear the current user's session and log them out.
@Tags authentication
@Accept json
@Produce json
@Security securitydefinitions.basic
@Success 204 "Session cleared"
@Failure 500 {object} happydns.ErrorResponse
@Router /auth/logout [post]
type NewsletterController ¶
type NewsletterController struct {
// contains filtered or unexported fields
}
func NewNewsletterController ¶
func NewNewsletterController(ns happydns.NewsletterSubscriptor) *NewsletterController
func (*NewsletterController) SubscribeToNewsletter ¶
func (nc *NewsletterController) SubscribeToNewsletter(uinfo happydns.UserInfo) error
type OIDCProvider ¶
type OIDCProvider struct {
// contains filtered or unexported fields
}
func NewOIDCProvider ¶
func NewOIDCProvider(cfg *happydns.Options, authService happydns.AuthenticationUsecase) *OIDCProvider
func (*OIDCProvider) CompleteOIDC ¶
func (p *OIDCProvider) CompleteOIDC(c *gin.Context)
func (*OIDCProvider) RedirectOIDC ¶
func (p *OIDCProvider) RedirectOIDC(c *gin.Context)
type ProviderController ¶
type ProviderController struct {
// contains filtered or unexported fields
}
func NewProviderController ¶
func NewProviderController(providerService happydns.ProviderUsecase) *ProviderController
func (*ProviderController) AddProvider ¶
func (pc *ProviderController) AddProvider(c *gin.Context)
addProvider appends a new provider.
@Summary Add a new provider
@Schemes
@Description Append a new provider for the user.
@Tags providers
@Accept json
@Produce json
@Param body body happydns.ProviderMinimal true "Provider to add"
@Security securitydefinitions.basic
@Success 200 {object} happydns.Provider
@Failure 400 {object} happydns.ErrorResponse "Error in received data"
@Failure 401 {object} happydns.ErrorResponse "Authentication failure"
@Failure 500 {object} happydns.ErrorResponse "Unable to retrieve current user's providers"
@Router /providers [post]
func (*ProviderController) CreateDomainOnProvider ¶
func (pc *ProviderController) CreateDomainOnProvider(c *gin.Context)
CreateDomainsOnProvider ensure the given domain exists on the provider or creates it if possible.
@Summary Create a domain on the Provider.
@Schemes
@Description Create a domain on the given Provider.
@Tags providers
@Accept json
@Produce json
@Param providerId path string true "Provider identifier"
@Security securitydefinitions.basic
@Success 200 {object} happydns.Provider
@Failure 400 {object} happydns.ErrorResponse "Unable to instantiate the provider"
@Failure 400 {object} happydns.ErrorResponse "The provider doesn't support domain listing"
@Failure 400 {object} happydns.ErrorResponse "Provider error"
@Failure 401 {object} happydns.ErrorResponse "Authentication failure"
@Failure 404 {object} happydns.ErrorResponse "Provider not found"
@Router /providers/{providerId}/domains/{fqdn} [get]
func (*ProviderController) DeleteProvider ¶
func (pc *ProviderController) DeleteProvider(c *gin.Context)
DeleteProvider removes a provider from the database.
@Summary Delete a Provider.
@Schemes
@Description Delete a Provider from the database. It is required that no Domain are still managed by this Provider before calling this route.
@Tags providers
@Accept json
@Produce json
@Param providerId path string true "Provider identifier"
@Security securitydefinitions.basic
@Success 204 "Provider deleted"
@Failure 400 {object} happydns.ErrorResponse "Invalid input"
@Failure 401 {object} happydns.ErrorResponse "Authentication failure"
@Failure 404 {object} happydns.ErrorResponse "Provider not found"
@Failure 500 {object} happydns.ErrorResponse "Database writing error"
@Router /providers/{providerId} [delete]
func (*ProviderController) GetDomainsHostedByProvider ¶
func (pc *ProviderController) GetDomainsHostedByProvider(c *gin.Context)
getDomainsHostedByProvider lists domains available to management from the given Provider.
@Summary Lists manageable domains from the Provider.
@Schemes
@Description List domains available from the given Provider.
@Tags providers
@Accept json
@Produce json
@Param providerId path string true "Provider identifier"
@Security securitydefinitions.basic
@Success 200 {object} happydns.Provider
@Failure 400 {object} happydns.ErrorResponse "Unable to instantiate the provider"
@Failure 400 {object} happydns.ErrorResponse "The provider doesn't support domain listing"
@Failure 400 {object} happydns.ErrorResponse "Provider error"
@Failure 401 {object} happydns.ErrorResponse "Authentication failure"
@Failure 404 {object} happydns.ErrorResponse "Provider not found"
@Router /providers/{providerId}/domains [get]
func (*ProviderController) GetProvider ¶
func (pc *ProviderController) GetProvider(c *gin.Context)
GetProvider retrieves information about a given Provider owned by the user.
@Summary Retrieve Provider information.
@Schemes
@Description Retrieve information in the database about a given Provider owned by the user.
@Tags providers
@Accept json
@Produce json
@Param providerId path string true "Provider identifier"
@Security securitydefinitions.basic
@Success 200 {object} happydns.Provider
@Failure 401 {object} happydns.ErrorResponse "Authentication failure"
@Failure 404 {object} happydns.ErrorResponse "Provider not found"
@Router /providers/{providerId} [get]
func (*ProviderController) ListProviders ¶
func (pc *ProviderController) ListProviders(c *gin.Context)
ListProviders retrieves all providers belonging to the user.
@Summary Retrieve user's providers
@Schemes
@Description Retrieve all DNS providers belonging to the user.
@Tags providers
@Accept json
@Produce json
@Security securitydefinitions.basic
@Success 200 {array} happydns.ProviderMeta
@Failure 401 {object} happydns.ErrorResponse "Authentication failure"
@Failure 404 {object} happydns.ErrorResponse "Unable to retrieve user's domains"
@Router /providers [get]
func (*ProviderController) UpdateProvider ¶
func (pc *ProviderController) UpdateProvider(c *gin.Context)
UpdateProvider updates the information about a given Provider owned by the user.
@Summary Update Provider information.
@Schemes
@Description Updates the information about a given Provider owned by the user.
@Tags providers
@Accept json
@Produce json
@Param providerId path string true "Provider identifier"
@Param body body happydns.Provider true "The new object overriding the current provider"
@Security securitydefinitions.basic
@Success 200 {object} happydns.Provider
@Failure 400 {object} happydns.ErrorResponse "Invalid input"
@Failure 400 {object} happydns.ErrorResponse "Identifier changed"
@Failure 401 {object} happydns.ErrorResponse "Authentication failure"
@Failure 404 {object} happydns.ErrorResponse "Provider not found"
@Failure 500 {object} happydns.ErrorResponse "Database writing error"
@Router /providers/{providerId} [put]
type ProviderSettingsController ¶
type ProviderSettingsController struct {
// contains filtered or unexported fields
}
func NewProviderSettingsController ¶
func NewProviderSettingsController(pSettingsServices happydns.ProviderSettingsUsecase) *ProviderSettingsController
func (*ProviderSettingsController) NextProviderSettingsState ¶
func (psc *ProviderSettingsController) NextProviderSettingsState(c *gin.Context)
getProviderSettingsState creates or updates a Provider with human fillable forms.
@Summary Assistant to Provider creation.
@Schemes
@Description This creates or updates a Provider with human fillable forms.
@Tags provider_specs
@Accept json
@Produce json
@Param providerType path string true "The provider's type"
@Param body body happydns.ProviderSettingsState true "The current state of the Provider's settings, possibly empty (but not null)"
@Security securitydefinitions.basic
@Success 200 {object} happydns.Provider "The Provider has been created with the given settings"
@Success 202 {object} happydns.ProviderSettingsResponse "The settings need more rafinement"
@Failure 400 {object} happydns.ErrorResponse "Invalid input"
@Failure 401 {object} happydns.ErrorResponse "Authentication failure"
@Failure 404 {object} happydns.ErrorResponse "Provider not found"
@Router /providers/_specs/{providerType}/settings [post]
type ProviderSpecsController ¶
type ProviderSpecsController struct {
// contains filtered or unexported fields
}
func NewProviderSpecsController ¶
func NewProviderSpecsController(pSpecsServices happydns.ProviderSpecsUsecase) *ProviderSpecsController
func (*ProviderSpecsController) GetProviderSpec ¶
func (psc *ProviderSpecsController) GetProviderSpec(c *gin.Context)
GetProviderSpec returns a description of the expected settings and the provider capabilities.
@Summary Get the provider capabilities and expected settings.
@Schemes
@Description Return a description of the expected settings and the provider capabilities.
@Tags provider_specs
@Accept json
@Produce json
@Param providerType path string true "The provider's type"
@Success 200 {object} happydns.ProviderSpecs
@Failure 404 {object} happydns.ErrorResponse "Provider type does not exist"
@Router /providers/_specs/{providerType} [get]
func (*ProviderSpecsController) GetProviderSpecIcon ¶
func (psc *ProviderSpecsController) GetProviderSpecIcon(c *gin.Context)
GetProviderSpecIcon returns the icon as image/png.
@Summary Get the PNG icon.
@Schemes
@Description Return the icon as a image/png file for the given provider type.
@Tags provider_specs
@Accept json
@Produce png
@Param providerType path string true "The provider's type"
@Success 200 {file} png
@Failure 404 {object} happydns.ErrorResponse "Provider type does not exist"
@Router /providers/_specs/{providerType}/icon.png [get]
func (*ProviderSpecsController) ListProviders ¶
func (psc *ProviderSpecsController) ListProviders(c *gin.Context)
ListProviders returns the static list of usable providers in this happyDomain release.
@Summary List all providers with which you can connect.
@Schemes
@Description This returns the static list of usable providers in this happyDomain release.
@Tags provider_specs
@Accept json
@Produce json
@Success 200 {object} map[string]happydns.ProviderInfos{} "The list"
@Router /providers/_specs [get]
type RecordController ¶ added in v0.5.0
type RecordController struct{}
func NewRecordController ¶ added in v0.5.0
func NewRecordController() *RecordController
func (*RecordController) ParseRecords ¶ added in v0.5.0
func (rc *RecordController) ParseRecords(c *gin.Context)
ParseRecords parses records.
@Summary Parse given text to retrieve inner records.
@Schemes
@Description Parse given text to retrieve inner records.
@Tags records
@Accept json
@Produce json
@Security securitydefinitions.basic
@Param origin query int false "Origin to use if not provided"
@Param body body string true "Zone file as text"
@Success 200 {object} happydns.Record
@Failure 400 {object} happydns.ErrorResponse "Invalid input"
@Failure 401 {object} happydns.ErrorResponse "Authentication failure"
@Router /records [post]
type RegistrationController ¶
type RegistrationController struct {
// contains filtered or unexported fields
}
func NewRegistrationController ¶
func NewRegistrationController(auService happydns.AuthUserUsecase) *RegistrationController
func (*RegistrationController) RegisterNewUser ¶
func (rc *RegistrationController) RegisterNewUser(c *gin.Context)
RegisterNewUser checks and appends a user in the database.
@Summary Register account.
@Schemes
@Description Register a new happyDomain account (when using internal authentication system).
@Tags users
@Accept json
@Produce json
@Param body body happydns.UserRegistration true "Account information"
@Success 200 {object} happydns.User "The created user"
@Failure 400 {object} happydns.ErrorResponse "Invalid input"
@Failure 500 {object} happydns.ErrorResponse
@Router /users [post]
type ResolverController ¶
type ResolverController struct {
// contains filtered or unexported fields
}
func NewResolverController ¶
func NewResolverController(resolverService happydns.ResolverUsecase) *ResolverController
func (*ResolverController) RunResolver ¶
func (rc *ResolverController) RunResolver(c *gin.Context)
runResolver performs a NS resolution for a given domain, with options.
@Summary Perform a DNS resolution.
@Schemes
@Description Perform a NS resolution for a given domain, with options.
@Tags resolver
@Accept json
@Produce json
@Param body body happydns.ResolverRequest true "Options to the resolution"
@Success 200 {object} DNSMsg
@Success 204 {object} happydns.ErrorResponse "No content"
@Failure 400 {object} happydns.ErrorResponse "Invalid input"
@Failure 401 {object} happydns.ErrorResponse "Authentication failure"
@Failure 403 {object} happydns.ErrorResponse "The resolver refused to treat our request"
@Failure 404 {object} happydns.ErrorResponse "The domain doesn't exist"
@Failure 406 {object} happydns.ErrorResponse "The resolver returned an error"
@Failure 500 {object} happydns.ErrorResponse
@Router /resolver [post]
type ServiceController ¶
type ServiceController struct {
// contains filtered or unexported fields
}
func NewServiceController ¶
func NewServiceController(duService happydns.ZoneServiceUsecase, suService happydns.ServiceUsecase, zuService happydns.ZoneUsecase) *ServiceController
func (*ServiceController) AddZoneService ¶
func (sc *ServiceController) AddZoneService(c *gin.Context)
addZoneService adds a Service to the given subdomain of the Zone.
@Summary Add a Service.
@Schemes
@Description Add a Service to the given subdomain of the Zone.
@Tags zones
@Accept json
@Produce json
@Security securitydefinitions.basic
@Param domainId path string true "Domain identifier"
@Param zoneId path string true "Zone identifier"
@Param subdomain path string true "Part of the subdomain considered for the service (@ for the root of the zone ; subdomain is relative to the root, do not include it)"
@Success 200 {object} happydns.Zone
@Failure 400 {object} happydns.ErrorResponse "Invalid input"
@Failure 401 {object} happydns.ErrorResponse "Authentication failure"
@Failure 404 {object} happydns.ErrorResponse "Domain or Zone not found"
@Router /domains/{domainId}/zone/{zoneId}/{subdomain}/services [post]
func (*ServiceController) DeleteZoneService ¶
func (sc *ServiceController) DeleteZoneService(c *gin.Context)
deleteZoneService drops the given Service.
@Summary Drop the given Service.
@Schemes
@Description Drop the given Service.
@Tags zones
@Accept json
@Produce json
@Security securitydefinitions.basic
@Param domainId path string true "Domain identifier"
@Param zoneId path string true "Zone identifier"
@Param subdomain path string true "Part of the subdomain considered for the service (@ for the root of the zone ; subdomain is relative to the root, do not include it)"
@Param serviceId path string true "Service identifier"
@Success 200 {object} happydns.Zone
@Failure 400 {object} happydns.ErrorResponse "Invalid input"
@Failure 401 {object} happydns.ErrorResponse "Authentication failure"
@Failure 404 {object} happydns.ErrorResponse "Domain or Zone not found"
@Router /domains/{domainId}/zone/{zoneId}/{subdomain}/services/{serviceId} [delete]
func (*ServiceController) GetZoneService ¶
func (sc *ServiceController) GetZoneService(c *gin.Context)
getServiceService retrieves the designated Service.
@Summary Get the Service.
@Schemes
@Description Retrieve the designated Service.
@Tags zones
@Accept json
@Produce json
@Security securitydefinitions.basic
@Param domainId path string true "Domain identifier"
@Param zoneId path string true "Zone identifier"
@Param subdomain path string true "Part of the subdomain considered for the service (@ for the root of the zone ; subdomain is relative to the root, do not include it)"
@Param serviceId path string true "Service identifier"
@Success 200 {object} happydns.Service
@Failure 401 {object} happydns.ErrorResponse "Authentication failure"
@Failure 404 {object} happydns.ErrorResponse "Domain or Zone not found"
@Router /domains/{domainId}/zone/{zoneId}/{subdomain}/services/{serviceId} [get]
func (*ServiceController) UpdateZoneService ¶
func (sc *ServiceController) UpdateZoneService(c *gin.Context)
UpdateZoneService adds or updates a service inside the given Zone.
@Summary Add or update a Service.
@Schemes
@Description Add or update a Service inside the given Zone.
@Tags zones
@Accept json
@Produce json
@Security securitydefinitions.basic
@Param domainId path string true "Domain identifier"
@Param zoneId path string true "Zone identifier"
@Param body body happydns.Service true "Service to update"
@Success 200 {object} happydns.Zone
@Failure 401 {object} happydns.ErrorResponse "Authentication failure"
@Failure 404 {object} happydns.ErrorResponse "Domain or Zone not found"
@Router /domains/{domainId}/zone/{zoneId} [patch]
type ServiceSpecsController ¶
type ServiceSpecsController struct {
// contains filtered or unexported fields
}
func NewServiceSpecsController ¶
func NewServiceSpecsController(sSpecsServices happydns.ServiceSpecsUsecase) *ServiceSpecsController
func (*ServiceSpecsController) GetServiceSpec ¶
func (ssc *ServiceSpecsController) GetServiceSpec(c *gin.Context)
getServiceSpec returns a description of the expected fields.
@Summary Get the service expected fields.
@Schemes
@Description Return a description of the expected fields.
@Tags service_specs
@Accept json
@Produce json
@Param serviceType path string true "The service's type"
@Success 200 {object} happydns.ServiceSpecs
@Failure 404 {object} happydns.ErrorResponse "Service type does not exist"
@Router /service_specs/{serviceType} [get]
func (*ServiceSpecsController) GetServiceSpecIcon ¶
func (ssc *ServiceSpecsController) GetServiceSpecIcon(c *gin.Context)
GetServiceSpecIcon returns the icon as image/png.
@Summary Get the PNG icon.
@Schemes
@Description Return the icon as a image/png file for the given service type.
@Tags service_specs
@Accept json
@Produce png
@Param serviceType path string true "The service's type"
@Success 200 {file} png
@Failure 404 {object} happydns.ErrorResponse "Service type does not exist"
@Router /service_specs/{serviceType}/icon.png [get]
func (*ServiceSpecsController) InitializeServiceSpec ¶ added in v0.5.1
func (ssc *ServiceSpecsController) InitializeServiceSpec(c *gin.Context)
InitializeServiceSpec returns an initialized service instance with default values.
@Summary Initialize a new service instance.
@Schemes
@Description Return an initialized service instance with default or custom values.
@Tags service_specs
@Accept json
@Produce json
@Param serviceType path string true "The service's type"
@Success 200 {object} interface{}
@Failure 404 {object} happydns.ErrorResponse "Service type does not exist"
@Failure 500 {object} happydns.ErrorResponse "Internal error"
@Router /service_specs/{serviceType}/init [post]
func (*ServiceSpecsController) ListServiceSpecs ¶
func (ssc *ServiceSpecsController) ListServiceSpecs(c *gin.Context)
ListServiceSpecs returns the static list of usable services in this happyDomain release.
@Summary List all services with which you can connect.
@Schemes
@Description This returns the static list of usable services in this happyDomain release.
@Tags service_specs
@Accept json
@Produce json
@Success 200 {object} map[string]happydns.ServiceInfos{} "The list"
@Router /service_specs [get]
type SessionController ¶
type SessionController struct {
// contains filtered or unexported fields
}
func NewSessionController ¶
func NewSessionController(sessionService happydns.SessionUsecase) *SessionController
func (*SessionController) ClearSession ¶
func (sc *SessionController) ClearSession(c *gin.Context)
clearSession removes the content of the current user's session.
@Summary Remove user's session content
@Schemes
@Description Remove the content of the current user's session.
@Tags users
@Accept json
@Prodsce json
@Security securitydefinitions.basic
@Ssccess 204 {null} null
@Failure 401 {object} happydns.ErrorResponse "Authentication failure"
@Router /session [delete]
func (*SessionController) ClearUserSessions ¶
func (sc *SessionController) ClearUserSessions(c *gin.Context)
clearUserSessions closes all existing sessions for a given user, and disconnect it.
@Summary Remove user's sessions
@Schemes
@Description Closes all sessions for a given user.
@Tags users
@Accept json
@Prodsce json
@Security securitydefinitions.basic
@Ssccess 204 {null} null
@Failure 401 {object} happydns.ErrorResponse "Authentication failure"
@Router /sessions [delete]
func (*SessionController) CreateSession ¶
func (sc *SessionController) CreateSession(c *gin.Context)
createSession create a new session for the current user
@Summary Create a new session for the current user.
@Schemes
@Description Create a new session for the current user.
@Tags users
@Accept json
@Prodsce json
@Security securitydefinitions.basic
@Ssccess 200 {object} happydns.Session
@Failure 401 {object} happydns.ErrorResponse "Authentication failure"
@Router /sessions [post]
func (*SessionController) DeleteSession ¶
func (sc *SessionController) DeleteSession(c *gin.Context)
deleteSession delete a session owned by the current user
@Summary Delete a session owned by the current user.
@Schemes
@Description Delete a session owned by the current user.
@Tags users
@Accept json
@Param sessionId path string true "Session identifier"
@Prodsce json
@Security securitydefinitions.basic
@Ssccess 200 {object} happydns.Session
@Failure 401 {object} happydns.ErrorResponse "Authentication failure"
@Router /sessions/{sessionId} [delete]
func (*SessionController) GetSession ¶
func (sc *SessionController) GetSession(c *gin.Context)
getSession gets the content of the current user's session.
@Summary Retrieve user's session content
@Schemes
@Description Get the content of the current user's session.
@Tags users
@Accept json
@Prodsce json
@Security securitydefinitions.basic
@Ssccess 200 {object} happydns.Session
@Failure 401 {object} happydns.ErrorResponse "Authentication failure"
@Router /session [get]
func (*SessionController) GetSessions ¶
func (sc *SessionController) GetSessions(c *gin.Context)
getSessions lists the sessions open for the current user.
@Summary List user's sessions
@Schemes
@Description List the sessions open for the current user
@Tags users
@Accept json
@Prodsce json
@Security securitydefinitions.basic
@Ssccess 200 {object} happydns.Session
@Failure 401 {object} happydns.ErrorResponse "Authentication failure"
@Router /sessions [get]
func (*SessionController) SessionHandler ¶
func (sc *SessionController) SessionHandler(c *gin.Context)
func (*SessionController) UpdateSession ¶
func (sc *SessionController) UpdateSession(c *gin.Context)
updateSession update a session owned by the current user
@Summary Update a session owned by the current user.
@Schemes
@Description Update a session owned by the current user.
@Tags users
@Accept json
@Param sessionId path string true "Session identifier"
@Prodsce json
@Security securitydefinitions.basic
@Ssccess 200 {object} happydns.Session
@Failure 401 {object} happydns.ErrorResponse "Authentication failure"
@Router /sessions/{sessionId} [put]
type UserController ¶
type UserController struct {
// contains filtered or unexported fields
}
func NewUserController ¶
func NewUserController(userService happydns.UserUsecase, lc *LoginController) *UserController
func (*UserController) ChangeUserSettings ¶
func (uc *UserController) ChangeUserSettings(c *gin.Context)
changeUserSettings updates the settings of the given user.
@Summary Update user's settings.
@Schemes
@Description Update the user's settings.
@Tags users
@Accept json
@Produce json
@Param userId path string true "User identifier"
@Param body body happydns.UserSettings true "User settings"
@Security securitydefinitions.basic
@Success 200 {object} happydns.UserSettings "User settings"
@Failure 400 {object} happydns.ErrorResponse "Invalid input"
@Failure 401 {object} happydns.ErrorResponse "Authentication failure"
@Failure 403 {object} happydns.ErrorResponse "Not your account"
@Failure 500 {object} happydns.ErrorResponse
@Router /users/{userId}/settings [post]
func (*UserController) DeleteMyUser ¶
func (uc *UserController) DeleteMyUser(c *gin.Context)
deleteMyUser deletes the current user's account.
@Summary Delete user account.
@Schemes
@Description Delete the current user's account and all associated data.
@Tags users
@Accept json
@Produce json
@Param userId path string true "User identifier"
@Security securitydefinitions.basic
@Success 204 "User deleted"
@Failure 401 {object} happydns.ErrorResponse "Authentication failure"
@Failure 403 {object} happydns.ErrorResponse "Not your account"
@Failure 500 {object} happydns.ErrorResponse
@Router /users/{userId} [delete]
func (*UserController) GetUser ¶
func (uc *UserController) GetUser(c *gin.Context)
getUser shows a user in the database.
@Summary Show user.
@Schemes
@Description Show a user from the database, information is limited to id and email if this is not the current user.
@Tags users
@Accept json
@Produce json
@Success 200 {object} happydns.User "The created user"
@Failure 500 {object} happydns.ErrorResponse
@Router /users/{userId} [get]
func (*UserController) GetUserAvatar ¶
func (uc *UserController) GetUserAvatar(c *gin.Context)
getUserAvatar returns a unique avatar for the user.
@Summary Show user's avatar.
@Schemes
@Description Returns a unique avatar for the user.
@Tags users
@Accept json
@Produce png
@Param size query int false "Image output desired size"
@Success 200 {file} png
@Failure 500 {object} happydns.ErrorResponse
@Router /users/{userId}/avatar.png [get]
func (*UserController) GetUserSettings ¶
func (uc *UserController) GetUserSettings(c *gin.Context)
getUserSettings gets the settings of the given user.
@Summary Retrieve user's settings.
@Schemes
@Description Retrieve the user's settings.
@Tags users
@Accept json
@Produce json
@Param userId path string true "User identifier"
@Security securitydefinitions.basic
@Success 200 {object} happydns.UserSettings "User settings"
@Failure 401 {object} happydns.ErrorResponse "Authentication failure"
@Failure 403 {object} happydns.ErrorResponse "Not your account"
@Router /users/{userId}/settings [get]
type UserRecoveryController ¶
type UserRecoveryController struct {
// contains filtered or unexported fields
}
func NewUserRecoveryController ¶
func NewUserRecoveryController(auService happydns.AuthUserUsecase) *UserRecoveryController
func (*UserRecoveryController) RecoverUserAccount ¶
func (rc *UserRecoveryController) RecoverUserAccount(c *gin.Context)
recoverUserAccount performs account recovery by reseting the password of the account.
@Summary Reset password with link in email.
@Schemes
@Description This performs account recovery by reseting the password of the account.
@Tags users
@Accept json
@Produce json
@Param userId path string true "User identifier"
@Param body body happydns.AccountRecoveryForm true "Recovery form"
@Success 204 {null} null "Recovery completed, you can now login with your new credentials"
@Failure 400 {object} happydns.ErrorResponse "Invalid input"
@Failure 500 {object} happydns.ErrorResponse
@Router /users/{userId}/recovery [post]
func (*UserRecoveryController) UserRecoveryOperations ¶
func (rc *UserRecoveryController) UserRecoveryOperations(c *gin.Context)
UserRecoveryOperations performs account recovery.
@Summary Account recovery.
@Schemes
@Description This will send an email to the user either to recover its account or with a new email validation link.
@Tags users
@Accept json
@Produce json
@Param body body happydns.UserSpecialAction true "Description of the action to perform and email of the user"
@Success 200 {object} happydns.ErrorResponse "Perhaps something happen"
@Failure 500 {object} happydns.ErrorResponse
@Router /users [patch]
func (*UserRecoveryController) ValidateUserAddress ¶
func (rc *UserRecoveryController) ValidateUserAddress(c *gin.Context)
validateUserAddress validates a user address after registration.
@Summary Validate e-mail address.
@Schemes
@Description This is the route called by the web interface in order to validate the e-mail address of the user.
@Tags users
@Accept json
@Produce json
@Param userId path string true "User identifier"
@Param body body happydns.AddressValidationForm true "Validation form"
@Success 204 {null} null "Email validated, you can now login"
@Failure 400 {object} happydns.ErrorResponse "Invalid input"
@Failure 500 {object} happydns.ErrorResponse
@Router /users/{userId}/email [post]
type ZoneController ¶
type ZoneController struct {
// contains filtered or unexported fields
}
func NewZoneController ¶
func NewZoneController(zoneService happydns.ZoneUsecase, domainService happydns.DomainUsecase, zoneCorrectionService happydns.ZoneCorrectionApplierUsecase) *ZoneController
func (*ZoneController) AddRecords ¶ added in v0.5.0
func (zc *ZoneController) AddRecords(c *gin.Context)
AddRecords adds a given record in the zone.
@Summary Add a given record in the zone.
@Schemes
@Description Add a given record in the zone.
@Tags zones
@Accept json
@Produce json
@Security securitydefinitions.basic
@Param domainId path string true "Domain identifier"
@Param zoneId path string true "Zone identifier"
@Param body body []string true "Records to add as text, one record per line array"
@Success 200 {object} happydns.Zone "The updated zone"
@Failure 401 {object} happydns.ErrorResponse "Authentication failure"
@Failure 404 {object} happydns.ErrorResponse "Domain or Zone not found"
@Router /domains/{domainId}/zone/{zoneId}/records [post]
func (*ZoneController) ApplyZoneCorrections ¶
func (zc *ZoneController) ApplyZoneCorrections(c *gin.Context)
applyZone performs the requested changes with the provider.
@Summary Performs requested changes to the real zone.
@Schemes
@Description Perform the requested changes with the provider.
@Tags zones
@Accept json
@Produce json
@Security securitydefinitions.basic
@Param domainId path string true "Domain identifier"
@Param zoneId path string true "Zone identifier"
@Param body body []string true "Differences (from /diff_zones) to apply"
@Success 200 {object} happydns.ZoneMeta "The new Zone metadata containing the current zone"
@Failure 400 {object} happydns.ErrorResponse "Invalid input"
@Failure 401 {object} happydns.ErrorResponse "Authentication failure"
@Failure 404 {object} happydns.ErrorResponse "Domain or Zone not found"
@Failure 500 {object} happydns.ErrorResponse
@Router /domains/{domainId}/zone/{zoneId}/apply_changes [post]
func (*ZoneController) DeleteRecords ¶ added in v0.5.0
func (zc *ZoneController) DeleteRecords(c *gin.Context)
DeleteRecords deletes a given record in the zone.
@Summary Delete a given record in the zone.
@Schemes
@Description Delete a given record in the zone.
@Tags zones
@Accept json
@Produce json
@Security securitydefinitions.basic
@Param domainId path string true "Domain identifier"
@Param zoneId path string true "Zone identifier"
@Param body body []string true "Records to delete as text, one record per line array"
@Success 200 {object} happydns.Zone "The updated zone"
@Failure 401 {object} happydns.ErrorResponse "Authentication failure"
@Failure 404 {object} happydns.ErrorResponse "Domain or Zone not found"
@Router /domains/{domainId}/zone/{zoneId}/records/delete [post]
func (*ZoneController) DiffZones ¶
func (zc *ZoneController) DiffZones(c *gin.Context)
DiffZones computes the difference between the two zone identifiers given.
@Summary Compute differences between zones.
@Schemes
@Description Compute the difference between the two zone identifiers given.
@Tags zones
@Accept json
@Produce json
@Security securitydefinitions.basic
@Param domainId path string true "Domain identifier"
@Param zoneId path string true "Zone identifier to use as the new one."
@Param oldZoneId path string true "Zone identifier to use as the old one. Currently only @ are expected, to use the currently deployed zone."
@Success 200 {object} []happydns.Correction "Differences, reported as text, one diff per item"
@Failure 400 {object} happydns.ErrorResponse "Invalid input"
@Failure 401 {object} happydns.ErrorResponse "Authentication failure"
@Failure 404 {object} happydns.ErrorResponse "Domain not found"
@Failure 500 {object} happydns.ErrorResponse
@Failure 501 {object} happydns.ErrorResponse "Diff between to zone identifier, currently not supported"
@Router /domains/{domainId}/zone/{zoneId}/diff/{oldZoneId} [post]
func (*ZoneController) ExportZone ¶
func (zc *ZoneController) ExportZone(c *gin.Context)
ExportZone creates a flatten export of the zone.
@Summary Get flatten zone file.
@Schemes
@Description Create a flatten export of the zone that can be read as a BIND-like file.
@Tags zones
@Accept json
@Produce json
@Security securitydefinitions.basic
@Param domainId path string true "Domain identifier"
@Param zoneId path string true "Zone identifier"
@Success 200 {object} string "The exported zone file (with initial and leading JSON quote)"
@Failure 401 {object} happydns.ErrorResponse "Authentication failure"
@Failure 404 {object} happydns.ErrorResponse "Domain or Zone not found"
@Router /domains/{domainId}/zone/{zoneId}/view [post]
func (*ZoneController) GetZone ¶
func (zc *ZoneController) GetZone(c *gin.Context)
getZone retrieves a zone's information.
@Summary Retrieve a zone.
@Schemes
@Description Retrieve information about a zone.
@Tags zones
@Accept json
@Produce json
@Security securitydefinitions.basic
@Param domainId path string true "Domain identifier"
@Param zoneId path string true "Zone identifier"
@Success 200 {object} happydns.Zone
@Failure 401 {object} happydns.ErrorResponse "Authentication failure"
@Failure 404 {object} happydns.ErrorResponse "Domain or Zone not found"
@Router /domains/{domainId}/zone/{zoneId} [get]
func (*ZoneController) GetZoneSubdomain ¶
func (zc *ZoneController) GetZoneSubdomain(c *gin.Context)
getZoneSubdomain returns the services associated with a given subdomain.
@Summary List services
@Schemes
@Description Returns the services associated with the given subdomain.
@Tags zones
@Accept json
@Produce json
@Security securitydefinitions.basic
@Param domainId path string true "Domain identifier"
@Param zoneId path string true "Zone identifier"
@Param subdomain path string true "Part of the subdomain considered for the service (@ for the root of the zone ; subdomain is relative to the root, do not include it)"
@Success 200 {object} happydns.ZoneServices
@Failure 401 {object} happydns.ErrorResponse "Authentication failure"
@Failure 404 {object} happydns.ErrorResponse "Domain or Zone not found"
@Router /domains/{domainId}/zone/{zoneId}/{subdomain} [get]
func (*ZoneController) UpdateRecord ¶ added in v0.5.0
func (zc *ZoneController) UpdateRecord(c *gin.Context)
UpdateRecords updates a given record in the zone.
@Summary Update a given record in the zone.
@Schemes
@Description Update a given record in the zone.
@Tags zones
@Accept json
@Produce json
@Security securitydefinitions.basic
@Param domainId path string true "Domain identifier"
@Param zoneId path string true "Zone identifier"
@Param body body happydns.UpdateRecordForm true "Record to update as text"
@Success 200 {object} happydns.Zone "The updated zone"
@Failure 401 {object} happydns.ErrorResponse "Authentication failure"
@Failure 404 {object} happydns.ErrorResponse "Domain or Zone not found"
@Router /domains/{domainId}/zone/{zoneId}/records [patch]
Source Files
¶
- auth_user.go
- authentication.go
- authentication_oidc.go
- domain.go
- domain_log.go
- newsletter.go
- provider.go
- provider_settings.go
- provider_specs.go
- record.go
- resolver.go
- service.go
- service_specs.go
- session.go
- user.go
- user_recovery.go
- user_registration.go
- version.go
- zone.go