import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import com.fasterxml.jackson.module.kotlin.readValue
import org.onap.ccsdk.cds.blueprintsprocessor.functions.k8s.K8sConnectionPluginConfiguration
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.k8s.instance.K8sRbInstanceRestClient.Companion.getK8sRbInstanceRestClient
import org.onap.ccsdk.cds.blueprintsprocessor.functions.k8s.instance.healthcheck.K8sRbInstanceHealthCheck
import org.onap.ccsdk.cds.blueprintsprocessor.functions.k8s.instance.healthcheck.K8sRbInstanceHealthCheckList
import org.onap.ccsdk.cds.blueprintsprocessor.functions.k8s.instance.healthcheck.K8sRbInstanceHealthCheckSimple
private val log = LoggerFactory.getLogger(K8sPluginInstanceApi::class.java)!!
fun getInstanceList(): List<K8sRbInstance>? {
- val rbInstanceService = K8sRbInstanceRestClient(k8sConfiguration)
+ val rbInstanceService = getK8sRbInstanceRestClient(k8sConfiguration)
try {
val result: BlueprintWebClientService.WebClientResponse<String> = rbInstanceService.exchangeResource(
GET.name,
}
fun getInstanceById(instanceId: String): K8sRbInstance? {
- val rbInstanceService = K8sRbInstanceRestClient(k8sConfiguration, instanceId)
+ val rbInstanceService = getK8sRbInstanceRestClient(k8sConfiguration, instanceId)
try {
val result: BlueprintWebClientService.WebClientResponse<String> = rbInstanceService.exchangeResource(
GET.name,
}
fun getFullInstanceById(instanceId: String): K8sRbInstanceFull? {
- val rbInstanceService = K8sRbInstanceRestClient(k8sConfiguration, instanceId)
+ val rbInstanceService = getK8sRbInstanceRestClient(k8sConfiguration, instanceId)
try {
val result: BlueprintWebClientService.WebClientResponse<String> = rbInstanceService.exchangeResource(
GET.name,
}
fun getInstanceStatus(instanceId: String): K8sRbInstanceStatus? {
- val rbInstanceService = K8sRbInstanceRestClient(k8sConfiguration, instanceId)
+ val rbInstanceService = getK8sRbInstanceRestClient(k8sConfiguration, instanceId)
try {
val result: BlueprintWebClientService.WebClientResponse<String> = rbInstanceService.exchangeResource(
GET.name,
name: String? = null,
labels: Map<String, String>? = null
): K8sRbInstanceStatus? {
- val rbInstanceService = K8sRbInstanceRestClient(k8sConfiguration, instanceId)
+ val rbInstanceService = getK8sRbInstanceRestClient(k8sConfiguration, instanceId)
try {
var path: String = "/query?ApiVersion=$apiVersion&Kind=$kind"
if (name != null)
}
fun getInstanceHealthCheckList(instanceId: String): K8sRbInstanceHealthCheckList? {
- val rbInstanceService = K8sRbInstanceRestClient(k8sConfiguration, instanceId)
+ val rbInstanceService = getK8sRbInstanceRestClient(k8sConfiguration, instanceId)
try {
val result: BlueprintWebClientService.WebClientResponse<String> = rbInstanceService.exchangeResource(
GET.name,
}
fun getInstanceHealthCheck(instanceId: String, healthCheckId: String): K8sRbInstanceHealthCheck? {
- val rbInstanceService = K8sRbInstanceRestClient(k8sConfiguration, instanceId)
+ val rbInstanceService = getK8sRbInstanceRestClient(k8sConfiguration, instanceId)
try {
val result: BlueprintWebClientService.WebClientResponse<String> = rbInstanceService.exchangeResource(
GET.name,
}
fun startInstanceHealthCheck(instanceId: String): K8sRbInstanceHealthCheckSimple? {
- val rbInstanceService = K8sRbInstanceRestClient(k8sConfiguration, instanceId)
+ val rbInstanceService = getK8sRbInstanceRestClient(k8sConfiguration, instanceId)
try {
val result: BlueprintWebClientService.WebClientResponse<String> = rbInstanceService.exchangeResource(
POST.name,
}
fun createConfigurationValues(configValues: K8sConfigValueRequest, instanceId: String): K8sConfigValueResponse? {
- val rbInstanceService = K8sRbInstanceRestClient(k8sConfiguration, instanceId)
+ val rbInstanceService = getK8sRbInstanceRestClient(k8sConfiguration, instanceId)
try {
val result: BlueprintWebClientService.WebClientResponse<String> = rbInstanceService.exchangeResource(
POST.name,
}
fun editConfigurationValues(configValues: K8sConfigValueRequest, instanceId: String, configName: String): K8sConfigValueResponse? {
- val rbInstanceService = K8sRbInstanceRestClient(k8sConfiguration, instanceId)
+ val rbInstanceService = getK8sRbInstanceRestClient(k8sConfiguration, instanceId)
try {
val result: BlueprintWebClientService.WebClientResponse<String> = rbInstanceService.exchangeResource(
PUT.name,
}
fun editConfigurationValuesByDelete(instanceId: String, configName: String): K8sConfigValueResponse? {
- val rbInstanceService = K8sRbInstanceRestClient(k8sConfiguration, instanceId)
+ val rbInstanceService = getK8sRbInstanceRestClient(k8sConfiguration, instanceId)
try {
val result: BlueprintWebClientService.WebClientResponse<String> = rbInstanceService.exchangeResource(
POST.name,
}
fun hasConfigurationValues(instanceId: String, configName: String): Boolean {
- val rbInstanceService = K8sRbInstanceRestClient(k8sConfiguration, instanceId)
+ val rbInstanceService = getK8sRbInstanceRestClient(k8sConfiguration, instanceId)
try {
val result: BlueprintWebClientService.WebClientResponse<String> = rbInstanceService.exchangeResource(
GET.name,
}
fun hasConfigurationValuesVersion(instanceId: String, configName: String, version: String): Boolean {
- val rbInstanceService = K8sRbInstanceRestClient(k8sConfiguration, instanceId)
+ val rbInstanceService = getK8sRbInstanceRestClient(k8sConfiguration, instanceId)
try {
val result: BlueprintWebClientService.WebClientResponse<String> = rbInstanceService.exchangeResource(
GET.name,
}
fun getConfigurationValues(instanceId: String, configName: String): K8sConfigValueResponse? {
- val rbInstanceService = K8sRbInstanceRestClient(k8sConfiguration, instanceId)
+ val rbInstanceService = getK8sRbInstanceRestClient(k8sConfiguration, instanceId)
try {
val result: BlueprintWebClientService.WebClientResponse<String> = rbInstanceService.exchangeResource(
GET.name,
}
fun getConfigurationValuesVersion(instanceId: String, configName: String, version: String): K8sConfigValueResponse? {
- val rbInstanceService = K8sRbInstanceRestClient(k8sConfiguration, instanceId)
+ val rbInstanceService = getK8sRbInstanceRestClient(k8sConfiguration, instanceId)
try {
val result: BlueprintWebClientService.WebClientResponse<String> = rbInstanceService.exchangeResource(
GET.name,
}
fun getConfigurationValuesVersionByTag(instanceId: String, configName: String, tag: String): K8sConfigValueResponse? {
- val rbInstanceService = K8sRbInstanceRestClient(k8sConfiguration, instanceId)
+ val rbInstanceService = getK8sRbInstanceRestClient(k8sConfiguration, instanceId)
try {
val result: BlueprintWebClientService.WebClientResponse<String> = rbInstanceService.exchangeResource(
GET.name,
}
fun getConfigurationValuesList(instanceId: String): List<K8sConfigValueResponse>? {
- val rbInstanceService = K8sRbInstanceRestClient(k8sConfiguration, instanceId)
+ val rbInstanceService = getK8sRbInstanceRestClient(k8sConfiguration, instanceId)
try {
val result: BlueprintWebClientService.WebClientResponse<String> = rbInstanceService.exchangeResource(
GET.name,
}
fun getConfigurationValuesVersionList(instanceId: String, configName: String): List<K8sConfigValueResponse>? {
- val rbInstanceService = K8sRbInstanceRestClient(k8sConfiguration, instanceId)
+ val rbInstanceService = getK8sRbInstanceRestClient(k8sConfiguration, instanceId)
try {
val result: BlueprintWebClientService.WebClientResponse<String> = rbInstanceService.exchangeResource(
GET.name,
}
fun getConfigurationValuesTagList(instanceId: String, configName: String): List<K8sConfigValueTag>? {
- val rbInstanceService = K8sRbInstanceRestClient(k8sConfiguration, instanceId)
+ val rbInstanceService = getK8sRbInstanceRestClient(k8sConfiguration, instanceId)
try {
val result: BlueprintWebClientService.WebClientResponse<String> = rbInstanceService.exchangeResource(
GET.name,
}
fun deleteConfigurationValues(instanceId: String, configName: String, deleteConfigOnly: Boolean) {
- val rbInstanceService = K8sRbInstanceRestClient(k8sConfiguration, instanceId)
+ val rbInstanceService = getK8sRbInstanceRestClient(k8sConfiguration, instanceId)
try {
var path: String = "/config/$configName"
if (deleteConfigOnly)
}
fun rollbackConfigurationValues(instanceId: String, configName: String, configVersion: String?, configTag: String?) {
- val rbInstanceService = K8sRbInstanceRestClient(k8sConfiguration, instanceId)
+ val rbInstanceService = getK8sRbInstanceRestClient(k8sConfiguration, instanceId)
try {
val configValues = hashMapOf<String, String>()
if (configVersion != null)
}
fun tagConfigurationValues(instanceId: String, configName: String, tagName: String) {
- val rbInstanceService = K8sRbInstanceRestClient(k8sConfiguration, instanceId)
+ val rbInstanceService = getK8sRbInstanceRestClient(k8sConfiguration, instanceId)
try {
val configValues = hashMapOf<String, String>()
configValues["tag-name"] = tagName
}
fun deleteInstanceHealthCheck(instanceId: String, healthCheckId: String) {
- val rbInstanceService = K8sRbInstanceRestClient(k8sConfiguration, instanceId)
+ val rbInstanceService = getK8sRbInstanceRestClient(k8sConfiguration, instanceId)
try {
val result: BlueprintWebClientService.WebClientResponse<String> = rbInstanceService.exchangeResource(
DELETE.name,