github.com/kubeshop/testkube@v1.17.23/pkg/tcl/mappertcl/tests/openapi_kube.go (about) 1 // Copyright 2024 Testkube. 2 // 3 // Licensed as a Testkube Pro file under the Testkube Community 4 // License (the "License"); you may not use this file except in compliance with 5 // the License. You may obtain a copy of the License at 6 // 7 // https://github.com/kubeshop/testkube/blob/main/licenses/TCL.txt 8 9 package tests 10 11 import ( 12 testsv3 "github.com/kubeshop/testkube-operator/api/tests/v3" 13 "github.com/kubeshop/testkube/pkg/api/v1/testkube" 14 ) 15 16 // MapExecutionRequestToSpecExecutionRequest maps ExecutionRequest OpenAPI spec to ExecutionRequest CRD spec 17 func MapExecutionRequestToSpecExecutionRequest(sourceRequest *testkube.ExecutionRequest, 18 destinationRequest *testsv3.ExecutionRequest) *testsv3.ExecutionRequest { 19 if sourceRequest == nil || destinationRequest == nil { 20 return destinationRequest 21 } 22 23 destinationRequest.ExecutionNamespace = sourceRequest.ExecutionNamespace 24 return destinationRequest 25 } 26 27 // MapExecutionUpdateRequestToSpecExecutionRequest maps ExecutionUpdateRequest OpenAPI spec to ExecutionRequest CRD spec 28 func MapExecutionUpdateRequestToSpecExecutionRequest(sourceRequest *testkube.ExecutionUpdateRequest, 29 destinationRequest *testsv3.ExecutionRequest) bool { 30 if sourceRequest == nil || destinationRequest == nil { 31 return true 32 } 33 34 if sourceRequest.ExecutionNamespace != nil { 35 destinationRequest.ExecutionNamespace = *sourceRequest.ExecutionNamespace 36 return false 37 } 38 39 return true 40 }