/// <summary> /// https://hadoop.apache.org/docs/r2.8.0/hadoop-project-dist/hadoop-hdfs/WebHDFS.html#Create_a_Symbolic_Link /// </summary> public async Task <bool> CreateSymlink( string path, string destination, bool?createParent) { var query = HttpUtility.ParseQueryString(string.Empty); WebHDFSHttpQueryParameter.SetOp(query, WebHDFSHttpQueryParameter.Op.CREATESYMLINK); WebHDFSHttpQueryParameter.SetDestination(query, destination); WebHDFSHttpQueryParameter.SetCreateParent(query, createParent); string requestPath = _baseAPI + path + '?' + query; var response = await _httpClient.PutAsync(requestPath, new ByteArrayContent(new byte[] { })); response.EnsureSuccessStatusCode(); return(response.IsSuccessStatusCode); }
/// <summary> /// https://hadoop.apache.org/docs/r2.8.0/hadoop-project-dist/hadoop-hdfs/WebHDFS.html#Rename_a_FileDirectory /// </summary> public async Task <Boolean> Rename( string path, string destination) { var query = HttpUtility.ParseQueryString(string.Empty); WebHDFSHttpQueryParameter.SetOp(query, WebHDFSHttpQueryParameter.Op.RENAME); WebHDFSHttpQueryParameter.SetDestination(query, destination); string requestPath = _baseAPI + path + '?' + query; var response = await _httpClient.PutAsync(requestPath, new ByteArrayContent(new byte[] { })); response.EnsureSuccessStatusCode(); var serializer = new DataContractJsonSerializer(typeof(Boolean)); return((Boolean)serializer.ReadObject(await response.Content.ReadAsStreamAsync())); }