diff options
author | Lukasz Rajewski <lukasz.rajewski@t-mobile.pl> | 2022-10-06 18:03:09 +0200 |
---|---|---|
committer | Lukasz Rajewski <lukasz.rajewski@t-mobile.pl> | 2022-10-06 18:41:42 +0000 |
commit | 04caefad432066ee233eb33899601a42a52b84c1 (patch) | |
tree | cd93875949892eb339e69714e3da6ffb09e961d1 /ms | |
parent | adc8f4c193a138f9cb06c145e16d56103acd5ecc (diff) |
UATExecutor support for k8sConnectionPlugin
Issue-ID: CCSDK-3785
Signed-off-by: Lukasz Rajewski <lukasz.rajewski@t-mobile.pl>
Change-Id: Ice34d61ac62fe8935a6df539376dcbb9e998beaf
Diffstat (limited to 'ms')
5 files changed, 22 insertions, 5 deletions
diff --git a/ms/blueprintsprocessor/functions/k8s-connection-plugin/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/K8sAbstractRestClientService.kt b/ms/blueprintsprocessor/functions/k8s-connection-plugin/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/K8sAbstractRestClientService.kt index b9c45e423..f0f8e298d 100644 --- a/ms/blueprintsprocessor/functions/k8s-connection-plugin/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/K8sAbstractRestClientService.kt +++ b/ms/blueprintsprocessor/functions/k8s-connection-plugin/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/K8sAbstractRestClientService.kt @@ -2,7 +2,7 @@ * Copyright © 2017-2018 AT&T Intellectual Property. * Modifications Copyright © 2019 IBM. * Modifications Copyright © 2021 Orange. - * Modifications Copyright © 2020 Deutsche Telekom AG. + * Modifications Copyright © 2022 Deutsche Telekom AG. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,12 +20,21 @@ package org.onap.ccsdk.cds.blueprintsprocessor.functions.k8s import org.onap.ccsdk.cds.blueprintsprocessor.rest.BasicAuthRestClientProperties +import org.onap.ccsdk.cds.blueprintsprocessor.rest.RestLibConstants import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BasicAuthRestClientService +import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BluePrintRestLibPropertyService +import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintDependencyService abstract class K8sAbstractRestClientService( - private val k8sConfiguration: K8sConnectionPluginConfiguration + private val k8sConfiguration: K8sConnectionPluginConfiguration, + clientName: String ) : BasicAuthRestClientService(BasicAuthRestClientProperties()) { + init { + val service: BluePrintRestLibPropertyService = BluePrintDependencyService.instance(RestLibConstants.SERVICE_BLUEPRINT_REST_LIB_PROPERTY) + service.interceptExternalBlueprintWebClientService(this, clientName) + } + protected val baseUrl: String = k8sConfiguration.getProperties().url private var restClientProperties: BasicAuthRestClientProperties? = null diff --git a/ms/blueprintsprocessor/functions/k8s-connection-plugin/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/definition/K8sDefinitionRestClient.kt b/ms/blueprintsprocessor/functions/k8s-connection-plugin/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/definition/K8sDefinitionRestClient.kt index 0c95fe3b6..224c6a884 100644 --- a/ms/blueprintsprocessor/functions/k8s-connection-plugin/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/definition/K8sDefinitionRestClient.kt +++ b/ms/blueprintsprocessor/functions/k8s-connection-plugin/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/definition/K8sDefinitionRestClient.kt @@ -26,7 +26,7 @@ open class K8sDefinitionRestClient( k8sConfiguration: K8sConnectionPluginConfiguration, private val definition: String, private val definitionVersion: String -) : K8sAbstractRestClientService(k8sConfiguration) { +) : K8sAbstractRestClientService(k8sConfiguration, "k8s-plugin-definition") { override fun apiUrl(): String { return "$baseUrl/v1/rb/definition/$definition/$definitionVersion" diff --git a/ms/blueprintsprocessor/functions/k8s-connection-plugin/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/instance/K8sRbInstanceRestClient.kt b/ms/blueprintsprocessor/functions/k8s-connection-plugin/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/instance/K8sRbInstanceRestClient.kt index 4c4da6200..9a28ed854 100644 --- a/ms/blueprintsprocessor/functions/k8s-connection-plugin/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/instance/K8sRbInstanceRestClient.kt +++ b/ms/blueprintsprocessor/functions/k8s-connection-plugin/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/instance/K8sRbInstanceRestClient.kt @@ -25,7 +25,7 @@ import org.onap.ccsdk.cds.blueprintsprocessor.functions.k8s.K8sConnectionPluginC open class K8sRbInstanceRestClient( k8sConfiguration: K8sConnectionPluginConfiguration, private val instanceId: String = "" -) : K8sAbstractRestClientService(k8sConfiguration) { +) : K8sAbstractRestClientService(k8sConfiguration, "k8s-plugin-instance") { override fun apiUrl(): String { return if (instanceId != "") diff --git a/ms/blueprintsprocessor/functions/k8s-connection-plugin/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/query/K8sQueryRestClient.kt b/ms/blueprintsprocessor/functions/k8s-connection-plugin/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/query/K8sQueryRestClient.kt index 672a3667d..b28c56d2d 100644 --- a/ms/blueprintsprocessor/functions/k8s-connection-plugin/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/query/K8sQueryRestClient.kt +++ b/ms/blueprintsprocessor/functions/k8s-connection-plugin/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/query/K8sQueryRestClient.kt @@ -23,7 +23,7 @@ import org.onap.ccsdk.cds.blueprintsprocessor.functions.k8s.K8sConnectionPluginC open class K8sQueryRestClient( k8sConfiguration: K8sConnectionPluginConfiguration -) : K8sAbstractRestClientService(k8sConfiguration) { +) : K8sAbstractRestClientService(k8sConfiguration, "k8s-plugin-query") { override fun apiUrl(): String { return "$baseUrl/v1/query" diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BluePrintRestLibPropertyService.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BluePrintRestLibPropertyService.kt index 4f91e547b..ac6cac2b7 100644 --- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BluePrintRestLibPropertyService.kt +++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BluePrintRestLibPropertyService.kt @@ -63,6 +63,14 @@ open class BluePrintRestLibPropertyService(private var bluePrintPropertiesServic return postInterceptor?.getInstance(selector, service) ?: service } + open fun interceptExternalBlueprintWebClientService( + externalService: BlueprintWebClientService, + selector: String + ): BlueprintWebClientService { + val service = preInterceptor?.getInstance(selector) ?: externalService + return postInterceptor?.getInstance(selector, service) ?: service + } + fun restClientProperties(prefix: String): RestClientProperties { val type = bluePrintPropertiesService.propertyBeanType( "$prefix.type", String::class.java |