The idea behind this folder is to show examples of how to use the Workload Factory APIs. Not every API is covered, but the ones required to get you started (i.e. get a bearer token, get the BlueXP accountID, get BlueXP credentials ID) are included. Once you have the information provided from these APIs you are ready to start calling the others. While these examples are implemented as bash shell scripts you should be able to translate them to the programming language that you prefer, such as Python, Go, or JavaScript.
You authenticate to the Workload Factory APIs with a "Bearer Token." You generate a bearer token by running a specific API using your "Refresh Token." Instructions on how to obtain your "Refresh Token" and generate an bearer token can be found in the NetApp Console documentation. Note that a bearer token expires after 24 hours whereas the Refresh Token does not expire until you revoke it from the NetApp Console.
Also note that all these scripts depend on the wf_utils file that contains common functions used by all of them.
So, if you copy just one of these scripts, make sure to also copy the wf_utils file as well.
To make it easier to run the scripts, a get_token() function is included in the wf_utils file
that retrieves a bearer token for you. So, you don't have to worry about manually generating a bearer token
everyday instead, you just pass the "Refresh Token" to the scripts, they will call the get_token() function and
generate a bearer token for you.
To run these scripts, you need to have the following prerequisites:
- A NetApp Console refresh token. You can generate one by visiting Refresh Token Generator page and following the instructions there.
- A bash shell. If you want to run from a Windows environment, you can use the Windows Subsystem for Linux (WSL).
- The
curlcommand-line tool installed. - The
jqcommand-line JSON processor installed. You can install it using your package manager, e.g.,apt-get install jqon Debian/Ubuntu orbrew install jqon macOS.
-
All scripts allow you to set environment variables to pass options instead of having to use the command line options. For example, instead of using the
-toption to pass the Refresh Token you can set theREFRESH_TOKENenvironment variable. -
All scripts accept the
-hoption to display the help message, which includes the available options and their descriptions.
Hopefully with these samples you'll be able to create your own scripts that use any of the Workload Factory APIs. If you do create a new script, please consider contributing it back to this repository so that others can benefit from it.
| Script | Description |
|---|---|
| bluexp_fsxn_discovery | This discovers FSx for ONTAP file systems for the giving bluexp account and workspace. |
| bluexp_organization_add | This adds a new BlueXP organization (a.k.a. account). |
| bluexp_organization_delete | This deletes a BlueXP organization (a.k.a. account). |
| credentials_delete | This deletes a Workload Factory credential. |
| fsxn_credentials_set | This sets the credentials for a specified FSx for ONTAP file system. |
| link_associate | This associates a Workload Factory Link with a specified FSx for ONTAP file system. |
| link_delete | This deletes a Workload Factory Link. |
| link_disassociate | This disassociates a Workload Factory Link with a specified FSx for ONTAP file system. |
| link_register | This registers a Lambda function as a Workload Factory Link. |
| list_bluexp_accts | This list all the BlueXP accounts (a.k.a. organizations) that you have access to. |
| list_bluexp_connectors | This list all the BlueXP connectors that you have access to. |
| list_bluexp_members | This list all members of a provided BlueXP account. |
| list_bluexp_workspaces | This list all the BlueXP workspaces that you have access to. |
| list_credentials | This lists all the Workload Factory credentials that you have access to. |
| list_filesystems | This lists all the FSx for ONTAP file systems that you have access to in the specified AWS region. |
| list_links | This lists all the Workload Factory Links that you have access to. |
| list_snapmirrors | This lists all the SnapMirror relationships that are associated with the specified file system. |
| list_svms | This lists all the SVMs that are associated with the specified file system. |
| list_volumes | This lists all the volumes that are associated with the specified file system. |
| show_fsxn_credentials | This shows the credentials that Workload Factory has stored for the specified FSx for ONTAP file system. |
| snapmirror_break | This breaks the SnapMirror relationship for the specified relationship. |
| snapmirror_create | This creates a SnapMirror relationship between the specified source volume and destination SVM. |
| snapmirror_delete | This deletes the SnapMirror relationship for the specified relationship. |
| snapmirror_resync | This resyncs the SnapMirror relationship for the specified relationship. |
| snapmirror_reverse | This reverses the SnapMirror relationship for the specified relationship. |
| snapmirror_update | This updates the SnapMirror relationship for the specified relationship. |
| snapshot_create | This creates a snapshot of the specified volume. |
| volume_clone | This clones the specified volume. |
| volume_delete | This deletes the specified volume. |
| wf_utils | This file contains common functions used by all the scripts. It includes the get_token() function that retrieves an access token from the Workload Factory API. |
This repository is maintained by the contributors listed on GitHub.
Licensed under the Apache License, Version 2.0 (the "License").
You may obtain a copy of the License at apache.org/licenses/LICENSE-2.0.
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" basis, without WARRANTIES or conditions of any kind, either express or implied.
See the License for the specific language governing permissions and limitations under the License.
© 2025 NetApp, Inc. All Rights Reserved.