github.com/kubeshop/testkube@v1.17.23/pkg/api/v1/testkube/model_variable_extended.go (about) 1 /* 2 * Testkube API 3 * 4 * Testkube provides a Kubernetes-native framework for test definition, execution and results 5 * 6 * API version: 1.0.0 7 * Contact: testkube@kubeshop.io 8 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) 9 */ 10 package testkube 11 12 func NewBasicVariable(name, value string) Variable { 13 return Variable{ 14 Name: name, 15 Value: value, 16 Type_: VariableTypeBasic, 17 } 18 } 19 20 func NewConfigMapVariableReference(name, configMap, key string) Variable { 21 return Variable{ 22 Name: name, 23 Type_: VariableTypeBasic, 24 ConfigMapRef: &ConfigMapRef{ 25 Name: configMap, 26 Key: key, 27 }, 28 } 29 } 30 31 func NewSecretVariable(name, value string) Variable { 32 return Variable{ 33 Name: name, 34 Value: value, 35 Type_: VariableTypeSecret, 36 } 37 } 38 39 func NewSecretVariableReference(name, secret, key string) Variable { 40 return Variable{ 41 Name: name, 42 Type_: VariableTypeSecret, 43 SecretRef: &SecretRef{ 44 Name: secret, 45 Key: key, 46 }, 47 } 48 } 49 50 func (v *Variable) IsSecret() bool { 51 return *v.Type_ == *VariableTypeSecret 52 }