diff options
author | 2021-07-13 16:47:08 +0200 | |
---|---|---|
committer | 2021-07-15 12:15:13 +0200 | |
commit | d63a4674317497fd6700c52c705649ce85ac3725 (patch) | |
tree | cd649e56e8eef1ba06ec89c164bbe8739dd0cd4b /certServiceK8sExternalProvider/src/certserviceclient/cert_service_client_factory.go | |
parent | 78b60d22b8779d1fbf3e27287b9774862f71404b (diff) |
[OOM-K8S-CERT-EXTERNAL-PROVIDER] Add send update request functionality
Issue-ID: OOM-2753
Signed-off-by: Tomasz Wrobel <tomasz.wrobel@nokia.com>
Change-Id: I0637ded5c870cc66c7dc27dff269dab0f7d9015b
Diffstat (limited to 'certServiceK8sExternalProvider/src/certserviceclient/cert_service_client_factory.go')
-rw-r--r-- | certServiceK8sExternalProvider/src/certserviceclient/cert_service_client_factory.go | 15 |
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 { |