/// <summary>
        /// This creates the YAML file in the specified dir and uploads it
        /// </summary>
        /// <param name="result"></param>
        private void UploadYamlFileToResources(ParseSqlResult result)
        {
            File.WriteAllText(_yamlFullFilePath, result.Yaml);

            using (IRSAPIClient rsapiClient = GetServiceFactory().CreateProxy <IRSAPIClient>())
            {
                ResourceFileRequest rfRequest = new ResourceFileRequest();

                rfRequest.FullFilePath = _yamlFullFilePath;
                rfRequest.AppGuid      = new Guid(DefaultAppGuid);
                rfRequest.FileName     = Path.GetFileName(_yamlFullFilePath);

                try
                {
                    rsapiClient.PushResourceFiles(rsapiClient.APIOptions, new List <ResourceFileRequest>()
                    {
                        rfRequest
                    });
                    Console.WriteLine($"{nameof(UploadYamlFileToResources)} - Local YAML file ({_yamlFullFilePath}) - was uploaded successfully");
                }
                catch (Exception ex)
                {
                    Console.WriteLine($"{nameof(UploadYamlFileToResources)} - Could not upload ({_yamlFullFilePath}) - Exception: {ex.Message}");
                }
            }
        }
Ejemplo n.º 2
0
        static void UploadYamlFileToResources()
        {
            using (IRSAPIClient rsapiClient = CreateRsapiClient())
            {
                ResourceFileRequest rfRequest = new ResourceFileRequest();

                rfRequest.FullFilePath = yamlFullFilePath;
                rfRequest.AppGuid      = new Guid(Constants.Guids.Default);
                rfRequest.FileName     = Path.GetFileName(yamlFullFilePath);

                try
                {
                    rsapiClient.PushResourceFiles(rsapiClient.APIOptions, new List <ResourceFileRequest>()
                    {
                        rfRequest
                    });
                    System.Console.WriteLine($"Local YAML file ({yamlFullFilePath}) - was uploaded successfully");
                }
                catch (Exception ex)
                {
                    System.Console.WriteLine($"Could not upload ({yamlFullFilePath}) - Exception: {ex.Message}");
                }
            }
        }