winget-cli

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

IPowerShellGet.cs (4520B)


      1 // -----------------------------------------------------------------------------
      2 // <copyright file="IPowerShellGet.cs" company="Microsoft Corporation">
      3 //     Copyright (c) Microsoft Corporation. Licensed under the MIT License.
      4 // </copyright>
      5 // -----------------------------------------------------------------------------
      6 
      7 namespace Microsoft.Management.Configuration.Processor.PowerShell.Helpers
      8 {
      9     using System.Management.Automation;
     10     using Microsoft.PowerShell.Commands;
     11     using SemanticVersion = Microsoft.Management.Configuration.Processor.Helpers.SemanticVersion;
     12 
     13     /// <summary>
     14     /// Interface for PowerShellGet cmdlets.
     15     /// </summary>
     16     internal interface IPowerShellGet
     17     {
     18         /// <summary>
     19         /// Calls Find-Module.
     20         /// </summary>
     21         /// <param name="pwsh">PowerShell instance.</param>
     22         /// <param name="moduleName">Module name.</param>
     23         /// <param name="semanticVersion">Optional version.</param>
     24         /// <param name="semanticMinVersion">Optional min version.</param>
     25         /// <param name="semanticMaxVersion">Optional max version.</param>
     26         /// <param name="repository">Optional repository.</param>
     27         /// <param name="allowPrerelease">Optional allow prerelease module.</param>
     28         /// <returns>Module info, null if not found.</returns>
     29         PSObject? FindModule(
     30             PowerShell pwsh,
     31             string moduleName,
     32             SemanticVersion? semanticVersion,
     33             SemanticVersion? semanticMinVersion,
     34             SemanticVersion? semanticMaxVersion,
     35             string? repository,
     36             bool? allowPrerelease);
     37 
     38         /// <summary>
     39         /// Calls Find-DscResource.
     40         /// </summary>
     41         /// <param name="pwsh">PowerShell instance.</param>
     42         /// <param name="resourceName">resource name.</param>
     43         /// <param name="moduleName">Optional module name.</param>
     44         /// <param name="semanticVersion">Optional version.</param>
     45         /// <param name="semanticMinVersion">Optional min version.</param>
     46         /// <param name="semanticMaxVersion">Optional max version.</param>
     47         /// <param name="repository">Optional repository.</param>
     48         /// <param name="allowPrerelease">Optional allow prerelease module.</param>
     49         /// <returns>Dsc Resource info, null if not found.</returns>
     50         PSObject? FindDscResource(
     51             PowerShell pwsh,
     52             string resourceName,
     53             string? moduleName,
     54             SemanticVersion? semanticVersion,
     55             SemanticVersion? semanticMinVersion,
     56             SemanticVersion? semanticMaxVersion,
     57             string? repository,
     58             bool? allowPrerelease);
     59 
     60         /// <summary>
     61         /// Calls Save-Module with module specification.
     62         /// </summary>
     63         /// <param name="pwsh">PowerShell instance.</param>
     64         /// <param name="moduleSpecification">Module specification.</param>
     65         /// <param name="location">Location to save module.</param>
     66         void SaveModule(PowerShell pwsh, ModuleSpecification moduleSpecification, string location);
     67 
     68         /// <summary>
     69         /// Calls Save-Module -InputObject object -Path location.
     70         /// Input object must be the result of Find cmdlets of PowerShellGet.
     71         /// </summary>
     72         /// <param name="pwsh">PowerShell instance.</param>
     73         /// <param name="inputObject">Input object.</param>
     74         /// <param name="location">Location to save module.</param>
     75         void SaveModule(PowerShell pwsh, PSObject inputObject, string location);
     76 
     77         /// <summary>
     78         /// Calls Install-Module -InputObject object.
     79         /// Input object must be the result of Find cmdlets of PowerShellGet.
     80         /// </summary>
     81         /// <param name="pwsh">PowerShell instance.</param>
     82         /// <param name="inputObject">Input object.</param>
     83         /// <param name="allUsers">If to install to all users.</param>
     84         void InstallModule(PowerShell pwsh, PSObject inputObject, bool allUsers);
     85 
     86         /// <summary>
     87         /// Calls Install-Module with a module specification.
     88         /// </summary>
     89         /// <param name="pwsh">PowerShell instance.</param>
     90         /// <param name="moduleSpecification">Module specification.</param>
     91         /// <param name="allUsers">If to install to all users.</param>
     92         void InstallModule(PowerShell pwsh, ModuleSpecification moduleSpecification, bool allUsers);
     93     }
     94 }