github.com/CycloneDX/sbom-utility@v0.16.0/schema/cyclonedx_formulation.go (about) 1 // SPDX-License-Identifier: Apache-2.0 2 /* 3 * Licensed to the Apache Software Foundation (ASF) under one or more 4 * contributor license agreements. See the NOTICE file distributed with 5 * this work for additional information regarding copyright ownership. 6 * The ASF licenses this file to You under the Apache License, Version 2.0 7 * (the "License"); you may not use this file except in compliance with 8 * the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 */ 18 19 package schema 20 21 // v1.5: added 22 // NOTE: CDXRefType is a named `string` type as of v1.5 23 type CDXFormula struct { 24 BOMRef *CDXRefType `json:"bom-ref,omitempty"` // v1.5 25 Components *[]CDXComponent `json:"components,omitempty"` // v1.5 26 Services *[]CDXService `json:"services,omitempty"` // v1.5 27 Workflows *[]CDXWorkflow `json:"workflows,omitempty"` // v1.5 28 Properties *[]CDXProperty `json:"properties,omitempty"` // v1.5 29 } 30 31 // v1.5: added 32 // NOTE: CDXRefType is a named `string` type as of v1.5 33 type CDXWorkflow struct { // v1.5 34 Uid string `json:"uid,omitempty"` // v1.5 35 Name string `json:"name,omitempty"` // v1.5 36 BOMRef *CDXRefType `json:"bom-ref,omitempty"` 37 Description string `json:"description,omitempty"` // v1.5 38 ResourceReferences *[]CDXResourceReferenceChoice `json:"resourceReferences,omitempty"` // v1.5 39 Tasks *[]CDXTask `json:"tasks,omitempty"` // v1.5 40 TaskDependencies *[]CDXDependency `json:"taskDependencies,omitempty"` // v1.5 41 TaskTypes *[]CDXTaskType `json:"taskTypes,omitempty"` // v1.5 42 Trigger CDXTrigger `json:"trigger,omitempty"` // v1.5 43 Steps *[]CDXStep `json:"steps,omitempty"` // v1.5 44 Inputs *[]CDXInputType `json:"inputs,omitempty"` // v1.5 45 Outputs *[]CDXOutputType `json:"outputs,omitempty"` // v1.5 46 TimeStart string `json:"timeStart,omitempty"` // v1.5 47 TimeEnd string `json:"timeEnd,omitempty"` // v1.5 48 Workspaces *[]CDXWorkspace `json:"workspaces,omitempty"` // v1.5 49 RuntimeTopology *[]CDXDependency `json:"runtimeTopology,omitempty"` // v1.5 50 Properties *[]CDXProperty `json:"properties,omitempty"` // v1.5 51 } 52 53 // v1.5: added 54 // NOTE: CDXRefType is a named `string` type as of v1.5 55 type CDXTask struct { 56 BOMRef *CDXRefType `json:"bom-ref,omitempty"` // v1.5 57 Uid string `json:"uid,omitempty"` // v1.5 58 Name string `json:"name,omitempty"` // v1.5 59 Description string `json:"description,omitempty"` // v1.5 60 ResourceReferences *[]CDXResourceReferenceChoice `json:"resourceReferences,omitempty"` // v1.5 61 TaskTypes *[]CDXTaskType `json:"taskTypes,omitempty"` // v1.5 62 Trigger CDXTrigger `json:"trigger,omitempty"` // v1.5 63 Steps *[]CDXStep `json:"steps,omitempty"` // v1.5 64 Inputs *[]CDXInputType `json:"inputs,omitempty"` // v1.5 65 Outputs *[]CDXOutputType `json:"outputs,omitempty"` // v1.5 66 TimeStart string `json:"timeStart,omitempty"` // v1.5 67 TimeEnd string `json:"timeEnd,omitempty"` // v1.5 68 Workspaces *[]CDXWorkspace `json:"workspaces,omitempty"` // v1.5 69 RuntimeTopology *[]CDXDependency `json:"runtimeTopology,omitempty"` // v1.5 70 Properties *[]CDXProperty `json:"properties,omitempty"` // v1.5 71 } 72 73 // v1.5: added 74 // "enum": ["copy","clone","lint","scan","merge","build","test","deliver","deploy","release","clean","other"] 75 type CDXTaskType string // v1.5 76 77 // v1.5: added 78 type CDXStep struct { 79 Name string `json:"name,omitempty"` // v1.5 80 Description string `json:"description,omitempty"` // v1.5 81 Commands *[]CDXCommand `json:"commands,omitempty"` // v1.5 82 Properties *[]CDXProperty `json:"properties,omitempty"` // v1.5 83 } 84 85 // v1.5: added 86 type CDXCommand struct { 87 Executed bool `json:"executed,omitempty"` // v1.5 88 Properties *[]CDXProperty `json:"properties,omitempty"` // v1.5 89 } 90 91 // v1.5: added 92 // NOTE: CDXRefType is a named `string` type as of v1.5 93 type CDXWorkspace struct { 94 BOMRef CDXRefType `json:"bom-ref,omitempty"` // v1.5 95 Uid string `json:"uid,omitempty"` // v1.5 96 Name string `json:"name,omitempty"` // v1.5 97 Aliases *[]string `json:"aliases,omitempty"` // v1.5 98 Description string `json:"description,omitempty"` // v1.5 99 ResourceReferences *[]CDXResourceReferenceChoice `json:"resourceReferences,omitempty"` // v1.5 100 AccessMode string `json:"accessMode,omitempty"` // v1.5 101 MountPath string `json:"mountPath,omitempty"` // v1.5 102 ManagedDataType string `json:"managedDataType,omitempty"` // v1.5 103 VolumeRequest string `json:"volumeRequest,omitempty"` // v1.5 104 Volume CDXVolume `json:"volume,omitempty"` // v1.5 105 Properties *[]CDXProperty `json:"properties,omitempty"` // v1.5 106 } 107 108 // v1.5: added 109 // NOTE: CDXRefType is a named `string` type as of v1.5 110 type CDXVolume struct { 111 Uid string `json:"uid,omitempty"` // v1.5 112 Name string `json:"name,omitempty"` // v1.5 113 Mode string `json:"mode,omitempty"` // v1.5 114 Path string `json:"path,omitempty"` // v1.5 115 SizeAllocated string `json:"sizeAllocated,omitempty"` // v1.5 116 Persistent bool `json:"persistent,omitempty"` // v1.5 117 Remote bool `json:"remote,omitempty"` // v1.5 118 Properties *[]CDXProperty `json:"properties,omitempty"` // v1.5 119 } 120 121 type CDXTrigger struct { 122 BOMRef CDXRefType `json:"bom-ref,omitempty"` // v1.5 123 Uid string `json:"uid,omitempty"` // v1.5 124 Name string `json:"name,omitempty"` // v1.5 125 Description string `json:"description,omitempty"` // v1.5 126 ResourceReferences *[]CDXResourceReferenceChoice `json:"resourceReferences,omitempty"` // v1.5 127 Type string `json:"type,omitempty"` // v1.5 // "enum": ["manual", "api", "webhook","scheduled"] 128 Event CDXEvent `json:"event,omitempty"` // v1.5 129 Condition CDXCondition `json:"condition,omitempty"` // v1.5 130 TimeActivated string `json:"timeActivated,omitempty"` // v1.5 131 Inputs *[]CDXInputType `json:"inputs,omitempty"` // v1.5 132 Outputs *[]CDXOutputType `json:"outputs,omitempty"` // v1.5 133 Properties *[]CDXProperty `json:"properties,omitempty"` // v1.5 134 } 135 136 type CDXEvent struct { 137 Uid string `json:"uid,omitempty"` // v1.5 138 Description string `json:"description,omitempty"` // v1.5 139 TimeReceived string `json:"timeReceived,omitempty"` // v1.5 140 Data CDXAttachment `json:"data,omitempty"` // v1.5 141 Source CDXResourceReferenceChoice `json:"source,omitempty"` // v1.5 142 Target CDXResourceReferenceChoice `json:"target,omitempty"` // v1.5 143 Properties *[]CDXProperty `json:"properties,omitempty"` // v1.5 144 } 145 146 // v1.5: added 147 // TODO: see if we can improve "environmentVars" types which is "oneOf": ["#/definitions/property", "string"] 148 type CDXInputType struct { 149 Source CDXResourceReferenceChoice `json:"source,omitempty"` // v1.5 150 Target CDXResourceReferenceChoice `json:"target,omitempty"` // v1.5 151 Resource CDXResourceReferenceChoice `json:"resource,omitempty"` // v1.5 152 Data CDXAttachment `json:"data,omitempty"` // v1.5 153 Parameters *[]CDXParameter `json:"parameters,omitempty"` // v1.5 154 EnvironmentVars *[]interface{} `json:"environmentVars,omitempty"` // v1.5 155 Properties *[]CDXProperty `json:"properties,omitempty"` // v1.5 156 } 157 158 // v1.5: added 159 // TODO: likely nothing better we can do for "environmentVars" which is type "oneOf": ["#/definitions/property", "string"] 160 type CDXOutputType struct { 161 Type string `json:"type,omitempty"` // "enum": ["artifact", "attestation", "log", "evidence", "metrics", "other"] 162 Source CDXResourceReferenceChoice `json:"source,omitempty"` // v1.5 163 Target CDXResourceReferenceChoice `json:"target,omitempty"` // v1.5 164 Resource CDXResourceReferenceChoice `json:"resource,omitempty"` // v1.5 165 Data CDXAttachment `json:"data,omitempty"` // v1.5 166 EnvironmentVars *[]interface{} `json:"environmentVars,omitempty"` // v1.5 167 Properties *[]CDXProperty `json:"properties,omitempty"` // v1.5 168 } 169 170 // v1.5: added 171 // v1.5: Note: "ref" is a constrained "string" which can be "anyOf": ["#/definitions/refLinkType", "#/definitions/bomLinkElementType"] 172 // TODO: actually, "Ref" should be its own anonymous type with "anyOf": ["#/definitions/refLinkType", "#/definitions/bomLinkElementType"] 173 type CDXResourceReferenceChoice struct { 174 Ref CDXRefLinkType `json:"description,omitempty"` // v1.5 175 ExternalReference CDXExternalReference `json:"externalReference,omitempty"` // v1.5 176 } 177 178 // v1.5: added 179 type CDXCondition struct { 180 Description string `json:"description,omitempty"` // v1.5 181 Expression string `json:"expression,omitempty"` // v1.5 182 Properties *[]CDXProperty `json:"properties,omitempty"` // v1.5 183 } 184 185 // v1.5: added 186 type CDXParameter struct { 187 Name string `json:"name,omitempty"` // v1.5 188 Value string `json:"value,omitempty"` // v1.5 189 DataType string `json:"dataType,omitempty"` // v1.5 190 }