Public/Storage.ps1

Function Get-NmeAzureFiles {
    <#
 
    .SYNOPSIS
 
    Get the list of File Shares.
 
    .DESCRIPTION
 
    Get the list of File Shares.
 
    This function calls the /api/v1/storage/azure-files endpoint of the NME REST API, using the get method.
 
 
 
 
    #>


    [CmdletBinding()]
    Param(

    )
    Set-NmeAuthHeaders
    Try {
        $Result = Invoke-RestMethod "$script:NmeUri/api/v1/storage/azure-files$Querystring" -Method get -Headers $script:AuthHeaders -ContentType 'application/json'
        $Result.PSObject.TypeNames.Insert(0, 'NmeFileShareModelRest')
        $Result | CapProps
    }
    Catch {
        $message = ParseErrorForResponseBody($_)
        write-error ($message | out-string)
    }
}
Function Get-NmeAzureFilesAutoScaleConfig {
    <#
 
    .SYNOPSIS
 
    Get Azure Files autoscale.
 
    .DESCRIPTION
 
    Get Azure Files autoscale.
 
    This function calls the /api/v1/storage/azure-files/{subscriptionId}/{resourceGroup}/{accountName}/{shareName}/auto-scale endpoint of the NME REST API, using the get method.
 
 
    .PARAMETER SubscriptionId
 
    The id (guid) of the subscription where this storage resides
 
    .PARAMETER ResourceGroup
 
    The Azure resource group where the storage resides
 
    .PARAMETER AccountName
 
    Storage account name
 
    .PARAMETER ShareName
 
    File share name
 
    #>


    [CmdletBinding()]
    Param(
        [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$SubscriptionId,
        [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$ResourceGroup,
        [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$AccountName,
        [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$ShareName
    )
    Set-NmeAuthHeaders
    Try {
        $Result = Invoke-RestMethod "$script:NmeUri/api/v1/storage/azure-files/$SubscriptionId/$ResourceGroup/$AccountName/$ShareName/auto-scale$Querystring" -Method get -Headers $script:AuthHeaders -ContentType 'application/json'
        $Result.PSObject.TypeNames.Insert(0, 'NmeAzureFilesAutoscaleConfigPatch')
        $Result.PSObject.TypeNames.Insert(0, 'NmeAzureFilesAutoscaleConfig')
        $Result | Add-Member -NotePropertyName 'subscriptionId' -NotePropertyValue $subscriptionId -erroraction 'SilentlyContinue'
        $Result | Add-Member -NotePropertyName 'resourceGroup' -NotePropertyValue $resourceGroup -erroraction 'SilentlyContinue'
        $Result | Add-Member -NotePropertyName 'accountName' -NotePropertyValue $accountName -erroraction 'SilentlyContinue'
        $Result | Add-Member -NotePropertyName 'shareName' -NotePropertyValue $shareName -erroraction 'SilentlyContinue'
        $Result | CapProps
    }
    Catch {
        $message = ParseErrorForResponseBody($_)
        write-error ($message | out-string)
    }
}
Function Set-NmeAzureFilesAutoScaleConfig {
    <#
 
    .SYNOPSIS
 
    Update Azure Files autoscale.
 
    .DESCRIPTION
 
    Update Azure Files autoscale.
 
    This function calls the /api/v1/storage/azure-files/{subscriptionId}/{resourceGroup}/{accountName}/{shareName}/auto-scale endpoint of the NME REST API, using the put method.
 
 
    .PARAMETER SubscriptionId
 
    The id (guid) of the subscription where this storage resides
 
    .PARAMETER ResourceGroup
 
    The Azure resource group where the storage resides
 
    .PARAMETER AccountName
 
    Storage account name
 
    .PARAMETER ShareName
 
    File share name
 
    .PARAMETER NmeAzureFilesAutoscaleConfig
 
    Requires an NmeAzureFilesAutoscaleConfig object, as generated by the New-NmeAzureFilesAutoscaleConfig command.
 
    #>


    [CmdletBinding()]
    Param(
        [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$SubscriptionId,
        [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$ResourceGroup,
        [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$AccountName,
        [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$ShareName,
        [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$True)][ValidateScript({if ($_.PSObject.TypeNames -contains "NmeAzureFilesAutoscaleConfig"){$true} else{throw " is not a NmeAzureFilesAutoscaleConfig object."}})][Alias("NmeAzureFilesAutoscaleConfigPatch")]$NmeAzureFilesAutoscaleConfig
    )
    Set-NmeAuthHeaders
    Try {
        $json = $NmeAzureFilesAutoscaleConfig | ConvertTo-Json -Depth 20
        Write-Debug 'json:'
        Write-Debug $json
        $Result = Invoke-RestMethod "$script:NmeUri/api/v1/storage/azure-files/$SubscriptionId/$ResourceGroup/$AccountName/$ShareName/auto-scale$QueryString" -Method put -Headers $script:AuthHeaders -ContentType 'application/json' -body $json
        Write-Verbose ($result | out-string)
        $Result.PSObject.TypeNames.Insert(0, 'NmeResponseWithJob')
        $Result.PSObject.TypeNames.Insert(0, 'NmeAzureFilesAutoscaleConfig')
        $Result | Add-Member -NotePropertyName 'subscriptionId' -NotePropertyValue $subscriptionId -erroraction 'SilentlyContinue'
        $Result | Add-Member -NotePropertyName 'resourceGroup' -NotePropertyValue $resourceGroup -erroraction 'SilentlyContinue'
        $Result | Add-Member -NotePropertyName 'accountName' -NotePropertyValue $accountName -erroraction 'SilentlyContinue'
        $Result | Add-Member -NotePropertyName 'shareName' -NotePropertyValue $shareName -erroraction 'SilentlyContinue'
        $Result | CapProps
    }
    Catch {
        $message = ParseErrorForResponseBody($_)
        write-error ($message | out-string)
    }
}
Function Update-NmeAzureFilesAutoScaleConfig {
    <#
 
    .SYNOPSIS
 
    Enable or disable Azure Files autoscale.
 
    .DESCRIPTION
 
    Enable or disable Azure Files autoscale.
 
    This function calls the /api/v1/storage/azure-files/{subscriptionId}/{resourceGroup}/{accountName}/{shareName}/auto-scale endpoint of the NME REST API, using the patch method.
 
 
    .PARAMETER SubscriptionId
 
    The id (guid) of the subscription where this storage resides
 
    .PARAMETER ResourceGroup
 
    The Azure resource group where the storage resides
 
    .PARAMETER AccountName
 
    Storage account name
 
    .PARAMETER ShareName
 
    File share name
 
    .PARAMETER NmeAzureFilesAutoscaleConfigPatch
 
    Requires an NmeAzureFilesAutoscaleConfigPatch object, as generated by the New-NmeAzureFilesAutoscaleConfigPatch command.
 
    #>


    [CmdletBinding()]
    Param(
        [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$SubscriptionId,
        [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$ResourceGroup,
        [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$AccountName,
        [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$ShareName,
        [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$True)][ValidateScript({if ($_.PSObject.TypeNames -contains "NmeAzureFilesAutoscaleConfigPatch"){$true} else{throw " is not a NmeAzureFilesAutoscaleConfigPatch object."}})][Alias("NmeAzureFilesAutoscaleConfig")]$NmeAzureFilesAutoscaleConfigPatch
    )
    Set-NmeAuthHeaders
    Try {
        $json = $NmeAzureFilesAutoscaleConfigPatch | ConvertTo-Json -Depth 20
        Write-Debug 'json:'
        Write-Debug $json
        $Result = Invoke-RestMethod "$script:NmeUri/api/v1/storage/azure-files/$SubscriptionId/$ResourceGroup/$AccountName/$ShareName/auto-scale$QueryString" -Method patch -Headers $script:AuthHeaders -ContentType 'application/json' -body $json
        Write-Verbose ($result | out-string)
        $Result.PSObject.TypeNames.Insert(0, 'NmeResponseWithJob')
        $Result.PSObject.TypeNames.Insert(0, 'NmeAzureFilesAutoscaleConfig')
        $Result | Add-Member -NotePropertyName 'subscriptionId' -NotePropertyValue $subscriptionId -erroraction 'SilentlyContinue'
        $Result | Add-Member -NotePropertyName 'resourceGroup' -NotePropertyValue $resourceGroup -erroraction 'SilentlyContinue'
        $Result | Add-Member -NotePropertyName 'accountName' -NotePropertyValue $accountName -erroraction 'SilentlyContinue'
        $Result | Add-Member -NotePropertyName 'shareName' -NotePropertyValue $shareName -erroraction 'SilentlyContinue'
        $Result | CapProps
    }
    Catch {
        $message = ParseErrorForResponseBody($_)
        write-error ($message | out-string)
    }
}
Function New-NmeAzureFilesLink {
    <#
 
    .SYNOPSIS
 
    Link File Share.
 
    .DESCRIPTION
 
    Link File Share.
 
    This function calls the /api/v1/storage/azure-files/{subscriptionId}/{resourceGroup}/{accountName}/{shareName}/link endpoint of the NME REST API, using the post method.
 
 
    .PARAMETER SubscriptionId
 
    The id (guid) of the subscription where this storage resides
 
    .PARAMETER ResourceGroup
 
    The Azure resource group where the storage resides
 
    .PARAMETER AccountName
 
    Storage account name
 
    .PARAMETER ShareName
 
    File share name
 
    #>


    [CmdletBinding()]
    Param(
        [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$SubscriptionId,
        [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$ResourceGroup,
        [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$AccountName,
        [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$ShareName
    )
    Set-NmeAuthHeaders
    Try {
        $Result = Invoke-RestMethod "$script:NmeUri/api/v1/storage/azure-files/$SubscriptionId/$ResourceGroup/$AccountName/$ShareName/link$Querystring" -Method post -Headers $script:AuthHeaders -ContentType 'application/json'
        $Result | CapProps
    }
    Catch {
        $message = ParseErrorForResponseBody($_)
        write-error ($message | out-string)
    }
}
Function Remove-NmeAzureFilesLink {
    <#
 
    .SYNOPSIS
 
    Unlink File Share.
 
    .DESCRIPTION
 
    Unlink File Share.
 
    This function calls the /api/v1/storage/azure-files/{subscriptionId}/{resourceGroup}/{accountName}/{shareName}/link endpoint of the NME REST API, using the delete method.
 
 
    .PARAMETER SubscriptionId
 
    The id (guid) of the subscription where this storage resides
 
    .PARAMETER ResourceGroup
 
    The Azure resource group where the storage resides
 
    .PARAMETER AccountName
 
    Storage account name
 
    .PARAMETER ShareName
 
    File share name
 
    #>


    [CmdletBinding()]
    Param(
        [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$SubscriptionId,
        [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$ResourceGroup,
        [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$AccountName,
        [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$ShareName
    )
    Set-NmeAuthHeaders
    Try {
        $Result = Invoke-RestMethod "$script:NmeUri/api/v1/storage/azure-files/$SubscriptionId/$ResourceGroup/$AccountName/$ShareName/link$Querystring" -Method delete -Headers $script:AuthHeaders -ContentType 'application/json'
        $Result | CapProps
    }
    Catch {
        $message = ParseErrorForResponseBody($_)
        write-error ($message | out-string)
    }
}
Function Get-NmeNetAppFilesAutoScaleConfig {
    <#
 
    .SYNOPSIS
 
    Get Net App Files autoscale.
 
    .DESCRIPTION
 
    Get Net App Files autoscale.
 
    This function calls the /api/v1/storage/netapp-files/{subscriptionId}/{resourceGroupName}/{accountName}/{poolName}/{volumeName}/auto-scale endpoint of the NME REST API, using the get method.
 
 
    .PARAMETER SubscriptionId
 
    The id (guid) of the subscription where this storage resides
 
    .PARAMETER ResourceGroupName
 
    Resource group name
 
    .PARAMETER AccountName
 
    Storage account name
 
    .PARAMETER PoolName
 
    NetApp Files capacity pool name
 
    .PARAMETER VolumeName
 
    NetApp volume name
 
    #>


    [CmdletBinding()]
    Param(
        [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$SubscriptionId,
        [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$ResourceGroupName,
        [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$AccountName,
        [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$PoolName,
        [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$VolumeName
    )
    Set-NmeAuthHeaders
    Try {
        $Result = Invoke-RestMethod "$script:NmeUri/api/v1/storage/netapp-files/$SubscriptionId/$ResourceGroupName/$AccountName/$PoolName/$VolumeName/auto-scale$Querystring" -Method get -Headers $script:AuthHeaders -ContentType 'application/json'
        $Result.PSObject.TypeNames.Insert(0, 'NmeNetAppFilesAutoscaleConfigPatch')
        $Result.PSObject.TypeNames.Insert(0, 'NmeNetAppFilesAutoscaleConfig')
        $Result | Add-Member -NotePropertyName 'subscriptionId' -NotePropertyValue $subscriptionId -erroraction 'SilentlyContinue'
        $Result | Add-Member -NotePropertyName 'resourceGroupName' -NotePropertyValue $resourceGroupName -erroraction 'SilentlyContinue'
        $Result | Add-Member -NotePropertyName 'accountName' -NotePropertyValue $accountName -erroraction 'SilentlyContinue'
        $Result | Add-Member -NotePropertyName 'poolName' -NotePropertyValue $poolName -erroraction 'SilentlyContinue'
        $Result | Add-Member -NotePropertyName 'volumeName' -NotePropertyValue $volumeName -erroraction 'SilentlyContinue'
        $Result | CapProps
    }
    Catch {
        $message = ParseErrorForResponseBody($_)
        write-error ($message | out-string)
    }
}
Function Set-NmeNetAppFilesAutoScaleConfig {
    <#
 
    .SYNOPSIS
 
    Update Net App Files autoscale.
 
    .DESCRIPTION
 
    Update Net App Files autoscale.
 
    This function calls the /api/v1/storage/netapp-files/{subscriptionId}/{resourceGroupName}/{accountName}/{poolName}/{volumeName}/auto-scale endpoint of the NME REST API, using the put method.
 
 
    .PARAMETER SubscriptionId
 
    The id (guid) of the subscription where this storage resides
 
    .PARAMETER ResourceGroupName
 
    Resource group name
 
    .PARAMETER AccountName
 
    Storage account name
 
    .PARAMETER PoolName
 
    NetApp Files capacity pool name
 
    .PARAMETER VolumeName
 
    NetApp volume name
 
    .PARAMETER NmeNetAppFilesAutoscaleConfig
 
    Requires an NmeNetAppFilesAutoscaleConfig object, as generated by the New-NmeNetAppFilesAutoscaleConfig command.
 
    #>


    [CmdletBinding()]
    Param(
        [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$SubscriptionId,
        [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$ResourceGroupName,
        [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$AccountName,
        [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$PoolName,
        [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$VolumeName,
        [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$True)][ValidateScript({if ($_.PSObject.TypeNames -contains "NmeNetAppFilesAutoscaleConfig"){$true} else{throw " is not a NmeNetAppFilesAutoscaleConfig object."}})][Alias("NmeNetAppFilesAutoscaleConfigPatch")]$NmeNetAppFilesAutoscaleConfig
    )
    Set-NmeAuthHeaders
    Try {
        $json = $NmeNetAppFilesAutoscaleConfig | ConvertTo-Json -Depth 20
        Write-Debug 'json:'
        Write-Debug $json
        $Result = Invoke-RestMethod "$script:NmeUri/api/v1/storage/netapp-files/$SubscriptionId/$ResourceGroupName/$AccountName/$PoolName/$VolumeName/auto-scale$QueryString" -Method put -Headers $script:AuthHeaders -ContentType 'application/json' -body $json
        Write-Verbose ($result | out-string)
        $Result.PSObject.TypeNames.Insert(0, 'NmeResponseWithJob')
        $Result.PSObject.TypeNames.Insert(0, 'NmeNetAppFilesAutoscaleConfig')
        $Result | Add-Member -NotePropertyName 'subscriptionId' -NotePropertyValue $subscriptionId -erroraction 'SilentlyContinue'
        $Result | Add-Member -NotePropertyName 'resourceGroupName' -NotePropertyValue $resourceGroupName -erroraction 'SilentlyContinue'
        $Result | Add-Member -NotePropertyName 'accountName' -NotePropertyValue $accountName -erroraction 'SilentlyContinue'
        $Result | Add-Member -NotePropertyName 'poolName' -NotePropertyValue $poolName -erroraction 'SilentlyContinue'
        $Result | Add-Member -NotePropertyName 'volumeName' -NotePropertyValue $volumeName -erroraction 'SilentlyContinue'
        $Result | CapProps
    }
    Catch {
        $message = ParseErrorForResponseBody($_)
        write-error ($message | out-string)
    }
}
Function Update-NmeNetAppFilesAutoScaleConfig {
    <#
 
    .SYNOPSIS
 
    Enable or disable Net App Files autoscale.
 
    .DESCRIPTION
 
    Enable or disable Net App Files autoscale.
 
    This function calls the /api/v1/storage/netapp-files/{subscriptionId}/{resourceGroupName}/{accountName}/{poolName}/{volumeName}/auto-scale endpoint of the NME REST API, using the patch method.
 
 
    .PARAMETER SubscriptionId
 
    The id (guid) of the subscription where this storage resides
 
    .PARAMETER ResourceGroupName
 
    Resource group name
 
    .PARAMETER AccountName
 
    Storage account name
 
    .PARAMETER PoolName
 
    NetApp Files capacity pool name
 
    .PARAMETER VolumeName
 
    NetApp volume name
 
    .PARAMETER NmeNetAppFilesAutoscaleConfigPatch
 
    Requires an NmeNetAppFilesAutoscaleConfigPatch object, as generated by the New-NmeNetAppFilesAutoscaleConfigPatch command.
 
    #>


    [CmdletBinding()]
    Param(
        [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$SubscriptionId,
        [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$ResourceGroupName,
        [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$AccountName,
        [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$PoolName,
        [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$VolumeName,
        [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$True)][ValidateScript({if ($_.PSObject.TypeNames -contains "NmeNetAppFilesAutoscaleConfigPatch"){$true} else{throw " is not a NmeNetAppFilesAutoscaleConfigPatch object."}})][Alias("NmeNetAppFilesAutoscaleConfig")]$NmeNetAppFilesAutoscaleConfigPatch
    )
    Set-NmeAuthHeaders
    Try {
        $json = $NmeNetAppFilesAutoscaleConfigPatch | ConvertTo-Json -Depth 20
        Write-Debug 'json:'
        Write-Debug $json
        $Result = Invoke-RestMethod "$script:NmeUri/api/v1/storage/netapp-files/$SubscriptionId/$ResourceGroupName/$AccountName/$PoolName/$VolumeName/auto-scale$QueryString" -Method patch -Headers $script:AuthHeaders -ContentType 'application/json' -body $json
        Write-Verbose ($result | out-string)
        $Result.PSObject.TypeNames.Insert(0, 'NmeResponseWithJob')
        $Result.PSObject.TypeNames.Insert(0, 'NmeNetAppFilesAutoscaleConfig')
        $Result | Add-Member -NotePropertyName 'subscriptionId' -NotePropertyValue $subscriptionId -erroraction 'SilentlyContinue'
        $Result | Add-Member -NotePropertyName 'resourceGroupName' -NotePropertyValue $resourceGroupName -erroraction 'SilentlyContinue'
        $Result | Add-Member -NotePropertyName 'accountName' -NotePropertyValue $accountName -erroraction 'SilentlyContinue'
        $Result | Add-Member -NotePropertyName 'poolName' -NotePropertyValue $poolName -erroraction 'SilentlyContinue'
        $Result | Add-Member -NotePropertyName 'volumeName' -NotePropertyValue $volumeName -erroraction 'SilentlyContinue'
        $Result | CapProps
    }
    Catch {
        $message = ParseErrorForResponseBody($_)
        write-error ($message | out-string)
    }
}