CheckStringIsNumeric() public static méthode

Method checks to ensure that the contents of the string are numeric
public static CheckStringIsNumeric ( string numericString ) : bool
numericString string String to check to make sure it only contains numbers
Résultat bool
Exemple #1
0
        /// <summary>
        /// Deletes a given AlertSpec
        /// </summary>
        /// <param name="alertSpecID">ID of the AlertSpec to delete</param>
        /// <returns>true if deleted, false if not</returns>
        public static bool destroy(string alertSpecID)
        {
            Utility.CheckStringIsNumeric(alertSpecID);

            string getURL = string.Format("/api/alert_specs/{0}", alertSpecID);

            return(Core.APIClient.Instance.Delete(getURL));
        }
Exemple #2
0
        /// <summary>
        /// Lists the attributes of a given backup
        /// </summary>
        /// <param name="backupID">ID of the backup to return</param>
        /// <returns>populated instance of Backup object specified</returns>
        public static Backup show(string backupID)
        {
            Utility.CheckStringIsNumeric(backupID);
            string getURL     = string.Format("/api/backups/{0}", backupID);
            string jsonString = Core.APIClient.Instance.Get(getURL);

            return(deserialize(jsonString));
        }
Exemple #3
0
        /// <summary>
        /// Deletes a given AlertSpec for a specific ServerArray
        /// </summary>
        /// <param name="alertSpecID">ID of the AlertSpec to delete</param>
        /// <param name="serverTemplateID">ID of the ServerArray where the AlertSpec resides</param>
        /// <returns>true if deleted, false if not</returns>
        public static bool destroy_serverArray(string alertSpecID, string serverTemplateID)
        {
            Utility.CheckStringIsNumeric(alertSpecID);
            Utility.CheckStringIsNumeric(serverTemplateID);

            string getURL = string.Format("/api/server_templates/{0}/alert_specs/{1}", serverTemplateID, alertSpecID);

            return(Core.APIClient.Instance.Delete(getURL));
        }
Exemple #4
0
        /// <summary>
        /// Gets a specific instance of an AlertSpec
        /// </summary>
        /// <param name="alertSpecID">ID of the AlertSpec to retrieve</param>
        /// <returns>instance of AlertSpec</returns>
        public static AlertSpec show(string alertSpecID)
        {
            Utility.CheckStringIsNumeric(alertSpecID);

            string getURL = string.Format("/api/alert_specs/{0}", alertSpecID);

            string jsonString = Core.APIClient.Instance.Get(getURL);

            return(deserialize(jsonString));
        }
Exemple #5
0
        /// <summary>
        /// Show method returns an instance of Account object based on account ID passed in
        /// </summary>
        /// <param name="accountID">ID of account object to return</param>
        /// <returns>instance of Account object</returns>
        public static Account show(string accountID)
        {
            Utility.CheckStringIsNumeric(accountID);

            string getURL = string.Format(APIHrefs.AccountByID, accountID);

            string jsonString = Core.APIClient.Instance.Get(getURL);

            return(deserialize(jsonString));
        }
Exemple #6
0
 /// <summary>
 /// Private Method checks required inputs for formatting and existence within the AlertSpec.create process
 /// </summary>
 /// <param name="condition">The condition (operator) in the condition sentence.</param>
 /// <param name="duration">The duration in minutes of the condition sentence.</param>
 /// <param name="file">The RRD path/file_name of the condition sentence.</param>
 /// <param name="name">The name of the AlertSpec.</param>
 /// <param name="threshold">The threshold of the condition sentence.</param>
 /// <param name="variable">The RRD variable of the condition sentence.</param>
 /// <param name="vote_type">Vote to grow or shrink a ServerArray when the alert is triggered. Must either escalate or vote</param>
 private static void checkCreateInputs(string condition, string duration, string file, string name, string threshold, string variable, string vote_type)
 {
     Utility.CheckStringHasValue(duration);
     Utility.CheckStringIsNumeric(duration);
     Utility.CheckStringHasValue(file);
     Utility.CheckStringHasValue(name);
     Utility.CheckStringHasValue(threshold);
     Utility.CheckStringHasValue(variable);
     Utility.CheckStringHasValue(condition);
     checkInputFormatting(condition, vote_type);
 }
Exemple #7
0
        /// <summary>
        /// Gets a specific instance of an AlertSpec for a given ServerTemplate
        /// </summary>
        /// <param name="alertSpecID">ID of the AlertSpec to retrieve</param>
        /// <param name="serverTemplateID">ServerTemplate where the Alert can be found</param>
        /// <returns>instance of AlertSpec</returns>
        public static AlertSpec show_serverTemplate(string alertSpecID, string serverTemplateID)
        {
            Utility.CheckStringIsNumeric(serverTemplateID);
            Utility.CheckStringIsNumeric(alertSpecID);

            string getURL = string.Format("/api/server_templates/{0}/alert_specs/{1}", serverTemplateID, alertSpecID);

            string jsonString = Core.APIClient.Instance.Get(getURL);

            return(deserialize(jsonString));
        }
Exemple #8
0
        /// <summary>
        /// Gets a speific instance of an AlertSpec for a given ServerArray
        /// </summary>
        /// <param name="alertSpecID">ID of the AlertSpec to retrieve</param>
        /// <param name="serverArrayID">ServerArray where the AlertSpec can be found</param>
        /// <returns>instance of AlertSpec</returns>
        public static AlertSpec show_serverArray(string alertSpecID, string serverArrayID)
        {
            Utility.CheckStringIsNumeric(serverArrayID);
            Utility.CheckStringIsNumeric(alertSpecID);

            string getURL = string.Format(APIHrefs.ServerArrayAlertSpecByID, serverArrayID, alertSpecID);

            string jsonString = Core.APIClient.Instance.Get(getURL);

            return(deserialize(jsonString));
        }
Exemple #9
0
        /// <summary>
        /// Appends more details to a given AuditEntry. Each audit entry detail is stored as one chunk, the offset determines the location of that chunk within the overall audit entry details section. For example, if you create an AuditEntry and append "DEF" at offset 10, and later append "ABC" at offset 9, the overall audit entry details will be "ABCDEF". Use the \n character to separate details by new lines.
        /// </summary>
        /// <param name="auditid">ID of the audit entry to be appended</param>
        /// <param name="detail">The details to be appended to the audit entry record.</param>
        /// <param name="offset">The offset where the new details should be appended to in the audit entry's existing details section.</param>
        /// <returns>true if successful, false if not</returns>
        public static bool append(string auditID, string detail, string offset)
        {
            string postHref = string.Format(APIHrefs.AuditEntryAppend, auditID);

            Utility.CheckStringIsNumeric(offset);
            List <KeyValuePair <string, string> > postParameters = new List <KeyValuePair <string, string> >();

            postParameters.Add(new KeyValuePair <string, string>("detail", detail));
            postParameters.Add(new KeyValuePair <string, string>("offset", offset));
            return(Core.APIClient.Instance.Post(postHref, postParameters));
        }
Exemple #10
0
        public static DataCenter show(string cloudID, string dataCenterID)
        {
            Utility.CheckStringIsNumeric(cloudID);
            Utility.CheckStringHasValue(dataCenterID);

            string getURL = string.Format(APIHrefs.DataCenterByID, cloudID, dataCenterID);

            string jsonString = Core.APIClient.Instance.Get(getURL);

            return(deserialize(jsonString));
        }
Exemple #11
0
        /// <summary>
        /// Lists the attributes of a given audit entry.
        /// </summary>
        /// <param name="auditEntryID">ID of the AuditEntry to show</param>
        /// <returns>Populated instance of AuditEntry object</returns>
        public static AuditEntry show(string auditEntryID)
        {
            //TODO: currently not working as expected
            Utility.CheckStringIsNumeric(auditEntryID);

            string getURL      = string.Format("/api/audit_entries/{0}", auditEntryID);
            string queryString = "view=default";

            string jsonString = Core.APIClient.Instance.Get(getURL, queryString);

            return(deserialize(jsonString));
        }
Exemple #12
0
        /// <summary>
        /// Show information about a single AccountGroup
        /// </summary>
        /// <param name="accountGroupID">ID of the AccountGroup to retrieve</param>
        /// <param name="view">Specific view of AccountGroup to filter result set</param>
        /// <returns>instance of AccountGroup based on inputs</returns>
        public static AccountGroup show(string accountGroupID, string view)
        {
            if (string.IsNullOrWhiteSpace(view))
            {
                view = "default";
            }
            List <string> validViews = new List <string>()
            {
                "default"
            };

            Utility.CheckStringInput("view", validViews, view);

            Utility.CheckStringIsNumeric(accountGroupID);

            string getURL      = string.Format(APIHrefs.AccountGroupByID, accountGroupID);
            string queryString = string.Format("view={0}", view);

            string jsonString = Core.APIClient.Instance.Get(getURL, queryString);

            return(deserialize(jsonString));
        }