Documentation ¶
Index ¶
- Constants
- func Migrate(db *gorm.DB) error
- type Certificate
- type Route
- type RouteManager
- func (m *RouteManager) CheckRoutesToUpdate()
- func (m *RouteManager) Create(instanceId, domain string, origin string, defaultTTL int64, ...) (*Route, error)
- func (m *RouteManager) DeleteOrphanedCerts()
- func (m *RouteManager) Disable(r *Route) error
- func (m *RouteManager) Get(instanceId string) (*Route, error)
- func (m *RouteManager) GetCDNConfiguration(route *Route) (*cloudfront.Distribution, error)
- func (m *RouteManager) GetCurrentlyDeployedDomains(r *Route) ([]string, error)
- func (m *RouteManager) GetDNSChallenges(route *Route, onlyValidatingCertificates bool) ([]utils.DomainValidationChallenge, error)
- func (m *RouteManager) Poll(r *Route) error
- func (m *RouteManager) Update(instanceId string, domain *string, defaultTTL *int64, ...) (bool, error)
- type RouteManagerIface
- type RouteStore
- type RouteStoreInterface
- type State
Constants ¶
View Source
const ( CertificateStatusAttached string = "attached" CertificateStatusValidating string = "validating" CertificateStatusDeleted string = "deleted" CertificateStatusFailed string = "failed" )
View Source
const ProvisioningExpirationPeriodHours time.Duration = 84 * time.Hour
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Certificate ¶
type Certificate struct { gorm.Model RouteId uint Domain string CertURL string Certificate []byte Expires time.Time `gorm:"index"` // adding a certificateArn to this struct, so we can truck the requested/provisioned certificates by ACM CertificateArn string `gorm:"not null"` CertificateStatus string `gorm:"not null"` //(Attached, Validating, Deleted, failed) }
type Route ¶
type Route struct { gorm.Model InstanceId string `gorm:"not null;unique_index"` State State `gorm:"not null;index"` ChallengeJSON []byte DomainExternal string DomainInternal string DistId string Origin string Path string // Always empty, should not remove because it is in DB InsecureOrigin bool // Always false, should not remove because it is in DB DefaultTTL int64 `gorm:"default:86400"` ProvisioningSince *time.Time //using the same field to measure a time for Provisioning or Deprovisioning Certificates []Certificate }
func (*Route) BeforeCreate ¶
BeforeCreate hook will change the value of Provisioning_since field to time.Now() if creating a route in 'Provisioning' state if the state is 'Provisioned' then the value should be 'nil'
func (*Route) GetDomains ¶
func (*Route) IsProvisioningExpired ¶
the issue of a certificate in ACM has a time out limit of 72 hours plus few (12) hours to account for any unexpected delays we've got to the magic number of 84 hours represented by the const - ProvisioningExpirationPeriodHours
type RouteManager ¶
type RouteManager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func NewManager( logger lager.Logger, cloudFront utils.DistributionIface, settings config.Settings, routeStoreIface RouteStoreInterface, certsManager utils.CertificateManagerInterface, ) RouteManager
func (*RouteManager) CheckRoutesToUpdate ¶
func (m *RouteManager) CheckRoutesToUpdate()
func (*RouteManager) DeleteOrphanedCerts ¶
func (m *RouteManager) DeleteOrphanedCerts()
func (*RouteManager) Disable ¶
func (m *RouteManager) Disable(r *Route) error
func (*RouteManager) Get ¶
func (m *RouteManager) Get(instanceId string) (*Route, error)
Get a Route from a database, by instanceId
func (*RouteManager) GetCDNConfiguration ¶
func (m *RouteManager) GetCDNConfiguration(route *Route) (*cloudfront.Distribution, error)
func (*RouteManager) GetCurrentlyDeployedDomains ¶
func (m *RouteManager) GetCurrentlyDeployedDomains(r *Route) ([]string, error)
func (*RouteManager) GetDNSChallenges ¶
func (m *RouteManager) GetDNSChallenges(route *Route, onlyValidatingCertificates bool) ([]utils.DomainValidationChallenge, error)
func (*RouteManager) Poll ¶
func (m *RouteManager) Poll(r *Route) error
func (*RouteManager) Update ¶
func (m *RouteManager) Update( instanceId string, domain *string, defaultTTL *int64, forwardedHeaders *utils.Headers, forwardCookies *bool, ) (bool, error)
Update function updates the CDN route service and returns whether the update has been performed asynchronously or not this function is ONLY called when a tenant will issue 'cf service-update'
type RouteManagerIface ¶
type RouteManagerIface interface { Create( instanceId string, domain string, origin string, defaultTTL int64, forwardedHeaders utils.Headers, forwardCookies bool, tags map[string]string, ) (*Route, error) Update( instanceId string, domain *string, defaultTTL *int64, forwardedHeaders *utils.Headers, forwardCookies *bool, ) (bool, error) Get(instanceId string) (*Route, error) Poll(route *Route) error Disable(route *Route) error DeleteOrphanedCerts() GetDNSChallenges(route *Route, onlyValidatingCertificates bool) ([]utils.DomainValidationChallenge, error) GetCDNConfiguration(route *Route) (*cloudfront.Distribution, error) }
type RouteStore ¶
func (RouteStore) Create ¶
func (r RouteStore) Create(route *Route) error
func (RouteStore) FindAllMatching ¶
func (r RouteStore) FindAllMatching(route Route) ([]Route, error)
func (RouteStore) FindOneMatching ¶
func (r RouteStore) FindOneMatching(route Route) (Route, error)
func (RouteStore) Save ¶
func (r RouteStore) Save(route *Route) error
type RouteStoreInterface ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.