public async Task Get()
        {
            #region Snippet:Managing_FileShares_GetFileShare
            FileShareCollection fileShareCollection = fileService.GetFileShares();
            FileShareResource   fileShare           = await fileShareCollection.GetAsync("myFileShare");

            Console.WriteLine(fileShare.Id.Name);
            #endregion
        }
        public async Task Delete()
        {
            #region Snippet:Managing_FileShares_DeleteFileShare
            FileShareCollection fileShareCollection = fileService.GetFileShares();
            FileShareResource   fileShare           = await fileShareCollection.GetAsync("myFileShare");

            await fileShare.DeleteAsync(WaitUntil.Completed);

            #endregion
        }
        public async Task Delete()
        {
            #region Snippet:Managing_FileShares_DeleteFileShare
            FileShareCollection fileShareCollection = fileService.GetFileShares();
            FileShare           fileShare           = await fileShareCollection.GetAsync("myFileShare");

            await fileShare.DeleteAsync(true);

            #endregion
        }
 public async Task List()
 {
     #region Snippet:Managing_FileShares_ListFileShares
     FileShareCollection fileShareCollection    = fileService.GetFileShares();
     AsyncPageable <FileShareResource> response = fileShareCollection.GetAllAsync();
     await foreach (FileShareResource fileShare in response)
     {
         Console.WriteLine(fileShare.Id.Name);
     }
     #endregion
 }
        public async Task CreateOrUpdate()
        {
            #region Snippet:Managing_FileShares_CreateFileShare
            FileShareCollection fileShareCollection = fileService.GetFileShares();
            string        fileShareName             = "myFileShare";
            FileShareData fileShareData             = new FileShareData();
            ArmOperation <FileShareResource> fileShareCreateOperation = await fileShareCollection.CreateOrUpdateAsync(WaitUntil.Started, fileShareName, fileShareData);

            FileShareResource fileShare = await fileShareCreateOperation.WaitForCompletionAsync();

            #endregion
        }
        public async Task CreateStorageAccountAndGetFileShareCollection()
        {
            _resourceGroup = await CreateResourceGroupAsync();

            string accountName = await CreateValidAccountNameAsync("teststoragemgmt");

            StorageAccountCollection storageAccountCollection = _resourceGroup.GetStorageAccounts();

            _storageAccount = (await storageAccountCollection.CreateOrUpdateAsync(true, accountName, GetDefaultStorageAccountParameters())).Value;
            _fileService    = _storageAccount.GetFileService();
            _fileService    = await _fileService.GetAsync();

            _fileShareCollection = _fileService.GetFileShares();
        }
예제 #7
0
        public async Task GetIfExist()
        {
            #region Snippet:Managing_FileShares_GetFileShareIFExists
            FileShareCollection fileShareCollection = fileService.GetFileShares();
            FileShare           fileShare           = await fileShareCollection.GetIfExistsAsync("foo");

            if (fileShare != null)
            {
                Console.WriteLine(fileShare.Id.Name);
            }
            if (await fileShareCollection.ExistsAsync("bar"))
            {
                Console.WriteLine("file share 'bar' exists");
            }
            #endregion
        }