Git Product home page Git Product logo

purestorage.pure1's Introduction

PureStorage.Pure1

Pure Storage Pure1 Module

The module is called PureStorage.Pure1 and can be used to interact with the Pure1 API via PowerShell.

To report issues or request new features, please enter them here:

https://github.com/PureStorage-OpenConnect/PureStorage.Pure1/issues

For questions, join our Pure Storage Code Slack team!

There are a couple of places you can download this. The best option is the PowerShell gallery! This allows you to use install-module to automatically install the module.

To install:

install-module PureStorage.Pure1

To load the module:

import-module PureStorage.Pure1 

To update:

update-module PureStorage.Pure1

Use either get-help or get-command to see the details:

Comment on Versioning

Versions numbering w.x.y.z (for example 1.2.0.0)

  • W is iterated for large updates
  • X is iterated for new cmdlets/significant enhancements
  • Y is iterated for new functions to existing cmdlets
  • Z is iterated for bug fixes

Latest version 1.4.4.3 (July 21st, 2022)

See version details: https://github.com/PureStorage-OpenConnect/PureStorage.Pure1/issues/52

New features:

Bug Fixes:

  • Enhanced handling of metrics with multiple availabilities by the Get-PureOneMetric command

Latest version 1.4.4.1 (June 2nd, 2021)

See version details: https://github.com/PureStorage-OpenConnect/PureStorage.Pure1/issues/45

New features:

Bug Fixes:

  • Fix for linux/mac based JWT generation

Version 1.4.4.0 (January 26th, 2021)

See version details: https://github.com/PureStorage-OpenConnect/PureStorage.Pure1/projects/8

New features:

Bug Fixes:

None

Version 1.4.3.1 (December 12th, 2020)

See version details: https://github.com/PureStorage-OpenConnect/PureStorage.Pure1/issues/43

New features:

Bug Fixes:

None

Version 1.4.2.0 (December 5th, 2020)

See version details: https://github.com/PureStorage-OpenConnect/PureStorage.Pure1/projects/6

New features:

Bug Fixes:

Version 1.4.1.1 (November 25th, 2020)

See version details: https://github.com/PureStorage-OpenConnect/PureStorage.Pure1/projects/6

New features:

Bug Fixes:

Version 1.3.0.0 (September 24th, 2020)

See version details: https://github.com/PureStorage-OpenConnect/PureStorage.Pure1/projects/3

New features:

Bug Fixes:



purestorage.pure1's People

Contributors

codyhosterman avatar aorlovatpure avatar

Stargazers

Andrew avatar Alex Carver avatar

Watchers

James Cloos avatar Wes Mertes avatar  avatar  avatar Craig Waters avatar Simon Dodsley avatar Alex Carver avatar  avatar  avatar

Forkers

kjstillabower

purestorage.pure1's Issues

Error with export certificate feature

PS>Get-PureOneCertificate -Export -ExportDirectory "c:\temp"
Please enter a certificate export password: ****
ConvertFrom-SecureString : A parameter cannot be found that matches parameter name 'AsPlainText'.

This is due to no support on PowerShell 5.1 for -asplaintext. Adding alternative code path if PowerShell 5 is in use

Formatting Output

On the Pure PowerShell code, when pulling the files, we are getting the columns combined in the file.

I have to manually separate out the columns.

Is it possible to update the powershell code to make this happen automatically ?

Here is the example.

Get-PureOneVolume

This cmdlet call shows the first two columns fine. But third column is a combination of four columns. We have to manually separate them.

Get-PureOneVolume | Select id, name , @{Expression={$.arrays.id -join ';' }} , @{Expression={$.arrays.name -join ';' }} , `

@{Expression={$.arrays.resource_type -join ';' }} , @{Expression={$.arrays.fqdn -join ';' }} , created, destroyed , eradicated , pod , provisioned , serial , source , _as_of

Same goes for other cmdlets
Get-PureOneFileSystem
Get-PureOneArrayTag

Please let me know if you can do it internally on the above mentioned cmdlets.

Allow cmdlets to use default cert/keys

With the 1.4.x.x release there is a new default cert/key feature. The cmdlets should be enhanced to not require a cert or private key if the default is desired. Cmdlets:

Get-PureOnePublicKey, New-PureOneJwt, New-PureOneConnection

Get-PureOneVolumeSnapshot fails with gateway issue

For some reason, the get-pureonevolumesnapshot operation does not scale well with the default result limit of 1,000. Seems to tip over at a 1,000. So I implemented a new global variable $global:PureOneRateLimit that controls how many responses are returned per REST operation for requests that use the continuation token (volumes, snapshots). The snapshot one will default to 500 unless you override by setting that variable to something else. Volumes will continue to default to whatever the default is, currently 1,000. If you set the variable though it will use that number too.

Will follow up with Pure1 as to why this is happening. If it hits the error though it will pause for 5 seconds and retry.

Pipelining doesnt work for certificate object for New-PureOneJwt

When support for Unix was added it broke pipelining support for Windows certificates. So the following:

$cert | New-PureOneJwt -PureAppID myAPPid

Asks you for the Unix private key. This is likely due to pipeline objects being processed last and causing PowerShell to select the wrong parameter set. Not sure how to fix this yet. For now the workaround is to pass in the certificate not via pipeline, so like:

New-PureOneJwt -PureAppID myAPPid -Certificate $cert

Handle cases when pure metrics have multiple availabilities defined

When a target metric passed to the Get-PureOneMetric command has a single availability defined (includes granularity and metrics history available time range), we can use the granularity and the available time range as defaults if no granularity and/or start time were specified via input the parameters of the command.
If there are multiple availabilities defined for a metric, those parameters (granularity and start time) need to be specified explicitly, since it's not clear which availability definition to use as defaults.

New-PureOneOperation - No access token found in the global variable or passed in.

Following error after authentication and pulling arrays list:
`
New-PureOneConnection -certificate $certObject -pureAppID "blahblahblah"
$arrays = @()
$arrays = Get-PureOneArray
$arrays | select | where {$_.name -like "MYTESTARRAY"}

#-We get a values list of Arrays (id/hosts redacted):
id : xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
name : MYTESTARRAY
fqdn : MYTESTARRAY.FDQN
model : FA-X20R2
os : Purity//FA
version : 6.0.0
_as_of : 1599061801000

#-/api/1.latest/alerts
$alerts = New-PureOneOperation -resourceType "alerts" -queryFilter "?names='MYTESTARRAY'" -restOperationType GET

No access token found in the global variable or passed in. Run the cmdlet New-PureOneRestConnection to authenticate.
At C:\Program Files\WindowsPowerShell\Modules\purestorage.pure1\PureStorage.Pure1.psm1:2078 char:9

  •     throw "No access token found in the global variable or passed ...
    
  •     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : OperationStopped: (No access token...o authenticate.:String) [], RuntimeException
    • FullyQualifiedErrorId : No access token found in the global variable or passed in. Run the cmdlet New-PureOneRestConnection to authenticate.
      `

$Global:DefaultPureOneConnection does not appear to be set as manually setting it to the active $Global:PureOneConnections

Does appear to carry on, but does not retrieve resources.

Support multiple Pure1 Organizations

Add ability to specify Pure1 org in cmdlets.

Make the cmdlets iterate through all organizations in the global variable. Or use what is passed in.

Add Remove-PureOneConnection

Add a cmdlet to remove Pure1 connections.

If only one existing session: remove it with no parameters.

If more than one connection: require org ID or access token.

Get-PureOnePublicKey fails on Mac/Linux

<location>Get-PureOnePublicKey Please enter your RSA private key password: *********** Exception: Public key could not be generated. Confirm password and/or permission access to private key

Issue retrieving the public key on Linux/Mac

Auto-refresh session if JWT is still valid

Currently PowerShell sessions expire after 10 hours, and the default JWT is good for 30 days. I will add semantics to catch expired sessions and refresh if the JWT is still good. If the JWT is expired that should be on the user to re-create the JWT.

Debug support

Currently there is no advanced debug logging. Adding write-debug where appropriate so when run with -debug more information can be gleaned

Reconnections fail in Pure1

Ggracefully handle multiple connection retries on same Pure1 org. If 2nd+ connection for same org is attempted fail and ensure that it is not listed in $Global:PureOneConnections.

New-PureOneOperation does not terminate correctly

New-PureOneOperation throws non-terminating errors when the Pure1 REST service returns an error response which causes cascading errors. Setting ErrorActionPreference to stop temporarily and then reverting so it ends upon REST failure

Pure1 PowerShell module does not work in Core on Linux

New-SelfSignedCertificate: /home/pureuser/.local/share/powershell/Modules/PureStorage.Pure1/1.1.0.0/PureStorage.Pure1.psm1:47
Line |
47 | $CertObj = New-SelfSignedCertificate -certstorelocation $cert …
| ~~~~~~~~~~~~~~~~~~~~~~~~~
| The term 'New-SelfSignedCertificate' is not recognized as the name of a cmdlet, function, script file,
| or operable program. Check the spelling of the name, or if a path was included, verify that the path
| is correct and try again.

This is due to not being able to use certificates and needs to use OpenSSL instead. Will work on updating it.

Use default private key if present for Unix systems

Since RSA private key pairs use passwords, we can have the New-PureOneConnection detect the default key pair and if present (and of course if no specific one was passed in) automatically use that. This will allow users of the default created key pair (at /home//PureOnePrivate.pem to not have to pass the key location in upon each initial login and only require the password and the Pure1 app ID.

Can't open ./PureOneSignedHeader.txt for reading, No such file or directory

Creating a new Pure1 connection or generating a JWT throws an error:

Can't open ./PureOneSignedHeader.txt for reading, No such file or directory
140496100544960:error:02001002:system library:fopen:No such file or directory:../crypto/bio/bss_file.c:72:fopen('./PureOneSignedHeader.txt','rb')
140496100544960:error:2006D080:BIO routines:BIO_new_file:no such file:../crypto/bio/bss_file.c:79:

This does not cause the operation to fail, but it looks like it does. This is due to a race condition between commands for openssl.

Set-PureOneDefaultCertificate

To make it easier to lookup a cert, there will be a designation of the default cert. This will be set automatically moving forward, but if you would like to change default certs or designate a manually created one this cmdlet will set the specified cert as default.

PowerShell core JWT creation fails

If you create a certificate and immediately try to create a JWT (after putting the public key in Pure1) it fails with an error of cannot find private key in PowerShell core only. There seems to be some lag with the creation of the private key and it does not appear in the powershell object storing the cert. The fix is to refresh the cert in the new-pureonecertificate cmdlet so it is fully created:

 $CertObj = Get-ChildItem -Path $CertObj.PSPath
  return $CertObj

Will add this in next release.

Make internal function for REST header

Instead of looking for REST token in each one, create one function to check for passed in token or if not present, global token and then convert it into the proper header style and return it.

Authenticate with a JWT

This will allow a script or user to use a JWT only to authenticate with Pure1, without needing a cert, key pair, or app ID

Mislabeled Parameter in Get-PureOneBusyMeter Help example

get-help Get-PureOneArrayLoadMeter -Examples
-------------------------- EXAMPLE 4 --------------------------
PS > PS C:\ Get-PureOneArrayBusyMeter -objectName flasharray-m50-1 -startTime (get-date).AddDays(-1) -startTime (get-date).AddDays(-1) -granularity 86400000 -maximum (edited)

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.