aboutsummaryrefslogtreecommitdiffstats
path: root/certServiceK8sExternalProvider/src/certserviceclient/cert_service_client_factory.go
diff options
context:
space:
mode:
Diffstat (limited to 'certServiceK8sExternalProvider/src/certserviceclient/cert_service_client_factory.go')
-rw-r--r--certServiceK8sExternalProvider/src/certserviceclient/cert_service_client_factory.go15
1 files changed, 9 insertions, 6 deletions
diff --git a/certServiceK8sExternalProvider/src/certserviceclient/cert_service_client_factory.go b/certServiceK8sExternalProvider/src/certserviceclient/cert_service_client_factory.go
index 0fa1d165..380cbcf9 100644
--- a/certServiceK8sExternalProvider/src/certserviceclient/cert_service_client_factory.go
+++ b/certServiceK8sExternalProvider/src/certserviceclient/cert_service_client_factory.go
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* oom-certservice-k8s-external-provider
* ================================================================================
- * Copyright (C) 2020 Nokia. All rights reserved.
+ * Copyright (C) 2020-2021 Nokia. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,7 +29,7 @@ import (
"path"
)
-func CreateCertServiceClient(baseUrl string, healthEndpoint string, certEndpoint string, caName string,
+func CreateCertServiceClient(baseUrl string, healthEndpoint string, certEndpoint string, updateEndpoint string, caName string,
keyPemBase64 []byte, certPemBase64 []byte, cacertPemBase64 []byte) (*CertServiceClientImpl, error) {
cert, err := tls.X509KeyPair(certPemBase64, keyPemBase64)
if err != nil {
@@ -49,31 +49,34 @@ func CreateCertServiceClient(baseUrl string, healthEndpoint string, certEndpoint
},
},
}
- healthUrl, certificationUrl, err := validateAndParseUrls(baseUrl, healthEndpoint, certEndpoint, caName)
+ healthUrl, certificationUrl, updateUrl, err := validateAndParseUrls(baseUrl, healthEndpoint, certEndpoint, updateEndpoint, caName)
if err != nil {
return nil, err
}
client := CertServiceClientImpl{
healthUrl: healthUrl,
certificationUrl: certificationUrl,
+ updateUrl: updateUrl,
httpClient: httpClient,
}
return &client, nil
}
-func validateAndParseUrls(baseUrl string, healthEndpoint string, certEndpoint string, caName string) (string, string, error) {
+func validateAndParseUrls(baseUrl string, healthEndpoint string, certEndpoint string, updateEndpoint string, caName string) (string, string, string, error) {
if err := validateUrls(baseUrl, healthEndpoint, certEndpoint, caName); err != nil {
- return "", "", err
+ return "", "", "", err
}
certUrl, _ := url.Parse(baseUrl)
healthUrl, _ := url.Parse(baseUrl)
+ updateUrl, _ := url.Parse(baseUrl)
certUrl.Path = path.Join(certEndpoint, caName)
healthUrl.Path = path.Join(healthEndpoint)
+ updateUrl.Path = path.Join(updateEndpoint, caName)
- return healthUrl.String(), certUrl.String(), nil
+ return healthUrl.String(), certUrl.String(), updateUrl.String(), nil
}
func validateUrls(baseUrl string, healthEndpoint string, certEndpoint string, caName string) error {