Class Pkg

java.lang.Object
com.suse.salt.netapi.calls.modules.Pkg

public class Pkg extends Object
salt.modules.pkg
  • Constructor Details

    • Pkg

      private Pkg()
  • Method Details

    • search

      public static LocalCall<Map<String, Pkg.PackageInfo>> search(String criteria)
    • fileDict

      public static LocalCall<Pkg.PackageDict> fileDict(String... packages)
    • listPkgs

      public static LocalCall<Map<String, List<String>>> listPkgs()
    • listPkgs

      public static LocalCall<Map<String, List<Xor<String,Pkg.Info>>>> listPkgs(List<String> attributes)
      Call 'pkg.list_pkgs'
      Parameters:
      attributes - list of attributes that should be included in the result
      Returns:
      the call. For each package, the map can contain a String (only the version) or an Info object containing specified attributes depending on Salt version and minion support
    • infoInstalled

      public static LocalCall<Map<String,Pkg.Info>> infoInstalled(List<String> attributes, boolean reportErrors, String... packages)
      Call 'pkg.info_installed' API.
      Parameters:
      attributes - list of attributes that should be included in the result
      reportErrors - if true will return an error message instead of corrupted text
      packages - optional give package names, otherwise return info about all packages
      Returns:
      the call
    • infoInstalledAllVersions

      public static LocalCall<Map<String, Xor<Pkg.Info, List<Pkg.Info>>>> infoInstalledAllVersions(List<String> attributes, boolean reportErrors, String... packages)
      Call 'pkg.info_installed' API.
      Parameters:
      attributes - list of attributes that should be included in the result
      reportErrors - if true will return an error message instead of corrupted text
      packages - optional give package names, otherwise return info about all packages
      Returns:
      the call
    • infoAvailable

      public static LocalCall<Map<String,Pkg.Info>> infoAvailable(String... packages)
    • install

      public static LocalCall<Map<String,Object>> install(boolean refresh, List<String> pkgs)
      Call 'pkg.install' API.
      Parameters:
      refresh - refresh repos before installation
      pkgs - list of packages
      Returns:
      the call
    • install

      public static LocalCall<Map<String, Change<Xor<String, List<Pkg.Info>>>>> install(boolean refresh, List<String> pkgs, List<String> attributes)
      Call 'pkg.install' API.
      Parameters:
      refresh - refresh repos before installation
      pkgs - list of packages
      attributes - list of attributes that should be included in the result
      Returns:
      the call. For each package, a change of old and new value. Those can contain an empty String, or a package version String, or an Info object containing specified attributes. They exact type depends on the Salt version depending on Salt version used and minion support
    • install

      public static LocalCall<Map<String,Object>> install(boolean refresh, Map<String,String> pkgs)
      Parameters:
      refresh - set true to perform a refresh before the installation
      pkgs - map of packages (name to version) to be installed
      Returns:
      the LocalCall object
    • install

      public static LocalCall<Map<String, Change<Xor<String, List<Pkg.Info>>>>> install(boolean refresh, Map<String,String> pkgs, List<String> attributes)
      Call 'pkg.install' API.
      Parameters:
      refresh - refresh repos before installation
      pkgs - map of packages (name to version) to be installed
      attributes - list of attributes that should be included in the result
      Returns:
      the call. For each package, a change of old and new value. Those can contain an empty String, or a package version String, or an Info object containing specified attributes. They exact type depends on the Salt version depending on Salt version used and minion support
    • remove

      public static LocalCall<Map<String,Object>> remove(Map<String,String> pkgs)
      Parameters:
      pkgs - map of packages (name to version) to be removed
      Returns:
      the LocalCall object
    • upgradeAvailable

      public static LocalCall<Boolean> upgradeAvailable(String packageName)
    • latestVersion

      public static LocalCall<String> latestVersion(String packageName)
    • latestVersion

      public static LocalCall<Map<String,String>> latestVersion(String firstPackageName, String secondPackageName, String... packages)
    • listPatterns

      public static LocalCall<Optional<Map<String, PatternInfo>>> listPatterns(boolean refresh)
      Call 'pkg.list_patterns' via Salt API.
      Parameters:
      refresh - refresh repos
      Returns:
      the call. Only returns a populated map for SUSE-based distros using zypper
    • preparePkgs

      private static List<Map<String,String>> preparePkgs(Map<String,String> pkgs)
      From a given map (package name -> version), create a list of maps with just one element each. This is how Salt requires us to send the 'pkgs' argument when multiple packages should be installed or removed.
      Parameters:
      pkgs - map with packages (name -> version)
      Returns:
      list of maps with one element each