github.com/oam-dev/kubevela@v1.9.11/charts/vela-core/templates/defwithtemplate/read-object.yaml (about)

     1  # Code generated by KubeVela templates. DO NOT EDIT. Please edit the original cue file.
     2  # Definition source cue file: vela-templates/definitions/internal/read-object.cue
     3  apiVersion: core.oam.dev/v1beta1
     4  kind: WorkflowStepDefinition
     5  metadata:
     6    annotations:
     7      custom.definition.oam.dev/category: Resource Management
     8      definition.oam.dev/description: Read Kubernetes objects from cluster for your workflow steps
     9    name: read-object
    10    namespace: {{ include "systemDefinitionNamespace" . }}
    11  spec:
    12    schematic:
    13      cue:
    14        template: |
    15          import (
    16          	"vela/op"
    17          )
    18  
    19          output: {
    20          	if parameter.apiVersion == _|_ && parameter.kind == _|_ {
    21          		op.#Read & {
    22          			value: {
    23          				apiVersion: "core.oam.dev/v1beta1"
    24          				kind:       "Application"
    25          				metadata: {
    26          					name: parameter.name
    27          					if parameter.namespace != _|_ {
    28          						namespace: parameter.namespace
    29          					}
    30          				}
    31          			}
    32          			cluster: parameter.cluster
    33          		}
    34          	}
    35          	if parameter.apiVersion != _|_ || parameter.kind != _|_ {
    36          		op.#Read & {
    37          			value: {
    38          				apiVersion: parameter.apiVersion
    39          				kind:       parameter.kind
    40          				metadata: {
    41          					name: parameter.name
    42          					if parameter.namespace != _|_ {
    43          						namespace: parameter.namespace
    44          					}
    45          				}
    46          			}
    47          			cluster: parameter.cluster
    48          		}
    49          	}
    50          }
    51          parameter: {
    52          	// +usage=Specify the apiVersion of the object, defaults to 'core.oam.dev/v1beta1'
    53          	apiVersion?: string
    54          	// +usage=Specify the kind of the object, defaults to Application
    55          	kind?: string
    56          	// +usage=Specify the name of the object
    57          	name: string
    58          	// +usage=The namespace of the resource you want to read
    59          	namespace?: *"default" | string
    60          	// +usage=The cluster you want to apply the resource to, default is the current control plane cluster
    61          	cluster: *"" | string
    62          }
    63