コード例 #1
0
        /// <summary>
        /// Uploads stream to remote path.
        /// </summary>
        /// <param name="client">The Kudu client.</param>
        /// <param name="sourceString">The source string.</param>
        /// <param name="remotePath">The remote target file path.</param>
        /// <param name="encoding">The text encoding.</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);
        ///
        /// string sourceString = "Hello";
        /// FilePath remoteFilePath = "/site/wwwroot/hello.txt";
        ///
        /// kuduClient.VFSUploadString(sourceString, remoteFilePath);
        /// </code>
        /// </example>
        // ReSharper disable once InconsistentNaming
        public static void VFSUploadString(
            this IKuduClient client,
            string sourceString,
            FilePath remotePath,
            Encoding encoding = null)
        {
            if (client == null)
            {
                throw new ArgumentNullException(nameof(client));
            }

            if (sourceString == null)
            {
                throw new ArgumentNullException(nameof(sourceString));
            }

            if (remotePath == null)
            {
                throw new ArgumentNullException(nameof(remotePath));
            }

            client.HttpPutString(
                EncodeVFSPath(remotePath),
                sourceString,
                encoding);
        }