예제 #1
0
        static bool Push(IList<string> unparsed)
        {
            if (unparsed.Count < 3 || unparsed.Count > 4)
            {
                Console.Error.WriteLine("Usage: vmc push <appname> <path> <url> [service] --instances N --mem MB");
                return false;
            }

            string appname = unparsed[0];
            string path    = unparsed[1];
            string fqdn    = unparsed[2];

            string[] serviceNames = null;
            if (unparsed.Count == 4)
            {
                serviceNames = new[] { unparsed[3] };
            }

            DirectoryInfo di = null;
            if (Directory.Exists(path))
            {
                di = new DirectoryInfo(path);
            }
            else
            {
                Console.Error.WriteLine(String.Format("Directory '{0}' does not exist."));
                return false;
            }

            IVcapClient vc = new VcapClient();
            VcapClientResult rv = vc.Push(appname, fqdn, instances, di, memoryMB, serviceNames);
            if (false == rv.Success)
            {
                Console.Error.WriteLine(rv.Message);
            }
            return rv.Success;
        }
예제 #2
0
 public ProviderResponse<bool> Push(Cloud cloud, string name, string url, ushort instances, string directoryToPushFrom, uint memory, string[] services)
 {
     var response = new ProviderResponse<bool>();
     try
     {
         IVcapClient client = new VcapClient(cloud);
         client.Push(name, url, instances, new System.IO.DirectoryInfo(directoryToPushFrom), memory, services);
         response.Response = true;
     }
     catch (Exception ex)
     {
         response.Response = false;
         response.Message = ex.Message;
     }
     return response;
 }