/// <summary>
 /// Create a directory placeholder blob with the given prefix.
 /// </summary>
 /// <param name="self">The data source.</param>
 /// <param name="bucket">The bucket that owns the files.</param>
 /// <param name="prefix">The directory path.</param>
 public static async Task CreateDirectoryAsync(this GcsDataSource self, string bucket, string prefix)
 {
     await self.UploadStreamAsync(
         bucket : bucket,
         name : prefix,
         stream : Stream.Null,
         contentType : "application/x-www-form-urlencoded;charset=UTF-8");
 }
Exemple #2
0
 private void InvalidateBucket()
 {
     _dataSource = new GcsDataSource(
         CredentialsStore.Default.CurrentProjectId,
         CredentialsStore.Default.CurrentGoogleCredential,
         GoogleCloudExtensionPackage.ApplicationName);
     _fileOperationsEngine = new FileOperationsEngine(_dataSource);
     UpdateCurrentState("");
 }
 /// <summary>
 /// Starts the delete operation using the data from the given operation.
 /// </summary>
 /// <param name="self">The data source.</param>
 /// <param name="operation">The operation to start.</param>
 /// <param name="cancellationToken">The cancellation token for the operation.</param>
 internal static void StartDeleteOperation(
     this GcsDataSource self,
     GcsDeleteFileOperation operation,
     CancellationToken cancellationToken)
 {
     self.StartDeleteOperation(
         bucket: operation.GcsItem.Bucket,
         name: operation.GcsItem.Name,
         operation: operation,
         token: cancellationToken);
 }
 /// <summary>
 /// Starts the download operation using the data from the given operation.
 /// </summary>
 /// <param name="self">The data source.</param>
 /// <param name="operation">The operation to start.</param>
 /// <param name="cancellationToken">The cancellation token for the operation.</param>
 internal static void StartFileDownloadOperation(
     this GcsDataSource self,
     GcsFileTransferOperation operation,
     CancellationToken cancellationToken)
 {
     self.StartFileDownloadOperation(
         bucket: operation.GcsItem.Bucket,
         name: operation.GcsItem.Name,
         destPath: operation.LocalPath,
         operation: operation,
         token: cancellationToken);
 }
 /// <summary>
 /// Starts the move operation using the data from the given operation.
 /// </summary>
 /// <param name="self">The data source.</param>
 /// <param name="operation">The operation to start.</param>
 /// <param name="cancellationToken">The cancellation token for the operation.</param>
 internal static void StartMoveOperation(
     this GcsDataSource self,
     GcsMoveFileOperation operation,
     CancellationToken cancellationToken)
 {
     self.StartMoveOperation(
         bucket: operation.GcsItem.Bucket,
         fromName: operation.GcsItem.Name,
         toName: operation.ToItem.Name,
         operation: operation,
         cancellationToken: cancellationToken);
 }
Exemple #6
0
 public FileOperationsEngine(GcsDataSource dataSource)
 {
     _dataSource = dataSource;
 }