Exemplo n.º 1
0
 /// <summary>
 /// Uploads stream to remote path.
 /// </summary>
 /// <param name="client">The Kudu client.</param>
 /// <param name="sourceStream">The source stream.</param>
 /// <param name="remotePath">The remote target file path.</param>
 /// <example>
 /// <code>
 /// #addin nuget:?package=Cake.Kudu.Client
 ///
 /// string  baseUri     = EnvironmentVariable("KUDU_CLIENT_BASEURI"),
 ///         userName    = EnvironmentVariable("KUDU_CLIENT_USERNAME"),
 ///         password    = EnvironmentVariable("KUDU_CLIENT_PASSWORD");
 ///
 /// IKuduClient kuduClient = KuduClient(
 ///     baseUri,
 ///     userName,
 ///     password);
 ///
 /// FilePath remoteFilePath = "/site/wwwroot/hello.txt";
 ///
 /// FilePath localFilePath = "./hello.txt";
 ///
 /// using(Stream sourceStream = kuduClient.FileSystem.GetFile(localFilePath).OpenRead())
 /// {
 ///     kuduClient.VFSUploadStream(sourceStream, remoteFilePath);
 /// }
 /// </code>
 /// </example>
 // ReSharper disable once InconsistentNaming
 public static void VFSUploadStream(
     this IKuduClient client,
     Stream sourceStream,
     FilePath remotePath)
 {
     client.UploadStream(sourceStream, remotePath, EncodeVFSPath);
 }
Exemplo n.º 2
0
 /// <summary>
 /// Uploads zip stream and extracts to remote directory path.
 /// </summary>
 /// <param name="client">The Kudu client.</param>
 /// <param name="sourceStream">The source stream.</param>
 /// <param name="remotePath">The remote directory path.</param>
 /// <example>
 /// <code>
 /// #addin nuget:?package=Cake.Kudu.Client
 ///
 /// string  baseUri     = EnvironmentVariable("KUDU_CLIENT_BASEURI"),
 ///         userName    = EnvironmentVariable("KUDU_CLIENT_USERNAME"),
 ///         password    = EnvironmentVariable("KUDU_CLIENT_PASSWORD");
 ///
 /// IKuduClient kuduClient = KuduClient(
 ///     baseUri,
 ///     userName,
 ///     password);
 ///
 /// DirectoryPath sourceDirectoryPath = "./Documentation/";
 /// DirectoryPath remoteDirectoryPath = "/site/wwwroot/docs/";
 /// FilePath zipFilePath = "./Documentation.zip";
 ///
 /// Zip(sourceDirectoryPath, zipFilePath);
 ///
 /// using(Stream sourceStream = kuduClient.FileSystem.GetFile(zipFilePath).OpenRead())
 /// {
 ///     kuduClient.ZipUploadStream(
 ///        sourceStream,
 ///        remoteDirectoryPath);
 /// }
 /// </code>
 /// </example>
 public static void ZipUploadStream(
     this IKuduClient client,
     Stream sourceStream,
     DirectoryPath remotePath)
 {
     client.UploadStream(
         sourceStream,
         remotePath,
         EncodeZipPath);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Uploads zip stream and extracts to remote directory path.
 /// </summary>
 /// <param name="client">The Kudu client.</param>
 /// <param name="localPath">The local directory path.</param>
 /// <param name="remotePath">The remote directory path.</param>
 /// <remarks>This will zip the folder in-memory.</remarks>
 /// <example>
 /// <code>
 /// #addin nuget:?package=Cake.Kudu.Client
 ///
 /// string  baseUri     = EnvironmentVariable("KUDU_CLIENT_BASEURI"),
 ///         userName    = EnvironmentVariable("KUDU_CLIENT_USERNAME"),
 ///         password    = EnvironmentVariable("KUDU_CLIENT_PASSWORD");
 ///
 /// IKuduClient kuduClient = KuduClient(
 ///     baseUri,
 ///     userName,
 ///     password);
 ///
 /// DirectoryPath sourceDirectoryPath = "./Documentation/";
 /// DirectoryPath remoteDirectoryPath = "/site/wwwroot/docs/";
 ///
 /// kuduClient.ZipUploadDirectory(
 ///     sourceDirectoryPath,
 ///     remoteDirectoryPath);
 /// </code>
 /// </example>
 public static void ZipUploadDirectory(
     this IKuduClient client,
     DirectoryPath localPath,
     DirectoryPath remotePath)
 {
     client.ZipDirectoryToMemoryStream(
         localPath,
         sourceStream =>
         client.UploadStream(
             sourceStream,
             remotePath,
             EncodeZipPath));
 }
Exemplo n.º 4
0
        internal static void UploadFile <T>(
            this IKuduClient client,
            FilePath localPath,
            T remotePath,
            Func <T, string> encodeRemotePathFunc)
        {
            if (localPath == null)
            {
                throw new ArgumentNullException(nameof(localPath));
            }

            using (var localStream = client.FileSystem.GetFile(localPath).OpenRead())
            {
                client.UploadStream(localStream, remotePath, encodeRemotePathFunc);
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// Creates directory on remote path.
 /// </summary>
 /// <param name="client">The Kudu client.</param>
 /// <param name="remotePath">The remote target path.</param>
 /// <example>
 /// <code>
 /// #addin nuget:?package=Cake.Kudu.Client
 ///
 /// string  baseUri     = EnvironmentVariable("KUDU_CLIENT_BASEURI"),
 ///         userName    = EnvironmentVariable("KUDU_CLIENT_USERNAME"),
 ///         password    = EnvironmentVariable("KUDU_CLIENT_PASSWORD");
 ///
 /// IKuduClient kuduClient = KuduClient(
 ///     baseUri,
 ///     userName,
 ///     password);
 ///
 /// DirectoryPath remoteDirectoryPath = "/site/wwwroot/hello/";
 /// kuduClient.VFSCreateDirectory(remoteDirectoryPath);
 /// </code>
 /// </example>
 // ReSharper disable once InconsistentNaming
 public static void VFSCreateDirectory(
     this IKuduClient client,
     DirectoryPath remotePath)
 {
     client.UploadStream(null, remotePath, EncodeVFSPath, true);
 }