MCPcopy Index your code
hub / github.com/cloudfoundry/cli / getCert

Function getCert

api/shared/wrap_for_cf_on_k8s.go:80–97  ·  view source on GitHub ↗
(restConfig *rest.Config)

Source from the content-addressed store, hash-verified

78}
79
80func 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
99type certRoundTripper struct {
100 cert *tls.Certificate

Callers 1

WrapForCFOnK8sAuthFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected