示例#1
0
        internal async Task <string> PrepForSnapshot(SnapSession session)
        {
            try
            {
                SnapShotPutBody body = new SnapShotPutBody();
                body.RunAsNames = session.RunAsName;
                VolumeMapping vm    = new VolumeMapping();
                VolumeName    vname = new VolumeName();
                vname.Name    = session.VolumeName;
                vm.VolumeName = vname;
                FootPrintObject fp = new FootPrintObject();
                fp.SVMName           = session.SvmName;
                fp.VolAndLunsMapping = new System.Collections.Generic.List <VolumeMapping>();
                fp.VolAndLunsMapping.Add(vm);
                body.FootPrint = new System.Collections.Generic.List <FootPrintObject>();
                body.FootPrint.Add(fp);
                PluginParams pluginParams = new PluginParams();
                pluginParams.Data = new System.Collections.Generic.List <PluginData>();
                PluginData port = new PluginData();
                port.Key   = "PORT";
                port.Value = "3306";
                pluginParams.Data.Add(port);
                PluginData ms = new PluginData();
                ms.Key   = "MASTER_SLAVE";
                ms.Value = "N";
                pluginParams.Data.Add(ms);
                PluginData host = new PluginData();
                host.Key   = "HOST";
                host.Value = session.CloneHostName;
                pluginParams.Data.Add(host);
                PluginData uid = new PluginData();
                uid.Key   = "CLONE_UID";
                uid.Value = SnapSession.BuildCloneName(session.DbName, session.AppName);
                pluginParams.Data.Add(uid);
                body.PluginParams = pluginParams;

                ClientResponse <SnapBackupResponse> response = await this.SendRequestAsync <SnapBackupResponse>(Method.PUT, $"api/3.0/plugins/{session.Plugin}/resources/{session.DbKey}", body, false);

                log.Info($"Payload PUT data Detail: {response.Payload}");

                return(response.Response.StatusCode.ToString());
            }
            catch (Exception ex)
            {
                this.log.Error($"Error executing PUT data for snapshot of clone with key {session.DbKey}: {ex}");
                throw;
            }
        }
示例#2
0
        internal async Task <string> CreateResource(SnapSession session)
        {
            string answer = string.Empty;

            try
            {
                log.Info($"Token = {this.token}");
                ResourceBody body = new ResourceBody();
                body.ResourceName = session.DbName;
                body.ResourceType = "Database";
                body.HostName     = session.HostName;
                body.RunAsNames   = $"{session.DbName}_{session.Plugin}";
                body.MountPaths   = new System.Collections.Generic.List <MountInfo>();
                MountInfo mi = new MountInfo();
                mi.MountPath = session.MountPath;
                body.MountPaths.Add(mi);
                VolumeMapping vm    = new VolumeMapping();
                VolumeName    vname = new VolumeName();
                vname.Name    = session.VolumeName;
                vm.VolumeName = vname;
                FootPrintObject fp = new FootPrintObject();
                fp.SVMName           = session.SvmName;
                fp.VolAndLunsMapping = new System.Collections.Generic.List <VolumeMapping>();
                fp.VolAndLunsMapping.Add(vm);
                body.FootPrint = new System.Collections.Generic.List <FootPrintObject>();
                body.FootPrint.Add(fp);
                PluginParams pluginParams = new PluginParams();
                pluginParams.Data = new System.Collections.Generic.List <PluginData>();
                PluginData ms = new PluginData();
                ms.Key   = "MASTER_SLAVE";
                ms.Value = "N";
                pluginParams.Data.Add(ms);
                body.PluginParams = pluginParams;

                var response = await this.SendRequestAsync <dynamic>(Method.POST, $"api/3.0/plugins/MySQL/resources", body, false);

                log.Info($"Payload: {response.Payload}");
                string dbKey = string.Empty;
                answer = response.Response.Content.ToString();
            }
            catch (Exception ex)
            {
                this.log.Error($"Error while getting creating resource key: {ex}");
            }
            return(answer);
        }
示例#3
0
    public void Convert(PluginParams p)
    {
        var documentation = p.Documentation;

        ParseArguments(p.Arguments);

        documentation.Namespaces = documentation.Namespaces.OrderBy(ns => ns.Name).ToArray();
        foreach (var ns in documentation.Namespaces)
        {
            ns.Datatypes = ns.Datatypes.OrderBy(d => d.Name).ToArray();
        }

        var tex = DocumentHeader() + TexifyDocumentation(documentation) + DocumentFooter();

        System.IO.Directory.CreateDirectory(p.TargetDirectory);

        var texPath = System.IO.Path.Combine(p.TargetDirectory, "out.tex");

        System.IO.File.WriteAllText(texPath, tex);

        var startInfo = new System.Diagnostics.ProcessStartInfo();

        startInfo.Arguments        = "out.tex";
        startInfo.FileName         = "pdflatex";
        startInfo.WorkingDirectory = p.TargetDirectory;

        /* twice for robustness */
        var pdflatex = System.Diagnostics.Process.Start(startInfo);

        pdflatex.WaitForExit();
        pdflatex = System.Diagnostics.Process.Start(startInfo);
        pdflatex.WaitForExit();

        Console.WriteLine($"Saved PDF at { p.TargetDirectory }");

        if (OpenFile)
        {
            var pdfPath = System.IO.Path.Combine(p.TargetDirectory, "out.pdf");
            Console.WriteLine("Opening PDF file at " + pdfPath);
            System.Diagnostics.Process.Start(pdfPath);
        }
    }
示例#4
0
        private static void Main()
        {
            Cx.Client.Taxi.ClientsBounty.PluginParams.CreateFile(AppDomain.CurrentDomain.BaseDirectory);
            PluginParams.CreateFile(AppDomain.CurrentDomain.BaseDirectory);
            UsersProvider.CreateFile(AppDomain.CurrentDomain.BaseDirectory);

            {
                using (ServiceHost serviceHost = new ServiceHost(typeof(ClientBonusService)))
                {
                    try
                    {
                        NetTcpBinding    portsharingBinding = new NetTcpBinding();
                        BasicHttpBinding httpBinding        = new BasicHttpBinding();
                        serviceHost.AddServiceEndpoint(typeof(IClientBonusService), portsharingBinding, "net.tcp://192.168.1.5:23445/ClientBonusService");
                        serviceHost.AddServiceEndpoint(typeof(IClientBonusService), httpBinding, "http://192.168.1.5:23444/ClientBonusService");
                        serviceHost.Open();

                        // The service can now be accessed.
                        Console.WriteLine("The service is ready.");
                        Console.WriteLine("Press <ENTER> to terminate service.");
                        Console.ReadLine();

                        // Close the ServiceHost.
                        serviceHost.Close();
                    }
                    catch (TimeoutException timeProblem)
                    {
                        Console.WriteLine(timeProblem.Message);
                        Console.ReadLine();
                    }
                    catch (CommunicationException commProblem)
                    {
                        Console.WriteLine(commProblem.Message);
                        Console.ReadLine();
                    }
                }
            }
        }