utils

package
v0.0.0-...-875c423 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2023 License: CC0-1.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const CertificateTagName string = "ServiceInstance"
View Source
const ManagedByTagName string = "ManagedBy"
View Source
const ManagedByTagValue string = "cdn-broker"

Variables

View Source
var ErrValidationTimedOut = errors.New("validation timed out")

ErrValidationTimedOut is the error that we return when the validation of the certificate has timed out, no further explanation is offered by the ACM API.

Functions

func StrSlicesAreEqual

func StrSlicesAreEqual(ss1 []string, ss2 []string) bool

StrSlicesAreEqual returns a bool val if ss1 and ss2 contain the same elems

Types

type CertificateDetails

type CertificateDetails struct {
	CertificateArn *string
	Status         *string
	InUseBy        []*string
	IssuedAt       *time.Time
	Tags           []*acm.Tag
}

type CertificateManager

type CertificateManager struct {
	Logger   lager.Logger
	Settings config.Settings
	Service  *acm.ACM
}

func (*CertificateManager) DeleteCertificate

func (cm *CertificateManager) DeleteCertificate(arn string) error

func (*CertificateManager) GetDomainValidationChallenges

func (cm *CertificateManager) GetDomainValidationChallenges(arn string) ([]DomainValidationChallenge, error)

func (*CertificateManager) IsCertificateIssued

func (cm *CertificateManager) IsCertificateIssued(arn string) (bool, error)

func (*CertificateManager) ListIssuedCertificates

func (cm *CertificateManager) ListIssuedCertificates() ([]CertificateDetails, error)

func (*CertificateManager) RequestCertificate

func (cm *CertificateManager) RequestCertificate(ds []string, instanceID string) (*string, error)

type CertificateManagerInterface

type CertificateManagerInterface interface {
	//the original is func (c *ACM) RequestCertificate(input *RequestCertificateInput) (*RequestCertificateOutput, error)
	//we only need to supply the DomainName and SubjectAlternativeNames, everything else can be derived from these.
	//we will be using only DNS validation
	//CertificateArn - *string
	RequestCertificate(ds []string, instanceID string) (*string, error)

	DeleteCertificate(arn string) error

	IsCertificateIssued(arn string) (bool, error)

	GetDomainValidationChallenges(arn string) ([]DomainValidationChallenge, error)

	ListIssuedCertificates() ([]CertificateDetails, error)
}

func NewCertificateManager

func NewCertificateManager(logger lager.Logger, settings config.Settings, session *session.Session) CertificateManagerInterface

NewCertificateManager retruns the NewCertificateManagerInterface, forceing ACM to be in Virginia (us-east-1) region, becuase CloudFront only supports reading certs from that region ONLY for more details - https://docs.aws.amazon.com/cloudfront/latest/APIReference/API_ViewerCertificate.html#cloudfront-Type-ViewerCertificate-ACMCertificateArn

type Distribution

type Distribution struct {
	Settings config.Settings
	Service  cloudfrontiface.CloudFrontAPI
}

func (*Distribution) Create

func (d *Distribution) Create(callerReference string, domains []string, origin string, defaultTTL int64, forwardedHeaders Headers, forwardCookies bool, tags map[string]string) (*cloudfront.Distribution, error)

func (*Distribution) Delete

func (d *Distribution) Delete(distId string) (bool, error)

func (*Distribution) Disable

func (d *Distribution) Disable(distId string) error

func (*Distribution) Get

func (d *Distribution) Get(distId string) (*cloudfront.Distribution, error)

func (*Distribution) ListDistributions

func (d *Distribution) ListDistributions(callback func(cloudfront.DistributionSummary) bool) error

func (*Distribution) SetCertificateAndCname

func (d *Distribution) SetCertificateAndCname(distId, certId string, domains []string) error

func (*Distribution) Update

func (d *Distribution) Update(
	distId string,
	domains *[]string,
	origin string,
	defaultTTL *int64,
	forwardedHeaders *Headers,
	forwardCookies *bool,
) (*cloudfront.Distribution, error)

type DistributionIface

type DistributionIface interface {
	Create(callerReference string, domains []string, origin string, defaultTTL int64, forwardedHeaders Headers, forwardCookies bool, tags map[string]string) (*cloudfront.Distribution, error)
	Update(distId string, domains *[]string, origin string, defaultTTL *int64, forwardedHeaders *Headers, forwardCookies *bool) (*cloudfront.Distribution, error)
	Get(distId string) (*cloudfront.Distribution, error)
	SetCertificateAndCname(distId, certId string, domains []string) error
	Disable(distId string) error
	Delete(distId string) (bool, error)
	ListDistributions(callback func(cloudfront.DistributionSummary) bool) error
}

type DomainValidationChallenge

type DomainValidationChallenge struct {
	DomainName string `json:"validating_domain_name"`

	RecordName string `json:"challenge_dns_record"`
	// RecordType can be only of CNAME type
	// const acm.RecordTypeCname represents that
	RecordType string `json:"challenges_dns_record_type"`

	RecordValue string `json:"challenges_dns_record_value"`
	// The validation status of the domain name. This can be one of the following
	// values:
	//
	//    * PENDING_VALIDATION
	//
	//    * SUCCESS
	//
	//    * FAILED
	ValidationStatus string `json:"status"`
}

type Headers

type Headers map[string]bool

func (Headers) Add

func (h Headers) Add(header string)

func (Headers) Contains

func (h Headers) Contains(header string) bool

func (Headers) Strings

func (h Headers) Strings() []string

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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