github.com/oam-dev/kubevela@v1.9.11/apis/core.oam.dev/v1beta1/workflow_step_definition.go (about) 1 /* 2 Copyright 2021. The KubeVela Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package v1beta1 18 19 import ( 20 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 21 22 "github.com/oam-dev/kubevela/apis/core.oam.dev/condition" 23 24 "github.com/oam-dev/kubevela/apis/core.oam.dev/common" 25 ) 26 27 // WorkflowStepDefinitionSpec defines the desired state of WorkflowStepDefinition 28 type WorkflowStepDefinitionSpec struct { 29 // Reference to the CustomResourceDefinition that defines this trait kind. 30 Reference common.DefinitionReference `json:"definitionRef,omitempty"` 31 32 // Schematic defines the data format and template of the encapsulation of the workflow step definition. 33 // Only CUE schematic is supported for now. 34 // +optional 35 Schematic *common.Schematic `json:"schematic,omitempty"` 36 } 37 38 // WorkflowStepDefinitionStatus is the status of WorkflowStepDefinition 39 type WorkflowStepDefinitionStatus struct { 40 // ConditionedStatus reflects the observed status of a resource 41 condition.ConditionedStatus `json:",inline"` 42 // ConfigMapRef refer to a ConfigMap which contains OpenAPI V3 JSON schema of Component parameters. 43 ConfigMapRef string `json:"configMapRef,omitempty"` 44 // LatestRevision of the component definition 45 // +optional 46 LatestRevision *common.Revision `json:"latestRevision,omitempty"` 47 } 48 49 // SetConditions set condition for WorkflowStepDefinition 50 func (d *WorkflowStepDefinition) SetConditions(c ...condition.Condition) { 51 d.Status.SetConditions(c...) 52 } 53 54 // GetCondition gets condition from WorkflowStepDefinition 55 func (d *WorkflowStepDefinition) GetCondition(conditionType condition.ConditionType) condition.Condition { 56 return d.Status.GetCondition(conditionType) 57 } 58 59 // +kubebuilder:object:root=true 60 61 // WorkflowStepDefinition is the Schema for the workflowstepdefinitions API 62 // +kubebuilder:resource:scope=Namespaced,categories={oam},shortName=workflowstep 63 // +kubebuilder:storageversion 64 // +kubebuilder:subresource:status 65 // +genclient 66 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 67 type WorkflowStepDefinition struct { 68 metav1.TypeMeta `json:",inline"` 69 metav1.ObjectMeta `json:"metadata,omitempty"` 70 71 Spec WorkflowStepDefinitionSpec `json:"spec,omitempty"` 72 Status WorkflowStepDefinitionStatus `json:"status,omitempty"` 73 } 74 75 // +kubebuilder:object:root=true 76 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 77 78 // WorkflowStepDefinitionList contains a list of WorkflowStepDefinition 79 type WorkflowStepDefinitionList struct { 80 metav1.TypeMeta `json:",inline"` 81 metav1.ListMeta `json:"metadata,omitempty"` 82 Items []WorkflowStepDefinition `json:"items"` 83 }