|
160 | 160 | # Define the query string that is used to get only the fields needed to generate the output. |
161 | 161 | # It also makes the 'jq' commands below easily, since it flattens the JSON structure. |
162 | 162 | queryString="FileSystems[*].{ |
| 163 | + FileSystemType: FileSystemType, |
163 | 164 | FileSystemId: FileSystemId, |
164 | 165 | Lifecycle:Lifecycle, |
165 | 166 | Name:Tags[?Key=='Name']|[0].Value, |
@@ -214,7 +215,7 @@ for region in ${regions[*]}; do |
214 | 215 | fi |
215 | 216 |
|
216 | 217 | printf "$region\n" |
217 | | - jq -r '.[] | .FileSystemId + " " + .Lifecycle + " =" + .Name + "="' $fileSystemsFile | while read fs fsStatus fsName; do |
| 218 | + jq -r '.[] | if(.FileSystemType != "ONTAP") then empty else .FileSystemId + " " + .Lifecycle + " =" + .Name + "=" end' $fileSystemsFile | while read fs fsStatus fsName; do |
218 | 219 | x="${fsName#=}" |
219 | 220 | fsName="${x%=}" |
220 | 221 | [ "$showStatus" == "true" ] && printf "\t$fs($fsStatus) - '$fsName'\n" |
@@ -244,10 +245,9 @@ for region in ${regions[*]}; do |
244 | 245 | # 11 = throughput |
245 | 246 | # 12 = size |
246 | 247 | if [ ! -z "$1" ]; then |
247 | | - #set -x |
248 | | - jq -r '.[] | .FileSystemId + "," + .ResourceARN + "," + (if((.Name | tostring) | test("'$1'")) then .Name else empty end) + "," + .Lifecycle + "," + .ManagementIp + "," + .VpcId + "," + .SubnetId + "," + (if(.AutomaticBackupRetentionDays == null) then "Dissabled" else (.AutomaticBackupRetentionDays | tostring) end) + "," + .DeploymentType + "," + (.DiskIopsConfiguration | tostring) + "," + (.ThroughputCapacity | tostring) + "," + (.StorageCapacity | tostring)' $fileSystemsFile > $tmpout |
| 248 | + jq -r '.[] | if(.FileSystemType == "ONTAP") then .FileSystemId + "," + .ResourceARN + "," + (if((.Name | tostring) | test("'$1'")) then .Name else empty end) + "," + .Lifecycle + "," + .ManagementIp + "," + .VpcId + "," + .SubnetId + "," + (if(.AutomaticBackupRetentionDays == null) then "Dissabled" else (.AutomaticBackupRetentionDays | tostring) end) + "," + .DeploymentType + "," + (.DiskIopsConfiguration | tostring) + "," + (.ThroughputCapacity | tostring) + "," + (.StorageCapacity | tostring) else empty end' $fileSystemsFile > $tmpout |
249 | 249 | else |
250 | | - jq -r '.[] | .FileSystemId + "," + .ResourceARN + "," + .Name + "," + .Lifecycle + "," + .ManagementIp + "," + .VpcId + "," + .SubnetId + "," + if(.AutomaticBackupRetentionDays == null) then "Dissabled" else (.AutomaticBackupRetentionDays | tostring) end + "," + .DeploymentType + "," + (.DiskIopsConfiguration | tostring) + "," + (.ThroughputCapacity | tostring) + "," + (.StorageCapacity | tostring)' $fileSystemsFile > $tmpout |
| 250 | + jq -r '.[] | if(.FileSystemType == "ONTAP") then .FileSystemId + "," + .ResourceARN + "," + .Name + "," + .Lifecycle + "," + .ManagementIp + "," + .VpcId + "," + .SubnetId + "," + if(.AutomaticBackupRetentionDays == null) then "Dissabled" else (.AutomaticBackupRetentionDays | tostring) end + "," + .DeploymentType + "," + (.DiskIopsConfiguration | tostring) + "," + (.ThroughputCapacity | tostring) + "," + (.StorageCapacity | tostring) else empty end' $fileSystemsFile > $tmpout |
251 | 251 | fi |
252 | 252 |
|
253 | 253 | if [ "$includeExtraInfo" == "true" ]; then |
|
0 commit comments