Exemplo n.º 1
0
        public string MergeWithRuleSet(string key, string secretKey, string mergeId, string data)
        {
            string s3Key;

            try
            {
                string jsonString = data;
                //using (var sr = new StreamReader(data))
                //{
                //    jsonString = sr.ReadToEnd();
                //}

                s3Key = S3Interface.AddRuleSet(Guid.Parse(mergeId), jsonString, key);
            }
            catch (UnAuthorizedAccesssException)
            {
                var ctx = WebOperationContext.Current;
                if (ctx != null)
                {
                    ctx.OutgoingResponse.StatusCode = System.Net.HttpStatusCode.Unauthorized;
                }
                return("Error: 1 Unauthorized");
            }
            catch (Exception)
            {
                var ctx = WebOperationContext.Current;
                if (ctx != null)
                {
                    ctx.OutgoingResponse.StatusCode = System.Net.HttpStatusCode.SeeOther;
                }
                return("Error: 2 General Error");
            }

            return(s3Key);
        }
Exemplo n.º 2
0
        public string MergeWithDefaultRules(string key, string secretKey, string mergeId)
        {
            string s3Key;

            try
            {
                const string jsonString = "{\"UseDefault\": \"true\"}";

                s3Key = S3Interface.AddRuleSet(Guid.Parse(mergeId), jsonString, key, true);
            }
            catch (UnAuthorizedAccesssException)
            {
                var ctx = WebOperationContext.Current;
                if (ctx != null)
                {
                    ctx.OutgoingResponse.StatusCode = System.Net.HttpStatusCode.Unauthorized;
                }
                return("Error: 1 Unauthorized");
            }
            catch (Exception)
            {
                var ctx = WebOperationContext.Current;
                if (ctx != null)
                {
                    ctx.OutgoingResponse.StatusCode = System.Net.HttpStatusCode.SeeOther;
                }
                return("Error: 2 General Error");
            }

            return(s3Key);
        }