Coder Social home page Coder Social logo

purestorage-connect / powershellsdk2 Goto Github PK

View Code? Open in Web Editor NEW
7.0 8.0 7.0 8.1 MB

Pure Storage FlashArray PowerShell Software Development Kit (SDK) version 2.

Home Page: https://support.purestorage.com/Solutions/Microsoft_Platform_Guide

License: Apache License 2.0

Rich Text Format 9.27% PowerShell 0.44% HTML 90.29%
powershell rest api flasharray powershell-sdk powershell-gallery storage

powershellsdk2's Introduction

Pure Storage FlashArray PowerShell SDK version 2   

GitHub all releases PowerShell Gallery

The Pure Storage PowerShell SDK provides integration with the Purity Operating Environment and FlashArray. It provides functionalities of Purity's REST API as PowerShell cmdlets. Read more about it here in our Microsoft Platform Guide.

Information on previous versions and the PowerShell Toolkit
The Pure Storage PowerShell SDK 1.19 is still available. There will be no future development on the 1.x versions of the SDK. All development is focused on supporting Purity REST API 2.x and greater.
We also have an open-source project, the Pure Storage PowerShell Toolkit that provides additional cmdlets to perform operations like testing Windows Server best practices, creating reports, remove pending deletes and more. We are always looking for contributions and feature requests.


🆕 WHAT'S NEW

Learn about all of the new capabilities that have been added to this latest release in the Release Notes.



☁️ INSTALLATION

Note: This MSI installer has been deprecated with this release.

Install-Module -Name PureStoragePowerShellSDK2


⬇️ RESOURCES

🔘 Pure Storage Support -- Programming Interfaces > PowerShell
🔘 Quick Start PowerShell SDK 2 Examples
🔘 Downloadable SDK v2 HTML Help file
🔘 SDK version 1.x Github Repository


ISSUES, QUESTION

🪲 Click here to report any issues.

❓ For questions or comments, join our Pure Storage Code Slack team! Check out the #pfa-powershell channel.

Visit code.purestorage.com for all our links to APIs, SDK, sample scripts, and more!



powershellsdk2's People

Contributors

dpecanha avatar dstamen avatar mikenelson-io avatar rquimbey avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

powershellsdk2's Issues

Add-PfaVolumeToContainer equivalent cmdlet for SDK2

Hello,

We are trying to add existing volumes to a new Pure Pod with SDK2. According to the cmdlet_Matrix.pdf, equivalent SDK2 cmdlet for Add-PfaVolumeToContainer is New-Pfa2Connection. Is this still the case? New-Pfa2Connection appears to only accept Host or Host Group as target for volume add, not a Pod.

In the case of Add-PfaVolumeToContainer, Pod is our target for volume add. I also came across Update-Pfa2ContainerDefaultProtection cmdlet, but I don't believe that's what we want.

Thank you!
Ivan

PureStoragePowerShellSDK2 cmdlets return blank lines when running within an IDE

When using the PureStoragePowerShellSDK2 module from within an IDE, such as VS Code, Sapien PowerShell Studio, ISE, etc., some (or all) cmdlets from the PureStoragePowerShellSDK2 module return only blank lines. For example, all of these will return blank lines:

Get-Pfa2Volume

$vols = Get-Pfa2Volume #no output expected here
$vols
$vols | Select-Object Name
$vols | Get-Member
Write-Output $vols

These commands, however, will return data:

$count = ($vols | Measure-Object).Count #no output expected here
$count

$volnames = $vols.Name #no output expected here
$volnames

foreach ($vol in $vols) {
    $volname = $vol.Name
    Write-Output $volname
}

This issue was confirmed by Pure support. See case #00934363.

Named cert import states that the cert already exists instead of importing the updated cert

Running this: New-Pfa2Certificate -Certificate $cert1 -IntermediateCertificate $cert2 -Key $key -Passphrase $pp --Name management
results in error:
New-Pfa2Certificate: Certificate exists (), https://arrayname/api/2.17/certificates?names=management (POST)
Expected result: new CA certificate imports and overwrites existing CA certificate (both for updating old cert or moving from self-signed to CA signed).

Also, if attempting to update without using the name parameter it does not tell you which parameter is missing:
New-Pfa2Certificate: Missing or invalid parameter. (), https://arrayname/api/2.17/certificates (POST)
Expected result: Error plus listing the parameter that was expected.

Utilizing CLI method directly works, although cannot use it via the SDK2 since it is interactive:
@purearray> purecert setattr management --certificate --intermediate-certificate --key --passphrase

The pipeline has been stopped.

Get-Pfa2Volume | Select-Object -First 1

Returns first X amount of volumes and then throws the exception.

PSMessageDetails      :
Exception             : System.Management.Automation.PipelineStoppedException: The pipeline has been stopped.
                           at System.Management.Automation.CommandProcessor.ProcessRecord()
                           at System.Management.Automation.CommandProcessorBase.DoExecute()
                           at System.Management.Automation.Cmdlet.WriteObject(Object sendToPipeline)
                           at PureStorage.Rest.PowerShell.CmdletUtils.ProcessApiResponse[T](PSCmdlet cmdlet, Rest2Api array, Nullable`1 Limit, Func`3 getReponseUsingToken)
                           at PureStorage.Rest.PowerShell.GetVolumeCmdlet.EndProcessing()
TargetObject          :
CategoryInfo          : NotSpecified: (:) [Get-Pfa2Volume], PipelineStoppedException
FullyQualifiedErrorId : PureStorage.Rest.PowerShell.GetVolumeCmdlet
ErrorDetails          :
InvocationInfo        : System.Management.Automation.InvocationInfo
ScriptStackTrace      : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : {0, 1, 1}

Get-Pfa2Volume (2.2.272.0) appears to be hardcoded to use only API v2.2

In my attempts to use Get-Pfa2Volume against Purity/FA running 5.3.13, it is failing with the following error.

PS>Get-Pfa2Volume -Array $array
Get-Pfa2Volume: Response: Error calling Api22VolumesGet: from Get-Pfa2Volume (__AllParameterSets) Array=blahblah

My attempts to force the use of API v2.0 or v2.1 where not successful.

Add Number of Host Target connections to Get-Pfa2Host cmdlet

It would be helpful during certain maintenance windows for us to get the number of target connections of all the hosts that the Pure array reports. The Get-Pfa2Host cmdlet already returns a PortConnectivity but only tells you the overall status such as 'redundant', 'unused', etc:

(Get-Pfa2Host -Array $pure112 -Name PASQL444B).PortConnectivity

Details     Status
-------     ------
Unused Port unhealthy

Could another item be added for an actual number count of target connections for the host? You can see the count in the purity UI under Health -> Connections, but it would be very helpful to get with this cmdlet

2023-03-03 16_31_44-papure112 _ Pure Storage - Brave

How to get system space usage via PureStoragePowerShellSDK2

It seems as if the PureStoragePowerShellSDK (v1) module is not compatible with PowerShell 7, so I need to move to the PureStoragePowerShellSDK2 module. Our arrays support it, so we're good there. With the v1 module, I am using the Get-PfaArraySpaceMetrics cmdlet to get some data from our arrays. How can I get this information when using the PureStoragePowerShellSDK2 module with PowerShell 7?

New-Pfa2PolicyQuotaRule Cmdlet only supports Bytes, and only 32bit Int

After reviewing command syntax in both 2.24.70 and 2.26.24, it appears that the cmdlet New-Pfa2PolicyQuotaRule only passes the -RulesQuotaLimit parameter to the array in bytes. This would not be a problem if it were not for the fact that the variable type <List[Nullable[int]]> is only a 32bit integer which does not support anything in the GB range or more.

Hopefully I am misunderstanding or missing a parameter that is not documented in the Help/Manifest because otherwise, creating Quota rules for my file shares is not easily scripted using this module.

Command syntax (As reported by get-command -syntax):
New-Pfa2PolicyQuotaRule -RulesQuotaLimit <List[Nullable[int]]> [-Array ] [-XRequestId ] [-PolicyId <List[string]>] [-PolicyName <List[string]>] [-IgnoreUsage ] [-Rules
Enforced <List[Nullable[bool]]>] [-RulesNotifications <List[string]>] [-ApiVersion ] []

Could not load file or assembly 'Newtonsoft.Json, Version=9.0.0.0

I upgraded to the latest version of the PS module (2.26.70), and I am now getting the following error when I try to connect to my arrays. I removed the module entirely and installed it from scratch, but I am still getting the same error. I don't know what version I had installed previously, but I did not get this error with it. I think it had a '7' in the version number, so maybe it was 2.2.272 or 2.2.276.

Connect-Pfa2Array : Could not load file or assembly 'Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies.
The system cannot find the file specified.

I checked the module's folder contents, and I see the Newtonsoft.Json.dll file in there. It says it is version 13, though.

Update-Pfa2Support requires 'array_admin' role to enable Remote Assist

Update-Pfa2Support requires 'array_admin' role to enable Remote Assist where as the current array management interface and the CLI allow the 'storage_admin' role to enable Remote Assist.

To my knowledge only the local 'pureuser' account can be assigned the 'array_admin' role. For Update-Pfa2Support to be useful in our automation work this cmdlet needs to allow the 'storage_admin' role to perform this function too.

PS7 module import

I am developing some automation against my Pure arrays in PowerShell 7. It seems that every time I want to execute a command in a PowerShell 7 session I have to import the module to use the cmdlets. This is not an issue in PowerShell 5 sessions however.

Get-Pfa2Connection returns $null, verbose shows exception.

Error: Exception "PureRestException: HttpStatusCode = '0', RestErrorCode = 'InternalError', Details = '', InnerException = 'Newtonsoft.Json.JsonReaderException: JSON
integer 38654705917 is too large or small for an Int32. Path 'items[0].lun', line 1, position 193.

API returns value as Int64.

VM disk ID mismatched with pure storage volume id

I am trying to compare VM disk with Pure Storage volume. We have an option in SDK 1 to get VVOL ID by using get-vvolUuidFromHardDisk. In SDK 2.0, didn't find option to get the same. We have to use SDK 1 and 2 both to get UID. Is there any option to get UID in SDK 2.0?

Get-Pfa2Array doesn't contain replication value, but API does.

Get-Pfa2Array

class Space {
   DataReduction: 
   Shared: 
   Snapshots: 
   System: 
   ThinProvisioning: 
   TotalPhysical: 
   TotalProvisioned: 
   TotalReduction: 
   Unique: 
   Virtual: 
}

JSON Response via -Verbose

"space":{
	"data_reduction":
	"shared":,
	"snapshots":,
	"system":,
	"thin_provisioning":,
	"total_physical":,
	"total_provisioned":,
	"total_reduction":,
	"unique":,
	"virtual":,
	"replication":
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.