Ejemplo n.º 1
0
        public async Task <Responses.VmStringValue> GuestFileWrite(Requests.FileWrite request)
        {
            var returnObject    = new Responses.VmStringValue();
            var executionResult = await _client.VSphere.GuestFileUploadContent(new Dictionary <string, object>
            {
                { "vm_id", request.Moid },
                { "username", request.Username },
                { "password", request.Password },
                { "guest_file_path", request.GuestFilePath },
                { "file_content", request.GuestFileContent },
                { "file_path", request.FilePath }
            });

            Log.Trace($"ExecutionResult: {executionResult}");

            try
            {
                returnObject.Id = executionResult.id;
                var commandTextObject = (JObject)executionResult.result;
                var result            = commandTextObject.GetValue("result");
                returnObject.Value = (string)result;
            }
            catch (Exception e)
            {
                Log.Error($"Object was not in expected format: {e}");
                Console.WriteLine(e);
                returnObject.Exception = e;
            }

            return(returnObject);
        }
Ejemplo n.º 2
0
        public async Task <object> GuestFileWrite(Requests.FileWrite request)
        {
            throw new NotImplementedException("//TODO");

            /*
             * public async Task<IActionResult> Upload(ICollection<IFormFile> files)
             * {
             *  var bucket = await BucketService.GetBucketForRequest();
             *  var fileStorageResults = await FileService.Upload(bucket, files);
             *  return Ok(fileStorageResults);
             * }
             */
        }