go.mondoo.com/cnquery@v0.0.0-20231005093811-59568235f6ea/providers-sdk/v1/inventory/inventory.proto (about) 1 // Copyright (c) Mondoo, Inc. 2 // SPDX-License-Identifier: BUSL-1.1 3 4 syntax = "proto3"; 5 package cnquery.providers.v1; 6 option go_package = "go.mondoo.com/cnquery/providers-sdk/v1/inventory"; 7 8 import "providers-sdk/v1/vault/vault.proto"; 9 import "providers-sdk/v1/upstream/upstream.proto"; 10 11 enum State { 12 STATE_UNKNOWN = 0; 13 // eg. permission or io error 14 STATE_ERROR = 1; 15 16 // run time states 17 STATE_PENDING = 2; 18 STATE_RUNNING = 3; 19 STATE_STOPPING = 4; 20 STATE_STOPPED = 5; 21 STATE_SHUTDOWN = 6; 22 STATE_TERMINATED = 7; 23 STATE_REBOOT = 8; 24 25 // static states 26 STATE_ONLINE = 9; 27 STATE_OFFLINE = 10; 28 29 // the asset is marked as deleted 30 STATE_DELETED = 11; 31 } 32 33 enum AssetCategory { 34 CATEGORY_INVENTORY = 0; 35 CATEGORY_CICD = 1; 36 } 37 38 message Asset { 39 reserved 30; 40 string id = 1; 41 string mrn = 2; 42 string name = 3; 43 44 // 3rd-party platform id eg. amazon arn, gcp resource name or ssh host key 45 repeated string platform_ids = 4; 46 47 // asset state 48 State state = 5; 49 50 Platform platform = 6; 51 52 // key is a lower case string of connection type 53 repeated Config connections = 17; 54 55 // labeled assets can be searched by labels 56 map<string, string> labels = 18; 57 58 // additional information that is not touched by the system 59 map<string, string> annotations = 19; 60 61 // additional options for that asset 62 map<string, string> options = 20; 63 64 // platform id detection mechanisms 65 repeated string id_detector = 31; 66 67 // indicator is this is an inventory object or a CI/CD run 68 AssetCategory category = 32; 69 70 repeated Asset related_assets = 33; 71 72 string managed_by = 34; 73 74 // optional url that can be used to access the asset via a browser 75 string url = 35; 76 77 string kind_string = 36; 78 } 79 80 // FIXME: DEPRECATED, remove in v10.0 (or later) vv 81 enum ProviderType { 82 LOCAL_OS = 0; 83 DOCKER_ENGINE_IMAGE = 1; 84 DOCKER_ENGINE_CONTAINER = 2; 85 SSH = 3; 86 WINRM = 4; 87 AWS_SSM_RUN_COMMAND = 5; 88 CONTAINER_REGISTRY = 6; 89 TAR = 7; 90 MOCK = 8; 91 VSPHERE = 9; 92 ARISTAEOS = 10; 93 reserved 11; 94 AWS = 12; 95 GCP = 13; 96 AZURE = 14; 97 MS365 = 15; 98 IPMI = 16; 99 VSPHERE_VM = 17; 100 FS = 18; 101 K8S = 19; 102 EQUINIX_METAL = 20; 103 DOCKER = 21; // unspecified if this is a container or image 104 GITHUB = 22; 105 VAGRANT = 23; 106 AWS_EC2_EBS = 24; 107 GITLAB = 25; 108 TERRAFORM = 26; 109 HOST = 27; 110 UNKNOWN = 28; 111 OKTA = 29; 112 GOOGLE_WORKSPACE = 30; 113 SLACK = 31; 114 VCD = 32; 115 OCI = 33; 116 OPCUA = 34; 117 GCP_COMPUTE_INSTANCE_SNAPSHOT =35; 118 } 119 120 message Config { 121 reserved 6, 7, 9, 10, 20; 122 // FIXME: DEPRECATED, remove in v10.0 (or later) vv 123 // This is replaced by type. We use a different number here so it doesn't 124 // conflict with the old "backend" while allowing us to load the field from yaml. 125 ProviderType backend = 28; 126 DeprecatedV8_Kind kind = 24; 127 // ^^ 128 129 string host = 2; 130 // Ports are not int by default, eg. docker://centos:latest parses a string as port 131 // Therefore it is up to the provider to convert the port to what they need 132 int32 port = 3; 133 string path = 4; 134 uint32 id = 5; 135 string type = 12; 136 137 // credentials available for this provider configuration 138 repeated Credential credentials = 11; 139 140 bool insecure = 8; // disable ssl/tls checks 141 Sudo sudo = 21; 142 bool record = 22; 143 144 map<string,string> options = 23; 145 146 // flags for additional asset discovery 147 Discovery discover = 27; 148 // additional platform information, passed-through 149 string runtime = 25; 150 // configuration to uniquely identify an specific asset for multi-asset api connection 151 string platform_id = 26; 152 repeated string capabilities = 29; 153 } 154 155 message Sudo { 156 bool active = 1; 157 string user = 2; 158 string shell = 3; 159 string executable = 4; 160 } 161 162 message Discovery { 163 repeated string targets = 1; 164 map<string,string> filter = 2; 165 } 166 167 enum DeprecatedV8_Kind { 168 KIND_UNKNOWN = 0; 169 170 // at rest 171 KIND_VIRTUAL_MACHINE_IMAGE = 1; 172 KIND_CONTAINER_IMAGE = 2; 173 KIND_CODE = 3; 174 KIND_PACKAGE = 4; 175 176 // in motion 177 KIND_VIRTUAL_MACHINE = 5; 178 KIND_CONTAINER = 6; 179 KIND_PROCESS = 7; 180 KIND_API = 8; 181 KIND_BARE_METAL = 9; 182 KIND_NETWORK = 10; 183 KIND_K8S_OBJECT = 11; 184 KIND_AWS_OBJECT = 12; 185 KIND_GCP_OBJECT = 13; 186 KIND_AZURE_OBJECT= 14; 187 } 188 189 message Platform { 190 string name = 1; 191 string arch = 3; 192 string title = 4; 193 repeated string family = 5; 194 string build = 6; 195 string version = 7; 196 string kind = 8; 197 198 // FIXME: DEPRECATED, remove in v10 vv 199 DeprecatedV8_Kind deprecated_v8_kind = 20; 200 // ^^ 201 202 string runtime = 21; 203 map<string, string> labels = 22; 204 } 205 206 // NOTE: the k8s types are apache 2 licenced and copied from 207 // https://github.com/kubernetes/apimachinery/blob/master/pkg/apis/meta/v1/generated.proto 208 209 // TypeMeta describes an individual object in an API response or request 210 // with strings representing the type of the object and its API schema version. 211 // Structures that are versioned or persisted should inline TypeMeta. 212 message TypeMeta { 213 // Kind is a string value representing the REST resource this object represents. 214 // Servers may infer this from the endpoint the client submits requests to. 215 // Cannot be updated. 216 // In CamelCase. 217 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds 218 // +optional 219 string kind = 1; 220 221 // APIVersion defines the versioned schema of this representation of an object. 222 // Servers should convert recognized schemas to the latest internal value, and 223 // may reject unrecognized values. 224 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources 225 // +optional 226 string apiVersion = 2; 227 } 228 229 230 // ObjectMeta is metadata that all persisted resources must have, which includes all objects 231 // users must create. 232 message ObjectMeta { 233 // Name must be unique within a namespace. Is required when creating resources, although 234 // some resources may allow a client to request the generation of an appropriate name 235 // automatically. Name is primarily intended for creation idempotence and configuration 236 // definition. 237 // Cannot be updated. 238 // More info: http://kubernetes.io/docs/user-guide/identifiers#names 239 // +optional 240 string name = 1; 241 242 // Namespace defines the space within which each name must be unique. An empty namespace is 243 // equivalent to the "default" namespace, but "default" is the canonical representation. 244 // Not all objects are required to be scoped to a namespace - the value of this field for 245 // those objects will be empty. 246 // 247 // Must be a DNS_LABEL. 248 // Cannot be updated. 249 // More info: http://kubernetes.io/docs/user-guide/namespaces 250 // +optional 251 string namespace = 3; 252 253 // Map of string keys and values that can be used to organize and categorize 254 // (scope and select) objects. May match selectors of replication controllers 255 // and services. 256 // More info: http://kubernetes.io/docs/user-guide/labels 257 // +optional 258 map<string, string> labels = 11; 259 260 // Annotations is an unstructured key value map stored with a resource that may be 261 // set by external tools to store and retrieve arbitrary metadata. They are not 262 // queryable and should be preserved when modifying objects. 263 // More info: http://kubernetes.io/docs/user-guide/annotations 264 // +optional 265 map<string, string> annotations = 12; 266 267 // List of objects depended by this object. If ALL objects in the list have 268 // been deleted, this object will be garbage collected. If this object is managed by a controller, 269 // then an entry in this list will point to this controller, with the controller field set to true. 270 // There cannot be more than one managing controller. 271 // +optional 272 // +patchMergeKey=uid 273 // +patchStrategy=merge 274 repeated OwnerReference ownerReferences = 13; 275 } 276 277 // Time is a wrapper around time.Time which supports correct 278 // marshaling to YAML and JSON. Wrappers are provided for many 279 // of the factory methods that the time package offers. 280 // 281 // +protobuf.options.marshal=false 282 // +protobuf.as=Timestamp 283 // +protobuf.options.(gogoproto.goproto_stringer)=false 284 message Time { 285 // Represents seconds of UTC time since Unix epoch 286 // 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to 287 // 9999-12-31T23:59:59Z inclusive. 288 int64 seconds = 1; 289 290 // Non-negative fractions of a second at nanosecond resolution. Negative 291 // second values with fractions must still have non-negative nanos values 292 // that count forward in time. Must be from 0 to 999,999,999 293 // inclusive. This field may be limited in precision depending on context. 294 int32 nanos = 2; 295 } 296 297 // OwnerReference contains enough information to let you identify an owning 298 // object. An owning object must be in the same namespace as the dependent, or 299 // be cluster-scoped, so there is no namespace field. 300 // +structType=atomic 301 message OwnerReference { 302 // API version of the referent. 303 string apiVersion = 5; 304 305 // Kind of the referent. 306 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds 307 string kind = 1; 308 309 // Name of the referent. 310 // More info: http://kubernetes.io/docs/user-guide/identifiers#names 311 string name = 3; 312 313 // UID of the referent. 314 // More info: http://kubernetes.io/docs/user-guide/identifiers#uids 315 string uid = 4; 316 } 317 318 // Inventory declares the all assets and their credentials 319 message Inventory { 320 // Standard object's metadata. 321 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata 322 ObjectMeta metadata = 1; 323 324 // Specification of the desired behavior of the Inventory. 325 InventorySpec spec = 2; 326 327 // Most recently observed status of the Inventory. 328 InventoryStatus status = 3; 329 } 330 331 message InventorySpec { 332 repeated Asset assets = 1; 333 map<string, Credential> credentials = 2; 334 VaultConfiguration vault = 3; 335 string credential_query = 4; 336 337 // optional: the upstream credentials to use for the inventory 338 mondoo.cnquery.upstream.v1.ServiceAccountCredentials upstream_credentials = 16; 339 } 340 341 message InventoryStatus {}