Documentation ¶
Overview ¶
Package lib provides the objects required to operate registrar
Package lib provides the objects required to operate registrar ¶
Package lib provides the objects required to operate registrar ¶
Package lib provides the objects required to operate registrar ¶
Package lib provides the objects required to operate registrar ¶
Package lib provides the objects required to operate registrar ¶
Package lib provides the objects required to operate registrar ¶
Package lib provides the objects required to operate registrar ¶
Package lib provides the objects required to operate go-registrar ¶
Package lib provides the objects required to operate registrar
Index ¶
- Constants
- Variables
- func APIRespond(httpResponse http.ResponseWriter, response APIResponse)
- func AppendEPPActionLog(dbCache *DBCache, request *http.Request) error
- func BootstrapRegistrar(dbCache *DBCache, conf Config) (err error)
- func CompareDSDataEntries(dse []DSDataEntry, dseo []DSDataEntry) bool
- func CompareHostAddressLists(halr []HostAddress, halre []HostAddress) bool
- func CompareToApproverExportShortLists(apps []ApproverExportShort, appse []ApproverExportShort) bool
- func CompareToApproverListExportShortList(apps []Approver, appse []ApproverExportShort) bool
- func CompareToApproverSetExportShortLists(approverSet1 []ApproverSetExportShort, approverSet2 []ApproverSetExportShort) bool
- func CompareToApproverSetListToExportShort(approverSet1 []ApproverSet, approverSet2 []ApproverSetExportShort) bool
- func CompareToHostExportShortLists(hostExport1 []HostExportShort, hostExport2 []HostExportShort) bool
- func CompareToHostListExportShortList(host []Host, hostExport []HostExportShort) bool
- func ConfigureLogging(conf Config) error
- func Create(scope *gorm.Scope)
- func CreateEPPRunRecord(dbCache *DBCache, clientID string) (id int64, err error)
- func CreateNewIPAllowListRevision(dbCache *DBCache, ips []string, username string) (err error)
- func CreateNewProtectedDomainList(dbCache *DBCache, domains []string, username string) (err error)
- func DBPing(db *gorm.DB) (time.Duration, error)
- func DiffDomainDSData(registry *epp.Response, registrar []DSDataEntry) (addDSRecords, remDSRecords []epp.DSData, err error)
- func DiffIPLists(currentList, expectedList []string) (add, remove []string)
- func DiffIPsExport(registry *epp.Response, registrar *HostExport) (ipv4Add, ipv4Rem, ipv6Add, ipv6Rem []string, err error)
- func DomainExists(domainName string, dbCache *DBCache) (bool, error)
- func EndEPPRunRecord(dbCache *DBCache, runid int64, clientID string) (err error)
- func ErrsToStrings(errs []error) (strs []string)
- func FlagDomainsRequiringRenewal(dbCache *DBCache) (err error)
- func FuncNOPErrFunc() error
- func GetActiveInactive(cleartextState string) string
- func GetActiveInactiveExternal(cleartextState string) string
- func GetActiveNewExternal(cleartextState string) string
- func GetAllHostNamess(dbCache *DBCache) (hostnames map[string]int64, err error)
- func GetCertificate(pemEncoded []byte) (cert *x509.Certificate, err error)
- func GetCertificateSerial(pemEncoded []byte) (serial string, err error)
- func GetCheckboxState(cleartextForm string) bool
- func GetDomainIDFromDomainName(dbCache *DBCache, domainName string) (domainID int64, err error)
- func GetEPPEncryptedPassphrase(dbCache *DBCache, username string) (encPassphrase string, err error)
- func GetIPAllowList(dbCache *DBCache) (ips []string, err error)
- func GetMailHosts(domain string) (hosts []string)
- func GetProtectedDomainList(dbCache *DBCache) (domains []string, err error)
- func GetRemoteUser(req *http.Request) (string, error)
- func GetRemoteUserEmail(req *http.Request, conf Config) (string, error)
- func GetServerLockChanges(dbCache *DBCache) (unlock map[string][]string, lock map[string][]string, err error)
- func GetValidApproverMap(dbCache *DBCache) (map[int64]string, error)
- func GetValidApproverSetMap(dbCache *DBCache) (map[int64]string, error)
- func GetValidContactMap(dbCache *DBCache) (ret map[int64]string, err error)
- func GetValidHostMap(dbCache *DBCache) (ret map[int64]string, err error)
- func HandleInProgress(rec interface{}, progressFunc func())
- func HostnameExists(hostname string, dbCache *DBCache) (ret bool, err error)
- func IsAdminUser(username string, dbCache *DBCache) (bool, error)
- func IsRegisterableDomain(domainName string) (bool, error)
- func IsScopeUnchanged(scope *gorm.Scope) bool
- func Load(dbCache *DBCache, rec Modeler) (err error)
- func LoadDB(conf Config, logger *logging.Logger) (db *gorm.DB, err error)
- func LoadTemplates(path string) *template.Template
- func MigrateDBAPIUser(dbCache *DBCache)
- func MigrateDBAPIUserRevision(dbCache *DBCache)
- func MigrateDBApproval(dbCache *DBCache)
- func MigrateDBApprover(dbCache *DBCache)
- func MigrateDBApproverRevision(dbCache *DBCache)
- func MigrateDBApproverSet(dbCache *DBCache)
- func MigrateDBApproverSetRevision(dbCache *DBCache)
- func MigrateDBChangeRequest(dbCache *DBCache)
- func MigrateDBContact(dbCache *DBCache)
- func MigrateDBContactRevision(dbCache *DBCache)
- func MigrateDBControls(dbCache *DBCache)
- func MigrateDBDomain(dbCache *DBCache)
- func MigrateDBDomainRevision(dbCache *DBCache)
- func MigrateDBHost(dbCache *DBCache)
- func MigrateDBHostRevision(dbCache *DBCache)
- func MigrateDBLivenessCheck(dbCache *DBCache)
- func MigrateEPPActionLog(dbCache *DBCache)
- func MustGetLogger(name string) *logging.Logger
- func NullInt64ConfirmEqual(valA, valB sql.NullInt64) (match bool, diff string)
- func PrepareBase(dbCache *DBCache, rec Modeler, recursiveFunc func() error) (err error)
- func RegisterableDomainSuffix(domainName string) string
- func Save(db *gorm.DB, dbStruct interface{}) *gorm.DB
- func SaveAfterAssociations(scope *gorm.Scope)
- func SaveBeforeAssociations(scope *gorm.Scope)
- func SendEmail(server string, fromEmail string, fromName string, subject string, ...) (err error)
- func SetEPPEncryptedPassphrase(dbCache *DBCache, username string, encPassphrase string) (err error)
- func SetIPAllowList(dbCache *DBCache, ips []string, username string) (err error)
- func SetProtectedDomainList(dbCache *DBCache, domains []string, username string) (err error)
- func SetScopeHash(scope *gorm.Scope)
- func StringsToErrs(strs []string) (errs []error)
- func TimeNow() time.Time
- func Update(scope *gorm.Scope)
- func UpdateApproverSets(object RegistrarObject, dbCache *DBCache, association string, ...) error
- func UpdateDSDataEntries(domainRevision *DomainRevision, dbCache *DBCache, association string, ...) error
- func UpdateHostAddresses(hostRev *HostRevision, dbCache *DBCache, association string, ...) error
- func UpdateHosts(object RegistrarObject, dbCache *DBCache, association string, hosts []Host) error
- func VerifyCR(dbCache *DBCache, rec RegistrarCRObject, _ *ChangeRequest) (checksOut bool, errs []error)
- func WHOISConfirmEmail(dbCache *DBCache, con Config) (err error)
- type APIRequest
- type APIResponse
- func GenerateApprovalDownload(data []byte, errs []error) APIResponse
- func GenerateErrorResponse(errs []error) APIResponse
- func GenerateIDList(objectType string, ids []int64, revisions []APIRevisionHint) APIResponse
- func GenerateObjectResponse(object RegistrarObjectExport) APIResponse
- func GenerateSignatureResponse(data []byte) APIResponse
- func GenerateTokenResponse(token string) APIResponse
- type APIRevisionHint
- func GetAllContacts(dbCache *DBCache) (retlist []int64, revisions []APIRevisionHint, err error)
- func GetAllDomains(dbCache *DBCache) (retlist []int64, revisions []APIRevisionHint, err error)
- func GetAllHosts(dbCache *DBCache) (retlist []int64, revisions []APIRevisionHint, err error)
- func GetWorkContacts(dbCache *DBCache) (retlist []int64, revisions []APIRevisionHint, err error)
- func GetWorkDomains(dbCache *DBCache) (retlist []int64, revisions []APIRevisionHint, err error)
- func GetWorkHosts(dbCache *DBCache) (retlist []int64, revisions []APIRevisionHint, err error)
- type APIUser
- func (a *APIUser) ComparePendingToCallback(loadFn CompareLoadFn) (retFn CompareReturnFn)
- func (a *APIUser) GetAllPage(dbCache *DBCache, _ string, _ string) (aop RegistrarObjectPage, err error)
- func (a *APIUser) GetCertName() string
- func (a *APIUser) GetCurrentRevisionID() sql.NullInt64
- func (a *APIUser) GetCurrentValue(field string) (ret string)
- func (a *APIUser) GetDisplayName() string
- func (a *APIUser) GetExportShortVersion() APIUserExportShort
- func (a *APIUser) GetExportVersion() RegistrarObjectExport
- func (a *APIUser) GetExportVersionAt(dbCache *DBCache, timestamp int64) (obj RegistrarObjectExport, err error)
- func (a *APIUser) GetInformedApproverSets(dbCache *DBCache) (as []ApproverSet, err error)
- func (a *APIUser) GetPage(dbCache *DBCache, username string, email string) (rop RegistrarObjectPage, err error)
- func (a *APIUser) GetPendingCRID() sql.NullInt64
- func (a *APIUser) GetPendingRevision() RegistrarObject
- func (a *APIUser) GetPendingRevisionID() int64
- func (a *APIUser) GetRequiredApproverSets(dbCache *DBCache) (approvers []ApproverSet, err error)
- func (a *APIUser) GetType() string
- func (a APIUser) HasPendingRevision() bool
- func (a APIUser) HasRevision() bool
- func (a *APIUser) IsAdmin(dbCache *DBCache) (isAdmin bool, err error)
- func (a *APIUser) IsCancelled() bool
- func (a *APIUser) IsEditable() bool
- func (a *APIUser) ParseFromForm(request *http.Request, _ *DBCache) error
- func (a *APIUser) ParseFromFormUpdate(_ *http.Request, _ *DBCache, _ Config) error
- func (a *APIUser) Prepare(dbCache *DBCache) (err error)
- func (a *APIUser) PrepareShallow(dbCache *DBCache) error
- func (a APIUser) SuggestedRevisionBool(field string) bool
- func (a APIUser) SuggestedRevisionValue(field string) string
- func (a *APIUser) TakeAction(response http.ResponseWriter, _ *http.Request, _ *DBCache, actionName string, ...) (errs []error)
- func (a *APIUser) UpdateState(dbCache *DBCache, _ Config) (changesMade bool, errs []error)
- func (a *APIUser) VerifyCR(dbCache *DBCache) (checksOut bool, errs []error)
- type APIUserExportFull
- type APIUserExportShort
- type APIUserPage
- type APIUserRevision
- func (a *APIUserRevision) Cancel(dbCache *DBCache, conf Config) (errs []error)
- func (a *APIUserRevision) Decline(dbCache *DBCache) (err error)
- func (a *APIUserRevision) GetActions(isSelf bool) map[string]string
- func (a *APIUserRevision) GetAllPage(dbCache *DBCache, _ string, _ string) (arop RegistrarObjectPage, err error)
- func (a *APIUserRevision) GetCertificate() (cert *x509.Certificate, err error)
- func (a *APIUserRevision) GetExportVersion() RegistrarObjectExport
- func (a *APIUserRevision) GetExportVersionAt(_ *DBCache, _ int64) (obj RegistrarObjectExport, err error)
- func (a *APIUserRevision) GetInformedApproverSets(dbCache *DBCache) (approverSets []ApproverSet, err error)
- func (a *APIUserRevision) GetPage(dbCache *DBCache, _ string, _ string) (arop RegistrarObjectPage, err error)
- func (a *APIUserRevision) GetRequiredApproverSets(dbCache *DBCache) (approverSets []ApproverSet, err error)
- func (a *APIUserRevision) GetState(cleartextState string) string
- func (a *APIUserRevision) GetType() string
- func (a APIUserRevision) HasHappened(actionType string) bool
- func (a *APIUserRevision) IsActive() bool
- func (a *APIUserRevision) IsCancelled() bool
- func (a APIUserRevision) IsDesiredState(state string) bool
- func (a *APIUserRevision) IsEditable() bool
- func (a *APIUserRevision) ParseFromForm(request *http.Request, dbCache *DBCache) error
- func (a *APIUserRevision) ParseFromFormUpdate(request *http.Request, dbCache *DBCache, _ Config) error
- func (a *APIUserRevision) Prepare(dbCache *DBCache) (err error)
- func (a *APIUserRevision) Promote(dbCache *DBCache) (err error)
- func (a *APIUserRevision) StartApprovalProcess(request *http.Request, dbCache *DBCache, conf Config) (err error)
- func (a *APIUserRevision) Supersed(dbCache *DBCache) (err error)
- func (a *APIUserRevision) TakeAction(responseWriter http.ResponseWriter, request *http.Request, dbCache *DBCache, ...) (errs []error)
- type APIUserRevisionExport
- func (are APIUserRevisionExport) Compare(apiUserRevision APIUserRevision) (pass bool, errs []error)
- func (are APIUserRevisionExport) CompareExport(apiUserRevisionExport APIUserRevisionExport) (pass bool, errs []error)
- func (are APIUserRevisionExport) GetDiff() (string, error)
- func (are APIUserRevisionExport) ToJSON() (string, error)
- type APIUserRevisionPage
- type APIUserRevisionsPage
- type APIUsersPage
- type Approval
- func (a *Approval) AfterSave(dbin *gorm.DB) error
- func (a *Approval) ApprovalUpdateEmail(newState string, conf Config, dbCache *DBCache) error
- func (a *Approval) CheckSignature(dbCache *DBCache) (validSig bool, action string, err error)
- func (a *Approval) CheckValidityOfApproverSet(dbCache *DBCache) (state string, err error)
- func (a *Approval) GetAllPage(dbCache *DBCache, _ string, _ string) (rop RegistrarObjectPage, err error)
- func (a *Approval) GetApprovalAttestation(dbCache *DBCache) (appatt ApprovalAttestationUnmarshal, validSig bool, err error)
- func (a *Approval) GetApproverEmails(dbCache *DBCache) (emails []string, err error)
- func (a *Approval) GetDownload(dbCache *DBCache, username string, method string) string
- func (a *Approval) GetDownloadAttestation(dbCache *DBCache, username string, method string) (aa ApprovalAttestation, err error)
- func (a *Approval) GetExportVersion() RegistrarObjectExport
- func (a *Approval) GetExportVersionAt(_ *DBCache, _ int64) (obj RegistrarObjectExport, err error)
- func (a *Approval) GetPage(dbCache *DBCache, _ string, email string) (rop RegistrarObjectPage, err error)
- func (a *Approval) GetSigner(dbCache *DBCache) (signers []Approver, err error)
- func (a *Approval) GetType() string
- func (a *Approval) IsCancelled() bool
- func (a *Approval) IsEditable() bool
- func (a *Approval) NewApprovalEmail(conf Config, dbCache *DBCache) error
- func (a *Approval) ParseFromForm(_ *http.Request, _ *DBCache) error
- func (a *Approval) ParseFromFormUpdate(request *http.Request, dbCache *DBCache, conf Config) (err error)
- func (a *Approval) PostUpdate(dbCache *DBCache, conf Config) error
- func (a *Approval) Prepare(dbCache *DBCache) (err error)
- func (a *Approval) TakeAction(responseWriter http.ResponseWriter, request *http.Request, dbCache *DBCache, ...) (errs []error)
- func (a *Approval) UpdateState(dbCache *DBCache, conf Config) (changesMade bool, errs []error)
- type ApprovalAttestation
- type ApprovalAttestationUnmarshal
- type ApprovalDownload
- type ApprovalExport
- type ApprovalPage
- type ApprovalsPage
- type Approver
- func (a *Approver) AfterSave(dbin *gorm.DB) error
- func (a *Approver) ComparePendingToCallback(loadFn CompareLoadFn) (retFn CompareReturnFn)
- func (a *Approver) GetActiveApproverSets(dbCache *DBCache) (approverSets []ApproverSet, err error)
- func (a *Approver) GetAllPage(dbCache *DBCache, _ string, _ string) (RegistrarObjectPage, error)
- func (a *Approver) GetCurrentRevisionID() sql.NullInt64
- func (a *Approver) GetCurrentValue(field string) (ret string)
- func (a *Approver) GetDisplayName() string
- func (a *Approver) GetExportShortVersion() ApproverExportShort
- func (a *Approver) GetExportVersion() RegistrarObjectExport
- func (a *Approver) GetExportVersionAt(dbCache *DBCache, timestamp int64) (obj RegistrarObjectExport, err error)
- func (a *Approver) GetGPGKeyBlock() (*openpgp.Entity, error)
- func (a *Approver) GetInformedApproverSets(dbCache *DBCache) ([]ApproverSet, error)
- func (a *Approver) GetPage(dbCache *DBCache, username string, email string) (rop RegistrarObjectPage, err error)
- func (a *Approver) GetPendingCRID() sql.NullInt64
- func (a *Approver) GetPendingRevision() RegistrarObject
- func (a *Approver) GetPendingRevisionID() int64
- func (a *Approver) GetRequiredApproverSets(dbCache *DBCache) (approvers []ApproverSet, err error)
- func (a *Approver) GetType() string
- func (a Approver) HasPendingRevision() bool
- func (a Approver) HasRevision() bool
- func (a *Approver) IsCancelled() bool
- func (a *Approver) IsEditable() bool
- func (a *Approver) ParseFromForm(request *http.Request, _ *DBCache) error
- func (a *Approver) ParseFromFormUpdate(_ *http.Request, _ *DBCache, _ Config) error
- func (a *Approver) PostUpdate(dbCache *DBCache, conf Config) error
- func (a *Approver) Prepare(dbCache *DBCache) (err error)
- func (a *Approver) PrepareShallow(dbCache *DBCache) error
- func (a Approver) SuggestedRevisionBool(field string) bool
- func (a Approver) SuggestedRevisionValue(field string) string
- func (a *Approver) TakeAction(response http.ResponseWriter, _ *http.Request, _ *DBCache, actionName string, ...) (errs []error)
- func (a *Approver) UpdateState(dbCache *DBCache, _ Config) (changesMade bool, errs []error)
- func (a *Approver) VerifyCR(dbCache *DBCache) (checksOut bool, errs []error)
- type ApproverExportFull
- type ApproverExportShort
- type ApproverPage
- type ApproverRevision
- func (a *ApproverRevision) Cancel(dbCache *DBCache, conf Config) (errs []error)
- func (a *ApproverRevision) Decline(dbCache *DBCache) (err error)
- func (a *ApproverRevision) GetActions(isSelf bool) map[string]string
- func (a *ApproverRevision) GetAllPage(dbCache *DBCache, _ string, _ string) (RegistrarObjectPage, error)
- func (a *ApproverRevision) GetExportVersion() RegistrarObjectExport
- func (a *ApproverRevision) GetExportVersionAt(_ *DBCache, _ int64) (obj RegistrarObjectExport, err error)
- func (a *ApproverRevision) GetInformedApproverSets(dbCache *DBCache) (approverSets []ApproverSet, err error)
- func (a *ApproverRevision) GetPage(dbCache *DBCache, _ string, _ string) (rop RegistrarObjectPage, err error)
- func (a *ApproverRevision) GetRequiredApproverSets(dbCache *DBCache) (approverSets []ApproverSet, err error)
- func (a *ApproverRevision) GetState(cleartextState string) string
- func (a *ApproverRevision) GetType() string
- func (a ApproverRevision) HasHappened(actionType string) bool
- func (a *ApproverRevision) IsActive() bool
- func (a *ApproverRevision) IsCancelled() bool
- func (a ApproverRevision) IsDesiredState(state string) bool
- func (a *ApproverRevision) IsEditable() bool
- func (a *ApproverRevision) ParseFromForm(request *http.Request, dbCache *DBCache) error
- func (a *ApproverRevision) ParseFromFormUpdate(request *http.Request, dbCache *DBCache, _ Config) error
- func (a *ApproverRevision) Prepare(dbCache *DBCache) (err error)
- func (a *ApproverRevision) Promote(dbCache *DBCache) (err error)
- func (a *ApproverRevision) StartApprovalProcess(request *http.Request, dbCache *DBCache, conf Config) (err error)
- func (a *ApproverRevision) Supersed(dbCache *DBCache) (err error)
- func (a *ApproverRevision) TakeAction(response http.ResponseWriter, request *http.Request, dbCache *DBCache, ...) (errs []error)
- type ApproverRevisionExport
- func (are ApproverRevisionExport) Compare(approverRevision ApproverRevision) (pass bool, errs []error)
- func (are ApproverRevisionExport) CompareExport(approverRevisionExport ApproverRevisionExport) (pass bool, errs []error)
- func (are ApproverRevisionExport) GetDiff() (string, error)
- func (are ApproverRevisionExport) ToJSON() (string, error)
- type ApproverRevisionPage
- type ApproverRevisionsPage
- type ApproverSet
- func GetDefaultApproverSet(dbCache *DBCache) (approverSet ApproverSet, err error)
- func GetInformedApproverSets(dbCache *DBCache, rec Modeler) (approverSets []ApproverSet, err error)
- func GetRequiredApproverSets(dbCache *DBCache, rec Modeler) (approverSets []ApproverSet, err error)
- func ParseApproverSets(request *http.Request, dbCache *DBCache, htmlID string, requireAppSet1 bool) (approverSets []ApproverSet, err error)
- func (a *ApproverSet) ApproverFromIdentityName(name string, dbCache *DBCache) (app Approver, err error)
- func (a *ApproverSet) ComparePendingToCallback(loadFn CompareLoadFn) (retFn CompareReturnFn)
- func (a ApproverSet) DecryptionKeys() (keys []openpgp.Key)
- func (a *ApproverSet) GetAllPage(dbCache *DBCache, _ string, _ string) (RegistrarObjectPage, error)
- func (a *ApproverSet) GetCurrentRevisionID() sql.NullInt64
- func (a *ApproverSet) GetCurrentValue(field string) (ret string)
- func (a *ApproverSet) GetDisplayName() string
- func (a *ApproverSet) GetDisplayObject() ApproverSetDisplayObject
- func (a *ApproverSet) GetExportVersion() RegistrarObjectExport
- func (a *ApproverSet) GetExportVersionAt(dbCache *DBCache, timestamp int64) (obj RegistrarObjectExport, err error)
- func (a *ApproverSet) GetInformedApproverSets(dbCache *DBCache) ([]ApproverSet, error)
- func (a *ApproverSet) GetPage(dbCache *DBCache, username string, email string) (rpo RegistrarObjectPage, err error)
- func (a *ApproverSet) GetPendingApprovals(dbCache *DBCache) (approvals []Approval, err error)
- func (a *ApproverSet) GetPendingCRID() sql.NullInt64
- func (a *ApproverSet) GetPendingRevision() RegistrarObject
- func (a *ApproverSet) GetPendingRevisionID() int64
- func (a *ApproverSet) GetRequiredApproverSets(dbCache *DBCache) (approvers []ApproverSet, err error)
- func (a *ApproverSet) GetType() string
- func (a ApproverSet) HasHappened(actionType string) bool
- func (a ApproverSet) HasPendingRevision() bool
- func (a ApproverSet) HasRevision() bool
- func (a *ApproverSet) IsCancelled() bool
- func (a *ApproverSet) IsEditable() bool
- func (a *ApproverSet) IsValidApproverByEmail(emailaddress string, dbCache *DBCache) (bool, error)
- func (a ApproverSet) KeysById(keyID uint64) (keys []openpgp.Key)
- func (a ApproverSet) KeysByIdUsage(keyID uint64, requiredUsage byte) (keys []openpgp.Key)
- func (a *ApproverSet) ParseFromForm(request *http.Request, _ *DBCache) error
- func (a *ApproverSet) ParseFromFormUpdate(_ *http.Request, _ *DBCache, _ Config) error
- func (a *ApproverSet) Prepare(dbCache *DBCache) error
- func (a *ApproverSet) PrepareDisplayShallow(dbCache *DBCache) error
- func (a *ApproverSet) PrepareGPGKeys(dbCache *DBCache) error
- func (a *ApproverSet) PrepareShallow(dbCache *DBCache) error
- func (a ApproverSet) SuggestedRevisionBool(field string) bool
- func (a ApproverSet) SuggestedRevisionValue(field string) string
- func (a *ApproverSet) TakeAction(response http.ResponseWriter, _ *http.Request, _ *DBCache, actionName string, ...) (errs []error)
- func (a *ApproverSet) UpdateState(dbCache *DBCache, conf Config) (changesMade bool, errs []error)
- func (a *ApproverSet) VerifyCR(dbCache *DBCache) (checksOut bool, errs []error)
- type ApproverSetDisplayObject
- type ApproverSetExportFull
- type ApproverSetExportShort
- type ApproverSetPage
- type ApproverSetRevision
- func (a *ApproverSetRevision) Cancel(dbCache *DBCache, conf Config) (errs []error)
- func (a *ApproverSetRevision) Decline(dbCache *DBCache) (err error)
- func (a *ApproverSetRevision) GetActions(isSelf bool) map[string]string
- func (a *ApproverSetRevision) GetAllPage(_ *DBCache, _ string, _ string) (RegistrarObjectPage, error)
- func (a *ApproverSetRevision) GetExportVersion() RegistrarObjectExport
- func (a *ApproverSetRevision) GetExportVersionAt(_ *DBCache, _ int64) (obj RegistrarObjectExport, err error)
- func (a *ApproverSetRevision) GetInformedApproverSets(dbCache *DBCache) (approverSets []ApproverSet, err error)
- func (a *ApproverSetRevision) GetPage(dbCache *DBCache, _ string, _ string) (rop RegistrarObjectPage, err error)
- func (a *ApproverSetRevision) GetRequiredApproverSets(dbCache *DBCache) (approverSets []ApproverSet, err error)
- func (a *ApproverSetRevision) GetState(cleartextState string) string
- func (a *ApproverSetRevision) GetType() string
- func (a ApproverSetRevision) HasHappened(actionType string) bool
- func (a *ApproverSetRevision) IsActive() bool
- func (a *ApproverSetRevision) IsCancelled() bool
- func (a ApproverSetRevision) IsDesiredState(state string) bool
- func (a *ApproverSetRevision) IsEditable() bool
- func (a *ApproverSetRevision) ParseFromForm(request *http.Request, dbCache *DBCache) error
- func (a *ApproverSetRevision) ParseFromFormUpdate(request *http.Request, dbCache *DBCache, _ Config) (err error)
- func (a *ApproverSetRevision) Prepare(dbCache *DBCache) (err error)
- func (a *ApproverSetRevision) PrepareShallow(dbCache *DBCache) error
- func (a *ApproverSetRevision) Promote(dbCache *DBCache) (err error)
- func (a *ApproverSetRevision) StartApprovalProcess(request *http.Request, dbCache *DBCache, conf Config) (err error)
- func (a *ApproverSetRevision) Supersed(dbCache *DBCache) (err error)
- func (a *ApproverSetRevision) TakeAction(response http.ResponseWriter, request *http.Request, dbCache *DBCache, ...) (errs []error)
- type ApproverSetRevisionExport
- func (asre *ApproverSetRevisionExport) AddVerifiedApprover(app ApproverExportFull) error
- func (asre ApproverSetRevisionExport) Compare(asr ApproverSetRevision) (pass bool, errs []error)
- func (asre ApproverSetRevisionExport) CompareExport(asr ApproverSetRevisionExport) (pass bool, errs []error)
- func (asre ApproverSetRevisionExport) DecryptionKeys() (keys []openpgp.Key)
- func (asre ApproverSetRevisionExport) GetDiff() (string, error)
- func (asre *ApproverSetRevisionExport) HasVerifiedApprovers() bool
- func (asre ApproverSetRevisionExport) IsSignedBy(sig []byte) (valid bool, signedBody []byte)
- func (asre ApproverSetRevisionExport) KeysById(entityID uint64) (keys []openpgp.Key)
- func (asre ApproverSetRevisionExport) KeysByIdUsage(id uint64, requiredUsage byte) (keys []openpgp.Key)
- func (asre ApproverSetRevisionExport) ToJSON() (string, error)
- type ApproverSetRevisionPage
- type ApproverSetRevisionsPage
- type ApproverSetsPage
- type ApproversPage
- type AuthType
- type ChangeRequest
- func (c *ChangeRequest) GetAllPage(dbCache *DBCache, _ string, _ string) (rop RegistrarObjectPage, err error)
- func (c *ChangeRequest) GetExportVersion() RegistrarObjectExport
- func (c *ChangeRequest) GetExportVersionAt(_ *DBCache, _ int64) (obj RegistrarObjectExport, err error)
- func (c *ChangeRequest) GetPage(_ *DBCache, _ string, _ string) (rop RegistrarObjectPage, err error)
- func (c *ChangeRequest) GetType() string
- func (c *ChangeRequest) IsCancelled() bool
- func (c *ChangeRequest) IsEditable() bool
- func (c *ChangeRequest) ParseFromForm(_ *http.Request, _ *DBCache) error
- func (c *ChangeRequest) ParseFromFormUpdate(_ *http.Request, _ *DBCache, _ Config) error
- func (c *ChangeRequest) Prepare(dbCache *DBCache) (err error)
- func (c *ChangeRequest) ReadyForFinalApproval() bool
- func (c *ChangeRequest) TakeAction(response http.ResponseWriter, _ *http.Request, _ *DBCache, actionName string, ...) (errs []error)
- func (c *ChangeRequest) UpdateApprovals(dbCache *DBCache, conf Config) (errs []error)
- func (c *ChangeRequest) UpdateState(dbCache *DBCache, conf Config) (changesMade bool, errs []error)
- type ChangeRequestExport
- type ChangeRequestPage
- type ChangeRequestsPage
- type CompareLoadFn
- type CompareReturnFn
- type Config
- type Contact
- func (c *Contact) ComparePendingToCallback(loadFn CompareLoadFn) (retFn CompareReturnFn)
- func (c *Contact) GetAllPage(dbCache *DBCache, _ string, _ string) (rop RegistrarObjectPage, err error)
- func (c *Contact) GetCurrentExtension(field string) string
- func (c *Contact) GetCurrentRevisionID() sql.NullInt64
- func (c *Contact) GetCurrentValue(field string) (ret string)
- func (c *Contact) GetDisplayName() string
- func (c *Contact) GetExportVersion() RegistrarObjectExport
- func (c *Contact) GetExportVersionAt(dbCache *DBCache, timestamp int64) (obj RegistrarObjectExport, err error)
- func (c *Contact) GetExportVersionShort() ContactExportShort
- func (c *Contact) GetInformedApproverSets(dbCache *DBCache) (as []ApproverSet, err error)
- func (c *Contact) GetPage(dbCache *DBCache, username string, email string) (rop RegistrarObjectPage, err error)
- func (c *Contact) GetPendingCRID() sql.NullInt64
- func (c *Contact) GetPendingRevision() RegistrarObject
- func (c *Contact) GetPendingRevisionID() int64
- func (c *Contact) GetRegistryExtension(field string) string
- func (c *Contact) GetRequiredApproverSets(dbCache *DBCache) (approvers []ApproverSet, err error)
- func (c Contact) GetType() string
- func (c Contact) HasPendingRevision() bool
- func (c Contact) HasRevision() bool
- func (c *Contact) IsCancelled() bool
- func (c *Contact) IsEditable() bool
- func (c *Contact) LoadEPPInfo(data []byte, dbCache *DBCache) error
- func (c *Contact) ParseFromForm(request *http.Request, _ *DBCache) error
- func (c *Contact) ParseFromFormUpdate(request *http.Request, _ *DBCache, _ Config) error
- func (c *Contact) Prepare(dbCache *DBCache) (err error)
- func (c *Contact) PrepareDisplayShallow(dbCache *DBCache) (err error)
- func (c *Contact) PrepareShallow(dbCache *DBCache) error
- func (c *Contact) SetRegistryID(data []byte, dbCache *DBCache) error
- func (c Contact) SuggestedRevisionBool(field string) bool
- func (c Contact) SuggestedRevisionValue(field string) string
- func (c *Contact) TakeAction(response http.ResponseWriter, request *http.Request, dbCache *DBCache, ...) (errs []error)
- func (c *Contact) UpdateHoldStatus(holdActive bool, holdReason string, holdBy string) error
- func (c *Contact) UpdateState(dbCache *DBCache, _ Config) (changesMade bool, errs []error)
- func (c *Contact) VerifyCR(dbCache *DBCache) (checksOut bool, errs []error)
- type ContactExport
- type ContactExportShort
- type ContactPage
- type ContactRevision
- func (c *ContactRevision) Cancel(dbCache *DBCache, conf Config) (errs []error)
- func (c *ContactRevision) Decline(dbCache *DBCache) (err error)
- func (c *ContactRevision) EscrowAddress() string
- func (c *ContactRevision) FaxNumber() string
- func (c *ContactRevision) FullAddress() string
- func (c *ContactRevision) GetActions(isSelf bool) map[string]string
- func (c *ContactRevision) GetAllPage(dbCache *DBCache, _ string, _ string) (rop RegistrarObjectPage, err error)
- func (c *ContactRevision) GetExportVersion() RegistrarObjectExport
- func (c *ContactRevision) GetExportVersionAt(_ *DBCache, _ int64) (obj RegistrarObjectExport, err error)
- func (c *ContactRevision) GetInformedApproverSets(dbCache *DBCache) (approverSets []ApproverSet, err error)
- func (c *ContactRevision) GetPage(dbCache *DBCache, _ string, _ string) (rop RegistrarObjectPage, err error)
- func (c *ContactRevision) GetPreviewAddress() string
- func (c *ContactRevision) GetPreviewEmail() string
- func (c *ContactRevision) GetPreviewName() string
- func (c *ContactRevision) GetPreviewPhone() string
- func (c *ContactRevision) GetRequiredApproverSets(dbCache *DBCache) (approverSets []ApproverSet, err error)
- func (c *ContactRevision) GetType() string
- func (c ContactRevision) HasHappened(actionType string) bool
- func (c *ContactRevision) IsActive() bool
- func (c *ContactRevision) IsCancelled() bool
- func (c ContactRevision) IsDesiredState(state string) bool
- func (c *ContactRevision) IsEditable() bool
- func (c *ContactRevision) NewContactEmail(contactName string, conf Config) error
- func (c *ContactRevision) ParseFromForm(request *http.Request, dbCache *DBCache) error
- func (c *ContactRevision) ParseFromFormUpdate(request *http.Request, dbCache *DBCache, _ Config) error
- func (c *ContactRevision) Prepare(dbCache *DBCache) (err error)
- func (c *ContactRevision) PrepareShallow(dbCache *DBCache) error
- func (c *ContactRevision) Promote(ddbCache *DBCache) (err error)
- func (c *ContactRevision) StartApprovalProcess(request *http.Request, dbCache *DBCache, conf Config) (err error)
- func (c *ContactRevision) Supersed(dbCache *DBCache) (err error)
- func (c *ContactRevision) TakeAction(response http.ResponseWriter, request *http.Request, dbCache *DBCache, ...) (errs []error)
- func (c *ContactRevision) VoiceNumber() string
- type ContactRevisionExport
- func (cre ContactRevisionExport) Compare(contactRevision ContactRevision) (pass bool, errs []error)
- func (cre ContactRevisionExport) CompareExport(contactRevision ContactRevisionExport) (pass bool, errs []error)
- func (cre ContactRevisionExport) EscrowAddress() string
- func (cre ContactRevisionExport) FaxNumber() string
- func (cre ContactRevisionExport) GetDiff() (string, error)
- func (cre ContactRevisionExport) ToJSON() (string, error)
- func (cre ContactRevisionExport) VoiceNumber() string
- type ContactRevisionPage
- type ContactRevisionsPage
- type ContactsPage
- type DBCache
- func (dbc *DBCache) AutoMigrate(value interface{})
- func (dbc *DBCache) Find(inobj interface{}) error
- func (dbc *DBCache) FindAll(value interface{}) (err error)
- func (dbc *DBCache) FindByID(inobj interface{}, objID int64) error
- func (dbc *DBCache) GetCacheStatsLog() string
- func (dbc *DBCache) GetNewAndPendingRevisions(object RegistrarParent) (err error)
- func (dbc *DBCache) GetRevisionAtTime(object RegistrarObject, parentID int64, timestamp int64) (err error)
- func (dbc *DBCache) InvalidateObject(_ interface{})
- func (dbc *DBCache) Purge(inobj interface{}) error
- func (dbc *DBCache) Related(targetObject interface{}, relatedObject interface{}) error
- func (dbc *DBCache) Save(rawObject interface{}) error
- func (dbc *DBCache) Update(targetObject interface{}, updateFields interface{}) error
- func (dbc *DBCache) WipeCache()
- type DBCacheFactory
- type DSDataEntry
- type DSDataEntryEpp
- type Domain
- func (d *Domain) ComparePendingToCallback(loadFn CompareLoadFn) (retFn CompareReturnFn)
- func (d *Domain) EPPMatchesExpected(resp *epp.Response) (bool, string)
- func (d *Domain) GetAllPage(dbCache *DBCache, _ string, _ string) (rop RegistrarObjectPage, err error)
- func (d *Domain) GetCurrentRevisionID() sql.NullInt64
- func (d *Domain) GetCurrentValue(field string) (ret string)
- func (d *Domain) GetExportVersion() RegistrarObjectExport
- func (d *Domain) GetExportVersionAt(dbCache *DBCache, timestamp int64) (obj RegistrarObjectExport, err error)
- func (d *Domain) GetInformedApproverSets(dbCache *DBCache) (as []ApproverSet, err error)
- func (d *Domain) GetPage(dbCache *DBCache, username string, email string) (rop RegistrarObjectPage, err error)
- func (d *Domain) GetPendingCRID() sql.NullInt64
- func (d *Domain) GetPendingRevision() RegistrarObject
- func (d *Domain) GetPendingRevisionID() int64
- func (d *Domain) GetRequiredApproverSets(dbCache *DBCache) (approvers []ApproverSet, err error)
- func (d Domain) GetType() string
- func (d Domain) HasPendingRevision() bool
- func (d Domain) HasRevision() bool
- func (d *Domain) IsCancelled() bool
- func (d *Domain) IsEditable() bool
- func (d *Domain) LoadEPPInfo(data []byte, dbCache *DBCache, conf Config) (err error)
- func (d *Domain) ParseFromForm(request *http.Request, dbCache *DBCache) error
- func (d *Domain) ParseFromFormUpdate(request *http.Request, dbCache *DBCache, _ Config) error
- func (d *Domain) Prepare(dbCache *DBCache) (err error)
- func (d *Domain) PrepareShallow(dbCache *DBCache) error
- func (d Domain) SuggestedContactID(field string) int64
- func (d Domain) SuggestedRevisionBool(field string) bool
- func (d Domain) SuggestedRevisionValue(field string) string
- func (d *Domain) TakeAction(response http.ResponseWriter, request *http.Request, dbCache *DBCache, ...) (errs []error)
- func (d *Domain) UpdateHoldStatus(holdActive bool, holdReason string, holdBy string) error
- func (d *Domain) UpdateState(dbCache *DBCache, _ Config) (changesMade bool, errs []error)
- func (d *Domain) UpdateWHOISFromResponse(resp whois.Response, dbCache *DBCache) (errs []error)
- func (d *Domain) VerifyCR(dbCache *DBCache) (checksOut bool, errs []error)
- func (d Domain) WHOISHasStatus(status string) bool
- func (d Domain) WHOISNameServers() []string
- func (d Domain) WHOISStatusFlags() []string
- type DomainExport
- type DomainPage
- type DomainRevision
- func (d *DomainRevision) Cancel(dbCache *DBCache, conf Config) (errs []error)
- func (d *DomainRevision) Decline(dbCache *DBCache) (err error)
- func (d *DomainRevision) GetActions(isSelf bool) map[string]string
- func (d *DomainRevision) GetAllPage(dbCache *DBCache, _ string, _ string) (rop RegistrarObjectPage, err error)
- func (d *DomainRevision) GetExportVersion() RegistrarObjectExport
- func (d *DomainRevision) GetExportVersionAt(_ *DBCache, _ int64) (obj RegistrarObjectExport, err error)
- func (d *DomainRevision) GetInformedApproverSets(dbCache *DBCache) (approverSets []ApproverSet, err error)
- func (d *DomainRevision) GetPage(dbCache *DBCache, _ string, _ string) (rop RegistrarObjectPage, err error)
- func (d *DomainRevision) GetPreviewHostnames() string
- func (d *DomainRevision) GetRequiredApproverSets(dbCache *DBCache) (approverSets []ApproverSet, err error)
- func (d *DomainRevision) GetType() string
- func (d DomainRevision) HasHappened(actionType string) bool
- func (d *DomainRevision) IsActive() bool
- func (d *DomainRevision) IsCancelled() bool
- func (d DomainRevision) IsDesiredState(state string) bool
- func (d *DomainRevision) IsEditable() bool
- func (d DomainRevision) IsSelectedClass(class string) bool
- func (d *DomainRevision) NewDomainEmail(domainName string, conf Config) error
- func (d *DomainRevision) ParseFromForm(request *http.Request, dbCache *DBCache) error
- func (d *DomainRevision) ParseFromFormUpdate(request *http.Request, dbCache *DBCache, _ Config) (err error)
- func (d *DomainRevision) Prepare(dbCache *DBCache) (err error)
- func (d *DomainRevision) Promote(dbCache *DBCache) (err error)
- func (d *DomainRevision) StartApprovalProcess(request *http.Request, dbCache *DBCache, conf Config) (err error)
- func (d *DomainRevision) Supersed(dbCache *DBCache) (err error)
- func (d *DomainRevision) TakeAction(response http.ResponseWriter, request *http.Request, dbCache *DBCache, ...) (errs []error)
- type DomainRevisionExport
- func (dre DomainRevisionExport) Compare(domainRevision DomainRevision) (pass bool, errs []error)
- func (dre DomainRevisionExport) CompareExport(domainRevision DomainRevisionExport) (pass bool, errs []error)
- func (dre DomainRevisionExport) GetDiff() (string, error)
- func (dre DomainRevisionExport) ToJSON() (string, error)
- type DomainRevisionPage
- type DomainRevisionsPage
- type DomainsPage
- type EPPAction
- type EPPEncryptedPassphrase
- type EPPRun
- type FieldHasher
- type Host
- func (h *Host) ComparePendingToCallback(loadFn CompareLoadFn) (retFn CompareReturnFn)
- func (h Host) DisplayName() string
- func (h *Host) EPPMatchesExpected(resp *epp.Response) (bool, string)
- func (h Host) FormDivName() string
- func (h *Host) GetAllPage(ddbCache *DBCache, _ string, _ string) (rop RegistrarObjectPage, err error)
- func (h *Host) GetCurrentHosts() []string
- func (h *Host) GetCurrentRevisionID() sql.NullInt64
- func (h *Host) GetCurrentValue(field string) (ret string)
- func (h *Host) GetDisplayName() string
- func (h *Host) GetExportShortVersion() HostExportShort
- func (h *Host) GetExportVersion() RegistrarObjectExport
- func (h *Host) GetExportVersionAt(dbCache *DBCache, timestamp int64) (obj RegistrarObjectExport, err error)
- func (h *Host) GetInformedApproverSets(dbCache *DBCache) (as []ApproverSet, err error)
- func (h *Host) GetPage(dbCache *DBCache, username string, email string) (rop RegistrarObjectPage, err error)
- func (h *Host) GetPendingCRID() sql.NullInt64
- func (h *Host) GetPendingRevision() RegistrarObject
- func (h *Host) GetPendingRevisionID() int64
- func (h *Host) GetRequiredApproverSets(dbCache *DBCache) (approvers []ApproverSet, err error)
- func (h Host) GetType() string
- func (h Host) HasPendingRevision() bool
- func (h Host) HasRevision() bool
- func (h *Host) IsCancelled() bool
- func (h *Host) IsEditable() bool
- func (h *Host) LoadEPPInfo(data []byte, dbCache *DBCache) (err error)
- func (h *Host) ParseFromForm(request *http.Request, dbCache *DBCache) error
- func (h *Host) ParseFromFormUpdate(request *http.Request, dbCache *DBCache, _ Config) error
- func (h *Host) Prepare(dbCache *DBCache) (err error)
- func (h *Host) PrepareDisplayShallow(dbCache *DBCache) (err error)
- func (h *Host) PrepareShallow(dbCache *DBCache) error
- func (h Host) SuggestedRevisionBool(field string) bool
- func (h Host) SuggestedRevisionValue(field string) string
- func (h *Host) TakeAction(response http.ResponseWriter, request *http.Request, dbCache *DBCache, ...) (errs []error)
- func (h *Host) UpdateHoldStatus(holdActive bool, holdReason string, holdBy string) error
- func (h *Host) UpdateState(dbCache *DBCache, _ Config) (changesMade bool, errs []error)
- func (h *Host) VerifyCR(dbCache *DBCache) (checksOut bool, errs []error)
- type HostAddress
- type HostAddressEpp
- type HostExport
- type HostExportShort
- type HostPage
- type HostRevision
- func (h *HostRevision) Cancel(dbCache *DBCache, conf Config) (errs []error)
- func (h *HostRevision) Decline(dbCache *DBCache) (err error)
- func (h *HostRevision) GetActions(isSelf bool) map[string]string
- func (h *HostRevision) GetAllPage(dbCache *DBCache, _ string, _ string) (rop RegistrarObjectPage, err error)
- func (h *HostRevision) GetExportVersion() RegistrarObjectExport
- func (h *HostRevision) GetExportVersionAt(_ *DBCache, _ int64) (obj RegistrarObjectExport, err error)
- func (h *HostRevision) GetInformedApproverSets(dbCache *DBCache) (approverSets []ApproverSet, err error)
- func (h *HostRevision) GetPage(dbCache *DBCache, _ string, _ string) (rop RegistrarObjectPage, err error)
- func (h *HostRevision) GetPreviewIPs() string
- func (h *HostRevision) GetRequiredApproverSets(dbCache *DBCache) (approverSets []ApproverSet, err error)
- func (h *HostRevision) GetType() string
- func (h HostRevision) HasHappened(actionType string) bool
- func (h *HostRevision) IsActive() bool
- func (h *HostRevision) IsCancelled() bool
- func (h HostRevision) IsDesiredState(state string) bool
- func (h *HostRevision) IsEditable() bool
- func (h *HostRevision) NewHostEmail(hostName string, conf Config) error
- func (h *HostRevision) ParseFromForm(request *http.Request, dbCache *DBCache) error
- func (h *HostRevision) ParseFromFormUpdate(request *http.Request, dbCache *DBCache, _ Config) (err error)
- func (h *HostRevision) Prepare(dbCache *DBCache) (err error)
- func (h *HostRevision) PrepareShallow(dbCache *DBCache) error
- func (h *HostRevision) Promote(dbCache *DBCache) (err error)
- func (h *HostRevision) StartApprovalProcess(request *http.Request, dbCache *DBCache, conf Config) (err error)
- func (h *HostRevision) Supersed(dbCache *DBCache) (err error)
- func (h *HostRevision) TakeAction(response http.ResponseWriter, request *http.Request, dbCache *DBCache, ...) (errs []error)
- type HostRevisionExport
- func (hre HostRevisionExport) Compare(hostRevision HostRevision) (pass bool, errs []error)
- func (hre HostRevisionExport) CompareExport(hostRevision HostRevisionExport) (pass bool, errs []error)
- func (hre HostRevisionExport) GetDiff() (string, error)
- func (hre HostRevisionExport) ToJSON() (string, error)
- type HostRevisionPage
- type HostRevisionsPage
- type HostsPage
- type IPAllowListRevision
- type LivenessCheck
- type LogWrapper
- type Model
- func (m *Model) AfterFind(scope *gorm.Scope)
- func (m *Model) FieldHash() []byte
- func (m *Model) GetID() int64
- func (m *Model) GetModel() *Model
- func (m *Model) HandleInProgress(progressFunc func())
- func (m *Model) IsLoaded() bool
- func (m *Model) IsScopeUnchanged(scope *gorm.Scope) bool
- func (m *Model) Load(dbCache *DBCache, rec Modeler) (err error)
- func (m *Model) SetFieldHash(db *gorm.DB, dbStruct interface{})
- func (m *Model) SetID(objectID int64) error
- func (m *Model) SetScopeFieldHash(scope *gorm.Scope)
- type Modeler
- type NotExportableObject
- type ProgressHandler
- type ProtectedHostnameListRevision
- type RegistrarApprovalable
- type RegistrarCRObject
- type RegistrarObject
- type RegistrarObjectExport
- type RegistrarObjectPage
- type RegistrarParent
- type RevisionModeler
- type SignatureResponse
- type SignatureUpload
- type TokenResponse
Constants ¶
const ( // ErrorResponseType is used to identify an APIResponse containing an // error(s). ErrorResponseType string = "error" // TokenResponseType is used to identify an APIResponse containing a // TokenResponse object. TokenResponseType string = "token" // DomainIDListType is used to identify an APIResponse containing a list // of DomainIDs. DomainIDListType string = "domainidlist" // HostIDListType is used to identify an APIResponse containing a list // of HostIDs. HostIDListType string = "hostidlist" // ContactIDListType is used to identify an APIResponse containing a list // of ContactIDs. ContactIDListType string = "contactidlist" // HostnameListType is used to identify an APIResponse containing a map of // hostnames to IDs. HostnameListType string = "hostnamelist" // HostIPAllowList is used to identify an APIResponse containing a list of // IPs which correspond to registrar controlled nameserver IPs // TODO: inclusive language edit. HostIPAllowList string = "hostipallowlist" // ProtectedDomainList is used to identity an APIResponse containing a list of // domains which are protected and suggest extra review before provisioning. ProtectedDomainList string = "protecteddomainlist" // DomainObjectType is used to identify an APIResponse containing a domain // object. DomainObjectType string = "domainobject" // DomainRevisionObjectType is used to identify an APIResponse containing a // domain revision object. DomainRevisionObjectType string = "domainrevisionobject" // HostObjectType is used to identify an APIResponse containing a host // object. HostObjectType string = "hostobject" // HostRevisionObjectType is used to identify an APIResponse containing a // host revision object. HostRevisionObjectType string = "hostrevisionobject" // ContactObjectType is used to identify an APIResponse containing a contact // object. ContactObjectType string = "contactobject" // ContactRevisionObjectType is used to identify an APIResponse containing a // contact revision object. ContactRevisionObjectType string = "contactrevisionobject" // APIUserObjectType is used to identify an APIResponse containing an // api user object. APIUserObjectType string = "apiuserobject" // APIUserRevisionObjectType is used to identify an APIResponse containing an // api user revision object. APIUserRevisionObjectType string = "apiuserrevisionobject" // ApproverObjectType is used to identify an APIResponse containing an // approver object. ApproverObjectType string = "approverobject" // ApproverRevisionObjectType is used to identify an APIResponse containing an // approver revision object. ApproverRevisionObjectType string = "approverrevisionobject" // ApproverSetObjectType is used to identify an APIResponse containing an // approver set object. ApproverSetObjectType string = "approversetobject" // ApproverSetRevisionObjectType is used to identify an APIResponse containing an // approver set revision object. ApproverSetRevisionObjectType string = "approversetrevisionobject" // ChangeRequestObjectType is used to identify an APIResponse containing an // change request object. ChangeRequestObjectType string = "changerequestobject" // ApprovalObjectType is used to identify an APIResponse containing an // approval object. ApprovalObjectType string = "approvalobject" )
const ( // DomainClassHighValue is used to represent domains that are // high value domains for a customer. These doamis are often registry // locked if supported. DomainClassHighValue string = "high-value" // DomainClassInUse is used to reprsent domains that are in use but not to // the level that require registry locks. DomainClassInUse string = "in-use" // DomainClassParked is used to represent the domain class for domains // that are owned but and parked. DomainClassParked string = "parked" // DomainClassOther is a pseudo class for domains that have classes // that are not defined above. DomainClassOther string = "other" )
const ( // EPPLogActionLogin represents the action where an EPP Login has happened. EPPLogActionLogin = "Login" // EPPLogActionLogout represents the action where an EPP Logout has happened. EPPLogActionLogout = "Logout" // EPPLogActionHello represents the action where an EPP Hello has happened. EPPLogActionHello = "Hello" // EPPLogActionPoll represents the action where an EPP Poll has happened. EPPLogActionPoll = "Poll" // EPPLogActionPollAck represents the action where an EPP Poll has been acked. EPPLogActionPollAck = "PollAck" // EPPLogActionDomainAvailable represents the action where an EPP Available // request has been made for a domain. The Argument provided is the domain // name that is queried. EPPLogActionDomainAvailable = "DomainAvailable" // EPPLogActionDomainInfo represents the action where an EPP Info // request has been made for a domain. The Argument provided is the domain // name that is queried. EPPLogActionDomainInfo = "DomainInfo" // EPPLogActionDomainCreate represents the action where an EPP Create // request has been made for a domain. The Argument provided is the domain // name that is queried. EPPLogActionDomainCreate = "DomainCreate" // EPPLogActionDomainDelete represents the action where an EPP Delete // request has been made for a domain. The Argument provided is the domain // name that is being created. EPPLogActionDomainDelete = "DomainDelete" // EPPLogActionDomainRenew represents the action where an EPP Renew // request has been made for a domain. The Argument provided is the domain // name that is being deleted. EPPLogActionDomainRenew = "DomainRenew" // EPPLogActionDomainAddHosts represents the action where an EPP Update // request has been made for a domain where the hosts are altered. The // Argument provided is the domain name that is queried. The notes will // have a list of the hosts that have been added. EPPLogActionDomainAddHosts = "DomainAddHosts" // EPPLogActionDomainRemoveHosts represents the action where an EPP Update // request has been made for a domain where the hosts are altered. The // Argument provided is the domain name that is queried. The notes will // have a list of the hosts that have been removed. EPPLogActionDomainRemoveHosts = "DomainRemoveHosts" // EPPLogActionDomainAddStatuses represents the action where an EPP Update // request has been made for a domain where the statuses are altered. The // Argument provided is the domain name that is queried. The notes will // have a list of the statuses that have been added. EPPLogActionDomainAddStatuses = "DomainAddStatuses" // EPPLogActionDomainRemoveStatuses represents the action where an EPP Update // request has been made for a domain where the statuses are altered. The // Argument provided is the domain name that is queried. The notes will // have a list of the statuses that have been removed. EPPLogActionDomainRemoveStatuses = "DomainRemoveStatuses" // EPPLogActionDomainAddDSRecord represents the action where an EPP Update // request has been made for a domain where the DS records are altered. The // Argument provided is the domain name that is queried. The notes will // have a list of the DS records that have been added. EPPLogActionDomainAddDSRecord = "DomainAddDSRecord" // EPPLogActionDomainRemoveDSRecord represents the action where an EPP Update // request has been made for a domain where the DS records are altered. The // Argument provided is the domain name that is queried. The notes will // have a list of the DS records that have been removed. EPPLogActionDomainRemoveDSRecord = "DomainRemoveDSRecord" // EPPLogActionDomainTransferRequest represents the action where an EPP // Transfer Request request has been made for a domain. The Argument provided // is the domain name that is requested. EPPLogActionDomainTransferRequest = "DomainTransferRequest" // EPPLogActionDomainTransferReject represents the action where an EPP // Transfer Reject request has been made for a domain. The Argument provided // is the domain name that is rejected. EPPLogActionDomainTransferReject = "DomainTransferReject" // EPPLogActionDomainTransferApprove represents the action where an EPP // Transfer Approve request has been made for a domain. The Argument provided // is the domain name that is approved. EPPLogActionDomainTransferApprove = "DomainTransferApprove" // EPPLogActionDomainTransferQuery represents the action where an EPP // Transfer Query request has been made for a domain. The Argument provided // is the domain name that is queried. EPPLogActionDomainTransferQuery = "DomainTransferQuery" // EPPLogActionDomainChangeAuthInfo represents the action where an EPP Update // request has been made for a domain to change its AuthInfo field. The // Argument provided is the domain name that is queried. EPPLogActionDomainChangeAuthInfo = "DomainChangeAuthInfo" // EPPLogActionDomainSync represents the action where an EPP Sync request has // been made for a domain to change its expiration date. The Argument provided // is the domain name that is queried. Notes are added for the day and month // of the new expiration date. EPPLogActionDomainSync = "DomainSync" // EPPLogActionHostAvailable represents the action where an EPP Available // request has been made for a host. The Argument provided is the host // name that is queried. EPPLogActionHostAvailable = "HostAvailable" // EPPLogActionHostInfo represents the action where an EPP Info // request has been made for a host. The Argument provided is the host // name that is queried. EPPLogActionHostInfo = "HostInfo" // EPPLogActionHostCreate represents the action where an EPP Create // request has been made for a host. The Argument provided is the host // name that is created. EPPLogActionHostCreate = "HostCreate" // EPPLogActionHostDelete represents the action where an EPP Delete // request has been made for a host. The Argument provided is the host // name that is deleted. EPPLogActionHostDelete = "HostDelete" // EPPLogActionHostUpdate represents the action where an EPP Update // request has been made for a host. The Argument provided is the host // name that is updated. The host IP addresses and statuses are included in // the action notes field. EPPLogActionHostUpdate = "HostUpdate" )
const ( // EventUpdated is used to represent when an object is update. EventUpdated string = "Updated" // EventApprovalStarted is used to represent when an object has // started the approval process. EventApprovalStarted string = "ApprovalStarted" // EventApprovalFailed is used to represent when an object has // failed the approval process. EventApprovalFailed string = "ApprovalFailed" // EventPromoted is used to represent when an object has completed // the approval process successfully. EventPromoted string = "Promoted" // EventSuperseded is used to represent when an object has been // superseded by a later object. EventSuperseded string = "Superseded" )
const ( // StateActive is used to indicate that an object is currently active // or in the case that it is the value of DesiredState, the state // which the parent object should be in if approved. StateActive string = "active" // StateApproved is used to incidate that the approval for an object // has completed successfully. StateApproved string = "approved" // StateBootstrap is used to incidate that an object is being used to // start the system for the first time. StateBootstrap string = "bootstrap" // StatePendingBootstrap is used to indicate that an object is waiting // for a bootstrap approval to be completed. StatePendingBootstrap string = "pendingbootstrap" // StateCancelled is used to incidate that the approval process for // the object revision has been cancelled. StateCancelled string = "cancelled" // StateDeclined is used to indicate that the change request for a // revision has been declined by at least one Approver Set. StateDeclined string = "declined" // StateApprovalFailed is used to indicate that the approval process // for a revision has failed for some reason. StateApprovalFailed string = "approvalfailed" // StateInactive is used to indicate that an object is currently // inactive or in the case that it is the value of DesiredState, the // state which the parent object should be in if approved. StateInactive string = "inactive" // StateExternal is used to indicate that an object is currently // external or in the case that it is the value of DesiredState, the // state which the parent object should be in if approved. StateExternal string = "external" // StateNewExternal is used to indicate that an object is currently // new but will be external when the first approval is completed. StateNewExternal string = "new-external" // StateNew is used to indicate that an object has been created but // not submitted for approval (in the case of a revision), no // revisions have been submitted (in the case of a parent object) or // an approval that has not started (in the case of an Approval). StateNew string = "new" // StatePendingApproval is used to indicate that an object is waiting // on approvals to be completed. StatePendingApproval string = "pendingapproval" // StateActivePendingApproval is used to indicate that an object is // currently active but pending approval. StateActivePendingApproval string = "activependingapproval" // StateInactivePendingApproval is used to indicate that an object is // currently inactive but pending approval. StateInactivePendingApproval string = "inactivependingapproval" // StateExternalPendingApproval is used to indicate that an object is // currently external but pending approval. StateExternalPendingApproval string = "externalpendingapproval" // StatePendingNew is used to indicate parent objects that have a // revision that has been submitted and now current revision. StatePendingNew string = "pendingnew" // StatePendingNewExternal is used to indicate parent objects that // have a revision that has been submitted and now current revision. StatePendingNewExternal string = "pendingnewexternal" // StateNoValidApprovers is used to indicate that there are no valid // Approvers within the Approver Set that is required for an Approval. StateNoValidApprovers string = "novalidapprovers" // StateSkippedNoValidApprovers is used to indicate that there were no // valid approvers for an Approver Set when the Change Request was // fully approved (for a Change Request to be approved, at least one // Approval must be approved). StateSkippedNoValidApprovers string = "skippednovalidapprovers" // StateInactiveApproverSet is used to indicate that the Approver // set required for an Approval is in an Inactive state at the time. StateInactiveApproverSet string = "inactiveapproverset" // StateSkippedInactiveApproverSet is used to indicate that the // Approver set required for an Approval was not in an active state // after all other available approver sets had completed the approval // process. (for a Change Request to be approved, at least one // Approval must be approved). StateSkippedInactiveApproverSet string = "skippedinactiveapproverset" // StateImplemented is used to indicate that a Change Request has been // approved and all implementation steps have completed. StateImplemented string = "implemented" // StateSuperseded is used to indicate that a new revision has been // approved and is now the current revsion. StateSuperseded string = "superseded" )
All constants prefixed with State are used to represent the state of an object. Not all objects can be in all states.
const ( // ActionApproved is used to incidate when an approval acction has // taken place. ActionApproved string = "approve" // ActionDeclined is used to indicate when approval has been declined // for some action. ActionDeclined string = "decline" // ActionCancel is used to indicate when the cancel action has been // requested by a user. ActionCancel string = "cancel" // ActionStartApproval is used to indicate when the start approval // action has been requested by a user. ActionStartApproval string = "startapproval" // ActionGet is used to represent the API action where the current // selected object is returned to the requestor. ActionGet string = "get" // ActionUpdateEPPInfo is used to reprsent the API action where // the client is trying to update the EPP info of the object. ActionUpdateEPPInfo string = "updateEPPInfo" // ActionUpdateEPPCheckRequired is used to represent that API action where the // client is trying to unset the check_reqired field for an object. ActionUpdateEPPCheckRequired string = "updateEPPCheckRequired" // ActionTriggerUpdate is used to represent that a parent update should have // its update state process triggered. ActionTriggerUpdate string = "triggerUpdate" // ActionUpdatePreview is used to represent that the requestor would like to // update the preview fields for an object. ActionUpdatePreview string = "updatePreview" )
All contants prefixed with Action are used to represent an action taken by an approver.
const APIUserCertificate string = "Certificate"
APIUserCertificate is the name that can be used to reference the Certificate field of the current apiuser revision.
const APIUserDescription string = "Description"
APIUserDescription is the name that can be used to reference the Description field of the current apiuser revision.
const APIUserName string = "Name"
APIUserName is the name that can be used to reference the Name field of the current apiuser revision.
const APIUserRevisionActionGOTOChangeRequest string = "gotochangerequest"
APIUserRevisionActionGOTOChangeRequest is the name of the action that will trigger a redirect to the current CR of an object.
const APIUserRevisionType string = "apiuserrevision"
APIUserRevisionType is a string used to represent the API User revision object.
const APIUserSerial string = "Serial"
APIUserSerial is the name that can be used to reference the Serial field of the current apiuser revision.
const APIUserType string = "apiuser"
APIUserType is a string used to represent the API User object.
const ApprovalDownloadType string = "downloadapproval"
ApprovalDownloadType is used to identify an APIResponse containing a ApprovalDownload object.
const ApprovalType string = "approval"
ApprovalType is the string used to represent the Approval object.
const ApproverFieldDepartment string = "Department"
ApproverFieldDepartment is a name that can be used to reference the Department field of the current approver revision.
const ApproverFieldEmailAddres string = "EmailAddress"
ApproverFieldEmailAddres is a name that can be used to reference the email address field of the current approver revision.
const ApproverFieldEmployeeID string = "EmployeeID"
ApproverFieldEmployeeID is a name that can be used to reference the EmployeeID field of the current approver revision.
const ApproverFieldFingerprint string = "Fingerprint"
ApproverFieldFingerprint is a name that can be used to reference the Fingerprint field of the current approver revision.
const ApproverFieldName string = "Name"
ApproverFieldName is a name that can be used to reference the name field of the current approver revision.
const ApproverFieldPublicKey string = "PublicKey"
ApproverFieldPublicKey is a name that can be used to reference the PublicKey field of the current approver revision.
const ApproverFieldRole string = "Role"
ApproverFieldRole is a name that can be used to reference the role field of the current approver revision.
const ApproverFieldUsername string = "Username"
ApproverFieldUsername is a name that can be used to reference the username field of the current approver revision.
const ApproverRevisionActionGOTOChangeRequest string = "gotochangerequest"
ApproverRevisionActionGOTOChangeRequest is the name of the action that will trigger a redirect to the current CR of an object.
const ApproverRevisionType string = "approverrevision"
ApproverRevisionType is the string used to represent the Approver Revision object.
const ApproverSetFieldDescription string = "Description"
ApproverSetFieldDescription is the name that can be used to reference the Description field of the current approver set revision.
const ApproverSetFieldTitle string = "Title"
ApproverSetFieldTitle is the name that can be used to reference the Title field of the current approver set revision.
const ApproverSetRevisionActionCancel string = "cancel"
ApproverSetRevisionActionCancel is the name of the action that will cancel an Approver Set Revision.
const ApproverSetRevisionActionGOTOChangeRequest string = "gotochangerequest"
ApproverSetRevisionActionGOTOChangeRequest is the name of the action that will trigger a redirect to the current CR of an object.
const ApproverSetRevisionActionStartApproval string = "startapproval"
ApproverSetRevisionActionStartApproval is the name of the action that will start the approval process for the Approver Set Revision.
const ApproverSetRevisionType string = "approversetrevision"
ApproverSetRevisionType is the string used to represent the Approver Set Revision object.
const ApproverSetType string = "approverset"
ApproverSetType is the string used to represent the Approver Set object.
const ApproverType string = "approver"
ApproverType is the string used to represent the Approver object.
const ChangeRequestType string = "changerequest"
ChangeRequestType is the string used to represent the Change Request object.
const ClientDeleteFlag = "ClientDelete"
ClientDeleteFlag is a name that can be used to reference the Client Delete field of the current revision.
const ClientHoldFlag = "ClientHold"
ClientHoldFlag is a name that can be used to reference the Client Hold field of the current revision.
const ClientRenewFlag = "ClientRenew"
ClientRenewFlag is a name that can be used to reference the Client Renew field of the current revision.
const ClientTransferFlag = "ClientTransfer"
ClientTransferFlag is a name that can be used to reference the Client Transfer field of the current revision.
const ClientUpdateFlag = "ClientUpdate"
ClientUpdateFlag is a name that can be used to reference the Client Transfer field of the current revision.
const ContactFieldAddressCity string = "City"
ContactFieldAddressCity is the name that is used to reference the address city field of the current contact revision.
const ContactFieldAddressCountry string = "Country"
ContactFieldAddressCountry is the name that is used to reference the address country field of the current contact revision.
const ContactFieldAddressPostalCode string = "PostalCode"
ContactFieldAddressPostalCode is the name that is used to reference the address postal code field of the current contact revision.
const ContactFieldAddressState string = "State"
ContactFieldAddressState is the name that is used to reference the address state field of the current contact revision.
const ContactFieldAddressStreet1 string = "Street1"
ContactFieldAddressStreet1 is the name that is used to reference the address street 1 field of the current contact revision.
const ContactFieldAddressStreet2 string = "Street2"
ContactFieldAddressStreet2 is the name that is used to reference the address street 2 field of the current contact revision.
const ContactFieldAddressStreet3 string = "Street3"
ContactFieldAddressStreet3 is the name that is used to reference the address street 3 field of the current contact revision.
const ContactFieldEmail string = "Email"
ContactFieldEmail is the name that is used to reference the email field of the current contact revision.
const ContactFieldFaxExtension string = "FaxExt"
ContactFieldFaxExtension is the name that is used to reference the fax phone number extension.
const ContactFieldFaxNumber string = "FaxNumber"
ContactFieldFaxNumber is the name that is used to reference the fax number field of the current contact revision.
const ContactFieldFullAddress string = "FullAddress"
ContactFieldFullAddress is the name that is used to reference the full address of the current contact revision (made up of other address fields).
const ContactFieldName string = "Name"
ContactFieldName is a name that can be used to reference the name field of the current contact revision.
const ContactFieldOrg string = "Org"
ContactFieldOrg is the name that is used to reference the org field of the current contact revision.
const ContactFieldVoiceExtension string = "VoiceExt"
ContactFieldVoiceExtension is the name that is used to reference the voice phone number extension.
const ContactFieldVoiceNumber string = "VoiceNumber"
ContactFieldVoiceNumber is the name that is used to reference the voice number field of the current contact revision.
const ContactRevisionActionGOTOChangeRequest string = "gotochangerequest"
ContactRevisionActionGOTOChangeRequest is the name of the action that will trigger a redirect to the current CR of an object.
const ContactRevisionType string = "contactrevision"
ContactRevisionType is the string used to represent the Contact Revision object.
const ContactType string = "contact"
ContactType is the string used to represent the Contact object.
const DBTypeMySQL string = "mysql"
DBTypeMySQL is a constant to describe a MySQL database type.
const DBTypePostgres string = "pq"
DBTypePostgres is a constant to describe a postgres database type.
const DBTypeSqlite string = "sqlite"
DBTypeSqlite is a constant to describe a sqlite database type.
const DesiredStateActive string = "DesiredStateActive"
DesiredStateActive is the name that can be used to reference the desired state of active when checking for a suggested value.
const DesiredStateExternal string = "DesiredStateExternal"
DesiredStateExternal is the name that can be used to reference the desired state of external when checking for a suggested value.
const DesiredStateInactive string = "DesiredStateInactive"
DesiredStateInactive is the name that can be used to reference the desired state of inactive when checking for a suggested value.
const DomainFieldClass string = "DomainClass"
DomainFieldClass is a name that can be used to reference the domain class of the current domain revision.
const DomainFieldDomainAdminContact string = "DomainAdminContact"
DomainFieldDomainAdminContact is a name that can be used to reference the domain admin contact id field of the current domain revision.
const DomainFieldDomainBillingContact string = "DomainBillingContact"
DomainFieldDomainBillingContact is a name that can be used to reference the domain billing contact id field of the current domain revision.
const DomainFieldDomainRegistrant string = "DomainRegistrant"
DomainFieldDomainRegistrant is a name that can be used to reference the domain registrant id field of the current domain revision.
const DomainFieldDomainTechContact string = "DomainTechContact"
DomainFieldDomainTechContact is a name that can be used to reference the domain technical contact id field of the current domain revision.
const DomainFieldName string = "Name"
DomainFieldName is a name that can be used to reference the name field of the current domain revision.
const DomainFieldOwners string = "Owners"
DomainFieldOwners is a name that can be used to reference the owners field of the current domain revision.
const DomainRevisionActionGOTOChangeRequest string = "gotochangerequest"
DomainRevisionActionGOTOChangeRequest is the name of the action that will trigger a redirect to the current CR of an object.
const DomainRevisionType string = "domainrevision"
DomainRevisionType is the string used to represent the Host Revision object.
const DomainType string = "domain"
DomainType is the string used to represent the Host object.
const HostFieldName string = "Name"
HostFieldName is a name that can be used to reference the name field of the current host revision.
const HostRevisionActionGOTOChangeRequest string = "gotochangerequest"
HostRevisionActionGOTOChangeRequest is the name of the action that will trigger a redirect to the current CR of an object.
const HostRevisionType string = "hostrevision"
HostRevisionType is the string used to represent the Host Revision object.
const HostType string = "host"
HostType is the string used to represent the Host object.
const SavedObjectNote string = "SavedObjectNote"
SavedObjectNote is the name that can be used to reference the saved object note for a revision.
const ServerDeleteFlag = "ServerDelete"
ServerDeleteFlag is a name that can be used to reference the Server Delete field of the current revision.
const ServerHoldFlag = "ServerHold"
ServerHoldFlag is a name that can be used to reference the Server Hold field of the current revision.
const ServerRenewFlag = "ServerRenew"
ServerRenewFlag is a name that can be used to reference the Server Renew field of the current revision.
const ServerTransferFlag = "ServerTransfer"
ServerTransferFlag is a name that can be used to reference the Server Transfer field of the current revision.
const ServerUpdateFlag = "ServerUpdate"
ServerUpdateFlag is a name that can be used to reference the Server Transfer field of the current revision.
const SignatureDownloadType string = "downloadsig"
SignatureDownloadType is used to identify an APIResponse containing a SignatureRequest object.
const SignatureUploadType string = "uploadsig"
SignatureUploadType is used to identify an APIRequest containing a SignatureRequest object.
const UnPreparedAPIUserError = "Error: APIUser Not Prepared"
UnPreparedAPIUserError is the text of an error that is displayed when a apiuser has not been prepared before use.
const UnPreparedApproverError = "Error: Approver Not Prepared"
UnPreparedApproverError is the text of an error that is displayed when a approver has not been prepared before use.
const UnPreparedContactError = "Error: Contact Not Prepared"
UnPreparedContactError is the text of an error that is displayed when a contact has not been prepared before use.
const UnPreparedDomainError = "Error: Domain Not Prepared"
UnPreparedDomainError is the text of an error that is displayed when a domain has not been prepared before use.
const UnPreparedHostError = "Error: Host Not Prepared"
UnPreparedHostError is the text of an error that is displayed when a host has not been prepared before use.
const UnknownObjectTypeError string = "Unknown object type"
UnknownObjectTypeError indicates the passed type is not supported.
Variables ¶
var ( // ErrIDNotSet indicates that an object ID was not set when it should be. ErrIDNotSet = errors.New("ID not set") // ErrAPIUserMayNotBeDirectlyUpdated indicates that the APIUser object may not // be directly updated. ErrAPIUserMayNotBeDirectlyUpdated = errors.New("APIUser may not be directly updated") )
var ( // ErrDatabaseCertPathNotSet is used to indicate that the cert path // for the application to communicate with the database is missing. ErrDatabaseCertPathNotSet = errors.New("database cert path was not set in the configuration") // ErrUnableToSelectMaxIndex is used to indicate that there was an // error finding the maximum secret index for the certificates. ErrUnableToSelectMaxIndex = errors.New("unable to select maximum secret index") )
var ( // ErrNoCurrentRevision is returned if there is no current revision. ErrNoCurrentRevision = errors.New("unable to find a current revision") // ErrPendingRevisionInInvalidState indicates the object is in an unexpected state. ErrPendingRevisionInInvalidState = errors.New("pending revision is in an invalid state") // ErrUnableToHandleState indicates that the service is unable to handle // the current state. ErrUnableToHandleState = errors.New("unable to handle state") // ErrUpdateStateNotImplemented indicates that the current state of an object // is not supported by its updateState method. ErrUpdateStateNotImplemented = errors.New("updateState not impemented for object") // ErrNoDefaultApprover indicates that no default approver was located. ErrNoDefaultApprover = errors.New("unable to find default approver - database probably not bootstrapped") // ErrNoAPIUsersForKey indicates that no APIUser was found for the provided // key. ErrNoAPIUsersForKey = errors.New("no APIUsers found with the key provided") // ErrExcessAPIKeysLocated indicates that more than 1 apiuser was found with the same // API key. ErrExcessAPIKeysLocated = errors.New("more than one user found for an API key") )
var ( // EPPStatusProvisioned represents a domain that has been successfully // provisioned. EPPStatusProvisioned = "Provisioned" // EPPStatusServerFlagsMismatch represents the state where a domain has // incorrect server flags. EPPStatusServerFlagsMismatch = "Server Flags Mismatch" // EPPStatusAdditionalDSRecords represents the state where DS records exist in // the registry but not in the configured state. EPPStatusAdditionalDSRecords = "Additional DS Record(s) found" // EPPStatusMissingDSRecords represents the state where DS not all of the // requested DS records are present in the registry. EPPStatusMissingDSRecords = "Missing DS Record(s)" // EPPStatusHostMismatch represents the state where the list of hosts at the // registry does not match the requested state. EPPStatusHostMismatch = "Hosts mismatch" // EPPStatusClientFlagMismatch represents the state where client flags need // to be changed. EPPStatusClientFlagMismatch = "Client Flags Mismatch" // EPPStatusPendingChange represents the state where a change needs to be // made to a host. EPPStatusPendingChange = "Pending Change" // EPPStatusPendingRenew represents the state where a domain is pending // renewal. EPPStatusPendingRenew = "Pending Renew" )
var DNSSECAlgorithms = map[int64]string{
1: "RSAMD5",
2: "DH",
3: "DSA",
5: "RSASHA1",
6: "DSA-NSEC3-SHA1",
7: "RSASHA1-NSEC3-SHA1",
8: "RSASHA256",
10: "RSASHA512",
12: "ECC-GOST",
13: "ECDSAP256SHA256",
14: "ECDSAP384SHA384",
252: "INDIRECT",
253: "PRIVATEDNS",
254: "PRIVATEOID",
}
DNSSECAlgorithms is a map of DNSSEC algorithm type IDs to the algorithm name as defined by IANA Source: http://www.iana.org/assignments/dns-sec-alg-numbers/dns-sec-alg-numbers.xhtml IANA Page Last Updated: 2014-03-31.
var DNSSECDigestTypes = map[int64]string{
1: "SHA-1",
2: "SHA-256",
3: "GOST R 34.11-94",
4: "SHA-384",
}
DNSSECDigestTypes is a map of DNSSEC digest types to the digest name as defined by IANA Source: http://www.iana.org/assignments/ds-rr-types/ds-rr-types.xhtml IANA Page Last Updated: 2012-04-13.
var ErrDomainContactNotSet = errors.New("all domain contacts must be set in each revision")
ErrDomainContactNotSet is returned when a domain contact is not set when parsing a domain revision update.
var ErrNoCSRFFound = errors.New("unable to find valid CSRF token")
ErrNoCSRFFound is an error that is used when no valid CSRF token is found when a token is required for the action.
var ErrUnableToParseDSDataEntry = errors.New("nnable to parse DS Data Entry")
ErrUnableToParseDSDataEntry defines the error returned when a DS Data entry is not able to be parsed.
var ErrUnableToParseHostAddress = errors.New("unable to parse Host Address")
ErrUnableToParseHostAddress defines the error returned when a host address is not able to be parsed.
var ValidSuffixList = []string{".COM", ".NET"}
ValidSuffixList contains a list of all valid zones for which domains can be registered.
Functions ¶
func APIRespond ¶
func APIRespond(httpResponse http.ResponseWriter, response APIResponse)
APIRespond sends the given response, ignoring possible errors. For error handling, use APIResponse.Write instead.
func AppendEPPActionLog ¶
AppendEPPActionLog will attempt to add the EPP log message to the list of log messages. In the event that the appending fails, an error will be returned.
func BootstrapRegistrar ¶
BootstrapRegistrar is used to preform the initial bootstrapping of the registrar system. The bootstrap process will ensure that the database is configured properly and then initialize the required approver and approver sets to start the system correctly.
func CompareDSDataEntries ¶
func CompareDSDataEntries(dse []DSDataEntry, dseo []DSDataEntry) bool
CompareDSDataEntries compares a list of DSDataEntries to another set of DSDataEntries that were from an export version of an object. If the counts match and the IDs for the DSDataEntries match true is returned otherwise, false is returned.
func CompareHostAddressLists ¶
func CompareHostAddressLists(halr []HostAddress, halre []HostAddress) bool
CompareHostAddressLists compares a list of HostAddresses to another set of HostAddresses that were from an export version of an object. If the counts match and the IDs for the host addresses match true is returned otherwise, false is returned.
func CompareToApproverExportShortLists ¶
func CompareToApproverExportShortLists(apps []ApproverExportShort, appse []ApproverExportShort) bool
CompareToApproverExportShortLists compares a list of approver export objects to another set of approver exports. If the counts match and the IDs for the aprover sets match true is returned otherwise, false is returned.
func CompareToApproverListExportShortList ¶
func CompareToApproverListExportShortList(apps []Approver, appse []ApproverExportShort) bool
CompareToApproverListExportShortList compares a list of approver sets to a set of approver sets that were from an export version of an object. If the counts match and the IDs for the aprover sets match true is returned otherwise, false is returned.
func CompareToApproverSetExportShortLists ¶
func CompareToApproverSetExportShortLists(approverSet1 []ApproverSetExportShort, approverSet2 []ApproverSetExportShort) bool
CompareToApproverSetExportShortLists compares two lists of approver set export short objects that were from an export version of an object. If the counts match and the IDs for the aprover sets match true is returned otherwise, false is returned.
func CompareToApproverSetListToExportShort ¶
func CompareToApproverSetListToExportShort(approverSet1 []ApproverSet, approverSet2 []ApproverSetExportShort) bool
CompareToApproverSetListToExportShort compares a list of approver sets to a set of approver sets that were from an export version of an object. If the counts match and the IDs for the aprover sets match true is returned otherwise, false is returned.
func CompareToHostExportShortLists ¶
func CompareToHostExportShortLists(hostExport1 []HostExportShort, hostExport2 []HostExportShort) bool
CompareToHostExportShortLists compares a list of host export objects to another list of host export objects. If the counts match and the IDs for the host list match true is returned otherwise, false is returned.
func CompareToHostListExportShortList ¶
func CompareToHostListExportShortList(host []Host, hostExport []HostExportShort) bool
CompareToHostListExportShortList compares a list of host list to a set of hosts that were from an export version of an object. If the counts match and the IDs for the host list match true is returned otherwise, false is returned.
func ConfigureLogging ¶
ConfigureLogging will prepare the logging infrastructure.
func Create ¶
Create is a simple wrapper around gorm.Create. It skips the create if an object is unchanged.
func CreateEPPRunRecord ¶
CreateEPPRunRecord will attempt to add a new EPP run to the database and then return the Unique ID for that run to the client. If an error occurs when creating the run it will be returned.
func CreateNewIPAllowListRevision ¶
CreateNewIPAllowListRevision is used to create a new Host IP allow list in the database and if an error occurs during creation, it will be returned.
func CreateNewProtectedDomainList ¶
CreateNewProtectedDomainList is used to create a new Protected domain list in the database and if an error occurs during creation, it will be returned.
func DBPing ¶
DBPing will time the round trip to the database for a connection and return the time. If an error occurs or the database cannot be contacted, a time of -1 second and an error will be returned.
func DiffDomainDSData ¶
func DiffDomainDSData(registry *epp.Response, registrar []DSDataEntry) (addDSRecords, remDSRecords []epp.DSData, err error)
DiffDomainDSData will take the DS records in the EPP response from the registry and the list of DS records that the registrar expects to be there and will return a list of the DS records that need to be added or removed from the from the registry.
func DiffIPLists ¶
DiffIPLists will take two lists of IP addresses represented as strings and compare the IPs to each other to deteremine which addresses need to be added or removed from the current list in order to match the expected list.
func DiffIPsExport ¶
func DiffIPsExport(registry *epp.Response, registrar *HostExport) (ipv4Add, ipv4Rem, ipv6Add, ipv6Rem []string, err error)
DiffIPsExport will take an epp response for a host and a host object from the registrar system and generate lists of the IP addresses to both add and remove for IPv4 and IPv6. If an error occurs during the process, it will be returned.
func DomainExists ¶
DomainExists will check if a domain name exists in the registrar system or not.
func EndEPPRunRecord ¶
EndEPPRunRecord will attempt to mark an EPPRun record as completed in the database and return an error if the completion time could not be logged.
func ErrsToStrings ¶
ErrsToStrings takes a list of error objects and converts them into a list of strings.
func FlagDomainsRequiringRenewal ¶
FlagDomainsRequiringRenewal will review all domains in the system that are active and will flag all domains that require renewal. If an error occurs during the processing it will be returned.
func FuncNOPErrFunc ¶
func FuncNOPErrFunc() error
FuncNOPErrFunc simple noop callback for use with PrepareBase for PreprareShallow methods.
func GetActiveInactive ¶
GetActiveInactive is used to verify that a state submitted in an HTTP request is either "active" or "inactive". If the submitted state does not match either of the options "active" is returned. "bootstrap" is not an allowed state via HTTP.
func GetActiveInactiveExternal ¶
GetActiveInactiveExternal is used to verify that a state submitted in a HTTP request is either "active", "inactive" or external. If the submitted state does not match either of the options, "active" is returned.
func GetActiveNewExternal ¶
GetActiveNewExternal is used to verify that a state submitted in a HTTP request is either "new" or "newexternal". If the submitted state does not match either of the options, "new" is returned.
func GetAllHostNamess ¶
GetAllHostNamess will return a map from hostnames to IDs for the related host.
func GetCertificate ¶
func GetCertificate(pemEncoded []byte) (cert *x509.Certificate, err error)
GetCertificate takes a byte string containing a PEM encoded certificate and returns returnes an x509.certificate object. If there is a problem parsing the certificate then an error is returned.
func GetCertificateSerial ¶
GetCertificateSerial takes a byte string containing a PEM encoded certificate and returns the serial number of the certificate if it can read the certificate. If there is an error reading the certificate then an error is returned.
func GetCheckboxState ¶
GetCheckboxState is used to turn a checkbox value into a boolean. If the form value is "on", "On" or "ON" true is returned, otherwise false is returned.
func GetDomainIDFromDomainName ¶
GetDomainIDFromDomainName will attempt to find the domain ID for the domain name passed and return the domain ID. If no domain was found, then an error will be returned.
func GetEPPEncryptedPassphrase ¶
GetEPPEncryptedPassphrase is used to get the encrypted passphrase for the username provided. If an error occurs finding the username, the error will be returned.
func GetIPAllowList ¶
GetIPAllowList will try to retrieve the current Host IP allow list from the database and return it. If an error occurs, it will be returned
TODO: Consider moving the db query into the dbcache object.
func GetMailHosts ¶
GetMailHosts will resolve the MX records for a domain name and return the list of hosts sorted by preference if MX records are sent, otherwise the domain name is returned as a fallback A or AAAA record.
func GetProtectedDomainList ¶
GetProtectedDomainList will try to retrieve the current Protected Domain list from the database and return it. If an error occurs, it will be returned.
TODO: Consider moving the db query into the dbcache object.
func GetRemoteUser ¶
GetRemoteUser extracts the REMOTE_USER header from a HTTP Request and returns the username found. The function assumes that a proxy in front of the application verifies the authenticity of the header. If the header is not set an error is returned.
func GetRemoteUserEmail ¶
GetRemoteUserEmail extracts the REMOTE_USER header from a HTTP request and returns the email address for the user. If no REMOTE_USER_ORG is not set, the org is assumed to be the default user domain configured otherwise the value in REMOTE_USER_ORG is appended to the REMOTE_USER. REMOTE_USER_ORG and REMOTE_USER are request headers that may be set.
func GetServerLockChanges ¶
func GetServerLockChanges(dbCache *DBCache) (unlock map[string][]string, lock map[string][]string, err error)
GetServerLockChanges will attempt to generate a list of domains and server flags that need to be added or removed in order to complete changes. If an error occurs, it will be returned.
func GetValidApproverMap ¶
GetValidApproverMap will return a map containing the Approvers email addresses and roles indexed by their Approver ID. Only Approvers with the state "active" are returned.
TODO: Consider moving the db query into the dbcache object.
func GetValidApproverSetMap ¶
GetValidApproverSetMap will return a map containing the Approver set title and ID indexed by their Approver Set ID. Only Approver Sets with the state "active" or "activependingapproval" are returned.
TODO: Consider moving the db call into the dbcache object.
func GetValidContactMap ¶
GetValidContactMap will return a map container the Host's title indexed by the host ID. If an error occurs, it will be returned
TODO: Consider moving the db query into the dbcache object.
func GetValidHostMap ¶
GetValidHostMap will return a map container the Host's title indexed by the host ID. Only
TODO: Consider moving the query into dbcache.
func HandleInProgress ¶
func HandleInProgress(rec interface{}, progressFunc func())
HandleInProgress handles the case of an arbitrary interface. (Mostly DB objects at this point) If the interface implements ProgressHandler, it will use HandleInProgress to prevent loops. Otherwise it will always run progressFunc.
func HostnameExists ¶
HostnameExists checks to see if the hostname passed is currently the hostname associated with a current revision. If there is an error querying the database, it will be returned otherwise true is returned indicating that the hostname is in use or not
TODO: Consider moving the query into dbcache.
func IsAdminUser ¶
IsAdminUser is used to test if a user is an admin user. Iff the user is an admin, true will be returned. If an error occurs during the check, it will be returned, otherwise nil is returned
TODO: Consider moving the db query into the dbcache object.
func IsRegisterableDomain ¶
IsRegisterableDomain will determine if the domain can be registered through the registrar system.
func IsScopeUnchanged ¶
IsScopeUnchanged returns false if it is passed a scope that doesn't have a FieldHash compatible value, otherwise returns the value of IsScopeUnchanged.
func LoadDB ¶
LoadDB is used to start the connection to the database and set up logging as defined in the configuration file. If an error occures when getting the database connection, an error is returned.
func LoadTemplates ¶
LoadTemplates will use the configuration provided and try to load the templates in that directory.
func MigrateDBAPIUser ¶
func MigrateDBAPIUser(dbCache *DBCache)
MigrateDBAPIUser will run the automigrate function for the Approver object.
func MigrateDBAPIUserRevision ¶
func MigrateDBAPIUserRevision(dbCache *DBCache)
MigrateDBAPIUserRevision will run the automigrate function for the APIUserRevision object.
func MigrateDBApproval ¶
func MigrateDBApproval(dbCache *DBCache)
MigrateDBApproval will run the automigrate function for the Approval object.
func MigrateDBApprover ¶
func MigrateDBApprover(dbCache *DBCache)
MigrateDBApprover will run the automigrate function for the Approver object.
func MigrateDBApproverRevision ¶
func MigrateDBApproverRevision(dbCache *DBCache)
MigrateDBApproverRevision will run the automigrate function for the ApproverRevision object.
func MigrateDBApproverSet ¶
func MigrateDBApproverSet(dbCache *DBCache)
MigrateDBApproverSet will run the automigrate function for the Approver Set object.
func MigrateDBApproverSetRevision ¶
func MigrateDBApproverSetRevision(dbCache *DBCache)
MigrateDBApproverSetRevision will run the automigrate function for the Approver Set Revision object.
func MigrateDBChangeRequest ¶
func MigrateDBChangeRequest(dbCache *DBCache)
MigrateDBChangeRequest will run the automigrate function for the Change Request and Approval objects.
func MigrateDBContact ¶
func MigrateDBContact(dbCache *DBCache)
MigrateDBContact will run the automigrate function for the Contact object.
func MigrateDBContactRevision ¶
func MigrateDBContactRevision(dbCache *DBCache)
MigrateDBContactRevision will run the automigrate function for the ContactRevision object.
func MigrateDBControls ¶
func MigrateDBControls(dbCache *DBCache)
MigrateDBControls will run the automigrate function for the separate controls that have been added.
func MigrateDBDomain ¶
func MigrateDBDomain(dbCache *DBCache)
MigrateDBDomain will run the automigrate function for the Domain object.
func MigrateDBDomainRevision ¶
func MigrateDBDomainRevision(dbCache *DBCache)
MigrateDBDomainRevision will run the automigrate function for the DomainRevision object.
func MigrateDBHost ¶
func MigrateDBHost(dbCache *DBCache)
MigrateDBHost will run the automigrate function for the Host object.
func MigrateDBHostRevision ¶
func MigrateDBHostRevision(dbCache *DBCache)
MigrateDBHostRevision will run the automigrate function for the HostRevision object.
func MigrateDBLivenessCheck ¶
func MigrateDBLivenessCheck(dbCache *DBCache)
MigrateDBLivenessCheck will run the automigrate function for the Liveness Check table and will also ensure that there is at least one row in the liveness check table.
func MigrateEPPActionLog ¶
func MigrateEPPActionLog(dbCache *DBCache)
MigrateEPPActionLog will run the automigrate function for the separate epp actions that have been added.
func MustGetLogger ¶
func MustGetLogger(name string) *logging.Logger
MustGetLogger wrapps the logging must get logging method that will get and return a logger object.
func NullInt64ConfirmEqual ¶
NullInt64ConfirmEqual returns match indicating if a and b are equal. If they are not, returns a string describing the difference.
func PrepareBase ¶
PrepareBase implements the core logic of all of the Prepare* methods, returning immediately if the m.prepared is set, loading the base class only if is not already loaded, runs recursiveFunc, and if everything runs without errors, setting prepared to true.
func RegisterableDomainSuffix ¶
RegisterableDomainSuffix will check to see if the domain is part of a zone that can be registered with registrar.
func Save ¶
Save implements save logic broadly equivalent to gorm.DB.Save, but with smarter loop preventing logic.
func SaveAfterAssociations ¶
SaveAfterAssociations from gorm/callback_shared.go, altered use our cycle handling Save function that only saves modified structs, (and trivially, our copies of their unexported shouldSaveAssociations and changeableField functions) Apart from that, a literal copy of the code gorm/callback_shared.go.
func SaveBeforeAssociations ¶
SaveBeforeAssociations from gorm/callback_shared.go, altered use our cycle handling Save function that only saves modified structs, (and trivially, our copies of their unexported shouldSaveAssociations and changeableField functions) Apart from that, a literal copy of the code gorm/callback_shared.go.
func SendEmail ¶
func SendEmail(server string, fromEmail string, fromName string, subject string, message string, sendTo []string) (err error)
SendEmail takes a subject, message and a list of recipients and will attempt to send an email. If the email fails to send, an error is returned, otherwise nil is returned.
func SetEPPEncryptedPassphrase ¶
SetEPPEncryptedPassphrase is used to set the encrypted passphrase for the provided user to the encrypted passphrase included. If an error occurs setting the passphrase for the user, it will be returned.
func SetIPAllowList ¶
SetIPAllowList will attempt to set the host ip allow list in the database and if the list is not set it will be created.
TODO: Consider moving the db query into the dbcache object.
func SetProtectedDomainList ¶
SetProtectedDomainList will attempt to set the protected domain list in the database and if the list is not set it will be created
TODO: Consider moving the db query into the dbcache object.
func SetScopeHash ¶
SetScopeHash will calculate a fieldHash for a scope containing a FieldHasher value.
func StringsToErrs ¶
StringsToErrs takes a list of strings and converts them into a list of errors.
func Update ¶
Update is a simple wrapper around gorm.Update. It skips the update if an object is unchanged.
func UpdateApproverSets ¶
func UpdateApproverSets(object RegistrarObject, dbCache *DBCache, association string, approverSets []ApproverSet) error
UpdateApproverSets will update a set of approvers for an object that is passed in to make the list reflect the list passed as the third parameter.
TODO: Consider moving the db query into the dbcache object.
func UpdateDSDataEntries ¶
func UpdateDSDataEntries(domainRevision *DomainRevision, dbCache *DBCache, association string, dsDataEntries []DSDataEntry) error
UpdateDSDataEntries will update a set of DS Data Entries for a domain that is passed in to make the list reflect the list passed as the third parameter.
TODO: Consider moving the query into dbcache.
func UpdateHostAddresses ¶
func UpdateHostAddresses(hostRev *HostRevision, dbCache *DBCache, association string, hostAddresses []HostAddress) error
UpdateHostAddresses will update a set of host addresses for a host
that is passed in to make the list reflect the list passed as the
third parameter.
TODO: Consider moving the query into dbcache.
func UpdateHosts ¶
func UpdateHosts(object RegistrarObject, dbCache *DBCache, association string, hosts []Host) error
UpdateHosts will update a set of hosts for an object that is passed in to make the list reflect the list passed as the third parameter.
TODO: Consider moving the query into dbcache.
func VerifyCR ¶
func VerifyCR(dbCache *DBCache, rec RegistrarCRObject, _ *ChangeRequest) (checksOut bool, errs []error)
VerifyCR is a generic implemention of checks to make sure that all of the values and approvals within a change request match the approver that it is linked to, and that the CR is genreally well formed.
func WHOISConfirmEmail ¶
WHOISConfirmEmail will collect the required information to generate the WHOIS confimation emails as required by ICANN and then send the email. Once the email has been sent, all of the domains that were processed will be marked as processed to prevent the email from being sent for another year.
Types ¶
type APIRequest ¶
type APIRequest struct { Signature *SignatureUpload `json:"omitempty"` MessageType string `json:"MessageType"` Token string `json:"Token"` }
APIRequest is an object that is populated when a client is making a request to the api entry point. No body is needed when all data is passed in as get parameters.
func GenerateSignatureUpload ¶
func GenerateSignatureUpload(data []byte) APIRequest
GenerateSignatureUpload will create a new APIRequest object with the SignatureResponse sub-object set.
type APIResponse ¶
type APIResponse struct { DomainObject *DomainExport `json:",omitempty"` DomainRevisionObject *DomainRevisionExport `json:",omitempty"` HostObject *HostExport `json:",omitempty"` HostRevisionObject *HostRevisionExport `json:",omitempty"` ContactObject *ContactExport `json:",omitempty"` ContactRevisionObject *ContactRevisionExport `json:",omitempty"` APIUserObject *APIUserExportFull `json:",omitempty"` APIUserRevisionObject *APIUserRevisionExport `json:",omitempty"` ApproverObject *ApproverExportFull `json:",omitempty"` ApproverRevisionObject *ApproverRevisionExport `json:",omitempty"` ApproverSetObject *ApproverSetExportFull `json:",omitempty"` ApproverSetRevisionObject *ApproverSetRevisionExport `json:",omitempty"` ChangeRequestObject *ChangeRequestExport `json:",omitempty"` ApprovalObject *ApprovalExport `json:",omitempty"` HostIPAllowList *[]string `json:",omitempty"` ProtectedDomainList *[]string `json:",omitempty"` DomainIDList *[]int64 `json:"DomainIDList,omitempty"` HostIDList *[]int64 `json:"HostIDList,omitempty"` ContactIDList *[]int64 `json:"ContactIDList,omitempty"` DomainHintList *[]APIRevisionHint `json:",omitempty"` HostHintList *[]APIRevisionHint `json:",omitempty"` ContactHintList *[]APIRevisionHint `json:",omitempty"` HostnamesMap *map[string]int64 `json:",omitempty"` Signature *SignatureResponse `json:",omitempty"` Approval *ApprovalDownload `json:",omitempty"` Token *TokenResponse `json:",omitempty"` EPPRunID *int64 `json:",omitempty"` EPPPassphrase *string `json:",omitempty"` MessageType string `json:"MessageType"` Errors []string `json:"Errors"` }
APIResponse is an object that is populated when responding to an API request.
func GenerateApprovalDownload ¶
func GenerateApprovalDownload(data []byte, errs []error) APIResponse
GenerateApprovalDownload is used to create an APIReponse object that has the apporval data and errors populated to be sent to the client.
func GenerateErrorResponse ¶
func GenerateErrorResponse(errs []error) APIResponse
GenerateErrorResponse will take a list of errors and create an APIReponse object indicating an error with the provided errors converted and set as the error list.
func GenerateIDList ¶
func GenerateIDList(objectType string, ids []int64, revisions []APIRevisionHint) APIResponse
GenerateIDList will take an object type and a list of IDs and create the correct IDList APIResponse object to return to the client.
func GenerateObjectResponse ¶
func GenerateObjectResponse(object RegistrarObjectExport) APIResponse
GenerateObjectResponse is used to prepare an APIResponse object that contains the object presented.
func GenerateSignatureResponse ¶
func GenerateSignatureResponse(data []byte) APIResponse
GenerateSignatureResponse will create a new APIResponse object with the SignatureResponse sub-object set.
func GenerateTokenResponse ¶
func GenerateTokenResponse(token string) APIResponse
GenerateTokenResponse will create a new APIReponse object with the TokenResponse sub-object set.
func (*APIResponse) GetRegistrarObject ¶
func (response *APIResponse) GetRegistrarObject() (outObj RegistrarObjectExport, errs []error)
GetRegistrarObject will return the RegistrarObjectExport contained in the APIResponse object if it exists or the errors if the APIResponse is an error response.
func (APIResponse) Serialize ¶
func (response APIResponse) Serialize() ([]byte, error)
Serialize returns a form of the response to be written to the wire.
type APIRevisionHint ¶
APIRevisionHint is used to provide a hint to the clients of which object revision is current for each current object.
func GetAllContacts ¶
func GetAllContacts(dbCache *DBCache) (retlist []int64, revisions []APIRevisionHint, err error)
GetAllContacts returns a list of IDs for contats that are in the active or activepending approval states or requires work to be done on the contact. If an error occurs, it will be returned
TODO: Consider moving the db query into the dbcache object.
func GetAllDomains ¶
func GetAllDomains(dbCache *DBCache) (retlist []int64, revisions []APIRevisionHint, err error)
GetAllDomains returns a list of IDs for domains that are in the active or activepending approval states or requires work to be done on the domain.
func GetAllHosts ¶
func GetAllHosts(dbCache *DBCache) (retlist []int64, revisions []APIRevisionHint, err error)
GetAllHosts returns a list of IDs for hosts that are in the active or activepending approval states or requires work to be done on the host. If an error occurs, it will be returned
TODO: Consider moving the query into dbcache.
func GetWorkContacts ¶
func GetWorkContacts(dbCache *DBCache) (retlist []int64, revisions []APIRevisionHint, err error)
GetWorkContacts returns a list of IDs for contacts that require attention in the form of an update to the registry or other related information. If an error occurs, it will be returned
TODO: Consider moving the db query into the dbcache object.
func GetWorkDomains ¶
func GetWorkDomains(dbCache *DBCache) (retlist []int64, revisions []APIRevisionHint, err error)
GetWorkDomains returns a list of IDs for domains that require attention in the form of an update to the registry or other related information. If an error occurs, it will be returned.
func GetWorkHosts ¶
func GetWorkHosts(dbCache *DBCache) (retlist []int64, revisions []APIRevisionHint, err error)
GetWorkHosts returns a list of IDs for hosts that require attention in the form of an update to the registry or other related information. If an error occurs, it will be returned
TODO: Consider moving the query into dbcache.
type APIUser ¶
type APIUser struct { Model State string `json:"state"` CurrentRevision APIUserRevision `json:"currentRevision"` CurrentRevisionID sql.NullInt64 `json:"currentRevisionID"` Revisions []APIUserRevision `json:"revision"` PendingRevision APIUserRevision `json:"pendingRevision" sql:"-"` CreatedAt time.Time `json:"createdAt"` CreatedBy string `json:"createdBy"` UpdatedAt time.Time `json:"updatedAt"` UpdatedBy string `json:"updatedBy"` }
APIUser is an object that represents a API account that may be used to query the registrar system without being an authenticated employee.
func GetAPIUser ¶
GetAPIUser extracts the certificate from the headers provided by apache and will look for a current user that has a matching certificate. If no certificate is found, or there is no API users associated with the certificate then an error is returned.
func GetAPIUserFromPEM ¶
GetAPIUserFromPEM takes a byte string containing a PEM encoded certificate and returns the API User associated with the certificate if there is only one API user that matches. If there is more than one API User with a matching key or no users, an error is returned and a nil object is returend.
TODO: Consider moving the db query into the dbcache object.
func (*APIUser) ComparePendingToCallback ¶
func (a *APIUser) ComparePendingToCallback(loadFn CompareLoadFn) (retFn CompareReturnFn)
ComparePendingToCallback will return a function that will compare the current revision object to itself after changes have been made.
func (*APIUser) GetAllPage ¶
func (a *APIUser) GetAllPage(dbCache *DBCache, _ string, _ string) (aop RegistrarObjectPage, err error)
GetAllPage will return an object that can be used to render a view Containing multiple approvers.
TODO: Add paging support. TODO: Add filtering.
func (*APIUser) GetCertName ¶
GetCertName returnes a string that will identify an API user like a regular user.
func (*APIUser) GetCurrentRevisionID ¶
GetCurrentRevisionID will return the id of the current API User Revision for the api user object.
func (*APIUser) GetCurrentValue ¶
GetCurrentValue is used to get the current value of a field in a revision if a current revision exists, otherwise an empty string is returned.
func (*APIUser) GetDisplayName ¶
GetDisplayName will return a name for the APIUser that can be used to display a shortened version of the invormation to users.
func (*APIUser) GetExportShortVersion ¶
func (a *APIUser) GetExportShortVersion() APIUserExportShort
GetExportShortVersion returns an export version of the APIUser Object in its short form.
func (*APIUser) GetExportVersion ¶
func (a *APIUser) GetExportVersion() RegistrarObjectExport
GetExportVersion returns an export version of the APIUser Object.
func (*APIUser) GetExportVersionAt ¶
func (a *APIUser) GetExportVersionAt(dbCache *DBCache, timestamp int64) (obj RegistrarObjectExport, err error)
GetExportVersionAt returns an export version of the APIUser Object at the timestamp provided if possible otherwise an error is returned. If a pending version existed at the time it will be excluded from the object.
func (*APIUser) GetInformedApproverSets ¶
func (a *APIUser) GetInformedApproverSets(dbCache *DBCache) (as []ApproverSet, err error)
GetInformedApproverSets returns the list of approver sets that are informed for the APIUser (if a valid approver revision exists). If no approver revisions are found, an empty list will be returned.
func (*APIUser) GetPage ¶
func (a *APIUser) GetPage(dbCache *DBCache, username string, email string) (rop RegistrarObjectPage, err error)
GetPage will return an object that can be used to render the HTML template for the APIUser.
func (*APIUser) GetPendingCRID ¶
GetPendingCRID will return the current CR id if it is set, otherwise a nil will be returned (in the form of a sql.NullInt64).
func (*APIUser) GetPendingRevision ¶
func (a *APIUser) GetPendingRevision() RegistrarObject
GetPendingRevision implements the RegistrarParent interface and returns the pending revision pointer.
func (*APIUser) GetPendingRevisionID ¶
GetPendingRevisionID will return the current pending revision for the API User object if it exists. If no pending revision exists a 0 is returned.
func (*APIUser) GetRequiredApproverSets ¶
func (a *APIUser) GetRequiredApproverSets(dbCache *DBCache) (approvers []ApproverSet, err error)
GetRequiredApproverSets returns the list of approver sets that are required for the APIUser (if a valid approver revision exists). If no APIUser revisions are found, a default of the infosec approver set will be returned.
func (*APIUser) GetType ¶
GetType will return the object type string as defined in the RegistrarObject definition.
func (APIUser) HasPendingRevision ¶
HasPendingRevision returns true iff a pending revision exists for the Approver, otherwise false.
func (APIUser) HasRevision ¶
HasRevision returns true iff a current revision exists, otherwise false.
TODO: add a check to verify that the current revision has an approved change request.
func (*APIUser) IsAdmin ¶
IsAdmin will return true if the current revision has the user marked as an admin and false otherwise. If there is an error retireveing if the user is an admin it will be returned.
func (*APIUser) IsCancelled ¶
IsCancelled returns true iff the object has been canclled.
func (*APIUser) IsEditable ¶
IsEditable returns true iff the object is editable.
func (*APIUser) ParseFromForm ¶
ParseFromForm takes a http Request and parses the field values and populates the acceptable values into the new object. An error is returned if there is difficulty parsing any of the fileds.
func (*APIUser) ParseFromFormUpdate ¶
ParseFromFormUpdate takes a http Request and parses the form values and returns a sparse APIUser object with the changes that were made. An error object is always the second return value which is nil when no errors have occurred during parsing otherwise an error is returned.
func (*APIUser) Prepare ¶
Prepare populate all of the fields for a given object as well as the linked objects.
func (*APIUser) PrepareShallow ¶
PrepareShallow populates all of the fields for the given object and not any of the linked objects.
func (APIUser) SuggestedRevisionBool ¶
SuggestedRevisionBool takes a string naming the flag that is being requested and returnes a bool containing the suggested value for the field in the new revision.
TODO: add other fields that have been added.
func (APIUser) SuggestedRevisionValue ¶
SuggestedRevisionValue takes a string naming the field that is being requested and returns a string containing the suggested value for the field in a new pending revision.
TODO: add other fields that have been added.
func (*APIUser) TakeAction ¶
func (a *APIUser) TakeAction(response http.ResponseWriter, _ *http.Request, _ *DBCache, actionName string, _ bool, authMethod AuthType, _ Config) (errs []error)
TakeAction processes actions that are to be taken on the object and either display a resulting page, trigger a download or redirect to another page if necessary.
func (*APIUser) UpdateState ¶
UpdateState can be called at any point to check the state of the APIUser and update it if necessary.
TODO: Implement. TODO: Make sure callers check errors.
type APIUserExportFull ¶
type APIUserExportFull struct { ID int64 `json:"ID"` State string `json:"state"` CurrentRevision APIUserRevisionExport `json:"currentRevision"` PendingRevision APIUserRevisionExport `json:"pendingRevision"` CreatedAt time.Time `json:"createdAt"` CreatedBy string `json:"createdBy"` }
APIUserExportFull is an object that is used to export the current state of an API User object. The full version of the export object also contains the current and pending revision (if either exists).
func (APIUserExportFull) GetDiff ¶
func (a APIUserExportFull) GetDiff() (string, error)
GetDiff will return a string containing a formatted diff of the current and pending revisions for the APIUser object. An empty string and an error are returned if an error occures during the processing.
TODO: Handle diff for objects that do not have a pending revision. TODO: Handle diff for objects that do not have a current revision.
func (APIUserExportFull) ToJSON ¶
func (a APIUserExportFull) ToJSON() (string, error)
ToJSON will return a string containing a JSON representation of the object. An empty string and an error are returned if a JSON representation cannot be returned.
type APIUserExportShort ¶
type APIUserExportShort struct { ID int64 `json:"ID"` State string `json:"state"` CreatedAt time.Time `json:"createdAt"` CreatedBy string `json:"createdBy"` }
APIUserExportShort is an object that is used to export the current state of an APIUser object. The short version of the export object does not contain the current or pending revision.
func (APIUserExportShort) ToJSON ¶
func (a APIUserExportShort) ToJSON() (string, error)
ToJSON will return a string containing a JSON representation of the object. An empty string and an error are returned if a JSON representation cannot be returned.
type APIUserPage ¶
type APIUserPage struct { Editable bool IsNew bool App APIUser CurrentRevisionPage *APIUserRevisionPage PendingRevisionPage *APIUserRevisionPage PendingActions map[string]string ValidApproverSets map[int64]string CSRFToken string }
APIUserPage is used to hold all the information required to render the APIUser HTML template.
func (*APIUserPage) GetCSRFToken ¶
func (a *APIUserPage) GetCSRFToken() string
GetCSRFToken retrieves the CSRF token from an the Page Object.
func (*APIUserPage) SetCSRFToken ¶
func (a *APIUserPage) SetCSRFToken(newToken string)
SetCSRFToken is used to set the CSRFToken for the Page Object.
type APIUserRevision ¶
type APIUserRevision struct { Model APIUserID int64 `json:"APIUserID"` RevisionState string `json:"RevisionState"` DesiredState string `json:"DesiredState"` Name string `json:"Name"` Description string `json:"Description" sql:"size:16384"` Serial string `json:"Serial" sql:"size:256"` Certificate string `json:"Certificate" sql:"size:16384"` SavedNotes string `json:"SavedNotes" sql:"size:16384"` IsAdmin bool `json:"IsAdmin"` IsEPPClient bool `json:"IsEPPClient"` RequiredApproverSets []ApproverSet `gorm:"many2many:required_approverset_to_apiuserrevision" json:"RequiredApproverSets"` InformedApproverSets []ApproverSet `gorm:"many2many:informed_approverset_to_apiuserrevision" json:"InformedApproverSets"` CR ChangeRequest `json:"CR"` CRID sql.NullInt64 `json:"CRID"` IssueCR string `json:"IssueCR" sql:"size:256"` Notes string `json:"Notes" sql:"size:2048"` CreatedAt time.Time `json:"CreatedAt"` CreatedBy string `json:"CreatedBy"` UpdatedAt time.Time `json:"UpdatedAt"` UpdatedBy string `json:"UpdatedBy"` ApprovalStartTime *time.Time `json:"ApprovalStartTime"` ApprovalStartBy string `json:"ApprovalStartBy"` PromotedTime *time.Time `json:"PromotedTime"` SupersededTime *time.Time `json:"SupersededTime"` ApprovalFailedTime *time.Time `json:"ApprovalFailedTime"` }
APIUserRevision represents individual versions of an APIUser object.
func (*APIUserRevision) Cancel ¶
func (a *APIUserRevision) Cancel(dbCache *DBCache, conf Config) (errs []error)
Cancel will change the State of a revision from either "new" or "pendingapproval" to "cancelled".
TODO: If in pending approval, cancel the change request and all approval objects. TODO: Consider moving the db query into the dbcache object.
func (*APIUserRevision) Decline ¶
func (a *APIUserRevision) Decline(dbCache *DBCache) (err error)
Decline will mark an ApproverRevision as decline for an Approver.
func (*APIUserRevision) GetActions ¶
func (a *APIUserRevision) GetActions(isSelf bool) map[string]string
GetActions will return a list of possible actions that can be taken while in the current state.
TODO: handle all states.
func (*APIUserRevision) GetAllPage ¶
func (a *APIUserRevision) GetAllPage(dbCache *DBCache, _ string, _ string) (arop RegistrarObjectPage, err error)
GetAllPage will return an object that can be used to render a view Containing multiple Approver Revisions.
TODO: Add paging support. TODO: Add filtering.
func (*APIUserRevision) GetCertificate ¶
func (a *APIUserRevision) GetCertificate() (cert *x509.Certificate, err error)
GetCertificate returnes an x509.certificate object for a API User Revision if it is set. If there is a problem parsing the certificate, no certificate is set or if the APIUserRevision object is not set then an error is returned.
func (*APIUserRevision) GetExportVersion ¶
func (a *APIUserRevision) GetExportVersion() RegistrarObjectExport
GetExportVersion returns a export version of the APIRevisionRevision Object.
func (*APIUserRevision) GetExportVersionAt ¶
func (a *APIUserRevision) GetExportVersionAt(_ *DBCache, _ int64) (obj RegistrarObjectExport, err error)
GetExportVersionAt returns an export version of the APIUser Revision Object at the timestamp provided if possible otherwise an error is returned. If a pending version existed at the time it will be excluded from the object.
func (*APIUserRevision) GetInformedApproverSets ¶
func (a *APIUserRevision) GetInformedApproverSets(dbCache *DBCache) (approverSets []ApproverSet, err error)
GetInformedApproverSets prepares object and returns the ApproverSets.
func (*APIUserRevision) GetPage ¶
func (a *APIUserRevision) GetPage(dbCache *DBCache, _ string, _ string) (arop RegistrarObjectPage, err error)
GetPage will return an object that can be used to render the HTML template for the APIUserRevision.
func (*APIUserRevision) GetRequiredApproverSets ¶
func (a *APIUserRevision) GetRequiredApproverSets(dbCache *DBCache) (approverSets []ApproverSet, err error)
GetRequiredApproverSets prepares object and returns the ApproverSets.
func (*APIUserRevision) GetState ¶
func (a *APIUserRevision) GetState(cleartextState string) string
GetState is used to verify that a state submitted in an HTTP request is either "active" or "inactive". If the submitted state does not match either of the options "active" is returned. "bootstrap" is not an allowed state via HTTP.
func (*APIUserRevision) GetType ¶
func (a *APIUserRevision) GetType() string
GetType will return the object type string as defined in the RegistrarObject definition.
func (APIUserRevision) HasHappened ¶
func (a APIUserRevision) HasHappened(actionType string) bool
HasHappened is a helper function that will return true if the value of the timestamp who's name is passes has happened after the revision was created. This function is intended to be used with templates.
func (*APIUserRevision) IsActive ¶
func (a *APIUserRevision) IsActive() bool
IsActive returns true if RevisionState is StateActive or StateBootstrap.
func (*APIUserRevision) IsCancelled ¶
func (a *APIUserRevision) IsCancelled() bool
IsCancelled returns true iff the object has been canclled.
func (APIUserRevision) IsDesiredState ¶
func (a APIUserRevision) IsDesiredState(state string) bool
IsDesiredState will return true iff the state passed in matches the desired state of the revision.
func (*APIUserRevision) IsEditable ¶
func (a *APIUserRevision) IsEditable() bool
IsEditable returns true iff the object is editable.
func (*APIUserRevision) ParseFromForm ¶
func (a *APIUserRevision) ParseFromForm(request *http.Request, dbCache *DBCache) error
ParseFromForm takes a http Request and parses the field values and populates the acceptable values into the new object. An error is returned if there is difficulty parsing any of the fileds.
TODO: verify public key. TODO: verify fingerprint.
func (*APIUserRevision) ParseFromFormUpdate ¶
func (a *APIUserRevision) ParseFromFormUpdate(request *http.Request, dbCache *DBCache, _ Config) error
ParseFromFormUpdate takes a http Request and parses the form values and returns a sparse APIUserRevision object with the changes that were made. An error object is always the second return value which is nil when no errors have occurred during parsing otherwise an error is returned.
TODO: verify public key. TODO: verify fingerprint.
func (*APIUserRevision) Prepare ¶
func (a *APIUserRevision) Prepare(dbCache *DBCache) (err error)
Prepare populate all of the fields for a given object as well as the linked objects.
TODO: Consider moving the db query into the dbcache object.
func (*APIUserRevision) Promote ¶
func (a *APIUserRevision) Promote(dbCache *DBCache) (err error)
Promote will mark an ApproverRevision as the current revision for an Approver if it has not been cancelled or failed approval.
func (*APIUserRevision) StartApprovalProcess ¶
func (a *APIUserRevision) StartApprovalProcess(request *http.Request, dbCache *DBCache, conf Config) (err error)
StartApprovalProcess creates a change request to start the process of approvnig a new Change Request. If the Change Request was created no error is returned, otherwise an error will be returned.
TODO: Check if a CR already exists for this object. TODO: Ensure that if an error occures no changes are made.
func (*APIUserRevision) Supersed ¶
func (a *APIUserRevision) Supersed(dbCache *DBCache) (err error)
Supersed will mark an ApproverRevision as a superseded revision for an Approver.
func (*APIUserRevision) TakeAction ¶
func (a *APIUserRevision) TakeAction(responseWriter http.ResponseWriter, request *http.Request, dbCache *DBCache, actionName string, validCSRF bool, authMethod AuthType, conf Config) (errs []error)
TakeAction processes actions that are to be taken on the object and either display a resulting page, trigger a download or redirect to another page if necessary.
type APIUserRevisionExport ¶
type APIUserRevisionExport struct { ID int64 `json:"ID"` APIUserID int64 `json:"APIUserID"` DesiredState string `json:"DesiredState"` Name string `json:"Name"` Description string `json:"Description"` Serial string `json:"Serial"` Certificate string `json:"Certificate"` SavedNotes string `json:"SavedNotes"` IsAdmin bool `json:"IsAdmin"` IsEPPClient bool `json:"IsEPPClient"` ChangeRequestID int64 `json:"ChangeRequestID"` IssueCR string `json:"IssueCR"` Notes string `json:"Notes"` RequiredApproverSets []ApproverSetExportShort `json:"RequiredApproverSets"` InformedApproverSets []ApproverSetExportShort `json:"InformedApproverSets"` CreatedAt time.Time `json:"CreatedAt"` CreatedBy string `json:"CreatedBy"` }
APIUserRevisionExport is an object that is used to export the current version of an APIUser Revision.
func (APIUserRevisionExport) Compare ¶
func (are APIUserRevisionExport) Compare(apiUserRevision APIUserRevision) (pass bool, errs []error)
Compare is used to compare an export version of an object to the full revision to verify that all of the values are the same.
func (APIUserRevisionExport) CompareExport ¶
func (are APIUserRevisionExport) CompareExport(apiUserRevisionExport APIUserRevisionExport) (pass bool, errs []error)
CompareExport is used to compare an export version of an object to another export revision to verify that all of the values are the same.
func (APIUserRevisionExport) GetDiff ¶
func (are APIUserRevisionExport) GetDiff() (string, error)
GetDiff will return an empty string and an error for a revision. A Diff is not available for revision objects.
func (APIUserRevisionExport) ToJSON ¶
func (are APIUserRevisionExport) ToJSON() (string, error)
ToJSON will return a string containing a JSON representation of the object. An empty string and an error are returned if a JSON representation cannot be returned.
type APIUserRevisionPage ¶
type APIUserRevisionPage struct { IsEditable bool IsNew bool Revision APIUserRevision PendingActions map[string]string ValidApproverSets map[int64]string ParentAPIUser *APIUser SuggestedRequiredApprovers map[int64]ApproverSetDisplayObject SuggestedInformedApprovers map[int64]ApproverSetDisplayObject CSRFToken string }
APIUserRevisionPage are used to hold all the information required to render the APIUserRevision HTML template.
func (*APIUserRevisionPage) GetCSRFToken ¶
func (a *APIUserRevisionPage) GetCSRFToken() string
GetCSRFToken retrieves the CSRF token from an the Page Object.
func (*APIUserRevisionPage) SetCSRFToken ¶
func (a *APIUserRevisionPage) SetCSRFToken(newToken string)
SetCSRFToken is used to set the CSRFToken for the Page Object.
type APIUserRevisionsPage ¶
type APIUserRevisionsPage struct { APIUserRevisions []APIUserRevision CSRFToken string }
The APIUserRevisionsPage type is used to render the html template which lists all of the APIUserRevisions currently in the registrar system.
TODO: Add paging support.
func (*APIUserRevisionsPage) GetCSRFToken ¶
func (a *APIUserRevisionsPage) GetCSRFToken() string
GetCSRFToken retrieves the CSRF token from an the Page Object.
func (*APIUserRevisionsPage) SetCSRFToken ¶
func (a *APIUserRevisionsPage) SetCSRFToken(newToken string)
SetCSRFToken is used to set the CSRFToken for the Page Object.
type APIUsersPage ¶
APIUsersPage is used to render the html template which lists all of the APIUsers currently in the registrar system.
TODO: Add paging support. TODO: Add filtering support.
func (*APIUsersPage) GetCSRFToken ¶
func (a *APIUsersPage) GetCSRFToken() string
GetCSRFToken retrieves the CSRF token from an the Page Object.
func (*APIUsersPage) SetCSRFToken ¶
func (a *APIUsersPage) SetCSRFToken(newToken string)
SetCSRFToken is used to set the CSRFToken for the Page Object.
type Approval ¶
type Approval struct { Model State string `json:"State"` IsSigned bool `json:"IsSigned" sql:"DEFAULT:false"` IsFinalApproval bool `json:"IsFinalApproval"` ChangeRequestID int64 `json:"ChangeRequestID"` ApproverSetID int64 `json:"ApproverSetID"` ApprovalApproverSet ApproverSet `json:"ApprovalAPproverSet" sql:"-"` Signature []byte `json:"Signature" sql:"signature,type:text"` CreatedAt time.Time `json:"CreatedAt"` CreatedBy string `json:"CreatedBy"` UpdatedAt time.Time `json:"UpdatedAt"` UpdatedBy string `json:"UpdatedBy"` }
Approval holds the data associated with getting a Change Request approved by a member of an Approver Set.
func (*Approval) AfterSave ¶
AfterSave is used to hook specific functions that are required for propogating the approval to the change request and attached objects after an approval has changed.
func (*Approval) ApprovalUpdateEmail ¶
ApprovalUpdateEmail will generate and send an email following the update of an approval TODO: Consider making this email a template and switching the registrar name to a variable.
func (*Approval) CheckSignature ¶
CheckSignature inspectes the signature of the approval object to see if the signature was created by one of the valid approvers in the linked Approver Set.
func (*Approval) CheckValidityOfApproverSet ¶
CheckValidityOfApproverSet will return StateInactiveApproverSet if the approver set is not valid, StateNoValidApprovers if there were no valid approvers for the approverset and StatePendingApproval if the approver set is valid and has valid approvers.
func (*Approval) GetAllPage ¶
func (a *Approval) GetAllPage(dbCache *DBCache, _ string, _ string) (rop RegistrarObjectPage, err error)
GetAllPage will return an object that can be used to render a view Containing multiple Approvals.
TODO: Implement. TODO: Add paging support. TODO: Add filtering.
func (*Approval) GetApprovalAttestation ¶
func (a *Approval) GetApprovalAttestation(dbCache *DBCache) (appatt ApprovalAttestationUnmarshal, validSig bool, err error)
GetApprovalAttestation will extract the approval attestation from the signed message stored in the object, if there is one and the signature is valid.
func (*Approval) GetApproverEmails ¶
GetApproverEmails will extract the email addresses from each of the users of the approvers in the linked approver set.
func (*Approval) GetDownload ¶
GetDownload is used to generate an approval assertion that can be used to approve or decline the Approval.
TODO: add an error to the return.
func (*Approval) GetDownloadAttestation ¶
func (a *Approval) GetDownloadAttestation(dbCache *DBCache, username string, method string) (aa ApprovalAttestation, err error)
GetDownloadAttestation will create and return an ApprovalAttestation object for the calling Approval. If the method is not valid an error will be returned.
func (*Approval) GetExportVersion ¶
func (a *Approval) GetExportVersion() RegistrarObjectExport
GetExportVersion returns a export version of the Approval Object.
func (*Approval) GetExportVersionAt ¶
func (a *Approval) GetExportVersionAt(_ *DBCache, _ int64) (obj RegistrarObjectExport, err error)
GetExportVersionAt returns an export version of the Approval Object at the timestamp provided if possible otherwise an error is returned. If a pending version existed at the time it will be excluded from the object. TODO: Implement.
func (*Approval) GetPage ¶
func (a *Approval) GetPage(dbCache *DBCache, _ string, email string) (rop RegistrarObjectPage, err error)
GetPage will return an object that can be used to render the HTML template for the Approval.
func (*Approval) GetSigner ¶
GetSigner is used to get the Approver(s) who have signed an approval returning an error if when an error occures trying to find Approvers from the signed object information.
func (*Approval) GetType ¶
GetType will return the object type string as defined in the RegistrarObject definition.
func (*Approval) IsCancelled ¶
IsCancelled returns true iff the object has been canclled.
func (*Approval) IsEditable ¶
IsEditable returns true iff the object is editable.
func (*Approval) NewApprovalEmail ¶
NewApprovalEmail will generate and send an email upon the creation of a new approval. TODO: Consider making this email a template and switching the registrar name to a variable.
func (*Approval) ParseFromForm ¶
ParseFromForm returns an error. Approvals may not be added using a web form.
func (*Approval) ParseFromFormUpdate ¶
func (a *Approval) ParseFromFormUpdate(request *http.Request, dbCache *DBCache, conf Config) (err error)
ParseFromFormUpdate takes a http Request and parses the field values and populates the acceptable values into the new object. An error is returned if there is difficulty parsing any of the fileds.
func (*Approval) PostUpdate ¶
PostUpdate is called on an object following a change to the object.
TODO: finish implementing.
func (*Approval) Prepare ¶
Prepare populate all of the fields for a given object as well as the linked objects.
func (*Approval) TakeAction ¶
func (a *Approval) TakeAction(responseWriter http.ResponseWriter, request *http.Request, dbCache *DBCache, actionName string, validCSRF bool, authMethod AuthType, conf Config) (errs []error)
TakeAction processes actions that are to be taken on the object and either display a resulting page, trigger a download or redirect to another page if necessary.
TODO: Implement.
type ApprovalAttestation ¶
type ApprovalAttestation struct { ApprovalID int64 `json:"ApprovalID"` ExportRev RegistrarObjectExport `json:"ExportRev"` Username string `json:"Username"` Action string `json:"Action"` ObjectType string `json:"ObjectType"` Signatures [][]byte `json:"Signature"` }
ApprovalAttestation is used to create the object that is exported and presented to an Approver so they can either approve or decline an approval. The exported object is then signed using a GPG key and then resubmitted to the registrar system.
func (ApprovalAttestation) ToJSON ¶
func (a ApprovalAttestation) ToJSON() (string, error)
ToJSON will return a string containing a JSON representation of the object. An empty string and an error are returned if a JSON representation cannot be returned.
type ApprovalAttestationUnmarshal ¶
type ApprovalAttestationUnmarshal struct { ApprovalID int64 `json:"ApprovalID"` ExportRev json.RawMessage `json:"ExportRev"` Username string `json:"Username"` Action string `json:"Action"` ObjectType string `json:"ObjectType"` Signatures [][]byte `json:"Signature"` }
ApprovalAttestationUnmarshal allows the Approval Attestations to be unpacked knowing that multiple types may be present.
type ApprovalDownload ¶
type ApprovalDownload struct {
Approval []byte `json:"Approval"`
}
ApprovalDownload is used to transmit a unsigned approval object over an APIResponse.
type ApprovalExport ¶
type ApprovalExport struct { ID int64 `json:"ID"` State string `json:"State"` IsSigned bool `json:"IsSigned"` IsFinalApproval bool `json:"IsFinalApproval"` ChangeRequestID int64 `json:"ChangeRequestID"` ApproverSetID int64 `json:"ApproverSetID"` Signature []byte `json:"Signature"` CreatedAt time.Time `json:"CreatedAt"` CreatedBy string `json:"CreatedBy"` }
ApprovalExport is an object that is used to export the current state of an Approval object.
func (ApprovalExport) GetDiff ¶
func (a ApprovalExport) GetDiff() (string, error)
GetDiff will return an empty string and an error for a revision. A Diff is not available for revision objects.
func (ApprovalExport) ToJSON ¶
func (a ApprovalExport) ToJSON() (string, error)
ToJSON will return a string containing a JSON representation of the object. An empty string and an error are returned if a JSON representation cannot be returned.
type ApprovalPage ¶
type ApprovalPage struct { App Approval CanApprove bool IsEditable bool IsSigned bool IsFinalApproval bool SigLen int HasSigner bool Signers []Approver CSRFToken string }
ApprovalPage is used to hold all the information required to render the Approval HTML Template.
func (*ApprovalPage) GetCSRFToken ¶
func (a *ApprovalPage) GetCSRFToken() string
GetCSRFToken retrieves the CSRF token from an the Page Object.
func (*ApprovalPage) SetCSRFToken ¶
func (a *ApprovalPage) SetCSRFToken(newToken string)
SetCSRFToken is used to set the CSRFToken for the Page Object.
type ApprovalsPage ¶
ApprovalsPage is used to render the HTML template which lists a group of approvals.
TODO: add paging support. TODO: add filtering support.
func (*ApprovalsPage) GetCSRFToken ¶
func (a *ApprovalsPage) GetCSRFToken() string
GetCSRFToken retrieves the CSRF token from an the Page Object.
func (*ApprovalsPage) SetCSRFToken ¶
func (a *ApprovalsPage) SetCSRFToken(newToken string)
SetCSRFToken is used to set the CSRFToken for the Page Object.
type Approver ¶
type Approver struct { Model State string `json:"State"` CurrentRevision ApproverRevision `json:"CurrentRevision"` CurrentRevisionID sql.NullInt64 `json:"CurrentRevisionID"` Revisions []ApproverRevision `json:"Revisions"` PendingRevision ApproverRevision `json:"PendingRevision" sql:"-"` ApproverSetRevisions []ApproverSetRevision `gorm:"many2many:approver_to_revision_set;" json:"ApproverSetRevisions"` CreatedAt time.Time `json:"CreatedAt"` CreatedBy string `json:"CreatedBy"` UpdatedAt time.Time `json:"UpdatedAt"` UpdatedBy string `json:"UpdatedBy"` }
Approver is an object that represents an individual that may be used to approve changes within the registrar system.
func ParseApprovers ¶
ParseApprovers takes the http Request, a database connection and the html ID of the approver list to parse and will return an array of Approvers that correspond to each of the id's from the http request's html element. If there are unparsable IDs in the list (could be strings or empty fields) and error is returned. Any valid approvers that were found will be returned in the array even if an error occures.
TODO: test for approver IDs that do not exist.
func (*Approver) AfterSave ¶
AfterSave is used to hook specific functions that are required for propogating the approval to the change request and attached objects after an approval has changed.
func (*Approver) ComparePendingToCallback ¶
func (a *Approver) ComparePendingToCallback(loadFn CompareLoadFn) (retFn CompareReturnFn)
ComparePendingToCallback will return a function that will compare the current revision object to itself after changes have been made.
func (*Approver) GetActiveApproverSets ¶
func (a *Approver) GetActiveApproverSets(dbCache *DBCache) (approverSets []ApproverSet, err error)
GetActiveApproverSets is used to get a list of ApproverSets that the calling approver is a member of which are in an active or inactive state.
TODO: Consider moving the query into dbcache.
func (*Approver) GetAllPage ¶
GetAllPage will return an object that can be used to render a view Containing multiple approvers.
TODO: Add paging support. TODO: Add filtering.
func (*Approver) GetCurrentRevisionID ¶
GetCurrentRevisionID will return the id of the current Approver Revision for the Approver object.
func (*Approver) GetCurrentValue ¶
GetCurrentValue is used to get the current value of a field in a revision if a current revision exists, otherwise an empty string is returned.
func (*Approver) GetDisplayName ¶
GetDisplayName will return a name for the Approver that can be used to display a shortened version of the invormation to users.
func (*Approver) GetExportShortVersion ¶
func (a *Approver) GetExportShortVersion() ApproverExportShort
GetExportShortVersion returns an export version of the Approver Object in its short form.
func (*Approver) GetExportVersion ¶
func (a *Approver) GetExportVersion() RegistrarObjectExport
GetExportVersion returns an export version of the Approver Object.
func (*Approver) GetExportVersionAt ¶
func (a *Approver) GetExportVersionAt(dbCache *DBCache, timestamp int64) (obj RegistrarObjectExport, err error)
GetExportVersionAt returns an export version of the Approver Object at the timestamp provided if possible otherwise an error is returned. If a pending version existed at the time it will be excluded from the object. TODO: Implement.
func (*Approver) GetGPGKeyBlock ¶
GetGPGKeyBlock will return a openpgp.Entity object if there is a key that exists in the current revision and the key is able to be parsed. If there is an error parsing the key, the error return value will be set to a non-nil value.
func (*Approver) GetInformedApproverSets ¶
func (a *Approver) GetInformedApproverSets(dbCache *DBCache) ([]ApproverSet, error)
GetInformedApproverSets returns the list of approver sets that are informed for the Approver (if a valid approver revision exists). If no approver revisions are found, an empty list will be returned.
func (*Approver) GetPage ¶
func (a *Approver) GetPage(dbCache *DBCache, username string, email string) (rop RegistrarObjectPage, err error)
GetPage will return an object that can be used to render the HTML template for the Approver.
func (*Approver) GetPendingCRID ¶
GetPendingCRID will return the current CR id if it is set, otherwise a nil will be returned (in the form of a sql.NullInt64).
func (*Approver) GetPendingRevision ¶
func (a *Approver) GetPendingRevision() RegistrarObject
GetPendingRevision implements the RegistrarParent interface and returns the pending revision pointer.
func (*Approver) GetPendingRevisionID ¶
GetPendingRevisionID will return the current pending revision for the Approver object if it exists. If no pending revision exists a 0 is returned.
func (*Approver) GetRequiredApproverSets ¶
func (a *Approver) GetRequiredApproverSets(dbCache *DBCache) (approvers []ApproverSet, err error)
GetRequiredApproverSets returns the list of approver sets that are required for the Approver (if a valid approver revision exists). If no approver revisions are found, a default of the infosec approver set will be returned.
func (*Approver) GetType ¶
GetType will return the object type string as defined in the RegistrarObject definition.
func (Approver) HasPendingRevision ¶
HasPendingRevision returns true iff a pending revision exists for the Approver, otherwise false.
func (Approver) HasRevision ¶
HasRevision returns true iff a current revision exists, otherwise false.
TODO: add a check to verify that the current revision has an approved change request.
func (*Approver) IsCancelled ¶
IsCancelled returns true iff the object has been canclled.
func (*Approver) IsEditable ¶
IsEditable returns true iff the object is editable.
func (*Approver) ParseFromForm ¶
ParseFromForm takes a http Request and parses the field values and populates the acceptable values into the new object. An error is returned if there is difficulty parsing any of the fileds.
func (*Approver) ParseFromFormUpdate ¶
ParseFromFormUpdate takes a http Request and parses the form values and returns a sparse Approver object with the changes that were made. An error object is always the second return value which is nil when no errors have occurred during parsing otherwise an error is returned.
func (*Approver) PostUpdate ¶
PostUpdate is called on an object following a change to the object.
func (*Approver) Prepare ¶
Prepare populate all of the fields for a given object as well as the linked objects.
func (*Approver) PrepareShallow ¶
PrepareShallow populates all of the fields for the given object and not any of the linked objects.
func (Approver) SuggestedRevisionBool ¶
SuggestedRevisionBool takes a string naming the flag that is being requested and returnes a bool containing the suggested value for the field in the new revision.
TODO: add other fields that have been added.
func (Approver) SuggestedRevisionValue ¶
SuggestedRevisionValue takes a string naming the field that is being requested and returns a string containing the suggested value for the field in a new pending revision.
TODO: add other fields that have been added.
func (*Approver) TakeAction ¶
func (a *Approver) TakeAction(response http.ResponseWriter, _ *http.Request, _ *DBCache, actionName string, _ bool, authMethod AuthType, _ Config) (errs []error)
TakeAction processes actions that are to be taken on the object and either display a resulting page, trigger a download or redirect to another page if necessary.
func (*Approver) UpdateState ¶
UpdateState can be called at any point to check the state of the Approver and update it if necessary.
TODO: Implement. TODO: Make sure callers check errors.
type ApproverExportFull ¶
type ApproverExportFull struct { ID int64 `json:"ID"` State string `json:"State"` CurrentRevision ApproverRevisionExport `json:"CurrentRevision"` PendingRevision ApproverRevisionExport `json:"PendingRevision"` CreatedAt time.Time `json:"CreatedAt"` CreatedBy string `json:"CreatedBy"` }
ApproverExportFull is an object that is used to export the current state of an approver object. The full version of the export object also contains the current and pending revision (if either exist).
func (ApproverExportFull) GetDiff ¶
func (a ApproverExportFull) GetDiff() (string, error)
GetDiff will return a string containing a formatted diff of the current and pending revisions for the Approver object. An empty string and an error are returned if an error occures during the processing.
TODO: Handle diff for objects that do not have a pending revision. TODO: Handle diff for objects that do not have a current revision.
func (ApproverExportFull) ToJSON ¶
func (a ApproverExportFull) ToJSON() (string, error)
ToJSON will return a string containing a JSON representation of the object. An empty string and an error are returned if a JSON representation cannot be returned.
type ApproverExportShort ¶
type ApproverExportShort struct { ID int64 `json:"ID"` State string `json:"State"` CreatedAt time.Time `json:"CreatedAt"` CreatedBy string `json:"CreatedBy"` }
ApproverExportShort is an object that is used to export the current state of an approver object. The short version of the export object does not contain the current or pending revision.
TODO: Candidate for removal.
func (ApproverExportShort) ToJSON ¶
func (a ApproverExportShort) ToJSON() (string, error)
ToJSON will return a string containing a JSON representation of the object. An empty string and an error are returned if a JSON representation cannot be returned.
type ApproverPage ¶
type ApproverPage struct { Editable bool IsNew bool App Approver CurrentRevisionPage *ApproverRevisionPage PendingRevisionPage *ApproverRevisionPage PendingActions map[string]string ValidApproverSets map[int64]string CSRFToken string }
ApproverPage is used to hold all the information required to render the Appprover HTML template.
func (*ApproverPage) GetCSRFToken ¶
func (a *ApproverPage) GetCSRFToken() string
GetCSRFToken retrieves the CSRF token from an the Page Object.
func (*ApproverPage) SetCSRFToken ¶
func (a *ApproverPage) SetCSRFToken(newToken string)
SetCSRFToken is used to set the CSRFToken for the Page Object.
type ApproverRevision ¶
type ApproverRevision struct { Model ApproverID int64 `json:"ApproverID"` RevisionState string `json:"RevisionState"` DesiredState string `json:"DesiredState"` Name string `json:"Name"` EmailAddress string `json:"EmailAddress"` Role string `json:"Role"` Username string `json:"Username"` EmployeeID int64 `json:"EmployeeID"` Department string `json:"Department"` IsAdmin bool `json:"IsAdmin"` SavedNotes string `json:"SavedNotes" sql:"size:16384"` RequiredApproverSets []ApproverSet `gorm:"many2many:required_approverset_to_approverrevision" json:"RequiredApproverSets"` InformedApproverSets []ApproverSet `gorm:"many2many:informed_approverset_to_approverrevision" json:"InformedApproverSets"` Fingerprint string `json:"Fingerprint"` PublicKey string `json:"PublicKey" sql:"size:16384"` CR ChangeRequest `json:"CR"` CRID sql.NullInt64 `json:"CRID"` IssueCR string `json:"IssueCR" sql:"size:256"` Notes string `json:"Notes" sql:"size:2048"` CreatedAt time.Time `json:"CreatedAt"` CreatedBy string `json:"CreatedBy"` UpdatedAt time.Time `json:"UpdatedAt"` UpdatedBy string `json:"UpdatedBy"` ApprovalStartTime *time.Time `json:"ApprovalStartTime"` ApprovalStartBy string `json:"ApprovalStartBy"` PromotedTime *time.Time `json:"PromotedTime"` SupersededTime *time.Time `json:"SuspendedTime"` ApprovalFailedTime *time.Time `json:"ApprovalFailedTime"` }
ApproverRevision represents individual versions of an Approver object.
func (*ApproverRevision) Cancel ¶
func (a *ApproverRevision) Cancel(dbCache *DBCache, conf Config) (errs []error)
Cancel will change the State of a revision from either "new" or "pendingapproval" to "cancelled".
TODO: If in pending approval, cancel the change request and all approval objects. TODO: Consider moving the db query into the dbcache object.
func (*ApproverRevision) Decline ¶
func (a *ApproverRevision) Decline(dbCache *DBCache) (err error)
Decline will mark an ApproverRevision as decline for an Approver.
func (*ApproverRevision) GetActions ¶
func (a *ApproverRevision) GetActions(isSelf bool) map[string]string
GetActions will return a list of possible actions that can be taken while in the current state.
TODO: handle all states.
func (*ApproverRevision) GetAllPage ¶
func (a *ApproverRevision) GetAllPage(dbCache *DBCache, _ string, _ string) (RegistrarObjectPage, error)
GetAllPage will return an object that can be used to render a view Containing multiple Approver Revisions.
TODO: Add paging support. TODO: Add filtering.
func (*ApproverRevision) GetExportVersion ¶
func (a *ApproverRevision) GetExportVersion() RegistrarObjectExport
GetExportVersion returns a export version of the ApproverRevision Object.
func (*ApproverRevision) GetExportVersionAt ¶
func (a *ApproverRevision) GetExportVersionAt(_ *DBCache, _ int64) (obj RegistrarObjectExport, err error)
GetExportVersionAt returns an export version of the Approver Revision Object at the timestamp provided if possible otherwise an error is returned. If a pending version existed at the time it will be excluded from the object.
func (*ApproverRevision) GetInformedApproverSets ¶
func (a *ApproverRevision) GetInformedApproverSets(dbCache *DBCache) (approverSets []ApproverSet, err error)
GetInformedApproverSets prepares object and returns the ApproverSets.
func (*ApproverRevision) GetPage ¶
func (a *ApproverRevision) GetPage(dbCache *DBCache, _ string, _ string) (rop RegistrarObjectPage, err error)
GetPage will return an object that can be used to render the HTML template for the ApproverRevision.
func (*ApproverRevision) GetRequiredApproverSets ¶
func (a *ApproverRevision) GetRequiredApproverSets(dbCache *DBCache) (approverSets []ApproverSet, err error)
GetRequiredApproverSets prepares object and returns the ApproverSets.
func (*ApproverRevision) GetState ¶
func (a *ApproverRevision) GetState(cleartextState string) string
GetState is used to verify that a state submitted in an HTTP request is either "active" or "inactive". If the submitted state does not match either of the options "active" is returned. "bootstrap" is not an allowed state via HTTP.
func (*ApproverRevision) GetType ¶
func (a *ApproverRevision) GetType() string
GetType will return the object type string as defined in the RegistrarObject definition.
func (ApproverRevision) HasHappened ¶
func (a ApproverRevision) HasHappened(actionType string) bool
HasHappened is a helper function that will return true if the value of the timestamp who's name is passes has happened after the revision was created. This function is intended to be used with templates.
func (*ApproverRevision) IsActive ¶
func (a *ApproverRevision) IsActive() bool
IsActive returns true if RevisionState is StateActive or StateBootstrap.
func (*ApproverRevision) IsCancelled ¶
func (a *ApproverRevision) IsCancelled() bool
IsCancelled returns true iff the object has been canclled.
func (ApproverRevision) IsDesiredState ¶
func (a ApproverRevision) IsDesiredState(state string) bool
IsDesiredState will return true iff the state passed in matches the desired state of the revision.
func (*ApproverRevision) IsEditable ¶
func (a *ApproverRevision) IsEditable() bool
IsEditable returns true iff the object is editable.
func (*ApproverRevision) ParseFromForm ¶
func (a *ApproverRevision) ParseFromForm(request *http.Request, dbCache *DBCache) error
ParseFromForm takes a http Request and parses the field values and populates the acceptable values into the new object. An error is returned if there is difficulty parsing any of the fileds.
TODO: verify public key. TODO: verify fingerprint.
func (*ApproverRevision) ParseFromFormUpdate ¶
func (a *ApproverRevision) ParseFromFormUpdate(request *http.Request, dbCache *DBCache, _ Config) error
ParseFromFormUpdate takes a http Request and parses the form values and returns a sparse ApproverRevision object with the changes that were made. An error object is always the second return value which is nil when no errors have occurred during parsing otherwise an error is returned.
TODO: verify public key. TODO: verify fingerprint.
func (*ApproverRevision) Prepare ¶
func (a *ApproverRevision) Prepare(dbCache *DBCache) (err error)
Prepare populate all of the fields for a given object as well as the linked objects.
TODO: Consider moving the db query into the dbcache object.
func (*ApproverRevision) Promote ¶
func (a *ApproverRevision) Promote(dbCache *DBCache) (err error)
Promote will mark an ApproverRevision as the current revision for an Approver if it has not been cancelled or failed approval.
func (*ApproverRevision) StartApprovalProcess ¶
func (a *ApproverRevision) StartApprovalProcess(request *http.Request, dbCache *DBCache, conf Config) (err error)
StartApprovalProcess creates a change request to start the process of approvnig a new Change Request. If the Change Request was created no error is returned, otherwise an error will be returned.
TODO: Check if a CR already exists for this object. TODO: Ensure that if an error occures no changes are made.
func (*ApproverRevision) Supersed ¶
func (a *ApproverRevision) Supersed(dbCache *DBCache) (err error)
Supersed will mark an ApproverRevision as a superseded revision for an Approver.
func (*ApproverRevision) TakeAction ¶
func (a *ApproverRevision) TakeAction(response http.ResponseWriter, request *http.Request, dbCache *DBCache, actionName string, validCSRF bool, authMethod AuthType, conf Config) (errs []error)
TakeAction processes actions that are to be taken on the object and either display a resulting page, trigger a download or redirect to another page if necessary.
type ApproverRevisionExport ¶
type ApproverRevisionExport struct { ID int64 `json:"ID"` ApproverID int64 `json:"ApproverID"` DesiredState string `json:"DesiredState"` Name string `json:"Name"` EmailAddress string `json:"EmailAddress"` Role string `json:"Role"` Username string `json:"Username"` EmployeeID int64 `json:"EmployeeID"` Department string `json:"Department"` IsAdmin bool `json:"IsAdmin"` SavedNotes string `json:"SavedNotes"` RequiredApproverSets []ApproverSetExportShort `json:"RequiredApproverSets"` InformedApproverSets []ApproverSetExportShort `json:"InformedApproverSets"` Fingerprint string `json:"Fingerprint"` PublicKey string `json:"PublicKey"` ChangeRequestID int64 `json:"ChangeRequestID"` IssueCR string `json:"IssueCR"` Notes string `json:"Notes"` CreatedAt time.Time `json:"CreatedAt"` CreatedBy string `json:"CreatedBy"` }
ApproverRevisionExport is an object that is used to export the current version of an Approver Revision.
func (ApproverRevisionExport) Compare ¶
func (are ApproverRevisionExport) Compare(approverRevision ApproverRevision) (pass bool, errs []error)
Compare is used to compare an export version of an object to the full revision to verify that all of the values are the same.
func (ApproverRevisionExport) CompareExport ¶
func (are ApproverRevisionExport) CompareExport(approverRevisionExport ApproverRevisionExport) (pass bool, errs []error)
CompareExport is used to compare an export version of an object to another export revision to verify that all of the values are the same.
func (ApproverRevisionExport) GetDiff ¶
func (are ApproverRevisionExport) GetDiff() (string, error)
GetDiff will return an empty string and an error for a revision. A Diff is not available for revision objects.
func (ApproverRevisionExport) ToJSON ¶
func (are ApproverRevisionExport) ToJSON() (string, error)
ToJSON will return a string containing a JSON representation of the object. An empty string and an error are returned if a JSON representation cannot be returned.
type ApproverRevisionPage ¶
type ApproverRevisionPage struct { IsEditable bool IsNew bool Revision ApproverRevision PendingActions map[string]string ValidApproverSets map[int64]string ParentApprover *Approver SuggestedRequiredApprovers map[int64]ApproverSetDisplayObject SuggestedInformedApprovers map[int64]ApproverSetDisplayObject CSRFToken string }
ApproverRevisionPage are used to hold all the information required to render the AppproverRevision HTML template.
func (*ApproverRevisionPage) GetCSRFToken ¶
func (a *ApproverRevisionPage) GetCSRFToken() string
GetCSRFToken retrieves the CSRF token from an the Page Object.
func (*ApproverRevisionPage) SetCSRFToken ¶
func (a *ApproverRevisionPage) SetCSRFToken(newToken string)
SetCSRFToken is used to set the CSRFToken for the Page Object.
type ApproverRevisionsPage ¶
type ApproverRevisionsPage struct { ApproverRevisions []ApproverRevision CSRFToken string }
The ApproverRevisionsPage type is used to render the html template which lists all of the AppproverRevisions currently in the registrar system.
TODO: Add paging support.
func (*ApproverRevisionsPage) GetCSRFToken ¶
func (a *ApproverRevisionsPage) GetCSRFToken() string
GetCSRFToken retrieves the CSRF token from an the Page Object.
func (*ApproverRevisionsPage) SetCSRFToken ¶
func (a *ApproverRevisionsPage) SetCSRFToken(newToken string)
SetCSRFToken is used to set the CSRFToken for the Page Object.
type ApproverSet ¶
type ApproverSet struct { Model State string CurrentRevision ApproverSetRevision CurrentRevisionID sql.NullInt64 Revisions []ApproverSetRevision PendingRevision ApproverSetRevision `sql:"-"` KeysSet bool `sql:"-"` Keys []*openpgp.Entity `sql:"-"` CreatedAt time.Time `json:"CreatedAt"` CreatedBy string `json:"CreatedBy"` UpdatedAt time.Time `json:"UpdatedAt"` UpdatedBy string `json:"UpdatedBy"` }
ApproverSet objects are used to group similar approvers together to allow equivalence classes of Approvers (increasing availability).
func GetDefaultApproverSet ¶
func GetDefaultApproverSet(dbCache *DBCache) (approverSet ApproverSet, err error)
GetDefaultApproverSet - return the default approver.
func GetInformedApproverSets ¶
func GetInformedApproverSets(dbCache *DBCache, rec Modeler) (approverSets []ApproverSet, err error)
GetInformedApproverSets is a general implementation of lookup for ApproverSets. It doesn't require that the object be loaded, only that it exist in the db. It returns the list of approver sets that are informed for rec (if a valid approver revision exists).
func GetRequiredApproverSets ¶
func GetRequiredApproverSets(dbCache *DBCache, rec Modeler) (approverSets []ApproverSet, err error)
GetRequiredApproverSets is a general implementation of lookup for ApproverSets. It doesn't require that the object be loaded, only that it exist in the db. It returns the list of approver sets that are required for rec (if a valid approver revision exists). If no rec revisions are found, a default of the infosec approver set will be returned.
func ParseApproverSets ¶
func ParseApproverSets(request *http.Request, dbCache *DBCache, htmlID string, requireAppSet1 bool) (approverSets []ApproverSet, err error)
ParseApproverSets takes the http Request, a database connection and the html ID of the approver set list to parse and will return an array of Approver Sets that correspond to each of the id's from the http request's html element. If there are unparsable IDs in the list (could be strings or empty fields) and error is returned. Any valid approver sets that were found will be returned in the array even if an error occures.
ApproverSets will be returned in ID order, regardless of the order requested.
func (*ApproverSet) ApproverFromIdentityName ¶
func (a *ApproverSet) ApproverFromIdentityName(name string, dbCache *DBCache) (app Approver, err error)
ApproverFromIdentityName will iterate over the aprovers from the current revision and try to find the approver with a key that has the same Identity Name. If no Approver is found it will return an error.
func (*ApproverSet) ComparePendingToCallback ¶
func (a *ApproverSet) ComparePendingToCallback(loadFn CompareLoadFn) (retFn CompareReturnFn)
ComparePendingToCallback will return a function that will compare the current revision object to itself after changes have been made.
func (ApproverSet) DecryptionKeys ¶
func (a ApproverSet) DecryptionKeys() (keys []openpgp.Key)
DecryptionKeys returns all private keys that are valid for decryption. No private keys are stored by the system so it is always a noop. This method is part of the interface for []openpgp.Entities.
func (*ApproverSet) GetAllPage ¶
func (a *ApproverSet) GetAllPage(dbCache *DBCache, _ string, _ string) (RegistrarObjectPage, error)
GetAllPage will return an object that can be used to render a view Containing multiple Approver Sets.
TODO: Add paging support. TODO: Add filtering.
func (*ApproverSet) GetCurrentRevisionID ¶
func (a *ApproverSet) GetCurrentRevisionID() sql.NullInt64
GetCurrentRevisionID will return the id of the current Approver Set Revision for the Approver Set object.
func (*ApproverSet) GetCurrentValue ¶
func (a *ApproverSet) GetCurrentValue(field string) (ret string)
GetCurrentValue is used to get the current value of a field in a revision if a current revision exists, otherwise an empty string is returned.
func (*ApproverSet) GetDisplayName ¶
func (a *ApproverSet) GetDisplayName() string
GetDisplayName will return a name for the Approver set that can be used to display a shortened version of the invormation to users.
func (*ApproverSet) GetDisplayObject ¶
func (a *ApproverSet) GetDisplayObject() ApproverSetDisplayObject
GetDisplayObject creates a display object for the called approver set.
func (*ApproverSet) GetExportVersion ¶
func (a *ApproverSet) GetExportVersion() RegistrarObjectExport
GetExportVersion returns a export version of the Approver Set Object.
TODO add CurrentRevision. TODO Add PendingRevision.
func (*ApproverSet) GetExportVersionAt ¶
func (a *ApproverSet) GetExportVersionAt(dbCache *DBCache, timestamp int64) (obj RegistrarObjectExport, err error)
GetExportVersionAt returns an export version of the Approver Set Object at the timestamp provided if possible otherwise an error is returned. If a pending version existed at the time it will be excluded from the object.
func (*ApproverSet) GetInformedApproverSets ¶
func (a *ApproverSet) GetInformedApproverSets(dbCache *DBCache) ([]ApproverSet, error)
GetInformedApproverSets returns the list of approver sets that are informed for the Approver Set (if a valid approver revision exists). If no approver revisions are found, an empty list will be returned.
func (*ApproverSet) GetPage ¶
func (a *ApproverSet) GetPage(dbCache *DBCache, username string, email string) (rpo RegistrarObjectPage, err error)
GetPage will return an object that can be used to render the HTML template for the Approver Set.
func (*ApproverSet) GetPendingApprovals ¶
func (a *ApproverSet) GetPendingApprovals(dbCache *DBCache) (approvals []Approval, err error)
GetPendingApprovals is used to get a list of approvals that are in the pendingapproval, inactiveapproverset or novalidapprovers states that have the passed approver set as their approver set.
TODO: Consider moving the query into dbcache.
func (*ApproverSet) GetPendingCRID ¶
func (a *ApproverSet) GetPendingCRID() sql.NullInt64
GetPendingCRID will return the current CR id if it is set, otherwise a nil will be returned (in the form of a sql.NullInt64).
func (*ApproverSet) GetPendingRevision ¶
func (a *ApproverSet) GetPendingRevision() RegistrarObject
GetPendingRevision implements the RegistrarParent interface and returns the pending revision pointer.
func (*ApproverSet) GetPendingRevisionID ¶
func (a *ApproverSet) GetPendingRevisionID() int64
GetPendingRevisionID will return the current pending revision for the Approver Set object if it exists. If no pending revision exists a 0 is returned.
func (*ApproverSet) GetRequiredApproverSets ¶
func (a *ApproverSet) GetRequiredApproverSets(dbCache *DBCache) (approvers []ApproverSet, err error)
GetRequiredApproverSets returns the list of approver sets that are required for the Approver Set (if a valid approver revision exists). If no approver revisions are found, a default of the infosec approver set will be returned.
func (*ApproverSet) GetType ¶
func (a *ApproverSet) GetType() string
GetType will return the object type string as defined in the RegistrarObject definition.
func (ApproverSet) HasHappened ¶
func (a ApproverSet) HasHappened(actionType string) bool
HasHappened is a helper function that will return true if the value of the timestamp who's name is passes has happened after the revision was created. This function is intended to be used with templates.
func (ApproverSet) HasPendingRevision ¶
func (a ApproverSet) HasPendingRevision() bool
HasPendingRevision returns true iff a pending revision exists for the Approver Set, otherwise false.
func (ApproverSet) HasRevision ¶
func (a ApproverSet) HasRevision() bool
HasRevision returns true iff a current revision exists, otherwise false.
TODO: add a check to verify that the current revision has an approved change request.
func (*ApproverSet) IsCancelled ¶
func (a *ApproverSet) IsCancelled() bool
IsCancelled returns true iff the object has been canclled.
func (*ApproverSet) IsEditable ¶
func (a *ApproverSet) IsEditable() bool
IsEditable returns true iff the object is editable.
func (*ApproverSet) IsValidApproverByEmail ¶
func (a *ApproverSet) IsValidApproverByEmail(emailaddress string, dbCache *DBCache) (bool, error)
IsValidApproverByEmail will check all of the approvers in the current approved revision to verify that the email address can be found.
TODO: Check for approver being active. TODO: Check for special case of bootstrap.
func (ApproverSet) KeysById ¶
func (a ApproverSet) KeysById(keyID uint64) (keys []openpgp.Key)
KeysById returns the set of keys that have the given key id. This method is part of the interface for []openpgp.Entities.
func (ApproverSet) KeysByIdUsage ¶
func (a ApproverSet) KeysByIdUsage(keyID uint64, requiredUsage byte) (keys []openpgp.Key)
KeysByIdUsage returns the set of keys with the given id that also meet the key usage given by requiredUsage. The requiredUsage is expressed as the bitwise-OR of packet.KeyFlag* values. This method is part of the interface for []openpgp.Entities.
func (*ApproverSet) ParseFromForm ¶
func (a *ApproverSet) ParseFromForm(request *http.Request, _ *DBCache) error
ParseFromForm takes a http Request and parses the field values and populates the acceptable values into the new object. An error is returned if there is difficulty parsing any of the fileds.
func (*ApproverSet) ParseFromFormUpdate ¶
ParseFromFormUpdate takes a http Request and parses the form values and returns a sparse Approver Set object with the changes that were made. An error object is always the second return value which is nil when no errors have occurred during parsing otherwise an error is returned.
TODO: Implement.
func (*ApproverSet) Prepare ¶
func (a *ApproverSet) Prepare(dbCache *DBCache) error
Prepare populate all of the fields for a given object as well as the linked objects.
func (*ApproverSet) PrepareDisplayShallow ¶
func (a *ApproverSet) PrepareDisplayShallow(dbCache *DBCache) error
PrepareDisplayShallow populate all of the fields for a given object and the current revision but not any of the other linked object.
func (*ApproverSet) PrepareGPGKeys ¶
func (a *ApproverSet) PrepareGPGKeys(dbCache *DBCache) error
PrepareGPGKeys will go over the list of current approvers and extract the GPG keys from the Approvers to prepare the Approver Set to be used as a verification keyring.
func (*ApproverSet) PrepareShallow ¶
func (a *ApproverSet) PrepareShallow(dbCache *DBCache) error
PrepareShallow populate all of the fields for a given object and not any of the linked object.
func (ApproverSet) SuggestedRevisionBool ¶
func (a ApproverSet) SuggestedRevisionBool(field string) bool
SuggestedRevisionBool takes a string naming the flag that is being requested and returnes a bool containing the suggested value for the field in the new revision.
TODO: add other fields that have been added.
func (ApproverSet) SuggestedRevisionValue ¶
func (a ApproverSet) SuggestedRevisionValue(field string) string
SuggestedRevisionValue takes a string naming the field that is being requested and returns a string containing the suggested value for the field in a new pending revision.
func (*ApproverSet) TakeAction ¶
func (a *ApproverSet) TakeAction(response http.ResponseWriter, _ *http.Request, _ *DBCache, actionName string, _ bool, authMethod AuthType, _ Config) (errs []error)
TakeAction processes actions that are to be taken on the object and either display a resulting page, trigger a download or redirect to another page if necessary.
TODO: Implement.
func (*ApproverSet) UpdateState ¶
func (a *ApproverSet) UpdateState(dbCache *DBCache, conf Config) (changesMade bool, errs []error)
UpdateState can be called at any point to check the state of the Approver Set and update it if necessary.
TODO: Implement.
func (*ApproverSet) VerifyCR ¶
func (a *ApproverSet) VerifyCR(dbCache *DBCache) (checksOut bool, errs []error)
VerifyCR Checks to make sure that all of the values and approvals within a change request match the approver set that it is linked to.
TODO: more rigirous check on if the CR approved text matches.
type ApproverSetDisplayObject ¶
ApproverSetDisplayObject is used to bundle the dispaly name and the approver set ID as one object to be passed into a template.
type ApproverSetExportFull ¶
type ApproverSetExportFull struct { ID int64 `json:"ID"` State string `json:"State"` CurrentRevision ApproverSetRevisionExport `json:"CurrentRevision"` PendingRevision ApproverSetRevisionExport `json:"PendingRevision"` CreatedAt time.Time `json:"CreatedAt"` CreatedBy string `json:"CreatedBy"` }
ApproverSetExportFull is an object that is uesd to export the current snapshot of an Approver Set object. The full version of the export object contains the current and pending revision objects if they exist.
func (ApproverSetExportFull) GetDiff ¶
func (a ApproverSetExportFull) GetDiff() (string, error)
GetDiff will return a string containing a formatted diff of the current and pending revisions for the Approver object. An empty string and an error are returned if an error occures during the processing.
func (ApproverSetExportFull) ToJSON ¶
func (a ApproverSetExportFull) ToJSON() (string, error)
ToJSON will return a string containing a JSON representation of the object. An empty string and an error are returned if a JSON representation cannot be returned.
type ApproverSetExportShort ¶
type ApproverSetExportShort struct { ID int64 State string CreatedAt time.Time `json:"CreatedAt"` CreatedBy string `json:"CreatedBy"` }
ApproverSetExportShort is an object that is used to expor the current snapshot of an Approver Set object. The short version of the export object does not contain any information about the current or pending revisions.
func GetApproverSetExportArr ¶
func GetApproverSetExportArr(as []ApproverSet) []ApproverSetExportShort
GetApproverSetExportArr converts an array of ApproverSets to an array of ApproverSetExportShort objects for exporting.
type ApproverSetPage ¶
type ApproverSetPage struct { Editable bool IsNew bool AppS ApproverSet CurrentRevisionPage *ApproverSetRevisionPage PendingRevisionPage *ApproverSetRevisionPage PendingActions map[string]string CSRFToken string }
ApproverSetPage is used to hold all the information required to render the Approver Set HTML template.
func (*ApproverSetPage) GetCSRFToken ¶
func (a *ApproverSetPage) GetCSRFToken() string
GetCSRFToken retrieves the CSRF token from an the Page Object.
func (*ApproverSetPage) SetCSRFToken ¶
func (a *ApproverSetPage) SetCSRFToken(newToken string)
SetCSRFToken is used to set the CSRFToken for the Page Object.
type ApproverSetRevision ¶
type ApproverSetRevision struct { Model ApproverSetID int64 RevisionState string DesiredState string Title string Description string Approvers []Approver `gorm:"many2many:approver_to_revision_set;"` SavedNotes string `sql:"size:16384"` RequiredApproverSets []ApproverSet `gorm:"many2many:required_approverset_to_approversetrevision"` InformedApproverSets []ApproverSet `gorm:"many2many:informed_approverset_to_approversetrevision"` CR ChangeRequest CRID sql.NullInt64 IssueCR string `sql:"size:256"` Notes string `sql:"size:2048"` CreatedAt time.Time `json:"CreatedAt"` CreatedBy string `json:"CreatedBy"` UpdatedAt time.Time `json:"UpdatedAt"` UpdatedBy string `json:"UpdatedBy"` ApprovalStartTime *time.Time ApprovalStartBy string PromotedTime *time.Time SupersededTime *time.Time ApprovalFailedTime *time.Time }
ApproverSetRevision represents an individual version of an Approver Set object.
func (*ApproverSetRevision) Cancel ¶
func (a *ApproverSetRevision) Cancel(dbCache *DBCache, conf Config) (errs []error)
Cancel will change the State of a revision from either "new" or "pendingapproval" to "cancelled"
TODO: If in pending approval, cancel the change request and all approval objects
TODO: Consider moving the db query into the dbcache object.
func (*ApproverSetRevision) Decline ¶
func (a *ApproverSetRevision) Decline(dbCache *DBCache) (err error)
Decline will mark an ApproverSetRevision as decline for an ApproverSet.
func (*ApproverSetRevision) GetActions ¶
func (a *ApproverSetRevision) GetActions(isSelf bool) map[string]string
GetActions will return a list of possible actions that can be taken while in the current state
TODO: handle all states.
func (*ApproverSetRevision) GetAllPage ¶
func (a *ApproverSetRevision) GetAllPage(_ *DBCache, _ string, _ string) (RegistrarObjectPage, error)
GetAllPage will return an object that can be used to render a view Containing multiple Approver Set Revisions.
TODO: Implement TODO: Add paging support TODO: Add filtering.
func (*ApproverSetRevision) GetExportVersion ¶
func (a *ApproverSetRevision) GetExportVersion() RegistrarObjectExport
GetExportVersion returns a export version of the ApproverSetRevision Object.
func (*ApproverSetRevision) GetExportVersionAt ¶
func (a *ApproverSetRevision) GetExportVersionAt(_ *DBCache, _ int64) (obj RegistrarObjectExport, err error)
GetExportVersionAt returns an export version of the Approver Set Revision Object at the timestamp provided if possible otherwise an error is returned. If a pending version existed at the time it will be excluded from the object.
func (*ApproverSetRevision) GetInformedApproverSets ¶
func (a *ApproverSetRevision) GetInformedApproverSets(dbCache *DBCache) (approverSets []ApproverSet, err error)
GetInformedApproverSets prepares object and returns the ApproverSets.
func (*ApproverSetRevision) GetPage ¶
func (a *ApproverSetRevision) GetPage(dbCache *DBCache, _ string, _ string) (rop RegistrarObjectPage, err error)
GetPage will return an object that can be used to render the HTML template for the Approver Set Revision.
func (*ApproverSetRevision) GetRequiredApproverSets ¶
func (a *ApproverSetRevision) GetRequiredApproverSets(dbCache *DBCache) (approverSets []ApproverSet, err error)
GetRequiredApproverSets prepares object and returns the ApproverSets.
func (*ApproverSetRevision) GetState ¶
func (a *ApproverSetRevision) GetState(cleartextState string) string
GetState is used to verify that a state submitted in an HTTP request is either "active" or "inactive". If the submitted state does not match either of the options "active" is returned. "bootstrap" is not an allowed state via HTTP.
func (*ApproverSetRevision) GetType ¶
func (a *ApproverSetRevision) GetType() string
GetType will return the object type string as defined in the RegistrarObject definition.
func (ApproverSetRevision) HasHappened ¶
func (a ApproverSetRevision) HasHappened(actionType string) bool
HasHappened is a helper function that will return true if the value of the timestamp who's name is passes has happened after the revision was created. This function is intended to be used with templates.
func (*ApproverSetRevision) IsActive ¶
func (a *ApproverSetRevision) IsActive() bool
IsActive returns true if RevisionState is StateActive or StateBootstrap.
func (*ApproverSetRevision) IsCancelled ¶
func (a *ApproverSetRevision) IsCancelled() bool
IsCancelled returns true iff the object has been canclled.
func (ApproverSetRevision) IsDesiredState ¶
func (a ApproverSetRevision) IsDesiredState(state string) bool
IsDesiredState will return true iff the state passed in matches the desired state of the revision.
func (*ApproverSetRevision) IsEditable ¶
func (a *ApproverSetRevision) IsEditable() bool
IsEditable returns true iff the object is editable.
func (*ApproverSetRevision) ParseFromForm ¶
func (a *ApproverSetRevision) ParseFromForm(request *http.Request, dbCache *DBCache) error
ParseFromForm takes a http Request and parses the field values and populates the acceptable values into the new object. An error is returned if there is difficulty parsing any of the fileds.
func (*ApproverSetRevision) ParseFromFormUpdate ¶
func (a *ApproverSetRevision) ParseFromFormUpdate(request *http.Request, dbCache *DBCache, _ Config) (err error)
ParseFromFormUpdate takes a http Request and parses the form values and returns a sparse ApproverSetRevision object with the changes that were made. An error object is always the second return value which is nil when no errors have occurred during parsing otherwise an error is returned.
TODO: Consider moving the db query into the dbcache object.
func (*ApproverSetRevision) Prepare ¶
func (a *ApproverSetRevision) Prepare(dbCache *DBCache) (err error)
Prepare populate all of the fields for a given object as well as the linked objects.
TODO: Consider moving the db query into the dbcache object.
func (*ApproverSetRevision) PrepareShallow ¶
func (a *ApproverSetRevision) PrepareShallow(dbCache *DBCache) error
PrepareShallow populate all of the fields for a given object and not any of the linked object.
func (*ApproverSetRevision) Promote ¶
func (a *ApproverSetRevision) Promote(dbCache *DBCache) (err error)
Promote will mark an ApproverSetRevision as the current revision for an Approver Set if it has not been cancelled or failed approval.
func (*ApproverSetRevision) StartApprovalProcess ¶
func (a *ApproverSetRevision) StartApprovalProcess(request *http.Request, dbCache *DBCache, conf Config) (err error)
StartApprovalProcess creates a change request to start the process of approvnig a new Change Request. If the Change Request was created no error is returned, otherwise an error will be returned.
TODO: Check if a CR already exists for this object TODO: Ensure that if an error occures no changes are made.
func (*ApproverSetRevision) Supersed ¶
func (a *ApproverSetRevision) Supersed(dbCache *DBCache) (err error)
Supersed will mark an ApproverSetRevision as a superseded revision for an ApproverSet.
func (*ApproverSetRevision) TakeAction ¶
func (a *ApproverSetRevision) TakeAction(response http.ResponseWriter, request *http.Request, dbCache *DBCache, actionName string, validCSRF bool, authMethod AuthType, conf Config) (errs []error)
TakeAction processes actions that are to be taken on the object and either display a resulting page, trigger a download or redirect to another page if necessary
TODO: Implement.
type ApproverSetRevisionExport ¶
type ApproverSetRevisionExport struct { ID int64 `json:"ID"` ApproverSetID int64 `json:"ApproverSetID"` RevisionState string `json:"RevisionState"` DesiredState string `json:"DesiredState"` Title string `json:"Title"` Description string `json:"Description"` Approvers []ApproverExportShort `json:"Approvers"` SavedNotes string `json:"SavedNotes"` ChangeRequestID int64 `json:"ChangeRequestID"` IssueCR string `json:"IssueCR"` Notes string `json:"Notes"` RequiredApproverSets []ApproverSetExportShort `json:"RequiredApproverSets"` InformedApproverSets []ApproverSetExportShort `json:"InformedApproverSets"` CreatedAt time.Time `json:"CreatedAt"` CreatedBy string `json:"CreatedBy"` // contains filtered or unexported fields }
ApproverSetRevisionExport is an object that is used to export the current version of an Approver Set Revision.
func (*ApproverSetRevisionExport) AddVerifiedApprover ¶
func (asre *ApproverSetRevisionExport) AddVerifiedApprover(app ApproverExportFull) error
AddVerifiedApprover appends the passed approver to the list of verified approvers for the approver set revision.
func (ApproverSetRevisionExport) Compare ¶
func (asre ApproverSetRevisionExport) Compare(asr ApproverSetRevision) (pass bool, errs []error)
Compare is used to compare an export version of an object to the full revision to verify that all of the values are the same.
func (ApproverSetRevisionExport) CompareExport ¶
func (asre ApproverSetRevisionExport) CompareExport(asr ApproverSetRevisionExport) (pass bool, errs []error)
CompareExport is used to compare an export version of an object to another export revision to verify that all of the values are the same.
func (ApproverSetRevisionExport) DecryptionKeys ¶
func (asre ApproverSetRevisionExport) DecryptionKeys() (keys []openpgp.Key)
DecryptionKeys returns all private keys that are valid for decryption. No private keys are stored by the system so it is always a noop. This method is part of the interface for []openpgp.Entities.
func (ApproverSetRevisionExport) GetDiff ¶
func (asre ApproverSetRevisionExport) GetDiff() (string, error)
GetDiff will return an empty string and an error for a revision. A Diff is not available for revision objects.
func (*ApproverSetRevisionExport) HasVerifiedApprovers ¶
func (asre *ApproverSetRevisionExport) HasVerifiedApprovers() bool
HasVerifiedApprovers returns true iff there are any verified approvers for the approver set revision.
func (ApproverSetRevisionExport) IsSignedBy ¶
func (asre ApproverSetRevisionExport) IsSignedBy(sig []byte) (valid bool, signedBody []byte)
IsSignedBy will return true if the object is signed by one of the members of the TrustAnchors list.
func (ApproverSetRevisionExport) KeysById ¶
func (asre ApproverSetRevisionExport) KeysById(entityID uint64) (keys []openpgp.Key)
KeysById returns the set of keys that have the given key id. This method is part of the interface for []openpgp.Entities.
func (ApproverSetRevisionExport) KeysByIdUsage ¶
func (asre ApproverSetRevisionExport) KeysByIdUsage(id uint64, requiredUsage byte) (keys []openpgp.Key)
KeysByIdUsage returns the set of keys with the given id that also meet the key usage given by requiredUsage. The requiredUsage is expressed as the bitwise-OR of packet.KeyFlag* values. This method is part of the interface for []openpgp.Entities.
func (ApproverSetRevisionExport) ToJSON ¶
func (asre ApproverSetRevisionExport) ToJSON() (string, error)
ToJSON will return a string containing a JSON representation of the object. An empty string and an error are returned if a JSON representation cannot be returned.
type ApproverSetRevisionPage ¶
type ApproverSetRevisionPage struct { IsEditable bool IsNew bool Revision ApproverSetRevision PendingActions map[string]string ValidApprovers map[int64]string ValidApproverSets map[int64]string ParentApproverSet *ApproverSet SuggestedRequiredApprovers map[int64]ApproverSetDisplayObject SuggestedInformedApprovers map[int64]ApproverSetDisplayObject SuggestedApprovers map[int64]string CSRFToken string }
ApproverSetRevisionPage are used to hold all the information required to render the ApproverSetRevision HTML template.
func (*ApproverSetRevisionPage) GetCSRFToken ¶
func (a *ApproverSetRevisionPage) GetCSRFToken() string
GetCSRFToken retrieves the CSRF token from an the Page Object.
func (*ApproverSetRevisionPage) SetCSRFToken ¶
func (a *ApproverSetRevisionPage) SetCSRFToken(newToken string)
SetCSRFToken is used to set the CSRFToken for the Page Object.
type ApproverSetRevisionsPage ¶
type ApproverSetRevisionsPage struct { ApproverSetRevisions []ApproverSetRevision CSRFToken string }
The ApproverSetRevisionsPage type is used to render the html template which lists all of the AppproverSetRevisions currently in the registrar system
TODO: Add paging support.
func (*ApproverSetRevisionsPage) GetCSRFToken ¶
func (a *ApproverSetRevisionsPage) GetCSRFToken() string
GetCSRFToken retrieves the CSRF token from an the Page Object.
func (*ApproverSetRevisionsPage) SetCSRFToken ¶
func (a *ApproverSetRevisionsPage) SetCSRFToken(newToken string)
SetCSRFToken is used to set the CSRFToken for the Page Object.
type ApproverSetsPage ¶
type ApproverSetsPage struct { ApproverSets []ApproverSet CSRFToken string }
ApproverSetsPage is used to render the html template which lists all of the Approvers currently in the registrar system.
TODO: Add paging support. TODO: Add filtering support.
func (*ApproverSetsPage) GetCSRFToken ¶
func (a *ApproverSetsPage) GetCSRFToken() string
GetCSRFToken retrieves the CSRF token from an the Page Object.
func (*ApproverSetsPage) SetCSRFToken ¶
func (a *ApproverSetsPage) SetCSRFToken(newToken string)
SetCSRFToken is used to set the CSRFToken for the Page Object.
type ApproversPage ¶
ApproversPage is used to render the html template which lists all of the Approvers currently in the registrar system.
TODO: Add paging support. TODO: Add filtering support.
func (*ApproversPage) GetCSRFToken ¶
func (a *ApproversPage) GetCSRFToken() string
GetCSRFToken retrieves the CSRF token from an the Page Object.
func (*ApproversPage) SetCSRFToken ¶
func (a *ApproversPage) SetCSRFToken(newToken string)
SetCSRFToken is used to set the CSRFToken for the Page Object.
type AuthType ¶
type AuthType string
AuthType is a type that is used to describe the authentication type that was used for the request that has triggered the action.
const CertAuthType AuthType = "cert_user_auth"
CertAuthType indicates that the authentication type was a client certificate.
const RemoteUserAuthType AuthType = "remote_user_auth"
RemoteUserAuthType indicates that the authentication type was a remote user header.
type ChangeRequest ¶
type ChangeRequest struct { Model RegistrarObjectType string `json:"RegistrarObjectType"` RegistrarObjectID int64 `json:"RegistrarObjectID"` State string `json:"State"` Object RegistrarApprovalable `json:"Object" sql:"-"` InitialRevisionID sql.NullInt64 `json:"InitialRevisionID"` ProposedRevisionID int64 `json:"ProposedRevisionID"` ChangeJSON string `json:"ChangeJSON" sql:"type:text;"` ChangeDiff string `json:"ChangeDiff" sql:"type:text;"` Approvals []Approval `json:"Approvals"` CreatedAt time.Time `json:"CreatedAt"` CreatedBy string `json:"CreatedBy"` UpdatedAt time.Time `json:"UpdatedAt"` UpdatedBy string `json:"UpdatedBy"` }
ChangeRequest is an object that represents a desired change in an object. It contains a link back to the originating object, revisions and Approvals that are required for the change request to be approved.
func (*ChangeRequest) GetAllPage ¶
func (c *ChangeRequest) GetAllPage(dbCache *DBCache, _ string, _ string) (rop RegistrarObjectPage, err error)
GetAllPage will return an object that can be used to render a view Containing multiple Change Requests.
TODO: Add paging support TODO: Add filtering.
func (*ChangeRequest) GetExportVersion ¶
func (c *ChangeRequest) GetExportVersion() RegistrarObjectExport
GetExportVersion returns a export version of the ChangeRequest Object.
func (*ChangeRequest) GetExportVersionAt ¶
func (c *ChangeRequest) GetExportVersionAt(_ *DBCache, _ int64) (obj RegistrarObjectExport, err error)
GetExportVersionAt returns an export version of the Changer Request Object at the timestamp provided if possible otherwise an error is returned. If a pending version existed at the time it will be excluded from the object. TODO: Implement.
func (*ChangeRequest) GetPage ¶
func (c *ChangeRequest) GetPage(_ *DBCache, _ string, _ string) (rop RegistrarObjectPage, err error)
GetPage will return an object that can be used to render the HTML template for the Change Request.
func (*ChangeRequest) GetType ¶
func (c *ChangeRequest) GetType() string
GetType will return the object type string as defined in the RegistrarObject definition.
func (*ChangeRequest) IsCancelled ¶
func (c *ChangeRequest) IsCancelled() bool
IsCancelled returns true iff the object has been canclled.
func (*ChangeRequest) IsEditable ¶
func (c *ChangeRequest) IsEditable() bool
IsEditable returns true iff the object is editable.
func (*ChangeRequest) ParseFromForm ¶
func (c *ChangeRequest) ParseFromForm(_ *http.Request, _ *DBCache) error
ParseFromForm returns an error. Change Requests may not be added using a web form.
func (*ChangeRequest) ParseFromFormUpdate ¶
ParseFromFormUpdate returns an error. Change Requests may not be updated using a web form.
func (*ChangeRequest) Prepare ¶
func (c *ChangeRequest) Prepare(dbCache *DBCache) (err error)
Prepare populate all of the fields for a given object as well as the linked objects.
TODO: Consider moving the db query into the dbcache object.
func (*ChangeRequest) ReadyForFinalApproval ¶
func (c *ChangeRequest) ReadyForFinalApproval() bool
ReadyForFinalApproval determines if the change request has all of the required approvals other than the final approval.
func (*ChangeRequest) TakeAction ¶
func (c *ChangeRequest) TakeAction(response http.ResponseWriter, _ *http.Request, _ *DBCache, actionName string, _ bool, authMethod AuthType, _ Config) (errs []error)
TakeAction processes actions that are to be taken on the object and either display a resulting page, trigger a download or redirect to another page if necessary
TODO: Implement.
func (*ChangeRequest) UpdateApprovals ¶
func (c *ChangeRequest) UpdateApprovals(dbCache *DBCache, conf Config) (errs []error)
UpdateApprovals will cycle through all of the change request approvals to make sure that they are in the correct state.
func (*ChangeRequest) UpdateState ¶
func (c *ChangeRequest) UpdateState(dbCache *DBCache, conf Config) (changesMade bool, errs []error)
UpdateState can be called at any point to check the state of the Change Request and update it if necessary
TODO: Implement.
type ChangeRequestExport ¶
type ChangeRequestExport struct { ID int64 `json:"ID"` State string `json:"State"` RegistrarObjectType string `json:"RegistrarObjectType"` RegistrarObjectID int64 `json:"RegistrarObjectID"` InitialRevisionID int64 `json:"InitialRevisionID"` ProposedRevisionID int64 `json:"ProposedRevisionID"` ChangeJSON string `json:"ChangeJSON"` ChangeDiff string `json:"ChangeDiff"` Approvals []ApprovalExport `json:"Approvals"` CreatedAt time.Time `json:"CreatedAt"` CreatedBy string `json:"CreatedBy"` }
ChangeRequestExport is an object that is used to export the current state of a ChangeRequest object.
func (ChangeRequestExport) GetDiff ¶
func (cre ChangeRequestExport) GetDiff() (string, error)
GetDiff will return an empty string and an error for a revision. A Diff is not available for revision objects.
func (ChangeRequestExport) ToJSON ¶
func (cre ChangeRequestExport) ToJSON() (string, error)
ToJSON will return a string containing a JSON representation of the object. An empty string and an error are returned if a JSON representation cannot be returned.
type ChangeRequestPage ¶
type ChangeRequestPage struct { CR ChangeRequest PendingActions map[string]string CSRFToken string }
ChangeRequestPage is used to hold all the information required to render the Change Reuqest HTML template.
func (*ChangeRequestPage) GetCSRFToken ¶
func (c *ChangeRequestPage) GetCSRFToken() string
GetCSRFToken retrieves the CSRF token from an the Page Object.
func (*ChangeRequestPage) SetCSRFToken ¶
func (c *ChangeRequestPage) SetCSRFToken(newToken string)
SetCSRFToken is used to set the CSRFToken for the Page Object.
func (ChangeRequestPage) SplitJSON ¶
func (c ChangeRequestPage) SplitJSON(json string) []string
SplitJSON is a helper function used by the ChangeRequest template to make a JSON object more readable when being displayed.
type ChangeRequestsPage ¶
type ChangeRequestsPage struct { CRs []ChangeRequest CSRFToken string }
ChangeRequestsPage is used to render the html template which lists all of the Change Requests currently in the registrar system
TODO: Add paging support TODO: Add filtering support.
func (*ChangeRequestsPage) GetCSRFToken ¶
func (c *ChangeRequestsPage) GetCSRFToken() string
GetCSRFToken retrieves the CSRF token from an the Page Object.
func (*ChangeRequestsPage) SetCSRFToken ¶
func (c *ChangeRequestsPage) SetCSRFToken(newToken string)
SetCSRFToken is used to set the CSRFToken for the Page Object.
type CompareLoadFn ¶
type CompareLoadFn func(RegistrarObjectExport)
CompareLoadFn is a callback function type that loads values into the provided RegistrarObjectExport.
type CompareReturnFn ¶
CompareReturnFn is callback function returned by ComparePendingToCallback. It represents a deferred comparison.
type Config ¶
type Config struct { Server struct { Port int64 TemplatePath string BasePath string AppURL string CertHeader string DefaultUserDomain string } Database struct { Type string Host string Port string User string Password string Database string Path string CertPath string `gcfg:"certpath"` KeyPath string `gcfg:"keypath"` ChainPath string `gcfg:"chainpath"` CertAuth bool MaxRTT float64 } Logging struct { File string `gcfg:"logFile"` DatabaseDebugging bool LogLevelRaw string `gcfg:"logLevel"` LogLevel logging.Level `gcfg:"logLevelParsed"` } Email struct { Server string FromEmail string FromName string Announce string CC string Enabled bool } Bootstrap struct { Name string Username string EmployeeID int64 EmailAddress string Role string Department string DefaultSetTitle string DefaultSetDescription string Fingerprint string Pubkeyfile string PubkeyContents []byte `gcfg:""` } CSRF struct { ValidityTime int64 ValidityDuration time.Duration `gcfg:""` MACKey string } Registrar struct { ID string } }
A Config object holds the runtime configuration parameters set in the configuration file which is read at startup. Common configuration settings like database connection information is required and bootstraping settings may also be included.
func GetConfig ¶
func GetConfig() Config
GetConfig returns the instance of Config thats has been created if an instance has been created. If Config.IsLoaded is not set it was not read to be used. TODO: try and see if there is a way to use this pattern http://marcio.io/2015/07/singleton-pattern-in-go/
func LoadConfig ¶
LoadConfig will attempt to load the configuration at the path provided and will return the parsed config or an error.
func (Config) GetHMACKey ¶
GetHMACKey returns the key that is used for.
func (Config) GetValidityPeriod ¶
GetValidityPeriod returns the period for which CSRF tokens will be valid for.
func (*Config) LoadConfig ¶
LoadConfig will open the file (arg1) parse the required fields before starting the application.
func (Config) SendAllEmail ¶
SendAllEmail will iterate through all of the users in the to field and will separate the users into lists of users for each domain and then send one email for each set of domain users using the domain lookup for the MX of the domains.
type Contact ¶
type Contact struct { Model State string ContactRegistryID string `sql:"size:32"` ContactROID string `sql:"size:32"` ContactStatus string ClientDeleteProhibitedStatus bool ServerDeleteProhibitedStatus bool ClientTransferProhibitedStatus bool ServerTransferProhibitedStatus bool ClientUpdateProhibitedStatus bool ServerUpdateProhibitedStatus bool LinkedStatus bool OKStatus bool PendingCreateStatus bool PendingDeleteStatus bool PendingTransferStatus bool PendingUpdateStatus bool Name string `sql:"size:128"` Org string `sql:"size:128"` Description string `sql:"size:2048"` AddressStreet1 string `sql:"size:128"` AddressStreet2 string `sql:"size:128"` AddressStreet3 string `sql:"size:128"` AddressCity string `sql:"size:64"` AddressState string `sql:"size:32"` AddressPostalCode string `sql:"size:32"` AddressCountry string `sql:"size:3"` VoicePhoneNumber string `sql:"size:32"` VoicePhoneExtension string `sql:"size:32"` FaxPhoneNumber string `sql:"size:32"` FaxPhoneExtension string `sql:"size:32"` EmailAddress string `sql:"size:128"` PreviewName string `sql:"size:2048"` PreviewAddress string `sql:"size:2048"` PreviewPhone string `sql:"size:2048"` PreviewEmail string `sql:"size:2048"` SponsoringClientID string `sql:"size:32"` CreateClientID string `sql:"size:32"` CreateDate time.Time UpdateClientID string `sql:"size:32"` UpdateDate time.Time TransferDate time.Time HoldActive bool HoldBy string HoldAt time.Time HoldReason string CurrentRevision ContactRevision CurrentRevisionID sql.NullInt64 Revisions []ContactRevision PendingRevision ContactRevision `sql:"-"` DisplayName string `sql:"-"` EPPStatus string EPPLastUpdate time.Time DNSStatus string DNSLastUpdate time.Time CreatedAt time.Time `json:"CreatedAt"` CreatedBy string `json:"CreatedBy"` UpdatedAt time.Time `json:"UpdatedAt"` UpdatedBy string `json:"UpdatedBy"` CheckRequired bool }
Contact is an object that represents the state of a registrar contact object as defined by RFC 5733 http://tools.ietf.org/html/rfc5733
func (*Contact) ComparePendingToCallback ¶
func (c *Contact) ComparePendingToCallback(loadFn CompareLoadFn) (retFn CompareReturnFn)
ComparePendingToCallback will return a function that will compare the current revision object to itself after changes have been made.
func (*Contact) GetAllPage ¶
func (c *Contact) GetAllPage(dbCache *DBCache, _ string, _ string) (rop RegistrarObjectPage, err error)
GetAllPage will return an object that can be used to render a view Containing multiple contacts.
TODO: Add paging support TODO: Add filtering.
func (*Contact) GetCurrentExtension ¶
GetCurrentExtension is used to get the extension of the number in the current revision. If an extension exists, an "x " is prepended to the string to denote an extension.
func (*Contact) GetCurrentRevisionID ¶
GetCurrentRevisionID will return the id of the current Contact Revision for the contact object.
func (*Contact) GetCurrentValue ¶
GetCurrentValue is used to get the current value of a field in a revision if a current revision exists, otherwise an empty string is returned.
func (*Contact) GetDisplayName ¶
GetDisplayName will return a name for the Contact that can be used to display a shortened version of the invormation to users.
func (*Contact) GetExportVersion ¶
func (c *Contact) GetExportVersion() RegistrarObjectExport
GetExportVersion returns a export version of the Contact Object.
func (*Contact) GetExportVersionAt ¶
func (c *Contact) GetExportVersionAt(dbCache *DBCache, timestamp int64) (obj RegistrarObjectExport, err error)
GetExportVersionAt returns an export version of the Contact Object at the timestamp provided if possible otherwise an error is returned. If a pending version existed at the time it will be excluded from the object.
func (*Contact) GetExportVersionShort ¶
func (c *Contact) GetExportVersionShort() ContactExportShort
GetExportVersionShort returns a short export version of the Contact Object.
func (*Contact) GetInformedApproverSets ¶
func (c *Contact) GetInformedApproverSets(dbCache *DBCache) (as []ApproverSet, err error)
GetInformedApproverSets returns the list of approver sets that are informed for the Contact (if a valid approver revision exists). If no approver revisions are found, an empty list will be returned.
func (*Contact) GetPage ¶
func (c *Contact) GetPage(dbCache *DBCache, username string, email string) (rop RegistrarObjectPage, err error)
GetPage will return an object that can be used to render the HTML template for the Contact.
func (*Contact) GetPendingCRID ¶
GetPendingCRID will return the current CR id if it is set, otherwise a nil will be returned (in the form of a sql.NullInt64).
func (*Contact) GetPendingRevision ¶
func (c *Contact) GetPendingRevision() RegistrarObject
GetPendingRevision implements the RegistrarParent interface and returns the pending revision pointer.
func (*Contact) GetPendingRevisionID ¶
GetPendingRevisionID will return the current pending revision for the Contact object if it exists. If no pending revision exists a 0 is returned.
func (*Contact) GetRegistryExtension ¶
GetRegistryExtension is used to get the extension of the number that is present at the registry. If an extension exists, an "x " is prepended to the string to denote an extension.
func (*Contact) GetRequiredApproverSets ¶
func (c *Contact) GetRequiredApproverSets(dbCache *DBCache) (approvers []ApproverSet, err error)
GetRequiredApproverSets returns the list of approver sets that are required for the Contact (if a valid approver revision exists). If no approver revisions are found, a default of the infosec approver set will be returned.
func (Contact) GetType ¶
GetType will return the object type string as defined in the RegistrarObject definition.
func (Contact) HasPendingRevision ¶
HasPendingRevision returns true iff a pending revision exists for the Contact, otherwise false.
func (Contact) HasRevision ¶
HasRevision returns true iff a current revision exists, otherwise false
TODO: add a check to verify that the current revision has an approved change request.
func (*Contact) IsCancelled ¶
IsCancelled returns true iff the object has been canclled.
func (*Contact) IsEditable ¶
IsEditable returns true iff the object is editable.
func (*Contact) LoadEPPInfo ¶
LoadEPPInfo accepts an EPP response and attempts to marshall the data from the response into the object that was called.
func (*Contact) ParseFromForm ¶
ParseFromForm takes a http Request and parses the field values and populates the acceptable values into the new object. An error is returned if there is difficulty parsing any of the fileds.
func (*Contact) ParseFromFormUpdate ¶
ParseFromFormUpdate takes a http Request and parses the form values and returns a sparse Contact object with the changes that were made. An error object is always the second return value which is nil when no errors have occurred during parsing otherwise an error is returned.
func (*Contact) Prepare ¶
Prepare populate all of the fields for a given object as well as the linked objects.
func (*Contact) PrepareDisplayShallow ¶
PrepareDisplayShallow populate all of the fields for a given object and the current revision but not any of the other linked object.
func (*Contact) PrepareShallow ¶
PrepareShallow populate all of the fields for a given object and not any of the linked object.
func (*Contact) SetRegistryID ¶
SetRegistryID is used to try and set the RegistryID of the contact object if it has not already been set. An error is returned if the contact's RegistryID has been set already.
func (Contact) SuggestedRevisionBool ¶
SuggestedRevisionBool takes a string naming the flag that is being requested and returnes a bool containing the suggested value for the field in the new revision
TODO: add other fields that have been added.
func (Contact) SuggestedRevisionValue ¶
SuggestedRevisionValue takes a string naming the field that is being requested and returns a string containing the suggested value for the field in a new pending revision
TODO: add other fields that have been added.
func (*Contact) TakeAction ¶
func (c *Contact) TakeAction(response http.ResponseWriter, request *http.Request, dbCache *DBCache, actionName string, _ bool, authMethod AuthType, _ Config) (errs []error)
TakeAction processes actions that are to be taken on the object and either display a resulting page, trigger a download or redirect to another page if necessary.
func (*Contact) UpdateHoldStatus ¶
UpdateHoldStatus is used to adjust the object's Hold status after the user has been verified as an admin. An error will be returned if the hold reason is not set.
func (*Contact) UpdateState ¶
UpdateState can be called at any point to check the state of the Contact and update it if necessary
TODO: Implement TODO: Make sure callers check errors.
type ContactExport ¶
type ContactExport struct { ID int64 `json:"ID"` State string `json:"State"` ContactRegistryID string `json:"ContactRegistryID"` ContactROID string `json:"ContactROID"` CurrentRevision ContactRevisionExport `json:"CurrentRevision"` PendingRevision ContactRevisionExport `json:"PendingRevision"` CreatedAt time.Time `json:"CreatedAt"` CreatedBy string `json:"CreatedBy"` UpdatedAt time.Time `json:"UpdatedAt"` UpdatedBy string `json:"UpdatedBy"` HoldActive bool `json:"HoldActive"` HoldBy string `json:"HoldBy"` HoldAt time.Time `json:"HoldAt"` HoldReason string `json:"HoldReason"` }
ContactExport is an object that is used to export the current state of a contact object. The full version of the export object also contains the current and pending revision (if either exist).
func (ContactExport) GetDiff ¶
func (c ContactExport) GetDiff() (string, error)
GetDiff will return a string containing a formatted diff of the current and pending revisions for the Contact object. An empty string and an error are returned if an error occures during the processing
TODO: Handle diff for objects that do not have a pending revision TODO: Handle diff for objects that do not have a current revision.
func (ContactExport) GetRegistryID ¶
func (c ContactExport) GetRegistryID(iteration int64) string
GetRegistryID will return what the current registry ID for the contact is if it is set or if the iteration is 0, it will return the first choice of regitry id of the string GOREG- followed by the contact ID or in subsequent calls the iteration number will be appended to the end of the first option.
func (ContactExport) ToJSON ¶
func (c ContactExport) ToJSON() (string, error)
ToJSON will return a string containing a JSON representation of the object. An empty string and an error are returned if a JSON representation cannot be returned.
type ContactExportShort ¶
type ContactExportShort struct { ID int64 `json:"ID"` State string `json:"State"` Name string `json:"Name"` ContactRegistryID string `json:"ContactRegistryID"` ContactROID string `json:"ContactROID"` CreatedAt time.Time `json:"CreatedAt"` CreatedBy string `json:"CreatedBy"` HoldActive bool `json:"HoldActive"` HoldBy string `json:"HoldBy"` HoldAt time.Time `json:"HoldAt"` HoldReason string `json:"HoldReason"` }
ContactExportShort is an object that is used to expor the current snapshot of an Contact object. The short version of the export object does not contain any information about the current or pending revisions.
type ContactPage ¶
type ContactPage struct { Editable bool IsNew bool Con Contact CurrentRevisionPage *ContactRevisionPage PendingRevisionPage *ContactRevisionPage PendingActions map[string]string ValidApproverSets map[int64]string CSRFToken string }
ContactPage is used to hold all the information required to render the Contact HTML page.
func (*ContactPage) GetCSRFToken ¶
func (c *ContactPage) GetCSRFToken() string
GetCSRFToken retrieves the CSRF token from an the Page Object.
func (*ContactPage) SetCSRFToken ¶
func (c *ContactPage) SetCSRFToken(newToken string)
SetCSRFToken is used to set the CSRFToken for the Page Object.
type ContactRevision ¶
type ContactRevision struct { Model ContactID int64 RevisionState string DesiredState string ContactStatus string ClientDeleteProhibitedStatus bool ServerDeleteProhibitedStatus bool ClientTransferProhibitedStatus bool ServerTransferProhibitedStatus bool ClientUpdateProhibitedStatus bool ServerUpdateProhibitedStatus bool Name string `sql:"size:128"` Org string `sql:"size:128"` AddressStreet1 string `sql:"size:128"` AddressStreet2 string `sql:"size:128"` AddressStreet3 string `sql:"size:128"` AddressCity string `sql:"size:64"` AddressState string `sql:"size:32"` AddressPostalCode string `sql:"size:32"` AddressCountry string `sql:"size:3"` VoicePhoneNumber string `sql:"size:32"` VoicePhoneExtension string `sql:"size:32"` FaxPhoneNumber string `sql:"size:32"` FaxPhoneExtension string `sql:"size:32"` EmailAddress string `sql:"size:128"` SavedNotes string `sql:"size:16384"` RequiredApproverSets []ApproverSet `gorm:"many2many:required_approverset_to_contactrevision"` InformedApproverSets []ApproverSet `gorm:"many2many:informed_approverset_to_contactrevision"` CR ChangeRequest CRID sql.NullInt64 IssueCR string `sql:"size:256"` Notes string `sql:"size:2048"` CreatedAt time.Time `json:"CreatedAt"` CreatedBy string `json:"CreatedBy"` UpdatedAt time.Time `json:"UpdatedAt"` UpdatedBy string `json:"UpdatedBy"` ApprovalStartTime *time.Time ApprovalStartBy string PromotedTime *time.Time SupersededTime *time.Time ApprovalFailedTime *time.Time }
ContactRevision represents individual versions of a Contact Object.
func (*ContactRevision) Cancel ¶
func (c *ContactRevision) Cancel(dbCache *DBCache, conf Config) (errs []error)
Cancel will change the State of a revision from either "new" or "pendingapproval" to "cancelled"
TODO: If in pending approval, cancel the change request and all approval objects TODO: Consider moving the db query into the dbcache object.
func (*ContactRevision) Decline ¶
func (c *ContactRevision) Decline(dbCache *DBCache) (err error)
Decline will mark an ContactRevision as decline for an Contact.
func (*ContactRevision) EscrowAddress ¶
func (c *ContactRevision) EscrowAddress() string
EscrowAddress is used to format the mailing address into a single line that can be used for the RDE escrow.
func (*ContactRevision) FaxNumber ¶
func (c *ContactRevision) FaxNumber() string
FaxNumber will return the fax number and extension in one string.
func (*ContactRevision) FullAddress ¶
func (c *ContactRevision) FullAddress() string
FullAddress generates a string of the full address and returns it.
func (*ContactRevision) GetActions ¶
func (c *ContactRevision) GetActions(isSelf bool) map[string]string
GetActions will return a list of possible actions that can be taken while in the current state
TODO: handle all states.
func (*ContactRevision) GetAllPage ¶
func (c *ContactRevision) GetAllPage(dbCache *DBCache, _ string, _ string) (rop RegistrarObjectPage, err error)
GetAllPage will return an object that can be used to render a view Containing multiple Contact Revisions.
TODO: Add paging support TODO: Add filtering.
func (*ContactRevision) GetExportVersion ¶
func (c *ContactRevision) GetExportVersion() RegistrarObjectExport
GetExportVersion returns a export version of the ContactRevision Object.
func (*ContactRevision) GetExportVersionAt ¶
func (c *ContactRevision) GetExportVersionAt(_ *DBCache, _ int64) (obj RegistrarObjectExport, err error)
GetExportVersionAt returns an export version of the Contact Revision Object at the timestamp provided if possible otherwise an error is returned. If a pending version existed at the time it will be excluded from the object.
func (*ContactRevision) GetInformedApproverSets ¶
func (c *ContactRevision) GetInformedApproverSets(dbCache *DBCache) (approverSets []ApproverSet, err error)
GetInformedApproverSets prepares object and returns the ApproverSets.
func (*ContactRevision) GetPage ¶
func (c *ContactRevision) GetPage(dbCache *DBCache, _ string, _ string) (rop RegistrarObjectPage, err error)
GetPage will return an object that can be used to render the HTML template for the ContactRevision.
func (*ContactRevision) GetPreviewAddress ¶
func (c *ContactRevision) GetPreviewAddress() string
GetPreviewAddress will generate and return the preview address text for the associated with this contact revision.
func (*ContactRevision) GetPreviewEmail ¶
func (c *ContactRevision) GetPreviewEmail() string
GetPreviewEmail will generate and return the preview email address text for the associated with this contact revision.
func (*ContactRevision) GetPreviewName ¶
func (c *ContactRevision) GetPreviewName() string
GetPreviewName will generate and return the preview name text for the associated with this contact revision.
func (*ContactRevision) GetPreviewPhone ¶
func (c *ContactRevision) GetPreviewPhone() string
GetPreviewPhone will generate and return the preview phone number text for the associated with this contact revision.
func (*ContactRevision) GetRequiredApproverSets ¶
func (c *ContactRevision) GetRequiredApproverSets(dbCache *DBCache) (approverSets []ApproverSet, err error)
GetRequiredApproverSets prepares object and returns the ApproverSets.
func (*ContactRevision) GetType ¶
func (c *ContactRevision) GetType() string
GetType will return the object type string as defined in the RegistrarObject definition.
func (ContactRevision) HasHappened ¶
func (c ContactRevision) HasHappened(actionType string) bool
HasHappened is a helper function that will return true if the value of the timestamp who's name is passes has happened after the revision was created. This function is intended to be used with templates.
func (*ContactRevision) IsActive ¶
func (c *ContactRevision) IsActive() bool
IsActive returns true if RevisionState is StateActive or StateBootstrap.
func (*ContactRevision) IsCancelled ¶
func (c *ContactRevision) IsCancelled() bool
IsCancelled returns true iff the object has been canclled.
func (ContactRevision) IsDesiredState ¶
func (c ContactRevision) IsDesiredState(state string) bool
IsDesiredState will return true iff the state passed in matches the desired state of the revision.
func (*ContactRevision) IsEditable ¶
func (c *ContactRevision) IsEditable() bool
IsEditable returns true iff the object is editable.
func (*ContactRevision) NewContactEmail ¶
func (c *ContactRevision) NewContactEmail(contactName string, conf Config) error
NewContactEmail will generate and send an email upon the creation of a new contact TODO: make this email a template with the registrar name a variable.
func (*ContactRevision) ParseFromForm ¶
func (c *ContactRevision) ParseFromForm(request *http.Request, dbCache *DBCache) error
ParseFromForm takes a http Request and parses the field values and populates the acceptable values into the new object. An error is returned if there is difficulty parsing any of the fileds.
TODO: add status flags TODO: Handle domain current status (new, transfer in).
func (*ContactRevision) ParseFromFormUpdate ¶
func (c *ContactRevision) ParseFromFormUpdate(request *http.Request, dbCache *DBCache, _ Config) error
ParseFromFormUpdate takes a http Request and parses the form values and returns a sparse ContactRevision object with the changes that were made. An error object is always the second return value which is nil when no errors have occurred during parsing otherwise an error is returned.
TODO: verify public key TODO: verify fingerprint.
func (*ContactRevision) Prepare ¶
func (c *ContactRevision) Prepare(dbCache *DBCache) (err error)
Prepare populate all of the fields for a given object as well as the linked objects.
TODO: Consider moving the db query into the dbcache object.
func (*ContactRevision) PrepareShallow ¶
func (c *ContactRevision) PrepareShallow(dbCache *DBCache) error
PrepareShallow populate all of the fields for a given object and not any of the linked object.
func (*ContactRevision) Promote ¶
func (c *ContactRevision) Promote(ddbCache *DBCache) (err error)
Promote will mark an ContactRevision as the current revision for an Contact if it has not been cancelled or failed approval.
func (*ContactRevision) StartApprovalProcess ¶
func (c *ContactRevision) StartApprovalProcess(request *http.Request, dbCache *DBCache, conf Config) (err error)
StartApprovalProcess creates a change request to start the process of approvnig a new Change Request. If the Change Request was created no error is returned, otherwise an error will be returned.
TODO: Check if a CR already exists for this object TODO: Ensure that if an error occures no changes are made.
func (*ContactRevision) Supersed ¶
func (c *ContactRevision) Supersed(dbCache *DBCache) (err error)
Supersed will mark an ContactRevision as a superseded revision for an Contact.
func (*ContactRevision) TakeAction ¶
func (c *ContactRevision) TakeAction(response http.ResponseWriter, request *http.Request, dbCache *DBCache, actionName string, validCSRF bool, authMethod AuthType, conf Config) (errs []error)
TakeAction processes actions that are to be taken on the object and either display a resulting page, trigger a download or redirect to another page if necessary.
func (*ContactRevision) VoiceNumber ¶
func (c *ContactRevision) VoiceNumber() string
VoiceNumber will return the phone number and extension in one string.
type ContactRevisionExport ¶
type ContactRevisionExport struct { ID int64 `json:"ID"` ContactID int64 `json:"ContactID"` RevisionState string `json:"RevisionState"` DesiredState string `json:"DesiredState"` ClientDeleteProhibitedStatus bool `json:"ClientDeleteProhibitedStatus"` ServerDeleteProhibitedStatus bool `json:"ServerDeleteProhibitedStatus"` ClientTransferProhibitedStatus bool `json:"ClientTransferProhibitedStatus"` ServerTransferProhibitedStatus bool `json:"ServerTransferProhibitedStatus"` ClientUpdateProhibitedStatus bool `json:"ClientUpdateProhibitedStatus"` ServerUpdateProhibitedStatus bool `json:"ServerUpdateProhibitedStatus"` Name string `json:"Name"` Org string `json:"Org"` AddressStreet1 string `json:"AddressStreet1"` AddressStreet2 string `json:"AddressStreet2"` AddressStreet3 string `json:"AddressStreet3"` AddressCity string `json:"AddressCity"` AddressState string `json:"AddressState"` AddressPostalCode string `json:"AddressPostalCode"` AddressCountry string `json:"AddressCountry"` VoicePhoneNumber string `json:"VoicePhoneNumber"` VoicePhoneExtension string `json:"VoicePhoneExtension"` FaxPhoneNumber string `json:"FaxPhoneNumber"` FaxPhoneExtension string `json:"FaxPhoneExtension"` EmailAddress string `json:"EmailAddress"` SavedNotes string `json:"SaveNotes"` ChangeRequestID int64 `json:"ChangeRequestID"` IssueCR string `json:"IssuerCR"` Notes string `json:"Notes"` RequiredApproverSets []ApproverSetExportShort `json:"RequiredApproverSets"` InformedApproverSets []ApproverSetExportShort `json:"InformedApproverSets"` CreatedAt time.Time `json:"CreatedAt"` CreatedBy string `json:"CreatedBy"` }
ContactRevisionExport is an object that is used to export the current version of a Contact Revision.
func (ContactRevisionExport) Compare ¶
func (cre ContactRevisionExport) Compare(contactRevision ContactRevision) (pass bool, errs []error)
Compare is used to compare an export version of an object to the full revision to verify that all of the values are the same.
func (ContactRevisionExport) CompareExport ¶
func (cre ContactRevisionExport) CompareExport(contactRevision ContactRevisionExport) (pass bool, errs []error)
CompareExport is used to compare an export version of an object to another export revision to verify that all of the values are the same.
func (ContactRevisionExport) EscrowAddress ¶
func (cre ContactRevisionExport) EscrowAddress() string
EscrowAddress is used to format the mailing address into a single line that can be used for the RDE escrow.
func (ContactRevisionExport) FaxNumber ¶
func (cre ContactRevisionExport) FaxNumber() string
FaxNumber will return the fax number and extension in one string.
func (ContactRevisionExport) GetDiff ¶
func (cre ContactRevisionExport) GetDiff() (string, error)
GetDiff will return an empty string and an error for a revision. A Diff is not available for revision objects.
func (ContactRevisionExport) ToJSON ¶
func (cre ContactRevisionExport) ToJSON() (string, error)
ToJSON will return a string containing a JSON representation of the object. An empty string and an error are returned if a JSON representation cannot be returned.
func (ContactRevisionExport) VoiceNumber ¶
func (cre ContactRevisionExport) VoiceNumber() string
VoiceNumber will return the phone number and extension in one string.
type ContactRevisionPage ¶
type ContactRevisionPage struct { IsEditable bool IsNew bool Revision ContactRevision PendingActions map[string]string ValidApproverSets map[int64]string ParentContact *Contact SuggestedRequiredApprovers map[int64]ApproverSetDisplayObject SuggestedInformedApprovers map[int64]ApproverSetDisplayObject CSRFToken string }
ContactRevisionPage are used to hold all the information required to render the ContactRevision HTML template.
func (*ContactRevisionPage) GetCSRFToken ¶
func (c *ContactRevisionPage) GetCSRFToken() string
GetCSRFToken retrieves the CSRF token from an the Page Object.
func (*ContactRevisionPage) SetCSRFToken ¶
func (c *ContactRevisionPage) SetCSRFToken(newToken string)
SetCSRFToken is used to set the CSRFToken for the Page Object.
type ContactRevisionsPage ¶
type ContactRevisionsPage struct { ContactRevisions []ContactRevision CSRFToken string }
The ContactRevisionsPage type is used to render the html template which lists all of the ContactRevisions currently in the registrar system
TODO: Add paging support.
func (*ContactRevisionsPage) GetCSRFToken ¶
func (c *ContactRevisionsPage) GetCSRFToken() string
GetCSRFToken retrieves the CSRF token from an the Page Object.
func (*ContactRevisionsPage) SetCSRFToken ¶
func (c *ContactRevisionsPage) SetCSRFToken(newToken string)
SetCSRFToken is used to set the CSRFToken for the Page Object.
type ContactsPage ¶
ContactsPage is used to hold all the information required to render the Contact HTML page.
func (*ContactsPage) GetCSRFToken ¶
func (c *ContactsPage) GetCSRFToken() string
GetCSRFToken retrieves the CSRF token from an the Page Object.
func (*ContactsPage) SetCSRFToken ¶
func (c *ContactsPage) SetCSRFToken(newToken string)
SetCSRFToken is used to set the CSRFToken for the Page Object.
type DBCache ¶
type DBCache struct { DB *gorm.DB CacheHits int64 CacheMisses int64 Approvers map[int64]*Approver ApproverRevisions map[int64]*ApproverRevision ApproverSets map[int64]*ApproverSet ApproverSetRevisions map[int64]*ApproverSetRevision APIUsers map[int64]*APIUser APIUserRevisions map[int64]*APIUserRevision ChangeRequests map[int64]*ChangeRequest Approvals map[int64]*Approval Domains map[int64]*Domain DomainRevisions map[int64]*DomainRevision Hosts map[int64]*Host HostRevisions map[int64]*HostRevision Contacts map[int64]*Contact ContactRevisions map[int64]*ContactRevision }
DBCache is a write through caching layer for the registrar system to allow objects to be cached on the server side for each request rather than having to contact the database for each request.
func NewDBCache ¶
NewDBCache will create a new DBCache object from the provided db object.
func (*DBCache) AutoMigrate ¶
func (dbc *DBCache) AutoMigrate(value interface{})
AutoMigrate is used to ensure that the data types are available in the selected storage mechanism.
func (*DBCache) Find ¶
Find will attempt to locate the object of the type passed with the id that is set. If the object is valid in cache, it will be returned from cache, otherwise it will be retrieved from the database, stored in the cache and returned.
func (*DBCache) FindByID ¶
FindByID will try and find the object type provided with the given id and return it. If there is an error setting the ID or finding the object, the error will be returned.
func (*DBCache) GetCacheStatsLog ¶
GetCacheStatsLog returns a message that indicates the status of the database cache that can be used in logging.
func (*DBCache) GetNewAndPendingRevisions ¶
func (dbc *DBCache) GetNewAndPendingRevisions(object RegistrarParent) (err error)
GetNewAndPendingRevisions will query for the first revision for the object that is in the new or pending approval state.
func (*DBCache) GetRevisionAtTime ¶
func (dbc *DBCache) GetRevisionAtTime(object RegistrarObject, parentID int64, timestamp int64) (err error)
GetRevisionAtTime will look up the revision at a the time provided with the with the parentID matching. If an error occurs, it will be returned.
func (*DBCache) InvalidateObject ¶
func (dbc *DBCache) InvalidateObject(_ interface{})
InvalidateObject will remove the given object from the cache if it exists.
func (*DBCache) Purge ¶
Purge will ensure that any object with a matching type and ID is purged from the cache.
func (*DBCache) Related ¶
Related will attempt to locate the related objects for a provided target object.
func (*DBCache) Save ¶
Save will attempt to save the provided object at the same time as pushing the object into the cache.
type DBCacheFactory ¶
type DBCacheFactory struct {
// contains filtered or unexported fields
}
DBCacheFactory is used to generate new DBCache objects for requests.
func NewDBCacheFactory ¶
func NewDBCacheFactory(db *gorm.DB) *DBCacheFactory
NewDBCacheFactory will generate and return a new DBCacheFactory using the db objedct passed to initialize the factory.
func (*DBCacheFactory) GetNewDBCache ¶
func (f *DBCacheFactory) GetNewDBCache() *DBCache
GetNewDBCache is used to generate and return a new DBCache object.
type DSDataEntry ¶
type DSDataEntry struct { ID int64 `gorm:"primary_key:yes"` DomainRevisionID int64 KeyTag int64 Algorithm int64 DigestType int64 Digest string `sql:"size:256"` }
DSDataEntry is an object that will hold a single DS Data entry used to indicate how a domain is signed with DNSSEC.
func ParseDSDataEntries ¶
ParseDSDataEntries takes a http Request, a database connection and the html ID of the ds data entry list to parse and will return an array of DSDataEntries that are represented in the http request. If an error occurs parsing any of the DS Data Entry a list of errors (one for each problem parsing) will be returned and the address will be excluded from the returned list.
func (DSDataEntry) DisplayName ¶
func (ds DSDataEntry) DisplayName() string
DisplayName formates a DSData Entry to be displayed as part of a HTML form.
func (DSDataEntry) FormDivName ¶
func (ds DSDataEntry) FormDivName() string
FormDivName creates a name that can be used as the ID for a div tag in the domain selection forms.
func (DSDataEntry) FormValue ¶
func (ds DSDataEntry) FormValue() string
FormValue will format the DSData Entry so it can be used as the value for a html form item.
func (*DSDataEntry) ParseFromFormValue ¶
func (ds *DSDataEntry) ParseFromFormValue(input string) error
ParseFromFormValue parses a value from a HTML form into a DSDataEntry taking into account the encoding used by the web UI.
type DSDataEntryEpp ¶
type DSDataEntryEpp struct { ID int64 `gorm:"primary_key:yes"` DomainID int64 KeyTag int64 Algorithm int64 DigestType int64 Digest string `sql:"size:256"` }
DSDataEntryEpp is an object that will hold a single DS Data entry used to indicate how a domain is signed with DNSSEC.
func (DSDataEntryEpp) DisplayName ¶
func (ds DSDataEntryEpp) DisplayName() string
DisplayName formates a DSData Entry to be displayed as part of a HTML form.
func (DSDataEntryEpp) FormDivName ¶
func (ds DSDataEntryEpp) FormDivName() string
FormDivName creates a name that can be used as the ID for a div tag in the domain selection forms.
func (DSDataEntryEpp) FormValue ¶
func (ds DSDataEntryEpp) FormValue() string
FormValue will format the DSData Entry so it can be used as the value for a html form item.
type Domain ¶
type Domain struct { Model State string RegistryDomainID string `sql:"size:32"` DomainStatus string ClientDeleteProhibitedStatus bool ServerDeleteProhibitedStatus bool ClientHoldStatus bool ServerHoldStatus bool ClientRenewProhibitedStatus bool ServerRenewProhibitedStatus bool ClientTransferProhibitedStatus bool ServerTransferProhibitedStatus bool ClientUpdateProhibitedStatus bool ServerUpdateProhibitedStatus bool LinkedStatus bool OKStatus bool PendingCreateStatus bool PendingDeleteStatus bool PendingRenewStatus bool PendingTransferStatus bool PendingUpdateStatus bool DomainName string `sql:"size:256"` DomainROID string `sql:"size:128"` DomainRegistrantROID string `sql:"size:128"` DomainAdminContactROID string `sql:"size:128"` DomainTechContactROID string `sql:"size:128"` DomainBillingContactROID string `sql:"size:128"` DomainNSList string `sql:"size:1024"` PreviewHostnames string `sql:"size:2048"` DSDataEntries []DSDataEntryEpp SponsoringClientID string `sql:"size:32"` CreateClientID string `sql:"size:32"` CreateDate time.Time UpdateClientID string `sql:"size:32"` UpdateDate time.Time TransferDate time.Time ExpireDate time.Time HoldActive bool HoldBy string HoldAt time.Time HoldReason string `sql:"size:1024"` CurrentRevision DomainRevision CurrentRevisionID sql.NullInt64 Revisions []DomainRevision PendingRevision DomainRevision `sql:"-"` WHOISRegistrar string WHOISRegistrarID string WHOISServer string WHOISDomainNS string WHOISRegistrantName string WHOISAdminName string WHOISTechName string WHOISBillingName string WHOISStatuses string WHOISDNSSSECSigned bool WHOISUpdatedDate time.Time WHOISCreateDate time.Time WHOISExpireDate time.Time WHOISLastUpdatedAt time.Time WHOISLastConfirmEmailAt time.Time EPPStatus string EPPLastUpdate time.Time DNSStatus string DNSLastUpdate time.Time CreatedAt time.Time `json:"CreatedAt"` CreatedBy string `json:"CreatedBy"` UpdatedAt time.Time `json:"UpdatedAt"` UpdatedBy string `json:"UpdatedBy"` CheckRequired bool }
Domain is an object that represents the state of a registrar domain object as defined by RFC 5731 http://tools.ietf.org/html/rfc5731
func GetWorkDomainsFull ¶
GetWorkDomainsFull returns a list of Doamins that require work to be done or an error.
func GetWorkDomainsPrepared ¶
GetWorkDomainsPrepared will try and find all domains that require work to be done and then will prepare all of the domain objects. If an error occurs in the process, the error will be returned.
func (*Domain) ComparePendingToCallback ¶
func (d *Domain) ComparePendingToCallback(loadFn CompareLoadFn) (retFn CompareReturnFn)
ComparePendingToCallback will return a function that will compare the current revision object to itself after changes have been made.
func (*Domain) EPPMatchesExpected ¶
EPPMatchesExpected takes a response from an EPP server and will compare the domain object to the EPP response and return true iff the domain is configured correctly or false otherwise. If false is returned, the string passed back represents the current state of the domain.
func (*Domain) GetAllPage ¶
func (d *Domain) GetAllPage(dbCache *DBCache, _ string, _ string) (rop RegistrarObjectPage, err error)
GetAllPage will return an object that can be used to render a view Containing multiple domains.
TODO: Add paging support TODO: Add filtering.
func (*Domain) GetCurrentRevisionID ¶
GetCurrentRevisionID will return the id of the current Domain Revision for the domain object.
func (*Domain) GetCurrentValue ¶
GetCurrentValue is used to get the current value of a field in a revision if a current revision exists, otherwise an empty string is returned.
func (*Domain) GetExportVersion ¶
func (d *Domain) GetExportVersion() RegistrarObjectExport
GetExportVersion returns a export version of the Domain Object.
func (*Domain) GetExportVersionAt ¶
func (d *Domain) GetExportVersionAt(dbCache *DBCache, timestamp int64) (obj RegistrarObjectExport, err error)
GetExportVersionAt returns an export version of the Domain Object at the timestamp provided if possible otherwise an error is returned. If a pending version existed at the time it will be excluded from the object.
func (*Domain) GetInformedApproverSets ¶
func (d *Domain) GetInformedApproverSets(dbCache *DBCache) (as []ApproverSet, err error)
GetInformedApproverSets returns the list of approver sets that are informed for the Domain (if a valid approver revision exists). If no approver revisions are found, an empty list will be returned.
func (*Domain) GetPage ¶
func (d *Domain) GetPage(dbCache *DBCache, username string, email string) (rop RegistrarObjectPage, err error)
GetPage will return an object that can be used to render the HTML template for the Domain.
func (*Domain) GetPendingCRID ¶
GetPendingCRID will return the current CR id if it is set, otherwise a nil will be returned (in the form of a sql.NullInt64).
func (*Domain) GetPendingRevision ¶
func (d *Domain) GetPendingRevision() RegistrarObject
GetPendingRevision implements the RegistrarParent interface and returns the pending revision pointer.
func (*Domain) GetPendingRevisionID ¶
GetPendingRevisionID will return the current pending revision for the Domain object if it exists. If no pending revision exists a 0 is returned.
func (*Domain) GetRequiredApproverSets ¶
func (d *Domain) GetRequiredApproverSets(dbCache *DBCache) (approvers []ApproverSet, err error)
GetRequiredApproverSets returns the list of approver sets that are required for the Domain (if a valid approver revision exists). If no approver revisions are found, a default of the infosec approver set will be returned.
func (Domain) GetType ¶
GetType will return the object type string as defined in the RegistrarObject definition.
func (Domain) HasPendingRevision ¶
HasPendingRevision returns true iff a pending revision exists for the Domain, otherwise false.
func (Domain) HasRevision ¶
HasRevision returns true iff a current revision exists, otherwise false
TODO: add a check to verify that the current revision has an approved change request.
func (*Domain) IsCancelled ¶
IsCancelled returns true iff the object has been canclled.
func (*Domain) IsEditable ¶
IsEditable returns true iff the object is editable.
func (*Domain) LoadEPPInfo ¶
LoadEPPInfo accepts an EPP response and attempts to marshall the data from the response into the object that was called.
TODO: Consider moving the query into dbcache.
func (*Domain) ParseFromForm ¶
ParseFromForm takes a http Request and parses the field values and populates the acceptable values into the new object. An error is returned if there is difficulty parsing any of the fileds.
func (*Domain) ParseFromFormUpdate ¶
ParseFromFormUpdate takes a http Request and parses the form values and returns a sparse Domain object with the changes that were made. An error object is always the second return value which is nil when no errors have occurred during parsing otherwise an error is returned.
func (*Domain) Prepare ¶
Prepare populate all of the fields for a given object as well as the linked objects.
TODO: Consider moving the query into dbcache.
func (*Domain) PrepareShallow ¶
PrepareShallow populate all of the fields for a given object and not any of the linked object.
func (Domain) SuggestedContactID ¶
SuggestedContactID takes a string naming the field that is being requested and returns an int64 containing the suggested value for the field in a new pending revions.
func (Domain) SuggestedRevisionBool ¶
SuggestedRevisionBool takes a string naming the flag that is being requested and returnes a bool containing the suggested value for the field in the new revision
TODO: add other fields that have been added.
func (Domain) SuggestedRevisionValue ¶
SuggestedRevisionValue takes a string naming the field that is being requested and returns a string containing the suggested value for the field in a new pending revision
TODO: add other fields that have been added.
func (*Domain) TakeAction ¶
func (d *Domain) TakeAction(response http.ResponseWriter, request *http.Request, dbCache *DBCache, actionName string, _ bool, authMethod AuthType, conf Config) (errs []error)
TakeAction processes actions that are to be taken on the object and either display a resulting page, trigger a download or redirect to another page if necessary.
func (*Domain) UpdateHoldStatus ¶
UpdateHoldStatus is used to adjust the object's Hold status after the user has been verified as an admin. An error will be returned if the hold reason is not set.
func (*Domain) UpdateState ¶
UpdateState can be called at any point to check the state of the Domain and update it if necessary
TODO: Implement TODO: Make sure callers check errors.
func (*Domain) UpdateWHOISFromResponse ¶
UpdateWHOISFromResponse takes a response from a WHOIS query and puts the resulting data into the domain object and updates the LastUpdateAt field to the current timestamp.
func (*Domain) VerifyCR ¶
VerifyCR Checks to make sure that all of the values and approvals within a change request match the domain that it is linked to
TODO: more rigirous check on if the CR approved text matches.
func (Domain) WHOISHasStatus ¶
WHOISHasStatus will check to see if a status exists in the list of statuses found in the WHOIS data. Comparisons are done on a lower case verson of both strings. If the status is found, true is returned otherwise, false is retuned.
func (Domain) WHOISNameServers ¶
WHOISNameServers turns the list of name servers into a n array of name servers by splitting on newlines.
func (Domain) WHOISStatusFlags ¶
WHOISStatusFlags turns a string of status flags into a list of status flags by splitting on new lines.
type DomainExport ¶
type DomainExport struct { ID int64 `json:"ID"` State string `json:"State"` DomainName string `json:"DomainName"` DomainROID string `json:"DomainROID"` CurrentRevision DomainRevisionExport `json:"CurrentRevision"` PendingRevision DomainRevisionExport `json:"PendingRevision"` CreateDate time.Time `json:"CreateDate"` UpdateDate time.Time `json:"UpdateDate"` ExpireDate time.Time `json:"ExpireDate"` ClientDeleteProhibitedStatus bool `json:"ClientDeleteProhibitedStatus"` ServerDeleteProhibitedStatus bool `json:"ServerDeleteProhibitedStatus"` ClientHoldStatus bool `json:"ClientHoldStatus"` ServerHoldStatus bool `json:"ServerHoldStatus"` ClientRenewProhibitedStatus bool `json:"ClientRenewProhibitedStatus"` ServerRenewProhibitedStatus bool `json:"ServerRenewProhibitedStatus"` ClientTransferProhibitedStatus bool `json:"ClientTransferProhibitedStatus"` ServerTransferProhibitedStatus bool `json:"ServerTransferProhibitedStatus"` ClientUpdateProhibitedStatus bool `json:"ClientUpdateProhibitedStatus"` ServerUpdateProhibitedStatus bool `json:"ServerUpdateProhibitedStatus"` LinkedStatus bool `json:"LinkedStatus"` OKStatus bool `json:"OKStatus"` PendingCreateStatus bool `json:"PendingCreateStatus"` PendingDeleteStatus bool `json:"PendingDeleteStatus"` PendingRenewStatus bool `json:"PendingRenewStatus"` PendingTransferStatus bool `json:"PendingTransferStatus"` PendingUpdateStatus bool `json:"PendingUpdateStatus"` CreatedAt time.Time `json:"CreatedAt"` CreatedBy string `json:"CreatedBy"` UpdatedAt time.Time `json:"UpdatedAt"` UpdatedBy string `json:"UpdatedBy"` HoldActive bool `json:"HoldActive"` HoldBy string `json:"HoldBy"` HoldAt time.Time `json:"HoldAt"` HoldReason string `json:"HoldReason"` }
DomainExport is an object that is used to export the current state of a Domain object. The full version of the export object also contains the current and pending revision (if either exist).
func (DomainExport) GetDiff ¶
func (d DomainExport) GetDiff() (string, error)
GetDiff will return a string containing a formatted diff of the current and pending revisions for the Domain object. An empty string and an error are returned if an error occures during the processing
TODO: Handle diff for objects that do not have a pending revision TODO: Handle diff for objects that do not have a current revision.
func (DomainExport) ToJSON ¶
func (d DomainExport) ToJSON() (string, error)
ToJSON will return a string containing a JSON representation of the object. An empty string and an error are returned if a JSON representation cannot be returned.
type DomainPage ¶
type DomainPage struct { Editable bool IsNew bool Dom Domain CurrentRevisionPage *DomainRevisionPage PendingRevisionPage *DomainRevisionPage PendingActions map[string]string ValidApproverSets map[int64]string CSRFToken string }
DomainPage is used to hold all the information required to render the Domain HTML page.
func (*DomainPage) GetCSRFToken ¶
func (d *DomainPage) GetCSRFToken() string
GetCSRFToken retrieves the CSRF token from an the Page Object.
func (*DomainPage) SetCSRFToken ¶
func (d *DomainPage) SetCSRFToken(newToken string)
SetCSRFToken is used to set the CSRFToken for the Page Object.
type DomainRevision ¶
type DomainRevision struct { Model DomainID int64 RevisionState string DesiredState string DomainStatus string Owners string Class string ClientDeleteProhibitedStatus bool ServerDeleteProhibitedStatus bool ClientHoldStatus bool ServerHoldStatus bool ClientRenewProhibitedStatus bool ServerRenewProhibitedStatus bool ClientTransferProhibitedStatus bool ServerTransferProhibitedStatus bool ClientUpdateProhibitedStatus bool ServerUpdateProhibitedStatus bool DomainRegistrant Contact DomainRegistrantID int64 DomainAdminContact Contact DomainAdminContactID int64 DomainTechContact Contact DomainTechContactID int64 DomainBillingContact Contact DomainBillingContactID int64 Hostnames []Host `gorm:"many2many:host_to_domainrevision"` DSDataEntries []DSDataEntry SavedNotes string `sql:"size:16384"` RequiredApproverSets []ApproverSet `gorm:"many2many:required_approverset_to_domainrevision"` InformedApproverSets []ApproverSet `gorm:"many2many:informed_approverset_to_domainrevision"` CR ChangeRequest CRID sql.NullInt64 IssueCR string `sql:"size:256"` Notes string `sql:"size:2048"` CreatedAt time.Time `json:"CreatedAt"` CreatedBy string `json:"CreatedBy"` UpdatedAt time.Time `json:"UpdatedAt"` UpdatedBy string `json:"UpdatedBy"` ApprovalStartTime *time.Time ApprovalStartBy string PromotedTime *time.Time SupersededTime *time.Time ApprovalFailedTime *time.Time }
DomainRevision represents individual versions of a Domain Object.
func (*DomainRevision) Cancel ¶
func (d *DomainRevision) Cancel(dbCache *DBCache, conf Config) (errs []error)
Cancel will change the State of a revision from either "new" or "pendingapproval" to "cancelled"
TODO: If in pending approval, cancel the change request and all approval objects TODO: Consider moving the query into dbcache.
func (*DomainRevision) Decline ¶
func (d *DomainRevision) Decline(dbCache *DBCache) (err error)
Decline will mark an DomainRevision as decline for an Domain.
func (*DomainRevision) GetActions ¶
func (d *DomainRevision) GetActions(isSelf bool) map[string]string
GetActions will return a list of possible actions that can be taken while in the current state
TODO: handle all states.
func (*DomainRevision) GetAllPage ¶
func (d *DomainRevision) GetAllPage(dbCache *DBCache, _ string, _ string) (rop RegistrarObjectPage, err error)
GetAllPage will return an object that can be used to render a view Containing multiple Domain Revisions.
TODO: Add paging support TODO: Add filtering.
func (*DomainRevision) GetExportVersion ¶
func (d *DomainRevision) GetExportVersion() RegistrarObjectExport
GetExportVersion returns a export version of the DomainRevision Object.
func (*DomainRevision) GetExportVersionAt ¶
func (d *DomainRevision) GetExportVersionAt(_ *DBCache, _ int64) (obj RegistrarObjectExport, err error)
GetExportVersionAt returns an export version of the DomainRevision Object at the timestamp provided if possible otherwise an error is returned. If a pending version existed at the time it will be excluded from the object.
func (*DomainRevision) GetInformedApproverSets ¶
func (d *DomainRevision) GetInformedApproverSets(dbCache *DBCache) (approverSets []ApproverSet, err error)
GetInformedApproverSets prepares object and returns the ApproverSets.
func (*DomainRevision) GetPage ¶
func (d *DomainRevision) GetPage(dbCache *DBCache, _ string, _ string) (rop RegistrarObjectPage, err error)
GetPage will return an object that can be used to render the HTML template for the DomainRevision.
func (*DomainRevision) GetPreviewHostnames ¶
func (d *DomainRevision) GetPreviewHostnames() string
GetPreviewHostnames will generate and return the preview hostnames text for the associated with this domain revision.
func (*DomainRevision) GetRequiredApproverSets ¶
func (d *DomainRevision) GetRequiredApproverSets(dbCache *DBCache) (approverSets []ApproverSet, err error)
GetRequiredApproverSets prepares object and returns the ApproverSets.
func (*DomainRevision) GetType ¶
func (d *DomainRevision) GetType() string
GetType will return the object type string as defined in the RegistrarObject definition.
func (DomainRevision) HasHappened ¶
func (d DomainRevision) HasHappened(actionType string) bool
HasHappened is a helper function that will return true if the value of the timestamp who's name is passes has happened after the revision was created. This function is intended to be used with templates.
func (*DomainRevision) IsActive ¶
func (d *DomainRevision) IsActive() bool
IsActive returns true if RevisionState is StateActive or StateBootstrap.
func (*DomainRevision) IsCancelled ¶
func (d *DomainRevision) IsCancelled() bool
IsCancelled returns true iff the object has been canclled.
func (DomainRevision) IsDesiredState ¶
func (d DomainRevision) IsDesiredState(state string) bool
IsDesiredState will return true iff the state passed in matches the desired state of the revision.
func (*DomainRevision) IsEditable ¶
func (d *DomainRevision) IsEditable() bool
IsEditable returns true iff the object is editable.
func (DomainRevision) IsSelectedClass ¶
func (d DomainRevision) IsSelectedClass(class string) bool
IsSelectedClass determines if the selected class matches the argument passed. In the case of an "other" passed, the function will check to make sure that the class does not match any of the defined classes.
func (*DomainRevision) NewDomainEmail ¶
func (d *DomainRevision) NewDomainEmail(domainName string, conf Config) error
NewDomainEmail will generate and send an email upon the creation of a new domain TODO: Move this email to a template and make the registrar name a variable.
func (*DomainRevision) ParseFromForm ¶
func (d *DomainRevision) ParseFromForm(request *http.Request, dbCache *DBCache) error
ParseFromForm takes a http Request and parses the field values and populates the acceptable values into the new object. An error is returned if there is difficulty parsing any of the fileds.
TODO: add status flags TODO: Handle domain current status (new, transfer in).
func (*DomainRevision) ParseFromFormUpdate ¶
func (d *DomainRevision) ParseFromFormUpdate(request *http.Request, dbCache *DBCache, _ Config) (err error)
ParseFromFormUpdate takes a http Request and parses the form values and returns a sparse DomainRevision object with the changes that were made. An error object is always the second return value which is nil when no errors have occurred during parsing otherwise an error is returned.
TODO: verify public key TODO: verify fingerprint TODO: Consider moving the query into dbcache.
func (*DomainRevision) Prepare ¶
func (d *DomainRevision) Prepare(dbCache *DBCache) (err error)
Prepare populate all of the fields for a given object as well as the linked objects.
TODO: Consider moving the query into dbcache.
func (*DomainRevision) Promote ¶
func (d *DomainRevision) Promote(dbCache *DBCache) (err error)
Promote will mark an DomainRevision as the current revision for an Domain if it has not been cancelled or failed approval.
func (*DomainRevision) StartApprovalProcess ¶
func (d *DomainRevision) StartApprovalProcess(request *http.Request, dbCache *DBCache, conf Config) (err error)
StartApprovalProcess creates a change request to start the process of approvnig a new Change Request. If the Change Request was created no error is returned, otherwise an error will be returned.
TODO: Check if a CR already exists for this object TODO: Ensure that if an error occures no changes are made.
func (*DomainRevision) Supersed ¶
func (d *DomainRevision) Supersed(dbCache *DBCache) (err error)
Supersed will mark an DomainRevision as a superseded revision for an Domain.
func (*DomainRevision) TakeAction ¶
func (d *DomainRevision) TakeAction(response http.ResponseWriter, request *http.Request, dbCache *DBCache, actionName string, validCSRF bool, authMethod AuthType, conf Config) (errs []error)
TakeAction processes actions that are to be taken on the object and either display a resulting page, trigger a download or redirect to another page if necessary.
type DomainRevisionExport ¶
type DomainRevisionExport struct { ID int64 `json:"ID"` DomainID int64 `json:"DomainID"` RevisionState string `json:"RevisionState"` DesiredState string `json:"DesiredState"` Owners string `json:"Owner"` Class string `json:"Class"` ClientDeleteProhibitedStatus bool `json:"ClientDeleteProhibitedStatus"` ServerDeleteProhibitedStatus bool `json:"ServerDeleteProhibitedStatus"` ClientHoldStatus bool `json:"ClientHoldStatus"` ServerHoldStatus bool `json:"ServerHoldStatus"` ClientRenewProhibitedStatus bool `json:"ClientRenewProhibitedStatus"` ServerRenewProhibitedStatus bool `json:"ServerRenewProhibitedStatus"` ClientTransferProhibitedStatus bool `json:"ClientTransferProhibitedStatus"` ServerTransferProhibitedStatus bool `json:"ServerTransferProhibitedStatus"` ClientUpdateProhibitedStatus bool `json:"ClientUpdateProhibitedStatus"` ServerUpdateProhibitedStatus bool `json:"ServerUpdateProhibitedStatus"` DomainRegistrant ContactExportShort `json:"DomainRegistrant"` DomainAdminContact ContactExportShort `json:"DomainAdminContact"` DomainTechContact ContactExportShort `json:"DomainTechContact"` DomainBillingContact ContactExportShort `json:"DomainBillingContact"` Hostnames []HostExportShort `json:"Hostnames"` DSDataEntries []DSDataEntry `json:"DSDataEntries"` SavedNotes string `json:"SavedNotes"` ChangeRequestID int64 `json:"ChangeRequestID"` IssueCR string `json:"IssueCR"` Notes string `json:"Notes"` RequiredApproverSets []ApproverSetExportShort `json:"RequiredApproverSets"` InformedApproverSets []ApproverSetExportShort `json:"InformedApproverSets"` CreatedAt time.Time `json:"CreatedAt"` CreatedBy string `json:"CreatedBy"` }
DomainRevisionExport is an object that is used to export the current version of a Domain Revision.
func (DomainRevisionExport) Compare ¶
func (dre DomainRevisionExport) Compare(domainRevision DomainRevision) (pass bool, errs []error)
Compare is used to compare an export version of an object to the full revision to verify that all of the values are the same.
func (DomainRevisionExport) CompareExport ¶
func (dre DomainRevisionExport) CompareExport(domainRevision DomainRevisionExport) (pass bool, errs []error)
CompareExport is used to compare an export version of an object to another export revision to verify that all of the values are the same.
func (DomainRevisionExport) GetDiff ¶
func (dre DomainRevisionExport) GetDiff() (string, error)
GetDiff will return an empty string and an error for a revision. A Diff is not available for revision objects.
func (DomainRevisionExport) ToJSON ¶
func (dre DomainRevisionExport) ToJSON() (string, error)
ToJSON will return a string containing a JSON representation of the object. An empty string and an error are returned if a JSON representation cannot be returned.
type DomainRevisionPage ¶
type DomainRevisionPage struct { IsEditable bool IsNew bool Revision DomainRevision PendingActions map[string]string ValidApproverSets map[int64]string ValidHosts map[int64]string ValidContacts map[int64]string ParentDomain *Domain SuggestedRequiredApprovers map[int64]ApproverSetDisplayObject SuggestedInformedApprovers map[int64]ApproverSetDisplayObject SuggestedHostnames []Host SuggestedDSData []DSDataEntry DNSSECAlgorithms map[int64]string DNSSECDigestTypes map[int64]string CSRFToken string }
DomainRevisionPage are used to hold all the information required to render the DomainRevision HTML template.
func (*DomainRevisionPage) GetCSRFToken ¶
func (d *DomainRevisionPage) GetCSRFToken() string
GetCSRFToken retrieves the CSRF token from an the Page Object.
func (*DomainRevisionPage) SetCSRFToken ¶
func (d *DomainRevisionPage) SetCSRFToken(newToken string)
SetCSRFToken is used to set the CSRFToken for the Page Object.
type DomainRevisionsPage ¶
type DomainRevisionsPage struct { DomainRevisions []DomainRevision CSRFToken string }
The DomainRevisionsPage type is used to render the html template which lists all of the DomainRevisions currently in the registrar system
TODO: Add paging support.
func (*DomainRevisionsPage) GetCSRFToken ¶
func (d *DomainRevisionsPage) GetCSRFToken() string
GetCSRFToken retrieves the CSRF token from an the Page Object.
func (*DomainRevisionsPage) SetCSRFToken ¶
func (d *DomainRevisionsPage) SetCSRFToken(newToken string)
SetCSRFToken is used to set the CSRFToken for the Page Object.
type DomainsPage ¶
DomainsPage is used to hold all the information required to render the Domain HTML page.
func (*DomainsPage) GetCSRFToken ¶
func (d *DomainsPage) GetCSRFToken() string
GetCSRFToken retrieves the CSRF token from an the Page Object.
func (*DomainsPage) SetCSRFToken ¶
func (d *DomainsPage) SetCSRFToken(newToken string)
SetCSRFToken is used to set the CSRFToken for the Page Object.
type EPPAction ¶
type EPPAction struct { Model RegistrarServerTimestamp time.Time `json:"RegistrarServerTimestamp"` EPPClientTimestamp time.Time `json:"EPPClientTimestamp"` RunID int64 `json:"RunID"` ClientTransactionID string `json:"ClientTransactionID"` ServerTransactionID string `json:"ServerTransactionID"` ResponseCode int `json:"ResponseCode"` ResponseMessage string `json:"ResponseMessage"` Action string `json:"Action"` Args string `json:"Args"` Notes string `json:"Notes"` Successful bool `json:"Successful"` }
EPPAction is used to store log infomration about an EPP action that has been taken.
func NewEPPAction ¶
NewEPPAction will gerenate and return a new EPPAction object.
func (*EPPAction) HandleResponse ¶
HandleResponse will process an EPP response object and set the action's server transaction id and the error based on the response.
type EPPEncryptedPassphrase ¶
type EPPEncryptedPassphrase struct { Model Username string EncryptedPassphrase string `gorm:"size:16384"` LastUpdate time.Time }
EPPEncryptedPassphrase is used to store the encrypted passphrases for the EPP accounts associated with the registrar.
type EPPRun ¶
type EPPRun struct { Model StartTime time.Time EndTime time.Time StartClientID string EndClientID string }
EPPRun is a record that is used to identify unique EPP sessions to ensure that the client transaction IDs for each epp command are unique.
type FieldHasher ¶
type FieldHasher interface { FieldHash() []byte IsLoaded() bool IsScopeUnchanged(*gorm.Scope) bool // IsUnchanged(*gorm.DB, interface{}) bool SetFieldHash(*gorm.DB, interface{}) SetScopeFieldHash(*gorm.Scope) AfterFind(*gorm.Scope) }
FieldHasher is the public interface field hashing routines in Model.
type Host ¶
type Host struct { Model State string HostStatus string ClientDeleteProhibitedStatus bool ServerDeleteProhibitedStatus bool ClientTransferProhibitedStatus bool ServerTransferProhibitedStatus bool ClientUpdateProhibitedStatus bool ServerUpdateProhibitedStatus bool LinkedStatus bool OKStatus bool PendingCreateStatus bool PendingDeleteStatus bool PendingTransferStatus bool PendingUpdateStatus bool HostName string `sql:"size:256"` HostROID string `sql:"size:128"` HostAddresses []HostAddressEpp PreviewIPs string `sql:"size:2048"` SponsoringClientID string `sql:"size:32"` CreateClientID string `sql:"size:32"` CreateDate time.Time UpdateClientID string `sql:"size:32"` UpdateDate time.Time TransferDate time.Time HoldActive bool HoldBy string HoldAt time.Time HoldReason string `sql:"size:1024"` CurrentRevision HostRevision CurrentRevisionID sql.NullInt64 Revisions []HostRevision PendingRevision HostRevision `sql:"-"` EPPStatus string EPPLastUpdate time.Time DNSStatus string DNSLastUpdate time.Time CreatedAt time.Time `json:"CreatedAt"` CreatedBy string `json:"CreatedBy"` UpdatedAt time.Time `json:"UpdatedAt"` UpdatedBy string `json:"UpdatedBy"` CheckRequired bool }
Host is an object that represents the state of a registrar host object as defined by RFC 5732 http://tools.ietf.org/html/rfc5732
func GetWorkHostsFull ¶
GetWorkHostsFull returns a list of Hosts that require work to be done or an error.
func ParseHostList ¶
ParseHostList takes the http Request, a database connection and the HTML ID of the host list to parse and will return an array of Hosts that correspond to each of the IDs from the http request's html element. If there are unparsable IDs in the list (could be strings or empty fields) an error is returned. Any valid hosts that are found will be returned in the array, even if an error is found.
func (*Host) ComparePendingToCallback ¶
func (h *Host) ComparePendingToCallback(loadFn CompareLoadFn) (retFn CompareReturnFn)
ComparePendingToCallback will return a function that will compare the current revision object to itself after changes have been made.
func (Host) DisplayName ¶
DisplayName formates a host address to be displayed as part of a HTML form.
func (*Host) EPPMatchesExpected ¶
EPPMatchesExpected takes a response from an EPP server and will compare the host object to the EPP response and return true iff the host is configured correctly or false otherwise. If false is returned, the string passed back represents the current state of the host.
func (Host) FormDivName ¶
FormDivName creates a name that can be used as the ID for a div tag in the host selection forms.
func (*Host) GetAllPage ¶
func (h *Host) GetAllPage(ddbCache *DBCache, _ string, _ string) (rop RegistrarObjectPage, err error)
GetAllPage will return an object that can be used to render a view Containing multiple hosts.
TODO: Add paging support TODO: Add filtering.
func (*Host) GetCurrentHosts ¶
GetCurrentHosts returnes an array of the display names for the Host Addresses of the current HostRevision.
func (*Host) GetCurrentRevisionID ¶
GetCurrentRevisionID will return the id of the current Host Revision for the host object.
func (*Host) GetCurrentValue ¶
GetCurrentValue is used to get the current value of a field in a revision if a current revision exists, otherwise an empty string is returned.
func (*Host) GetDisplayName ¶
GetDisplayName will return a name for the Host that can be used to display a shortened version of the invormation to users.
func (*Host) GetExportShortVersion ¶
func (h *Host) GetExportShortVersion() HostExportShort
GetExportShortVersion returned an export version of the Host object in its short form.
func (*Host) GetExportVersion ¶
func (h *Host) GetExportVersion() RegistrarObjectExport
GetExportVersion returns an export version of the Host Object.
func (*Host) GetExportVersionAt ¶
func (h *Host) GetExportVersionAt(dbCache *DBCache, timestamp int64) (obj RegistrarObjectExport, err error)
GetExportVersionAt returns an export version of the Host Object at the timestamp provided if possible otherwise an error is returned. If a pending version existed at the time it will be excluded from the object.
func (*Host) GetInformedApproverSets ¶
func (h *Host) GetInformedApproverSets(dbCache *DBCache) (as []ApproverSet, err error)
GetInformedApproverSets returns the list of approver sets that are informed for the Host (if a valid approver revision exists). If no approver revisions are found, an empty list will be returned.
func (*Host) GetPage ¶
func (h *Host) GetPage(dbCache *DBCache, username string, email string) (rop RegistrarObjectPage, err error)
GetPage will return an object that can be used to render the HTML template for the Host.
func (*Host) GetPendingCRID ¶
GetPendingCRID will return the current CR id if it is set, otherwise a nil will be returned (in the form of a sql.NullInt64).
func (*Host) GetPendingRevision ¶
func (h *Host) GetPendingRevision() RegistrarObject
GetPendingRevision implements the RegistrarParent interface and returns the pending revision pointer.
func (*Host) GetPendingRevisionID ¶
GetPendingRevisionID will return the current pending revision for the Host object if it exists. If no pending revision exists a 0 is returned.
func (*Host) GetRequiredApproverSets ¶
func (h *Host) GetRequiredApproverSets(dbCache *DBCache) (approvers []ApproverSet, err error)
GetRequiredApproverSets returns the list of approver sets that are required for the Host (if a valid approver revision exists). If no approver revisions are found, a default of the infosec approver set will be returned.
func (Host) GetType ¶
GetType will return the object type string as defined in the RegistrarObject definition.
func (Host) HasPendingRevision ¶
HasPendingRevision returns true iff a pending revision exists for the Host, otherwise false.
func (Host) HasRevision ¶
HasRevision returns true iff a current revision exists, otherwise false
TODO: add a check to verify that the current revision has an approved change request.
func (*Host) IsCancelled ¶
IsCancelled returns true iff the object has been canclled.
func (*Host) IsEditable ¶
IsEditable returns true iff the object is editable.
func (*Host) LoadEPPInfo ¶
LoadEPPInfo accepts an EPP response and attempts to marshall the data from the response into the object that was called.
TODO: Consider moving the query into dbcache.
func (*Host) ParseFromForm ¶
ParseFromForm takes a http Request and parses the field values and populates the acceptable values into the new object. An error is returned if there is difficulty parsing any of the fileds.
func (*Host) ParseFromFormUpdate ¶
ParseFromFormUpdate takes a http Request and parses the form values and returns a sparse Host object with the changes that were made. An error object is always the second return value which is nil when no errors have occurred during parsing otherwise an error is returned.
func (*Host) Prepare ¶
Prepare populate all of the fields for a given object as well as the linked objects.
TODO: Consider moving the query into dbcache.
func (*Host) PrepareDisplayShallow ¶
PrepareDisplayShallow populate all of the fields for a given object and the current revision but not any of the other linked object.
func (*Host) PrepareShallow ¶
PrepareShallow populate all of the fields for a given object and not any of the linked object.
func (Host) SuggestedRevisionBool ¶
SuggestedRevisionBool takes a string naming the flag that is being requested and returnes a bool containing the suggested value for the field in the new revision
TODO: add other fields that have been added.
func (Host) SuggestedRevisionValue ¶
SuggestedRevisionValue takes a string naming the field that is being requested and returns a string containing the suggested value for the field in a new pending revision
TODO: add other fields that have been added.
func (*Host) TakeAction ¶
func (h *Host) TakeAction(response http.ResponseWriter, request *http.Request, dbCache *DBCache, actionName string, _ bool, authMethod AuthType, _ Config) (errs []error)
TakeAction processes actions that are to be taken on the object and either display a resulting page, trigger a download or redirect to another page if necessary.
func (*Host) UpdateHoldStatus ¶
UpdateHoldStatus is used to adjust the object's Hold status after the user has been verified as an admin. An error will be returned if the hold reason is not set.
func (*Host) UpdateState ¶
UpdateState can be called at any point to check the state of the Host and update it if necessary
TODO: Implement TODO: Make sure callers check errors.
type HostAddress ¶
type HostAddress struct { ID int64 `gorm:"primary_key:yes"` HostRevisionID int64 IPAddress string Protocol int64 }
HostAddress is an object that will hold an IP address and the prodocol that the address is from (IPv4 / IPv6).
func ParseHostAddresses ¶
ParseHostAddresses takes a http Request, a database connection and the html ID of the host address list to parse and will return an array of Host Addresses that are represented in the http request. If an error occurs parsing the IP addresses a list of errors (one for each problem parsing) will be returned and the address will be excluded from the returned list.
func (HostAddress) DisplayName ¶
func (h HostAddress) DisplayName() string
DisplayName formates a host address to be displayed as part of a HTML form.
func (HostAddress) FormDivName ¶
func (h HostAddress) FormDivName() string
FormDivName creates a name that can be used as the ID for a div tag in the host selection forms.
func (HostAddress) FormValue ¶
func (h HostAddress) FormValue() string
FormValue will format the host address so it can be used as the value for a html form item.
func (*HostAddress) ParseFromFormValue ¶
func (h *HostAddress) ParseFromFormValue(input string) error
ParseFromFormValue parses a value from a HTML form into a Host Address taking into account the encoding used by the web UI.
type HostAddressEpp ¶
type HostAddressEpp struct { ID int64 `gorm:"primary_key:yes"` HostID int64 IPAddress string Protocol int64 }
HostAddressEpp is an object that will hold an IP address and the prodocol that the address is from (IPv4 / IPv6).
func (HostAddressEpp) DisplayName ¶
func (h HostAddressEpp) DisplayName() string
DisplayName formates a host address to be displayed as part of a HTML form.
func (HostAddressEpp) FormDivName ¶
func (h HostAddressEpp) FormDivName() string
FormDivName creates a name that can be used as the ID for a div tag in the host selection forms.
func (HostAddressEpp) FormValue ¶
func (h HostAddressEpp) FormValue() string
FormValue will format the host address so it can be used as the value for a html form item.
type HostExport ¶
type HostExport struct { ID int64 `json:"ID"` State string `json:"State"` HostName string `json:"HostName"` HostROID string `json:"HostROID"` CurrentRevision HostRevisionExport `json:"CurrentRevision"` PendingRevision HostRevisionExport `json:"PendingRevision"` CreatedAt time.Time `json:"CreatedAt"` CreatedBy string `json:"CreatedBy"` UpdatedAt time.Time `json:"UpdatedAt"` UpdatedBy string `json:"UpdatedBy"` HoldActive bool `json:"HoldActive"` HoldBy string `json:"HoldBy"` HoldAt time.Time `json:"HoldAt"` HoldReason string `json:"HoldReason" sql:"size:1024"` }
HostExport is an object that is used to export the current state of a host object. The full version of the export object also contains the current and pending revision (if either exist).
func (HostExport) GetDiff ¶
func (h HostExport) GetDiff() (string, error)
GetDiff will return a string containing a formatted diff of the current and pending revisions for the Host object. An empty string and an error are returned if an error occures during the processing
TODO: Handle diff for objects that do not have a pending revision TODO: Handle diff for objects that do not have a current revision.
func (HostExport) ToJSON ¶
func (h HostExport) ToJSON() (string, error)
ToJSON will return a string containing a JSON representation of the object. An empty string and an error are returned if a JSON representation cannot be returned.
type HostExportShort ¶
type HostExportShort struct { ID int64 `json:"ID"` State string `json:"State"` HostName string `json:"HostName"` HostROID string `json:"HostROID"` CreatedAt time.Time `json:"CreatedAt"` CreatedBy string `json:"CreatedBy"` HoldActive bool `json:"HoldActive"` HoldBy string `json:"HoldBy"` HoldAt time.Time `json:"HoldAt"` HoldReason string `json:"HoldReason" sql:"size:1024"` }
HostExportShort is an object that is used to export the current state of a host object. The short version of the export object does not contain the current or pending revision.
func (HostExportShort) ToJSON ¶
func (h HostExportShort) ToJSON() (string, error)
ToJSON will return a string containing the JSON representation of the object. An empty string and an error are returned if the JSON representation cannot be returned.
type HostPage ¶
type HostPage struct { Editable bool IsNew bool Hos Host CurrentRevisionPage *HostRevisionPage PendingRevisionPage *HostRevisionPage PendingActions map[string]string ValidApproverSets map[int64]string CSRFToken string }
HostPage is used to hold all the information required to render the Host HTML page.
func (*HostPage) GetCSRFToken ¶
GetCSRFToken retrieves the CSRF token from an the Page Object.
func (*HostPage) SetCSRFToken ¶
SetCSRFToken is used to set the CSRFToken for the Page Object.
type HostRevision ¶
type HostRevision struct { Model HostID int64 RevisionState string DesiredState string HostStatus string ClientDeleteProhibitedStatus bool ServerDeleteProhibitedStatus bool ClientTransferProhibitedStatus bool ServerTransferProhibitedStatus bool ClientUpdateProhibitedStatus bool ServerUpdateProhibitedStatus bool HostAddresses []HostAddress SavedNotes string `sql:"size:16384"` RequiredApproverSets []ApproverSet `gorm:"many2many:required_approverset_to_hostrevision"` InformedApproverSets []ApproverSet `gorm:"many2many:informed_approverset_to_hostrevision"` CR ChangeRequest CRID sql.NullInt64 IssueCR string `sql:"size:256"` Notes string `sql:"size:2048"` CreatedAt time.Time `json:"CreatedAt"` CreatedBy string `json:"CreatedBy"` UpdatedAt time.Time `json:"UpdatedAt"` UpdatedBy string `json:"UpdatedBy"` ApprovalStartTime *time.Time ApprovalStartBy string PromotedTime *time.Time SupersededTime *time.Time ApprovalFailedTime *time.Time }
HostRevision represents individual versions of a Host Object.
func (*HostRevision) Cancel ¶
func (h *HostRevision) Cancel(dbCache *DBCache, conf Config) (errs []error)
Cancel will change the State of a revision from either "new" or "pendingapproval" to "cancelled"
TODO: If in pending approval, cancel the change request and all approval objects TODO: Consider moving the query into dbcache.
func (*HostRevision) Decline ¶
func (h *HostRevision) Decline(dbCache *DBCache) (err error)
Decline will mark an HostRevision as decline for an Host.
func (*HostRevision) GetActions ¶
func (h *HostRevision) GetActions(isSelf bool) map[string]string
GetActions will return a list of possible actions that can be taken while in the current state
TODO: handle all states.
func (*HostRevision) GetAllPage ¶
func (h *HostRevision) GetAllPage(dbCache *DBCache, _ string, _ string) (rop RegistrarObjectPage, err error)
GetAllPage will return an object that can be used to render a view Containing multiple Host Revisions.
TODO: Add paging support TODO: Add filtering.
func (*HostRevision) GetExportVersion ¶
func (h *HostRevision) GetExportVersion() RegistrarObjectExport
GetExportVersion returns a export version of the HostRevision Object.
func (*HostRevision) GetExportVersionAt ¶
func (h *HostRevision) GetExportVersionAt(_ *DBCache, _ int64) (obj RegistrarObjectExport, err error)
GetExportVersionAt returns an export version of the Host Revision Object at the timestamp provided if possible otherwise an error is returned. If a pending version existed at the time it will be excluded from the object.
func (*HostRevision) GetInformedApproverSets ¶
func (h *HostRevision) GetInformedApproverSets(dbCache *DBCache) (approverSets []ApproverSet, err error)
GetInformedApproverSets prepares object and returns the ApproverSets.
func (*HostRevision) GetPage ¶
func (h *HostRevision) GetPage(dbCache *DBCache, _ string, _ string) (rop RegistrarObjectPage, err error)
GetPage will return an object that can be used to render the HTML template for the HostRevision.
func (*HostRevision) GetPreviewIPs ¶
func (h *HostRevision) GetPreviewIPs() string
GetPreview will generate and return the preview text for the associated with this host revision.
func (*HostRevision) GetRequiredApproverSets ¶
func (h *HostRevision) GetRequiredApproverSets(dbCache *DBCache) (approverSets []ApproverSet, err error)
GetRequiredApproverSets prepares object and returns the ApproverSets.
func (*HostRevision) GetType ¶
func (h *HostRevision) GetType() string
GetType will return the object type string as defined in the RegistrarObject definition.
func (HostRevision) HasHappened ¶
func (h HostRevision) HasHappened(actionType string) bool
HasHappened is a helper function that will return true if the value of the timestamp who's name is passes has happened after the revision was created. This function is intended to be used with templates.
func (*HostRevision) IsActive ¶
func (h *HostRevision) IsActive() bool
IsActive returns true if RevisionState is StateActive or StateBootstrap.
func (*HostRevision) IsCancelled ¶
func (h *HostRevision) IsCancelled() bool
IsCancelled returns true iff the object has been canclled.
func (HostRevision) IsDesiredState ¶
func (h HostRevision) IsDesiredState(state string) bool
IsDesiredState will return true iff the state passed in matches the desired state of the revision.
func (*HostRevision) IsEditable ¶
func (h *HostRevision) IsEditable() bool
IsEditable returns true iff the object is editable.
func (*HostRevision) NewHostEmail ¶
func (h *HostRevision) NewHostEmail(hostName string, conf Config) error
NewHostEmail will generate and send an email upon the creation of a new host TODO: Make this email a template and set the registrar name as a variable.
func (*HostRevision) ParseFromForm ¶
func (h *HostRevision) ParseFromForm(request *http.Request, dbCache *DBCache) error
ParseFromForm takes a http Request and parses the field values and populates the acceptable values into the new object. An error is returned if there is difficulty parsing any of the fileds.
TODO: add status flags TODO: Handle domain current status (new, transfer in).
func (*HostRevision) ParseFromFormUpdate ¶
func (h *HostRevision) ParseFromFormUpdate(request *http.Request, dbCache *DBCache, _ Config) (err error)
ParseFromFormUpdate takes a http Request and parses the form values and returns a sparse HostRevision object with the changes that were made. An error object is always the second return value which is nil when no errors have occurred during parsing otherwise an error is returned.
TODO: return error list rather than error TODO: Consider moving the query into dbcache.
func (*HostRevision) Prepare ¶
func (h *HostRevision) Prepare(dbCache *DBCache) (err error)
Prepare populate all of the fields for a given object as well as the linked objects.
TODO: Consider moving the query into dbcache.
func (*HostRevision) PrepareShallow ¶
func (h *HostRevision) PrepareShallow(dbCache *DBCache) error
PrepareShallow populate all of the fields for a given object and not any of the linked object.
func (*HostRevision) Promote ¶
func (h *HostRevision) Promote(dbCache *DBCache) (err error)
Promote will mark an HostRevision as the current revision for an Host if it has not been cancelled or failed approval.
func (*HostRevision) StartApprovalProcess ¶
func (h *HostRevision) StartApprovalProcess(request *http.Request, dbCache *DBCache, conf Config) (err error)
StartApprovalProcess creates a change request to start the process of approvnig a new Change Request. If the Change Request was created no error is returned, otherwise an error will be returned.
TODO: Check if a CR already exists for this object TODO: Ensure that if an error occures no changes are made.
func (*HostRevision) Supersed ¶
func (h *HostRevision) Supersed(dbCache *DBCache) (err error)
Supersed will mark an HostRevision as a superseded revision for an Host.
func (*HostRevision) TakeAction ¶
func (h *HostRevision) TakeAction(response http.ResponseWriter, request *http.Request, dbCache *DBCache, actionName string, validCSRF bool, authMethod AuthType, conf Config) (errs []error)
TakeAction processes actions that are to be taken on the object and either display a resulting page, trigger a download or redirect to another page if necessary.
type HostRevisionExport ¶
type HostRevisionExport struct { ID int64 `json:"ID"` HostID int64 `json:"HostID"` RevisionState string `json:"RevisionState"` DesiredState string `json:"DesiredState"` ClientDeleteProhibitedStatus bool `json:"ClientDeleteProhibitedStatus"` ServerDeleteProhibitedStatus bool `json:"ServerDeleteProhibitedStatus"` ClientTransferProhibitedStatus bool `json:"ClientTransferProhibitedStatus"` ServerTransferProhibitedStatus bool `json:"ServerTransferProhibitedStatus"` ClientUpdateProhibitedStatus bool `json:"ClientUpdateProhibitedStatus"` ServerUpdateProhibitedStatus bool `json:"ServerUpdateProhibitedStatus"` HostAddresses []HostAddress `json:"HostAddresses"` SavedNotes string `json:"SavedNotes"` ChangeRequestID int64 `json:"ChangeRequestID"` IssueCR string `json:"IssueCR"` Notes string `json:"Notes"` RequiredApproverSets []ApproverSetExportShort `json:"RequiredApproverSets"` InformedApproverSets []ApproverSetExportShort `json:"InformedApproverSets"` CreatedAt time.Time `json:"CreatedAt"` CreatedBy string `json:"CreatedBy"` }
HostRevisionExport is an object that is used to export the current version of a Host Revision.
func (HostRevisionExport) Compare ¶
func (hre HostRevisionExport) Compare(hostRevision HostRevision) (pass bool, errs []error)
Compare is used to compare an export version of an object to the full revision to verify that all of the values are the same.
func (HostRevisionExport) CompareExport ¶
func (hre HostRevisionExport) CompareExport(hostRevision HostRevisionExport) (pass bool, errs []error)
CompareExport is used to compare an export version of an object to another export revision to verify that all of the values are the same.
func (HostRevisionExport) GetDiff ¶
func (hre HostRevisionExport) GetDiff() (string, error)
GetDiff will return an empty string and an error for a revision. A Diff is not available for revision objects.
func (HostRevisionExport) ToJSON ¶
func (hre HostRevisionExport) ToJSON() (string, error)
ToJSON will return a string containing a JSON representation of the object. An empty string and an error are returned if a JSON representation cannot be returned.
type HostRevisionPage ¶
type HostRevisionPage struct { IsEditable bool IsNew bool Revision HostRevision PendingActions map[string]string ValidApproverSets map[int64]string ParentHost *Host SuggestedRequiredApprovers map[int64]ApproverSetDisplayObject SuggestedInformedApprovers map[int64]ApproverSetDisplayObject SuggestedHostAddresses []HostAddress CSRFToken string }
HostRevisionPage are used to hold all the information required to render the HostRevision HTML template.
func (*HostRevisionPage) GetCSRFToken ¶
func (h *HostRevisionPage) GetCSRFToken() string
GetCSRFToken retrieves the CSRF token from an the Page Object.
func (*HostRevisionPage) SetCSRFToken ¶
func (h *HostRevisionPage) SetCSRFToken(newToken string)
SetCSRFToken is used to set the CSRFToken for the Page Object.
type HostRevisionsPage ¶
type HostRevisionsPage struct { HostRevisions []HostRevision CSRFToken string }
The HostRevisionsPage type is used to render the html template which lists all of the HostRevisions currently in the registrar system
TODO: Add paging support.
func (*HostRevisionsPage) GetCSRFToken ¶
func (h *HostRevisionsPage) GetCSRFToken() string
GetCSRFToken retrieves the CSRF token from an the Page Object.
func (*HostRevisionsPage) SetCSRFToken ¶
func (h *HostRevisionsPage) SetCSRFToken(newToken string)
SetCSRFToken is used to set the CSRFToken for the Page Object.
type HostsPage ¶
HostsPage is used to hold all the information required to render the Host HTML page.
func (*HostsPage) GetCSRFToken ¶
GetCSRFToken retrieves the CSRF token from an the Page Object.
func (*HostsPage) SetCSRFToken ¶
SetCSRFToken is used to set the CSRFToken for the Page Object.
type IPAllowListRevision ¶
type IPAllowListRevision struct { Model IPsJSON []byte `sql:"type:text"` IsActive bool RefreshedAt time.Time RefreshedBy string CreatedAt time.Time `json:"CreatedAt"` CreatedBy string `json:"CreatedBy"` }
IPAllowListRevision represents a list of IPs that correspond to NameServers in control of the registrar.
type LivenessCheck ¶
LivenessCheck is a table that is used to get a known value when the GTM liveness check is issued.
type LogWrapper ¶
type LogWrapper struct {
Logger debugLogger
}
func (LogWrapper) Print ¶
func (l LogWrapper) Print(values ...interface{})
Print will take a list of values passed in the form of the Gorm.Logger output format and display them as a signle line in a way that can be pushed to a output logger (like go-logging).
type Model ¶
type Model struct { ID int64 `gorm:"primary_key:yes" json:"ID"` // contains filtered or unexported fields }
Model is a base type for our gorm objects, it is the basis for many of the utility functions.
func (*Model) AfterFind ¶
AfterFind is the callback for model. It will be called for each object that embeds Model. We *almost* cleverly get around the problem with of only have Model instead of object that embeds it, by using scope.Value which points to what was getting loaded, thus allowing us to do our field hashing.
There's one pretty significant problem with this: loading slices rather than single values. When a slice is loaded, scope.Value will be pointer to the slice, and AfterFind will be called for each element. Attempting to use the field values from scope in this case results in garbage.
So when we see that scope.Value is a slice, we manually create a scope and invoke AfterFind for each element.
func (*Model) GetModel ¶
GetModel is an accessor method to get Model from any struct that embeds it.
func (*Model) HandleInProgress ¶
func (m *Model) HandleInProgress(progressFunc func())
HandleInProgress implements a simple loop prevention mechanism. If inProgress is not set it will set inProgress to true (setting it back to false with a defer) and run progressFunc. If inProgress is true it will return immediately.
func (*Model) IsLoaded ¶
IsLoaded checks to see if the fieldHash has been calculated (it is set to a non-nil 0 len value on error), since the AfterFind method should set fieldHash, we can tell if a given struct has not been loaded.
func (*Model) IsScopeUnchanged ¶
IsScopeUnchanged returns true iff m.fieldHash has been successfully calculated, and a hash for the provided scope can be succfully calculated, and these values as the same. This should be the case for any loaded struct embedding Model and running the AfterFind method.
func (*Model) SetFieldHash ¶
SetFieldHash generates a scope to calculate the hash for dbStruct see IsScopeUnchanged/IsUnchanged for below for the context in which this is used.
func (*Model) SetID ¶
SetID sets the ID of the object if it is not already set. If the ID of the object has been set already an error will be returned.
func (*Model) SetScopeFieldHash ¶
SetScopeFieldHash uses scope to calculate and set fieldHash see IsScopeUnchanged/IsUnchanged for below for the context in which this is used.
type Modeler ¶
type Modeler interface {
GetModel() *Model
}
Modeler interface for any struct implements GetModel, which is to say any struct that embeds Model.
type NotExportableObject ¶
type NotExportableObject struct {
Type string
}
A NotExportableObject is used when trying to fully implement a Registrar object but do not want to create exportable versions of the object.
func (NotExportableObject) GetDiff ¶
func (a NotExportableObject) GetDiff() (string, error)
GetDiff on a NotExportableObject will result in an empty string and an error.
func (NotExportableObject) ToJSON ¶
func (a NotExportableObject) ToJSON() (string, error)
ToJSON on a NotExportableObject will result in an empty string and an error.
type ProgressHandler ¶
type ProgressHandler interface {
HandleInProgress(func())
}
ProgressHandler is a simple interface for the HandleInProgress method.
type ProtectedHostnameListRevision ¶
type ProtectedHostnameListRevision struct { Model DomainsJSON []byte `sql:"type:text"` IsActive bool RefreshedAt time.Time RefreshedBy string CreatedAt time.Time `json:"CreatedAt"` CreatedBy string `json:"CreatedBy"` }
ProtectedHostnameListRevision is a list of domains that encourage extra attention when changes are being made.
type RegistrarApprovalable ¶
type RegistrarApprovalable interface { GetRequiredApproverSets(dbCache *DBCache) ([]ApproverSet, error) GetInformedApproverSets(dbCache *DBCache) ([]ApproverSet, error) UpdateState(dbCache *DBCache, conf Config) (bool, []error) GetExportVersion() RegistrarObjectExport IsCancelled() bool HasPendingRevision() bool VerifyCR(dbCacheb *DBCache) (checksOut bool, errs []error) }
RegistrarApprovalable is an interface that is used for objects that may have revisions and can be used to get information related to the current state of a revision.
type RegistrarCRObject ¶
type RegistrarCRObject interface { RegistrarApprovalable SetID(ID int64) error GetID() int64 GetType() string Prepare(*DBCache) error GetCurrentRevisionID() sql.NullInt64 GetPendingRevisionID() int64 GetPendingCRID() sql.NullInt64 ComparePendingToCallback(loadFn CompareLoadFn) CompareReturnFn }
RegistrarCRObject is an implementation extension RegistrarApprovalable that includes methods for loading objects and other functions.
type RegistrarObject ¶
type RegistrarObject interface { ParseFromForm(request *http.Request, dbCache *DBCache) error ParseFromFormUpdate(request *http.Request, dbCache *DBCache, conf Config) error Prepare(dbCache *DBCache) error SetID(int64) error GetID() int64 GetType() string IsEditable() bool IsCancelled() bool GetPage(dbCache *DBCache, username string, email string) (RegistrarObjectPage, error) // TODO: Add paging support to getall page GetAllPage(dbCache *DBCache, username string, email string) (RegistrarObjectPage, error) TakeAction(response http.ResponseWriter, request *http.Request, dbCache *DBCache, actionName string, validCSRF bool, authMethod AuthType, conf Config) []error GetExportVersion() RegistrarObjectExport GetExportVersionAt(dbCache *DBCache, timestamp int64) (RegistrarObjectExport, error) }
RegistrarObject is defined to allow shared CRUD tasks within a single application.
func NewRegistrarObject ¶
func NewRegistrarObject(objectType string) (obj RegistrarObject, err error)
NewRegistrarObject will return the object that is of the type of the object type passed.
type RegistrarObjectExport ¶
RegistrarObjectExport is an interface that can be used to create a diff or json for export to be used in signing or verification operations. Export objects only include a restricted subset of object fields and prevent reference loops.
type RegistrarObjectPage ¶
RegistrarObjectPage is an interface that is used to define methods that can be used to help generate HTML templates.
type RegistrarParent ¶
type RegistrarParent interface { GetID() int64 GetPendingRevision() RegistrarObject }
RegistrarParent is an interface that represents a parent object where the child revision can be found.
type RevisionModeler ¶
type RevisionModeler interface { Modeler IsActive() bool GetRequiredApproverSets(dbCache *DBCache) (approverSets []ApproverSet, err error) GetInformedApproverSets(dbCache *DBCache) (approverSets []ApproverSet, err error) }
A RevisionModeler is a abstration of a revision model to a general purpose GetRequiredApproverSets and GetInformedApproverSets to be written for all base types (e.g. APIUser, Approver, etc.)
type SignatureResponse ¶
type SignatureResponse struct {
Signature []byte `json:"Signature" xml:"Signature"`
}
SignatureResponse is used to transmit a signed approval object from the server to the client.
type SignatureUpload ¶
type SignatureUpload SignatureResponse
SignatureUpload is used to transmit a signed approval object from a client to the server.
type TokenResponse ¶
TokenResponse is the object that is populated when a request is sent for a CSRF token over the api.
Source Files ¶
- alt_gorm.go
- api.go
- apiuser.go
- apiuserrevision.go
- approval.go
- approver.go
- approverrevision.go
- approverset.go
- approversetrevision.go
- bootstrap.go
- changerequest.go
- config.go
- contact.go
- contactrevision.go
- controls.go
- core.go
- db.go
- dbcache.go
- domain.go
- domainrevision.go
- epp.go
- host.go
- hostrevision.go
- logging.go
- registrarobject.go
- templates.go