modules/storage.psm1
### storage # /api/v2/data-targets function Get-PPDMdata_targets { [CmdletBinding()] param( [Parameter(Mandatory = $false, ParameterSetName = 'byID', ValueFromPipelineByPropertyName = $true)] [string]$ID, $PPDM_API_BaseUri = $Global:PPDM_API_BaseUri, $apiver = "/api/v2" ) begin { $Response = @() $METHOD = "GET" $Myself = ($MyInvocation.MyCommand.Name.Substring(8) -replace "_", "-").ToLower() # $response = Invoke-WebRequest -Method $Method -Uri $Global:PPDM_API_BaseUri/api/v0/$Myself -Headers $Global:PPDM_API_Headers } Process { switch ($PsCmdlet.ParameterSetName) { 'byID' { $URI = "/$myself/$ID" } default { $URI = "/$myself" } } $Parameters = @{ body = $body Uri = $Uri Method = $Method RequestMethod = 'Rest' PPDM_API_BaseUri = $PPDM_API_BaseUri apiver = $apiver Verbose = $PSBoundParameters['Verbose'] -eq $true } try { $Response += Invoke-PPDMapirequest @Parameters } catch { Get-PPDMWebException -ExceptionMessage $_ break } write-verbose ($response | Out-String) } end { switch ($PsCmdlet.ParameterSetName) { 'byID' { write-output $response } default { write-output $response.content } } } } # Storage Targets # /api/v2/storage-systems function Get-PPDMstorage_systems { [CmdletBinding()] param( [Parameter(Mandatory = $false, ParameterSetName = 'byID', ValueFromPipelineByPropertyName = $true)] [string]$ID, $PPDM_API_BaseUri = $Global:PPDM_API_BaseUri, $apiver = "/api/v2" ) begin { $Response = @() $METHOD = "GET" $Myself = ($MyInvocation.MyCommand.Name.Substring(8) -replace "_", "-").ToLower() # $response = Invoke-WebRequest -Method $Method -Uri $Global:PPDM_API_BaseUri/api/v0/$Myself -Headers $Global:PPDM_API_Headers } Process { switch ($PsCmdlet.ParameterSetName) { 'byID' { $URI = "/$myself/$ID" } default { $URI = "/$myself" } } $Parameters = @{ body = $body Uri = $Uri Method = $Method RequestMethod = 'Rest' PPDM_API_BaseUri = $PPDM_API_BaseUri apiver = $apiver Verbose = $PSBoundParameters['Verbose'] -eq $true } try { $Response += Invoke-PPDMapirequest @Parameters } catch { Get-PPDMWebException -ExceptionMessage $_ break } write-verbose ($response | Out-String) } end { switch ($PsCmdlet.ParameterSetName) { 'byID' { write-output $response } default { write-output $response.content } } } } # mtrees # /api/v2/datadomain-mtrees function Get-PPDMdatadomain_mtrees { [CmdletBinding()] param( [Parameter(Mandatory = $false, ParameterSetName = 'byID', ValueFromPipelineByPropertyName = $true)] [string]$ID, $PPDM_API_BaseUri = $Global:PPDM_API_BaseUri, $apiver = "/api/v2" ) begin { $Response = @() $METHOD = "GET" $Myself = ($MyInvocation.MyCommand.Name.Substring(8) -replace "_", "-").ToLower() # $response = Invoke-WebRequest -Method $Method -Uri $Global:PPDM_API_BaseUri/api/v0/$Myself -Headers $Global:PPDM_API_Headers } Process { switch ($PsCmdlet.ParameterSetName) { 'byID' { $URI = "/$myself/$ID" } default { $URI = "/$myself" } } $Parameters = @{ body = $body Uri = $Uri Method = $Method RequestMethod = 'Rest' PPDM_API_BaseUri = $PPDM_API_BaseUri apiver = $apiver Verbose = $PSBoundParameters['Verbose'] -eq $true } try { $Response += Invoke-PPDMapirequest @Parameters } catch { Get-PPDMWebException -ExceptionMessage $_ break } write-verbose ($response | Out-String) } end { switch ($PsCmdlet.ParameterSetName) { 'byID' { write-output $response } default { write-output $response.content } } } } #### # api/v2/datadomain-cloud-units/{storageSystemId} function Get-PPDMdatadomain_cloud_units { [CmdletBinding()] param( [Parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true)] [alias('Id')][string]$storageSystemId, $PPDM_API_BaseUri = $Global:PPDM_API_BaseUri, $apiver = "/api/v2" ) begin { $Response = @() $METHOD = "GET" $Myself = ($MyInvocation.MyCommand.Name.Substring(8) -replace "_", "-").ToLower() # $response = Invoke-WebRequest -Method $Method -Uri $Global:PPDM_API_BaseUri/api/v0/$Myself -Headers $Global:PPDM_API_Headers } Process { switch ($PsCmdlet.ParameterSetName) { default { $URI = "/$myself/$storageSystemId" } } $Parameters = @{ body = $body Uri = $Uri Method = $Method RequestMethod = 'Rest' PPDM_API_BaseUri = $PPDM_API_BaseUri apiver = $apiver Verbose = $PSBoundParameters['Verbose'] -eq $true } try { $Response += Invoke-PPDMapirequest @Parameters } catch { Get-PPDMWebException -ExceptionMessage $_ break } write-verbose ($response | Out-String) } end { switch ($PsCmdlet.ParameterSetName) { 'byID' { write-output $response } default { write-output $response.content } } } } ###### # api/v2/datadomain-ddboost-encryption-settings function Get-PPDMdatadomain_ddboost_encryption_settings { [CmdletBinding()] param( [Parameter(Mandatory = $false, ParameterSetName = 'byID', ValueFromPipelineByPropertyName = $true)] [string]$ID, $PPDM_API_BaseUri = $Global:PPDM_API_BaseUri, $apiver = "/api/v2" ) begin { $Response = @() $METHOD = "GET" $Myself = ($MyInvocation.MyCommand.Name.Substring(8) -replace "_", "-").ToLower() } Process { switch ($PsCmdlet.ParameterSetName) { 'byID' { $URI = "/$myself/$ID" } default { $URI = "/$myself" } } $Parameters = @{ body = $body Uri = $Uri Method = $Method RequestMethod = 'Rest' PPDM_API_BaseUri = $PPDM_API_BaseUri apiver = $apiver Verbose = $PSBoundParameters['Verbose'] -eq $true } try { $Response += Invoke-PPDMapirequest @Parameters } catch { Get-PPDMWebException -ExceptionMessage $_ break } write-verbose ($response | Out-String) } end { switch ($PsCmdlet.ParameterSetName) { 'byID' { write-output $response } default { write-output $response.content } } } } |