Example #1
0
        private async Task <bool> IsConfigured(RestClient rc, ScribeOrganization org)
        {
            bool isConfigured = false;

            try
            {
                string response = await rc.Get(string.Format(CultureInfo.InvariantCulture, URL_SUBSCRIPTIONS, org.Id));

                List <ScribeSubscription> subscriptions = JsonConvert.DeserializeObject <List <ScribeSubscription> >(response);

                if (subscriptions != null)
                {
                    for (int i = 0; i < subscriptions.Count && !isConfigured; i++)
                    {
                        isConfigured = subscriptions[i].Name.Equals(REPLICATION_SERVICES, StringComparison.OrdinalIgnoreCase) &&
                                       DateTime.Now.CompareTo(Convert.ToDateTime(subscriptions[i].ExpirationDate)) < 0;
                    }
                }
            }
            catch
            {
                // Failed to get subscriptions - IP address wasn't safe listed
            }

            return(isConfigured);
        }
Example #2
0
 private async Task ProvisionCloudAgent(RestClient rc, ScribeOrganization org)
 {
     try
     {
         await rc.Post(string.Format(CultureInfo.InvariantCulture, URL_PROVISION_CLOUD_AGENT, org.Id), string.Empty);
     }
     catch (Exception)
     {
         // Silently ignore exception if the cloud agent was already provisioned
     }
 }
Example #3
0
 private async Task SafeList(RestClient rc, ScribeOrganization org)
 {
     try
     {
         await rc.Post(string.Format(CultureInfo.InvariantCulture, URL_SECURITY_RULES, org.Id), JsonUtility.GetJsonStringFromObject(new ScribeSecurityRule()));
     }
     catch
     {
         // Failed to apply security rule
     }
 }
        private async Task <bool> IsConfigured(RestClient rc, ScribeOrganization org)
        {
            bool isConfigured = false;

            try
            {
                List <ScribeSubscription> subscriptions = JsonUtility.Deserialize <List <ScribeSubscription> >(await rc.Get(string.Format(ScribeUtility.URL_SUBSCRIPTIONS, org.Id)));

                if (subscriptions != null)
                {
                    for (int i = 0; i < subscriptions.Count && !isConfigured; i++)
                    {
                        isConfigured = subscriptions[i].Name.EqualsIgnoreCase(ScribeUtility.REPLICATION_SERVICES) &&
                                       DateTime.Now.CompareTo(Convert.ToDateTime(subscriptions[i].ExpirationDate)) < 0;
                    }
                }
            }
            catch
            {
                // Failed to get subscriptions - IP address wasn't safe listed
            }

            return(isConfigured);
        }