file_advanced_samples_3.py 712 B

1234567891011121314151617181920
  1. def list_shares(self, service):
  2. share_prefix = 'sharesample' + self.random_data.get_random_name(6)
  3. try:
  4. print('1. Create multiple shares with prefix: ', share_prefix)
  5. for i in range(5):
  6. service.create_share(share_name=share_prefix + str(i))
  7. print('2. List shares')
  8. shares = service.list_shares()
  9. for share in shares:
  10. print(' Share name:' + share.name)
  11. except Exception as e:
  12. print(e)
  13. finally:
  14. print('3. Delete shares with prefix:' + share_prefix)
  15. for i in range(5):
  16. service.delete_share(share_prefix + str(i))