github.com/google/osv-scalibr@v0.4.1/extractor/standalone/windows/ospackages/ospackages_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 !windows
    16  
    17  // Package ospackages extracts installed softwares on Windows.
    18  package ospackages
    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 = "windows/ospackages"
    31  
    32  // Configuration for the extractor.
    33  type Configuration struct{}
    34  
    35  // DefaultConfiguration for the extractor. On non-windows, it contains nothing.
    36  func DefaultConfiguration() Configuration {
    37  	return Configuration{}
    38  }
    39  
    40  // Extractor implements the ospackages extractor.
    41  type Extractor struct{}
    42  
    43  // New creates a new Extractor from a given configuration.
    44  func New(config Configuration) standalone.Extractor {
    45  	return &Extractor{}
    46  }
    47  
    48  // NewDefault returns an extractor with the default config settings.
    49  func NewDefault() standalone.Extractor {
    50  	return New(DefaultConfiguration())
    51  }
    52  
    53  // Name of the extractor.
    54  func (e Extractor) Name() string { return Name }
    55  
    56  // Version of the extractor.
    57  func (e Extractor) Version() int { return 0 }
    58  
    59  // Requirements of the extractor.
    60  func (e Extractor) Requirements() *plugin.Capabilities {
    61  	return &plugin.Capabilities{OS: plugin.OSWindows}
    62  }
    63  
    64  // Extract is a no-op for Linux.
    65  func (e *Extractor) Extract(ctx context.Context, input *standalone.ScanInput) (inventory.Inventory, error) {
    66  	return inventory.Inventory{}, errors.New("only supported on Windows")
    67  }