I am trying to list all fileshares on a specific Storage Gateway like so:
import boto3
sg = boto3.client('storagegateway', 'us-east-1')
aws = sg.list_file_shares(
GatewayARN = "arn:aws:storagegateway:us-east-1:........."
)
for fileshare in aws:
print(
"Id: {0}\nFileShareType: {1}\nFileShareARN: {2}\nFileShareId: {3}\nFileShareStatus".format(
FileShareInfolist[fileshareType], fileshare.FileShareARN, fileshare.FileShareId, fileshare.FileShareStatus
)
I am not sure how to get the info I need. Please help.
The list_file_shares()
API call returns:
{
'Marker': 'string',
'NextMarker': 'string',
'FileShareInfoList': [
{
'FileShareType': 'NFS'|'SMB',
'FileShareARN': 'string',
'FileShareId': 'string',
'FileShareStatus': 'string',
'GatewayARN': 'string'
},
]
}
Therefore, your code would be something like:
import boto3
sg_client = boto3.client('storagegateway', 'us-east-1')
response = sg_client.list_file_shares(GatewayARN = "arn:aws:storagegateway:us-east-1:.........")
for fileshare in response['FileShareInfoList']:
print(
"Id: {0}\nFileShareType: {1}\nFileShareARN: {2}\nFileShareId: {3}\nFileShareStatus".format(
fileshare['FileShareType'], fileshare['FileShareARN'], fileshare['FileShareId'], fileshare['FileShareStatus']
)
)
Thank you. your solution works great
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.