The go-pure-client Go module provides clients for the FlashArray 2.x API and the FlashBlade 2.x API (preview).
The module requires Go 1.24 or higher.
Each REST version is its own Go module. Add the import for the REST version you target:
import gopureclient "github.com/PureStorage-OpenConnect/go-pure-client/flasharray/FA_2_26"Install it pinned to an SDK release:
go get github.com/PureStorage-OpenConnect/go-pure-client/flasharray/FA_2_26@v0.25.0
or track the latest:
go get github.com/PureStorage-OpenConnect/go-pure-client/flasharray/FA_2_26@latest
Please note: Specific package might be different depending on the REST version used.
Releases are tagged per module with directory-prefixed tags, as Go's
multi-module repository rules require (e.g. flasharray/FA_2_26/v0.25.0);
go get <module>@vX.Y.Z resolves them automatically.
To build client's configuration use configuration builder.
An example for OAuth authentication where user is pureuser, issuer is go-test, key id is 123e4567-e89b-12d3-a456-426614174000, client id is 123e4567-e89b-12d3-a456-426614174000, privateKeyBytes contains RSA private key protected by password pwd123:
configuration, err := openapiclient.NewConfigurationBuilder("[ARRAY_URL]").
OAuth("pureuser", "go-test", "123e4567-e89b-12d3-a456-426614174000", "123e4567-e89b-12d3-a456-426614174000", "pwd123", privateKeyBytes).
DisableSSLVerification().
Build()OAuth configuration for FA can be found here.
An example for API token authentication:
configuration, err := openapiclient.NewConfigurationBuilder("[ARRAY_URL]").
APIToken(apiToken).
DisableSSLVerification().
Build()API token can be retrieved via running the following command on the target array:
# pureadmin list --api-token --expose
username local 123e4567-e89b-12d3-a456-426614174000 2099-12-12 00:00:01 PST -An example for anonymous authentication:
configuration, err := openapiclient.NewConfigurationBuilder("[ARRAY_URL]").
DisableSSLVerification().
Build()| Method | Description |
|---|---|
| UserAgent | Sets custom user agent |
| DisableSSLVerification | Disables verification of certificate chain |
| DebugMode | Enables debug mode |
| HTTPClient | Sets custom HTTPClient |
| Timeout | Sets request timeout of the default HTTP client |
| OAuthWithRawTokenID | Sets OAuth authentication with raw ID token |
| OAuth | Sets OAuth authentication with private key |
| APIToken | Sets API token authentication |
| RateLimitRetries | Sets maximum number of retries in case of rate limit 429 response |
By default requests time out after 90 seconds, including reading the response
body. Use Timeout to change this, or Timeout(0) to disable it. When you
bring your own client via HTTPClient, set the timeout on that client instead;
combining it with Timeout is rejected by Build, as is
DisableSSLVerification.
Arrays rate limit the REST API and answer HTTP 429 (Too Many Requests) when
a client sends too much. The client handles this for you: it waits for the
time the array asks for in the Retry-After header (or RateLimit-Reset
when absent, or a short exponential backoff when neither is sent), adds up
to half a second of random jitter, and sends the request again up to max
retries limit (default is 5).
The client never waits past the deadline of the context.Context you pass
to the API call. Use context.WithTimeout to cap the total time a call,
including retries, may take. RateLimitRetries caps how many times the
client retries, and Timeout caps each HTTP round trip. Neither caps the
wait between retries: that is whatever the array asks for. With
context.Background() the total call time is unbounded, so pass a context
with a deadline when that matters.
ctx, cancel := context.WithTimeout(context.Background(), 300*time.Second)
defer cancel()
resp, httpResp, err := client.VolumesApi.VolumesGet(ctx).Execute()package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/PureStorage-OpenConnect/go-pure-client/flasharray/FA_2_34"
)
func main() {
url := "10.0.0.1"
apiToken := "123e4567-e89b-12d3-a456-426614174000"
configuration, err := openapiclient.NewConfigurationBuilder(url).
APIToken(apiToken).
DisableSSLVerification().
Build()
if err != nil {
fmt.Fprintf(os.Stderr, "Failed to create configuration: %v\n", err)
return
}
client, err := openapiclient.NewClient(configuration)
if err != nil {
fmt.Fprintf(os.Stderr, "Failed to create client: %v\n", err)
return
}
defer client.Close()
req := client.VolumesApi.VolumesGet(context.Background())
resp, httpResp, err := req.Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `VolumesApi.VolumesGet`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", httpResp)
return
}
fmt.Fprintf(os.Stdout, "Response from `VolumesApi.VolumesGet`: %v\n", resp)
}- FA2.0
- FA2.1
- FA2.2
- FA2.3
- FA2.4
- FA2.5
- FA2.6
- FA2.7
- FA2.8
- FA2.9
- FA2.10
- FA2.11
- FA2.13
- FA2.14
- FA2.15
- FA2.16
- FA2.17
- FA2.19
- FA2.20
- FA2.21
- FA2.22
- FA2.23
- FA2.24
- FA2.25
- FA2.26
- FA2.27
- FA2.28
- FA2.29
- FA2.30
- FA2.31
- FA2.32
- FA2.33
- FA2.34
- FA2.35
- FA2.36
- FA2.37
- FA2.38
- FA2.39
- FA2.40
- FA2.41
- FA2.42
- FA2.43
- FA2.44
- FA2.45
- FA2.46
- FA2.47
- FA2.48
- FA2.49
- FA2.50
- FA2.51
- FA2.52
- FA2.53
- FA2.54
- FA2.55
- FA2.56
- FA2.57