Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolving Submit-Request.ps1 conflict.
- Loading branch information
Showing
77 changed files
with
1,378 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Expected Behavior | ||
|
||
Please describe the behavior you are expecting. | ||
|
||
# Current Behavior | ||
|
||
What is the current behavior? | ||
|
||
# Failure Information (for bugs) | ||
|
||
Please help provide information about the failure if this is a bug by issuing the command using the `-Verbose` command. | ||
|
||
``` | ||
Paste the verbose output from the command here | ||
``` | ||
|
||
**_If it is not a bug, please remove the rest of this template._** | ||
|
||
## Steps to Reproduce | ||
|
||
Please provide detailed steps for reproducing the issue. | ||
|
||
1. Step 1 | ||
1. Step 2 | ||
1. Step 3 (and so on) | ||
|
||
## Context | ||
|
||
Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions. | ||
|
||
* **Rubrik PowerShell Module Version**: Use `Get-Module -ListAvailable Rubrik` | ||
* **PowerShell Version**: Use `Get-PSVersion` | ||
* **Operating System**: | ||
|
||
## Failure Logs | ||
|
||
Please include any relevant log snippets or files here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Description | ||
|
||
Please describe your pull request in detail. | ||
|
||
## Related Issue | ||
|
||
This project only accepts pull requests related to open issues. | ||
|
||
* If suggesting a new feature or change, please discuss it in an issue first. | ||
* If fixing a bug, there should be an issue describing it with steps to reproduce | ||
|
||
_Please link to the issue here_ | ||
|
||
## Motivation and Context | ||
|
||
Why is this change required? What problem does it solve? | ||
|
||
## How Has This Been Tested? | ||
|
||
* Please describe in detail how you tested your changes. | ||
* Include details of your testing environment, and the tests you ran to see how your change affects other areas of the code, etc. | ||
|
||
## Screenshots (if appropriate): | ||
|
||
## Types of changes | ||
|
||
What types of changes does your code introduce? Put an `x` in all the boxes that apply: | ||
- [ ] Bug fix (non-breaking change which fixes an issue) | ||
- [ ] New feature (non-breaking change which adds functionality) | ||
- [ ] Breaking change (fix or feature that would cause existing functionality to change) | ||
|
||
## Checklist: | ||
|
||
Go over all the following points, and put an `x` in all the boxes that apply. If you're unsure about any of these, don't hesitate to ask. We're here to help! | ||
- [ ] My code follows the code style of this project. | ||
- [ ] My change requires a change to the documentation. | ||
- [ ] I have updated the documentation accordingly. | ||
- [ ] I have read the **[CONTRIBUTION](http://rubrikinc.github.io/PowerShell-Module/documentation/contribution.html)** document. | ||
- [ ] I have updated the CHANGELOG file accordingly for the version that this merge modifies. | ||
- [ ] I have added tests to cover my changes. | ||
- [ ] All new and existing tests passed. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Change Log | ||
|
||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](http://keepachangelog.com/) | ||
and this project adheres to [Semantic Versioning](http://semver.org/). | ||
|
||
## Types of changes | ||
|
||
* **Added** for new features. | ||
* **Changed** for changes in existing functionality. | ||
* **Deprecated** for soon-to-be removed features. | ||
* **Removed** for now removed features. | ||
* **Fixed** for any bug fixes. | ||
* **Security** in case of vulnerabilities. | ||
|
||
## [Unreleased] | ||
|
||
### Added | ||
|
||
* Testing for MacOS and Linux as per [143](https://github.com/rubrikinc/PowerShell-Module/issues/143) | ||
|
||
## [4.0.0] - 2017-07-07 | ||
|
||
### Added | ||
|
||
* `Set-RubrikSupportTunnel` - Modifies the configuration of the Support Tunnel. | ||
* `Get-RubrikSupportTunnel` - Checks the status of the Support Tunnel. | ||
* This Changelog - moving forward, related changes will be documented here in an easy to read format for human eyeballs. | ||
* Dynamic documentation creation via GitBook. | ||
* [GitHub Pull Request Template](https://github.com/rubrikinc/PowerShell-Module/pull/135). | ||
* [GitHub Issue Template](https://github.com/rubrikinc/PowerShell-Module/commit/ca0a7fc1864c42162236b4e68af6f44d07f0a164). | ||
* [Invoke-RubrikRESTCall](https://github.com/rubrikinc/PowerShell-Module/pull/118). | ||
|
||
### Changed | ||
|
||
* Track `user_error` responses in the `Submit-Request` private function | ||
* The `Get-RubrikSnapshot` function supports HyperV VMs. | ||
|
||
### Deprecated | ||
|
||
* Dynamic documentation using ReadTheDocs and reStructuredText. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,41 @@ | ||
function Submit-Request($uri,$header,$method = $($resources.Method) ,$body) | ||
{ | ||
# The Submit-Request function is used to send data to an endpoint and then format the response for further use | ||
# $uri = The endpoint's URI | ||
# $header = The header containing authentication details | ||
# $method = The action (method) to perform on the endpoint | ||
# $body = Any optional body data being submitted to the endpoint | ||
function Submit-Request($uri, $header, $method = $($resources.Method) , $body) { | ||
# The Submit-Request function is used to send data to an endpoint and then format the response for further use | ||
# $uri = The endpoint's URI | ||
# $header = The header containing authentication details | ||
# $method = The action (method) to perform on the endpoint | ||
# $body = Any optional body data being submitted to the endpoint | ||
|
||
if ($PSCmdlet.ShouldProcess($id,$resources.Description)) | ||
{ | ||
try | ||
{ | ||
Write-Verbose -Message 'Submitting the request' | ||
# Because some calls require more than the default payload limit of 2MB, ExpandPayload dynamically adjusts the payload limit | ||
$result = ExpandPayload -response (Invoke-WebRequest -Uri $uri -Headers $header -Method $method -Body $body) | ||
} | ||
catch | ||
{ | ||
switch -Wildcard ($_) | ||
{ | ||
'Route not defined.' | ||
{ | ||
Write-Warning -Message "The endpoint supplied to Rubrik is invalid. Likely this is due to an incompatible version of the API or references pointing to a non-existent endpoint. The URI passed was: $uri" -Verbose | ||
throw $_.Exception | ||
} | ||
'Invalid ManagedId*' | ||
{ | ||
Write-Warning -Message "The endpoint supplied to Rubrik is invalid. Likely this is due to an incompatible version of the API or references pointing to a non-existent endpoint. The URI passed was: $uri" -Verbose | ||
throw $_.Exception | ||
if ($PSCmdlet.ShouldProcess($id, $resources.Description)) { | ||
try { | ||
Write-Verbose -Message 'Submitting the request' | ||
# Because some calls require more than the default payload limit of 2MB, ExpandPayload dynamically adjusts the payload limit | ||
$result = ExpandPayload -response (Invoke-WebRequest -Uri $uri -Headers $header -Method $method -Body $body) | ||
} | ||
default | ||
{ | ||
throw $_ | ||
catch { | ||
switch -Wildcard ($_) { | ||
'Route not defined.' { | ||
Write-Warning -Message "The endpoint supplied to Rubrik is invalid. Likely this is due to an incompatible version of the API or references pointing to a non-existent endpoint. The URI passed was: $uri" -Verbose | ||
throw $_.Exception | ||
} | ||
'Invalid ManagedId*' { | ||
Write-Warning -Message "The endpoint supplied to Rubrik is invalid. Likely this is due to an incompatible version of the API or references pointing to a non-existent endpoint. The URI passed was: $uri" -Verbose | ||
throw $_.Exception | ||
} | ||
'{"errorType":*' { | ||
# Parses the Rubrik generated JSON warning into something a bit more human readable | ||
# Fields are: errorType, message, and cause | ||
[Array]$rubrikWarning = ConvertFrom-Json $_.ErrorDetails.Message | ||
if ($rubrikWarning.errorType) {Write-Warning -Message $rubrikWarning.errorType} | ||
if ($rubrikWarning.message) {Write-Warning -Message $rubrikWarning.message} | ||
if ($rubrikWarning.cause) {Write-Warning -Message $rubrikWarning.cause} | ||
throw $_.Exception | ||
} | ||
default { | ||
throw $_ | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
return $result | ||
} | ||
return $result | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#requires -Version 3 | ||
function Get-RubrikSupportTunnel | ||
{ | ||
<# | ||
.SYNOPSIS | ||
Checks the status of the Support Tunnel | ||
.DESCRIPTION | ||
The Get-RubrikSupportTunnel cmdlet is used to query the Rubrik cluster to determine the status of the Support Tunnel | ||
This tunnel is used by Rubrik's support team for providing remote assistance and is toggled on or off by the cluster administrator | ||
.NOTES | ||
Written by Chris Wahl for community usage | ||
Twitter: @ChrisWahl | ||
GitHub: chriswahl | ||
.LINK | ||
https://github.com/rubrikinc/PowerShell-Module | ||
.EXAMPLE | ||
Get-RubrikSupportTunnel | ||
This will return details on the configuration of the Support Tunnel for the currently connected Rubrik cluster | ||
#> | ||
|
||
[CmdletBinding()] | ||
Param( | ||
# Rubrik server IP or FQDN | ||
[String]$Server = $global:RubrikConnection.server, | ||
# API version | ||
[String]$api = $global:RubrikConnection.api | ||
) | ||
|
||
Begin { | ||
|
||
# The Begin section is used to perform one-time loads of data necessary to carry out the function's purpose | ||
# If a command needs to be run with each iteration or pipeline input, place it in the Process section | ||
|
||
# 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).$api | ||
Write-Verbose -Message "Load API data for $($resources.Function)" | ||
Write-Verbose -Message "Description: $($resources.Description)" | ||
|
||
} | ||
|
||
Process { | ||
|
||
$uri = New-URIString -server $Server -endpoint ($resources.URI) -id $id | ||
$uri = Test-QueryParam -querykeys ($resources.Query.Keys) -parameters ((Get-Command $function).Parameters.Values) -uri $uri | ||
$body = New-BodyString -bodykeys ($resources.Body.Keys) -parameters ((Get-Command $function).Parameters.Values) | ||
$result = Submit-Request -uri $uri -header $Header -method $($resources.Method) -body $body | ||
$result = Test-ReturnFormat -api $api -result $result -location $resources.Result | ||
$result = Test-FilterObject -filter ($resources.Filter) -result $result | ||
|
||
return $result | ||
|
||
} # End of process | ||
} # End of function |
Oops, something went wrong.