///////////////////////////////////////////////////////////////////////////////// // // ///////////////////////////////////////////////////////////////////////////////// async void CreateBucket_Click(object sender, RoutedEventArgs e) { BucketSettingsDlg settingsDlg = new BucketSettingsDlg(); settingsDlg.Owner = this.Parent as Window; settingsDlg.ShowDialog(); if (!settingsDlg.DialogResult.HasValue || !settingsDlg.DialogResult.Value) return; var bucketData = new BucketCreationData( settingsDlg.BucketName, settingsDlg.BucketPolicy); var bucketResponse = await _viewDataClient.CreateBucketAsync(bucketData); if (!bucketResponse.IsOk()) { _logger.LogError("Bucket creation failed: " + bucketResponse.Error.StatusCode.ToString()); return; } _rootNode.AddNode( new TreeItem(bucketResponse)); _logger.LogMessage("Bucket creation successful: " + settingsDlg.BucketName); }
private async Task<BucketDetailsResponse> CreateBucket() { var bucketResponse = await _viewDataClient.GetBucketDetailsAsync(BUCKET_NAME); if (bucketResponse.IsOk()) { return bucketResponse; } else if (bucketResponse.Error.StatusCode == System.Net.HttpStatusCode.NotFound) { BucketCreationData bucketData = new BucketCreationData( BUCKET_NAME, BucketPolicyEnum.kPersistent); BucketDetailsResponse bucketCreationResponse = await _viewDataClient.CreateBucketAsync(bucketData); return bucketCreationResponse; } else { return bucketResponse; } }