github.com/google/osv-scalibr@v0.4.1/extractor/standalone/containers/containerd/containerd_dummy.go (about) 1 // Copyright 2025 Google LLC 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 //go:build !linux 16 17 // Package containerd extracts container inventory from containerd API. 18 package containerd 19 20 import ( 21 "context" 22 "errors" 23 24 "github.com/google/osv-scalibr/extractor/standalone" 25 "github.com/google/osv-scalibr/inventory" 26 "github.com/google/osv-scalibr/plugin" 27 ) 28 29 // Name of the extractor 30 const Name = "containers/containerd-runtime" 31 32 // Config is the configuration for the Extractor. 33 type Config struct{} 34 35 // DefaultConfig returns the default configuration for the containerd extractor. 36 func DefaultConfig() Config { 37 return Config{} 38 } 39 40 // Extractor implements the containerd runtime extractor. 41 type Extractor struct{} 42 43 // New creates a new containerd client and returns a containerd container package extractor. 44 // No op for non-Linux. 45 func New(cfg Config) standalone.Extractor { 46 return &Extractor{} 47 } 48 49 // NewDefault returns an extractor with the default config settings. 50 func NewDefault() standalone.Extractor { 51 return New(DefaultConfig()) 52 } 53 54 // Config returns the configuration of the extractor. 55 func (e Extractor) Config() Config { 56 return Config{} 57 } 58 59 // Name of the extractor. 60 func (e Extractor) Name() string { return Name } 61 62 // Version of the extractor. 63 func (e Extractor) Version() int { return 0 } 64 65 // Requirements of the extractor. 66 func (e Extractor) Requirements() *plugin.Capabilities { return &plugin.Capabilities{} } 67 68 // Extract is a no-op for non-Linux. 69 func (e *Extractor) Extract(ctx context.Context, input *standalone.ScanInput) (inventory.Inventory, error) { 70 return inventory.Inventory{}, errors.New("only supported on Linux") 71 }