exports/Add-CVSoftwareCache.ps1


# ----------------------------------------------------------------------------------
#
# Copyright Microsoft Corporation
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ----------------------------------------------------------------------------------

<#
.Synopsis
Create a new software cache
.Description
Create a new software cache
.Example
PS C:\> {{ Add code here }}
 
{{ Add output here }}
.Example
PS C:\> {{ Add code here }}
 
{{ Add output here }}
 
.Inputs
Commvault.Powershell.Models.ISoftwareCacheDetail
.Outputs
Commvault.Powershell.Models.IGenericResp
.Notes
COMPLEX PARAMETER PROPERTIES
 
To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.
 
ASSOCIATIONS <IServerOrServerGroupAssociation[]>: List of servers and server groups.
  [Id <Int64?>]: Id of server or server group
  [Name <String>]: Name of server or server group
  [Type <String>]: ServerOrServerGroupTypes
 
BODY <ISoftwareCacheDetail>: Details of software cache server.
  [Associations <IServerOrServerGroupAssociation[]>]: List of servers and server groups.
    [Id <Int64?>]: Id of server or server group
    [Name <String>]: Name of server or server group
    [Type <String>]: ServerOrServerGroupTypes
  [CacheContents <ISoftwareCacheContent[]>]: List of cache content details of software cache.
    [AdditionalUpdates <String>]: List of additional updates available in software cache
    [OSName <String>]: OS Name of the media available in software cache
    [PackagesInCache <String>]: List of packages available in the software cache
    [Version <String>]: Version of the media available in software cache
  [CacheDirectory <String>]: The software cache directory path where the media will be located
  [CacheId <Int64?>]:
  [CacheName <String>]:
  [Configurable <Boolean?>]: Whether the software cache is configurable
  [Enabled <Boolean?>]: Whether the software cache is enabled or not
  [Status <String>]: The status of the software cache for server. Either In Sync or Out of Sync with CommServe cache
 
CACHECONTENTS <ISoftwareCacheContent[]>: List of cache content details of software cache.
  [AdditionalUpdates <String>]: List of additional updates available in software cache
  [OSName <String>]: OS Name of the media available in software cache
  [PackagesInCache <String>]: List of packages available in the software cache
  [Version <String>]: Version of the media available in software cache
.Link
https://docs.microsoft.com/en-us/powershell/module/commvaultpowershell/add-cvsoftwarecache
#>

function Add-CVSoftwareCache {
[OutputType([Commvault.Powershell.Models.IGenericResp])]
[CmdletBinding(DefaultParameterSetName='AddExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
param(
    [Parameter(ParameterSetName='Add', Mandatory, ValueFromPipeline)]
    [Commvault.Powershell.Category('Body')]
    [Commvault.Powershell.Models.ISoftwareCacheDetail]
    # Details of software cache server.
    # To construct, see NOTES section for BODY properties and create a hash table.
    ${Body},

    [Parameter(ParameterSetName='AddExpanded')]
    [Commvault.Powershell.Category('Body')]
    [Commvault.Powershell.Models.IServerOrServerGroupAssociation[]]
    # List of servers and server groups.
    # To construct, see NOTES section for ASSOCIATIONS properties and create a hash table.
    ${Associations},

    [Parameter(ParameterSetName='AddExpanded')]
    [Commvault.Powershell.Category('Body')]
    [Commvault.Powershell.Models.ISoftwareCacheContent[]]
    # List of cache content details of software cache.
    # To construct, see NOTES section for CACHECONTENTS properties and create a hash table.
    ${CacheContents},

    [Parameter(ParameterSetName='AddExpanded')]
    [Commvault.Powershell.Category('Body')]
    [System.String]
    # The software cache directory path where the media will be located
    ${CacheDirectory},

    [Parameter(ParameterSetName='AddExpanded')]
    [Commvault.Powershell.Category('Body')]
    [System.Int64]
    # .
    ${CacheId},

    [Parameter(ParameterSetName='AddExpanded')]
    [Commvault.Powershell.Category('Body')]
    [System.String]
    # .
    ${CacheName},

    [Parameter(ParameterSetName='AddExpanded')]
    [Commvault.Powershell.Category('Body')]
    [System.Management.Automation.SwitchParameter]
    # Whether the software cache is configurable
    ${Configurable},

    [Parameter(ParameterSetName='AddExpanded')]
    [Commvault.Powershell.Category('Body')]
    [System.Management.Automation.SwitchParameter]
    # Whether the software cache is enabled or not
    ${Enabled},

    [Parameter(ParameterSetName='AddExpanded')]
    [Commvault.Powershell.Category('Body')]
    [System.String]
    # The status of the software cache for server.
    # Either In Sync or Out of Sync with CommServe cache
    ${Status},

    [Parameter(DontShow)]
    [Commvault.Powershell.Category('Runtime')]
    [System.Management.Automation.SwitchParameter]
    # Wait for .NET debugger to attach
    ${Break},

    [Parameter(DontShow)]
    [ValidateNotNull()]
    [Commvault.Powershell.Category('Runtime')]
    [Commvault.Powershell.Runtime.SendAsyncStep[]]
    # SendAsync Pipeline Steps to be appended to the front of the pipeline
    ${HttpPipelineAppend},

    [Parameter(DontShow)]
    [ValidateNotNull()]
    [Commvault.Powershell.Category('Runtime')]
    [Commvault.Powershell.Runtime.SendAsyncStep[]]
    # SendAsync Pipeline Steps to be prepended to the front of the pipeline
    ${HttpPipelinePrepend},

    [Parameter(DontShow)]
    [Commvault.Powershell.Category('Runtime')]
    [System.Uri]
    # The URI for the proxy server to use
    ${Proxy},

    [Parameter(DontShow)]
    [ValidateNotNull()]
    [Commvault.Powershell.Category('Runtime')]
    [System.Management.Automation.PSCredential]
    # Credentials for a proxy server to use for the remote call
    ${ProxyCredential},

    [Parameter(DontShow)]
    [Commvault.Powershell.Category('Runtime')]
    [System.Management.Automation.SwitchParameter]
    # Use the default credentials for the proxy
    ${ProxyUseDefaultCredentials}
)

begin {
    try {
        $outBuffer = $null
        if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) {
            $PSBoundParameters['OutBuffer'] = 1
        }
        $parameterSet = $PSCmdlet.ParameterSetName
        $mapping = @{
            Add = 'CommvaultPowershell.private\Add-CVSoftwareCache_Add';
            AddExpanded = 'CommvaultPowershell.private\Add-CVSoftwareCache_AddExpanded';
        }
        $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
        $scriptCmd = {& $wrappedCmd @PSBoundParameters}
        $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin)
        $steppablePipeline.Begin($PSCmdlet)
    } catch {
        throw
    }
}

process {
    try {
        $steppablePipeline.Process($_)
    } catch {
        throw
    }
}

end {
    try {
        $steppablePipeline.End()
    } catch {
        throw
    }
}
}