func()

in cmd/lb_create.go [77:107]


func (o *lbCreateOperation) setCertificateARNs(domainNames []string) []error {
	var (
		certificateARNs []string
		errs            []error
	)

	for _, domainName := range domainNames {
		if certificate, err := o.findCertificate(domainName); err == nil {
			if certificate.IsIssued() {
				certificateARNs = append(certificateARNs, certificate.ARN)
			} else {
				errs = append(errs, fmt.Errorf("certificate %s is in state %s", domainName, Humanize(certificate.Status)))
			}
		} else {
			switch err {
			case errCertificateNotFound:
				errs = append(errs, fmt.Errorf("no certificate found for %s", domainName))
			case errCertificateTooManyFound:
				errs = append(errs, fmt.Errorf("multiple certificates found for %s", domainName))
			default:
				errs = append(errs, fmt.Errorf("could not find certificate ARN: %v", err))
			}
		}
	}

	if len(errs) == 0 {
		o.certificateARNs = certificateARNs
	}

	return errs
}