(restConfig *rest.Config)
| 78 | } |
| 79 | |
| 80 | func getCert(restConfig *rest.Config) (*tls.Certificate, error) { |
| 81 | tlsConfig, err := rest.TLSConfigFor(restConfig) |
| 82 | if err != nil { |
| 83 | return nil, fmt.Errorf("failed to get tls config: %w", err) |
| 84 | } |
| 85 | |
| 86 | if tlsConfig != nil && tlsConfig.GetClientCertificate != nil { |
| 87 | cert, err := tlsConfig.GetClientCertificate(nil) |
| 88 | if err != nil { |
| 89 | return nil, fmt.Errorf("failed to get client certificate: %w", err) |
| 90 | } |
| 91 | |
| 92 | if len(cert.Certificate) > 0 && cert.PrivateKey != nil { |
| 93 | return cert, nil |
| 94 | } |
| 95 | } |
| 96 | return nil, nil |
| 97 | } |
| 98 | |
| 99 | type certRoundTripper struct { |
| 100 | cert *tls.Certificate |
no outgoing calls
no test coverage detected