Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 604 - More content-body errors #606

Merged
merged 2 commits into from
Apr 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

### Changed

* Removed -Body $body from `Get-RubrikClusterStorage` and `Get-RubrikDNSSetting` when it passes variables to Submit-Request as per [Issue 604](https://github.com/rubrikinc/rubrik-sdk-for-powershell/issues/604)
* Removed -Body $body from `Get-RubrikClusterInfo` when it passes variables to Submit-Request as per [Issue 604](https://github.com/rubrikinc/rubrik-sdk-for-powershell/issues/604)
* Added support to `Get-RubrikObject` for ClusterNetworkInterfaces, Event Series, HyperV Hosts, Nodes, Notification Settings, NTP Servers, Nutanix Clusters and SMB Domains
* Added support to `Get-RubrikObject` to support searching by id on an attribute which isn't named `id`
Expand Down
38 changes: 19 additions & 19 deletions Rubrik/Public/Get-RubrikClusterStorage.ps1
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
#Requires -Version 3
function Get-RubrikClusterStorage
{
<#
<#
.SYNOPSIS
Connects to Rubrik and retrieves node information for a given cluster

.DESCRIPTION
The Get-RubrikClusterStorage cmdlet will retrieve various capacity and usage information about cluster storage.

.NOTES
Written by Mike Preston for community usage
Twitter: @mwpreston
GitHub: mwpreston

.LINK
https://rubrik.gitbook.io/rubrik-sdk-for-powershell/command-documentation/reference/get-rubrikclusterstorage

.EXAMPLE
Get-RubrikClusterStorage
This will return the storage capacity and usage information about the authenticated cluster.
Expand All @@ -36,17 +36,17 @@ function Get-RubrikClusterStorage

# Check to ensure that a session to the Rubrik cluster exists and load the needed header data for authentication
Test-RubrikConnection

# API data references the name of the function
# For convenience, that name is saved here to $function
$function = $MyInvocation.MyCommand.Name

# Retrieve all of the URI, method, body, query, result, filter, and success details for the API endpoint
Write-Verbose -Message "Gather API Data for $function"
$resources = Get-RubrikAPIData -endpoint $function
Write-Verbose -Message "Load API data for $($resources.Function)"
Write-Verbose -Message "Description: $($resources.Description)"

}

Process {
Expand All @@ -56,7 +56,7 @@ function Get-RubrikClusterStorage
$result = @{}
foreach ($key in $resources.URI.Keys ) {
$uri = New-URIString -server $Server -endpoint $Resources.URI[$key] -id $id
$iresult = Submit-Request -uri $uri -header $Header -method $($resources.Method) -body $body
$iresult = Submit-Request -uri $uri -header $Header -method $($resources.Method)
switch ($key) {
{$_ -in "DiskCapacityInTb","FlashCapacityInTb"} { $result.Add($key, ([Math]::round(($iresult.bytes/$tb),$precision))) }
"StorageOverview" {
Expand All @@ -69,25 +69,25 @@ function Get-RubrikClusterStorage
$SnapshotStorageInBy = $iresult.snapshot # For later usage
$AvailableStorageInBy = $iresult.available # for later calculations
}
"CloudStorage" {
$result.add("ArchivalUsageInTb", ([Math]::round(($iresult.value/$tb),$precision)))
"CloudStorage" {
$result.add("ArchivalUsageInTb", ([Math]::round(($iresult.value/$tb),$precision)))
$ArchivalUsageInBy = $iresult.value # for later usage
}
"DailyGrowth" {
$result.add("AverageGrowthPerDayInGb", ([Math]::round(($iresult.bytes/$gb),$precision)))
"DailyGrowth" {
$result.add("AverageGrowthPerDayInGb", ([Math]::round(($iresult.bytes/$gb),$precision)))
$DailyGrowthInBy = $iresult.bytes # for later calculations
}
"CloudStorageIngested" {
"CloudStorageIngested" {
$result.add("TotalArchiveStorageIngestedInTb",([Math]::round(($iresult.value/$tb),$precision)))
$IngestedArchiveStorageInB = $iresult.value
}
"LocalStorageIngested" {
}
"LocalStorageIngested" {
$result.add("TotalLocalStorageIngestedInTb",([Math]::round(($iresult.value/$tb),$precision)))
$IngestedLocalStorageInBy = $iresult.value
}
}
}
}

# Calculate data reduction numbers with ingested storage, and estimated runway,add to results
if ($IngestedArchiveStorageInB -eq 0 -or $null -eq $IngestedArchiveStorageInB) { $ArchivalDataReduction = "Not Available" }
else { $ArchivalDataReduction = [Math]::round(100 - (($ArchivalUsageInBy/$IngestedArchiveStorageInB) * 100),1) }
Expand All @@ -98,7 +98,7 @@ function Get-RubrikClusterStorage
if ($DailyGrowthInBy -eq 0 -or $null -eq $DailyGrowthInBy) { $EstimatedRunwayInDays = "Not Available"}
else { $EstimatedRunwayInDays = [Math]::round(($AvailableStorageInBy/$DailyGrowthInBy)) }
$result.Add("EstimatedRunwayInDays", $EstimatedRunwayInDays)

return $result

} # End of process
Expand Down
22 changes: 11 additions & 11 deletions Rubrik/Public/Get-RubrikDNSSetting.ps1
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
#Requires -Version 3
function Get-RubrikDNSSetting
{
<#
<#
.SYNOPSIS
Connects to Rubrik and retrieves DNS Settings assigned to a given cluster

.DESCRIPTION
The Get-RubrikDNSSetting cmdlet will retrieve information around the node members of a given cluster.

.NOTES
Written by Mike Preston for community usage
Twitter: @mwpreston
GitHub: mwpreston

.LINK
https://rubrik.gitbook.io/rubrik-sdk-for-powershell/command-documentation/reference/get-rubrikdnssetting

.EXAMPLE
Get-RubrikDNSSetting
Get-RubrikDNSSetting
This will return the information around the DNS settings of the currently authenticated cluster
#>

Expand All @@ -36,28 +36,28 @@ function Get-RubrikDNSSetting

# Check to ensure that a session to the Rubrik cluster exists and load the needed header data for authentication
Test-RubrikConnection

# API data references the name of the function
# For convenience, that name is saved here to $function
$function = $MyInvocation.MyCommand.Name

# Retrieve all of the URI, method, body, query, result, filter, and success details for the API endpoint
Write-Verbose -Message "Gather API Data for $function"
$resources = Get-RubrikAPIData -endpoint $function
Write-Verbose -Message "Load API data for $($resources.Function)"
Write-Verbose -Message "Description: $($resources.Description)"

}

Process {

$result = New-Object -TypeName psobject
foreach ($key in $resources.URI.Keys ) {
$uri = New-URIString -server $Server -endpoint $Resources.URI[$key] -id $id
$iresult = Submit-Request -uri $uri -header $Header -method $($resources.Method) -body $body
$iresult = Submit-Request -uri $uri -header $Header -method $($resources.Method)
# support for < 5.0
if ($null -ne $iresult.data ) { $iresult = $iresult.data }

switch ($key) {
"DNSServers" {$result | Add-Member -NotePropertyName "$key" -NotePropertyValue $iresult}
"DNSSearchDomain" {$result | Add-Member -NotePropertyName "$key" -NotePropertyValue $iresult}
Expand Down