Skip to content

Commit 4992d33

Browse files
committed
Added new scripts
1 parent 3f6ebc5 commit 4992d33

8 files changed

Lines changed: 16 additions & 15 deletions

File tree

Management-Utilities/Workload-Factory-API-Samples/bluexp_fsxn_discovery

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# The username field is optional and defaults to fsxadmin if not present.
77
#
88
################################################################################
9-
# Display usage information then exists the script.
9+
# Display usage information then exits the script.
1010
################################################################################
1111
usage () {
1212
cat 1>&2 <<EOF

Management-Utilities/Workload-Factory-API-Samples/bluexp_organization_add

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# This script adds an organization to a BlueXP account.
44
#
55
################################################################################
6-
# Display usage information then exists the script.
6+
# Display usage information then exits the script.
77
################################################################################
88
usage () {
99
cat 1>&2 <<EOF

Management-Utilities/Workload-Factory-API-Samples/bluexp_organization_delete

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# This script deletes an organization from a BlueXP account.
44
#
55
################################################################################
6-
# Display usage information then exists the script.
6+
# Display usage information then exits the script.
77
################################################################################
88
usage () {
99
cat 1>&2 <<EOF

Management-Utilities/Workload-Factory-API-Samples/bluexp_organization_rename

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#!/bin/bash
22
#
3-
# This script renamees an BlueXP organization.
3+
# This script renamees a BlueXP organization.
44
#
55
################################################################################
6-
# Display usage information then exists the script.
6+
# Display usage information then exits the script.
77
################################################################################
88
usage () {
99
cat 1>&2 <<EOF
@@ -63,7 +63,7 @@ required_options["REFRESH_TOKEN"]='Error: A BlueXP refresh token is required to
6363
required_options["ORGANIZATION_ID"]='Error: You must provide the name of the organization you want to delete.
6464
You can get the list of organization you have access to by running the "list_bluexp_accts" script
6565
found in this GitHub repository: https://github.com/NetApp/FSx-ONTAP-samples-scripts/tree/main/Management-Utilities/Workload-Factory-API-Samples\n\n'
66-
requiredd_options["NEW_NAME"]='Error: You must provide the new name of the organization.\n\n'
66+
required_options["NEW_NAME"]='Error: You must provide the new name of the organization.\n\n'
6767

6868
check_required_options
6969
#

Management-Utilities/Workload-Factory-API-Samples/cicd_project_create

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,16 @@ usage() {
1616
cat >&2 <<EOF
1717
This script is used to create a EDA CI/CD project.
1818
19-
Usage: $(basename $0) -t refresh_token -a blueXP_account_ID -n project_name -r aws_region -f filesystem_id -v volume_id
19+
Usage: $(basename $0) -t refresh_token -a blueXP_account_ID -c credentials_id -n project_name -r aws_region -f filesystem_id -v volume_id
2020
2121
Where: refresh_token - Is a refresh token used to obtain an access token needed
2222
to run the Workload Factory APIs. You can obtain a refresh
2323
token by going to https://services.cloud.netapp.com/refresh-token
2424
blueXP_account_ID - is the BlueXP account ID. Run 'list_bluexp_accts' to get a
2525
list of accounts you have access to.
26+
credentials_ID - is the Workload Factory credentials ID for the AWS account.
27+
Run 'list_credentials' to get a list of Workload Factory
28+
credentials you have access to.
2629
project_name - is the name you want to give the EDA CI/CD project.
2730
aws_region - is the AWS region where the file system is located.
2831
filesystem_id - is the ID of the FSx for ONTAP file system to where the volume is located.
@@ -128,5 +131,3 @@ body='{
128131

129132
URL="https://api.workloads.netapp.com/accounts/${BLUEXP_ACCOUNT_ID}/builders/v1/projects"
130133
run_curl POST "$token" "$URL" $tmpout $tmperr "$body"
131-
echo "return status=$?"
132-
echo "Project $PROJECT_NAME has been created."

Management-Utilities/Workload-Factory-API-Samples/list_volumes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Where: refresh_token - Is a refresh token used to obtain an access token needed
3030
credentials you have access to.
3131
aws_region - is the AWS region where the file system resides.
3232
filesystem_id - is the ID of the FSx file system to list SVMs for
33-
j - If specified, the output will be in JSON format instead of a table.
33+
-j - If specified, the output will be in JSON format instead of a table.
3434
3535
Instead of passing parameters on the command line, you can set the
3636
following environment variables:

Management-Utilities/Workload-Factory-API-Samples/volume_cifs_share_create

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ unless you specify a specific path with the -p option. Note that the path
2727
must exist. It will give it full control for everyone permissions to the
2828
share.
2929
30-
If a share with the same name already exists, nothing will change.
30+
If a share with the same name already exists the script will display an error and exit.
3131
3232
Usage: $(basename $0) -t refresh_token -a blueXP_account_ID -c credentials_ID -r aws_region -f filesystem_ID -v volume_ID -n cifs_share_name [-p share_path]
3333
@@ -141,7 +141,7 @@ if [ "$alreadExist" -gt 0 ]; then
141141
exit 1
142142
fi
143143
junctionPath=$(jq -r '.junctionPath' $tmpout)
144-
if [ -z "$junctionPath" ]; then
144+
if [ -z "$junctionPath" -o "$junctionPath" == "null" ]; then
145145
echo "Error: The volume doesn't have a junction path." >&2
146146
exit 1
147147
fi

Management-Utilities/Workload-Factory-API-Samples/volume_cifs_share_delete

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Where: refresh_token - Is a refresh token used to obtain an access token needed
2929
'list_credentials' to get a list of credentials you have access to
3030
aws_region - is the AWS region where the FSx file systems are located
3131
filesystem_id - is the AWS file system ID of the FSx file system where the volume resides
32-
volume_ID - is the AWS volume ID of the volume where you want to create the cifs share.
32+
volume_ID - is the AWS volume ID of the volume where you want to delete the cifs share from.
3333
cifs_share_name - is the name of the share to delete.
3434
3535
Instead of passing parameters on the command line, you can set the
@@ -87,7 +87,7 @@ required_options["REFRESH_TOKEN"]='Error: A BlueXP refresh token is required to
8787
required_options["BLUEXP_ACCOUNT_ID"]='Error: A BlueXP account ID is required to run this script.
8888
You can get the list of accounts you have access to by running the "list_bluexp_accts" script
8989
found in this GitHub repository: https://github.com/NetApp/FSx-ONTAP-samples-scripts/tree/main/Management-Utilities/Workload-Factory-API-Samples\n\n'
90-
required_options["CREDENTIALS_ID"]='Error: A Worload Factory Credential ID is required to run this script.
90+
required_options["CREDENTIALS_ID"]='Error: A Workload Factory Credential ID is required to run this script.
9191
You can get a list of credentials by running the "list_credentials" script
9292
found in this GitHub repository: https://github.com/NetApp/FSx-ONTAP-samples-scripts/tree/main/Management-Utilities/Workload-Factory-API-Samples\n\n'
9393
required_options["AWS_REGION"]='Error: The AWS region where the file system is located is required.\n\n'
@@ -117,7 +117,7 @@ fi
117117
run_curl GET "$token" "https://api.workloads.netapp.com/accounts/${BLUEXP_ACCOUNT_ID}/fsx/v2/credentials/${CREDENTIALS_ID}/regions/${AWS_REGION}/file-systems/${FILESYSTEM_ID}/volumes/${VOLUME_ID}?include=cifsShares" $tmpout $tmperr
118118
cifsShares=$(jq -r '.cifsShares' $tmpout)
119119
#
120-
# Add the new share to the existing ones.
120+
# Remove the specified share from the existing ones.
121121
cifsShares=$(echo "$cifsShares" | jq -r 'map(select(.name != "'$CIFS_SHARE_NAME'"))')
122122
cifsShares="{\"cifsShares\": $cifsShares}"
123123
run_curl PATCH "$token" "https://api.workloads.netapp.com/accounts/${BLUEXP_ACCOUNT_ID}/fsx/v2/credentials/${CREDENTIALS_ID}/regions/${AWS_REGION}/file-systems/${FILESYSTEM_ID}/volumes/${VOLUME_ID}" $tmpout $tmperr "$cifsShares"

0 commit comments

Comments
 (0)