Esempio n. 1
0
        public Function Delete(string clientName)
        {
            ReturnType rt = new ReturnType();

            Logger.log("info", "Attempting to delete client: " + clientName);

            ChefRequest cr = new ChefRequest();
            string response = cr.Delete(ChefConfig.Validator, "clients/" + clientName);

            if (response.Contains("Response status code does not indicate success"))
            {
                rt.Result = 4;
                rt.Data = null;
                rt.Object = null;
                rt.Message = "Unable to delete client.";
            }
            else
            {
                rt.Result = 0;
                rt.Data = response;
                rt.Object = null;
                rt.Message = "Client: " + clientName + " is deleted.";
            }
            return rt;
        }
Esempio n. 2
0
        public Function Delete(string nodeName)
        {
            ReturnType rt = new ReturnType();

            Logger.log("info", "Attempting to delete node: " + nodeName);

            ChefRequest cr       = new ChefRequest();
            string      response = cr.Delete(ChefConfig.Validator, "nodes/" + nodeName);

            if (response.Contains("Response status code does not indicate success"))
            {
                rt.Result  = 4;
                rt.Data    = String.Empty;
                rt.Object  = null;
                rt.Message = "Unable to delete node.";
            }
            else
            {
                rt.Result  = 0;
                rt.Data    = String.Empty;
                rt.Object  = null;
                rt.Message = "Node: " + nodeName + " is deleted.";
            }
            return(rt);
        }
Esempio n. 3
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     txtError.Text = String.Empty;
     try
     {
         ChefRequest cr       = new ChefRequest();
         string      nodeName = ChefConfig.NodeName;
         string      json     = cr.Delete(nodeName, txtSelect.Text);
         jvResponse.Json = json;
         jvResponse.Text = json;
         jvResponse.ShowTab(Tabs.Text);
     }
     catch (Exception ex)
     {
         MessageBox.Show("Unable to DELETE resource: \r\n" + ex.Message + "\r\nCan not find the requested endpoint on the Chef server.",
                         "Chef API Path Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }