Beispiel #1
0
        public IRequest Marshall(ListClosedWorkflowExecutionsRequest listClosedWorkflowExecutionsRequest)
        {
            IRequest request = new DefaultRequest(listClosedWorkflowExecutionsRequest, "AmazonSimpleWorkflow");
            string   target  = "SimpleWorkflowService.ListClosedWorkflowExecutions";

            request.Headers["X-Amz-Target"] = target;
            request.Headers["Content-Type"] = "application/x-amz-json-1.0";



            string uriResourcePath = "";

            if (uriResourcePath.Contains("?"))
            {
                string queryString = uriResourcePath.Substring(uriResourcePath.IndexOf("?") + 1);
                uriResourcePath = uriResourcePath.Substring(0, uriResourcePath.IndexOf("?"));

                foreach (string s in queryString.Split('&', ';'))
                {
                    string[] nameValuePair = s.Split('=');
                    if (nameValuePair.Length == 2 && nameValuePair[1].Length > 0)
                    {
                        request.Parameters.Add(nameValuePair[0], nameValuePair[1]);
                    }
                    else
                    {
                        request.Parameters.Add(nameValuePair[0], null);
                    }
                }
            }

            request.ResourcePath = uriResourcePath;


            using (StringWriter stringWriter = new StringWriter())
            {
                JsonWriter writer = new JsonWriter(stringWriter);
                writer.WriteObjectStart();

                if (listClosedWorkflowExecutionsRequest != null && listClosedWorkflowExecutionsRequest.IsSetDomain())
                {
                    writer.WritePropertyName("domain");
                    writer.Write(listClosedWorkflowExecutionsRequest.Domain);
                }

                if (listClosedWorkflowExecutionsRequest != null)
                {
                    ExecutionTimeFilter startTimeFilter = listClosedWorkflowExecutionsRequest.StartTimeFilter;
                    if (startTimeFilter != null)
                    {
                        writer.WritePropertyName("startTimeFilter");
                        writer.WriteObjectStart();
                        if (startTimeFilter != null && startTimeFilter.IsSetOldestDate())
                        {
                            writer.WritePropertyName("oldestDate");
                            writer.Write(startTimeFilter.OldestDate);
                        }
                        if (startTimeFilter != null && startTimeFilter.IsSetLatestDate())
                        {
                            writer.WritePropertyName("latestDate");
                            writer.Write(startTimeFilter.LatestDate);
                        }
                        writer.WriteObjectEnd();
                    }
                }

                if (listClosedWorkflowExecutionsRequest != null)
                {
                    ExecutionTimeFilter closeTimeFilter = listClosedWorkflowExecutionsRequest.CloseTimeFilter;
                    if (closeTimeFilter != null)
                    {
                        writer.WritePropertyName("closeTimeFilter");
                        writer.WriteObjectStart();
                        if (closeTimeFilter != null && closeTimeFilter.IsSetOldestDate())
                        {
                            writer.WritePropertyName("oldestDate");
                            writer.Write(closeTimeFilter.OldestDate);
                        }
                        if (closeTimeFilter != null && closeTimeFilter.IsSetLatestDate())
                        {
                            writer.WritePropertyName("latestDate");
                            writer.Write(closeTimeFilter.LatestDate);
                        }
                        writer.WriteObjectEnd();
                    }
                }

                if (listClosedWorkflowExecutionsRequest != null)
                {
                    WorkflowExecutionFilter executionFilter = listClosedWorkflowExecutionsRequest.ExecutionFilter;
                    if (executionFilter != null)
                    {
                        writer.WritePropertyName("executionFilter");
                        writer.WriteObjectStart();
                        if (executionFilter != null && executionFilter.IsSetWorkflowId())
                        {
                            writer.WritePropertyName("workflowId");
                            writer.Write(executionFilter.WorkflowId);
                        }
                        writer.WriteObjectEnd();
                    }
                }

                if (listClosedWorkflowExecutionsRequest != null)
                {
                    CloseStatusFilter closeStatusFilter = listClosedWorkflowExecutionsRequest.CloseStatusFilter;
                    if (closeStatusFilter != null)
                    {
                        writer.WritePropertyName("closeStatusFilter");
                        writer.WriteObjectStart();
                        if (closeStatusFilter != null && closeStatusFilter.IsSetStatus())
                        {
                            writer.WritePropertyName("status");
                            writer.Write(closeStatusFilter.Status);
                        }
                        writer.WriteObjectEnd();
                    }
                }

                if (listClosedWorkflowExecutionsRequest != null)
                {
                    WorkflowTypeFilter typeFilter = listClosedWorkflowExecutionsRequest.TypeFilter;
                    if (typeFilter != null)
                    {
                        writer.WritePropertyName("typeFilter");
                        writer.WriteObjectStart();
                        if (typeFilter != null && typeFilter.IsSetName())
                        {
                            writer.WritePropertyName("name");
                            writer.Write(typeFilter.Name);
                        }
                        if (typeFilter != null && typeFilter.IsSetVersion())
                        {
                            writer.WritePropertyName("version");
                            writer.Write(typeFilter.Version);
                        }
                        writer.WriteObjectEnd();
                    }
                }

                if (listClosedWorkflowExecutionsRequest != null)
                {
                    TagFilter tagFilter = listClosedWorkflowExecutionsRequest.TagFilter;
                    if (tagFilter != null)
                    {
                        writer.WritePropertyName("tagFilter");
                        writer.WriteObjectStart();
                        if (tagFilter != null && tagFilter.IsSetTag())
                        {
                            writer.WritePropertyName("tag");
                            writer.Write(tagFilter.Tag);
                        }
                        writer.WriteObjectEnd();
                    }
                }
                if (listClosedWorkflowExecutionsRequest != null && listClosedWorkflowExecutionsRequest.IsSetNextPageToken())
                {
                    writer.WritePropertyName("nextPageToken");
                    writer.Write(listClosedWorkflowExecutionsRequest.NextPageToken);
                }
                if (listClosedWorkflowExecutionsRequest != null && listClosedWorkflowExecutionsRequest.IsSetMaximumPageSize())
                {
                    writer.WritePropertyName("maximumPageSize");
                    writer.Write(listClosedWorkflowExecutionsRequest.MaximumPageSize);
                }
                if (listClosedWorkflowExecutionsRequest != null && listClosedWorkflowExecutionsRequest.IsSetReverseOrder())
                {
                    writer.WritePropertyName("reverseOrder");
                    writer.Write(listClosedWorkflowExecutionsRequest.ReverseOrder);
                }

                writer.WriteObjectEnd();

                string snippet = stringWriter.ToString();
                request.Content = System.Text.Encoding.UTF8.GetBytes(snippet);
            }


            return(request);
        }
Beispiel #2
0
        public IRequest Marshall(CountOpenWorkflowExecutionsRequest countOpenWorkflowExecutionsRequest)
        {
            IRequest request = new DefaultRequest(countOpenWorkflowExecutionsRequest, "AmazonSimpleWorkflow");
            string   target  = "SimpleWorkflowService.CountOpenWorkflowExecutions";

            request.Headers["X-Amz-Target"] = target;

            request.Headers["Content-Type"] = "application/x-amz-json-1.0";


            string uriResourcePath = "";

            if (uriResourcePath.Contains("?"))
            {
                int    queryPosition = uriResourcePath.IndexOf("?", StringComparison.OrdinalIgnoreCase);
                string queryString   = uriResourcePath.Substring(queryPosition + 1);
                uriResourcePath = uriResourcePath.Substring(0, queryPosition);

                foreach (string s in queryString.Split('&', ';'))
                {
                    string[] nameValuePair = s.Split('=');
                    if (nameValuePair.Length == 2 && nameValuePair[1].Length > 0)
                    {
                        request.Parameters.Add(nameValuePair[0], nameValuePair[1]);
                    }
                    else
                    {
                        request.Parameters.Add(nameValuePair[0], null);
                    }
                }
            }

            request.ResourcePath = uriResourcePath;


            using (StringWriter stringWriter = new StringWriter(System.Globalization.CultureInfo.InvariantCulture))
            {
                JsonWriter writer = new JsonWriter(stringWriter);
                writer.WriteObjectStart();

                if (countOpenWorkflowExecutionsRequest != null && countOpenWorkflowExecutionsRequest.IsSetDomain())
                {
                    writer.WritePropertyName("domain");
                    writer.Write(countOpenWorkflowExecutionsRequest.Domain);
                }

                if (countOpenWorkflowExecutionsRequest != null)
                {
                    ExecutionTimeFilter startTimeFilter = countOpenWorkflowExecutionsRequest.StartTimeFilter;
                    if (startTimeFilter != null)
                    {
                        writer.WritePropertyName("startTimeFilter");
                        writer.WriteObjectStart();
                        if (startTimeFilter != null && startTimeFilter.IsSetOldestDate())
                        {
                            writer.WritePropertyName("oldestDate");
                            writer.Write(startTimeFilter.OldestDate);
                        }
                        if (startTimeFilter != null && startTimeFilter.IsSetLatestDate())
                        {
                            writer.WritePropertyName("latestDate");
                            writer.Write(startTimeFilter.LatestDate);
                        }
                        writer.WriteObjectEnd();
                    }
                }

                if (countOpenWorkflowExecutionsRequest != null)
                {
                    WorkflowTypeFilter typeFilter = countOpenWorkflowExecutionsRequest.TypeFilter;
                    if (typeFilter != null)
                    {
                        writer.WritePropertyName("typeFilter");
                        writer.WriteObjectStart();
                        if (typeFilter != null && typeFilter.IsSetName())
                        {
                            writer.WritePropertyName("name");
                            writer.Write(typeFilter.Name);
                        }
                        if (typeFilter != null && typeFilter.IsSetVersion())
                        {
                            writer.WritePropertyName("version");
                            writer.Write(typeFilter.Version);
                        }
                        writer.WriteObjectEnd();
                    }
                }

                if (countOpenWorkflowExecutionsRequest != null)
                {
                    TagFilter tagFilter = countOpenWorkflowExecutionsRequest.TagFilter;
                    if (tagFilter != null)
                    {
                        writer.WritePropertyName("tagFilter");
                        writer.WriteObjectStart();
                        if (tagFilter != null && tagFilter.IsSetTag())
                        {
                            writer.WritePropertyName("tag");
                            writer.Write(tagFilter.Tag);
                        }
                        writer.WriteObjectEnd();
                    }
                }

                if (countOpenWorkflowExecutionsRequest != null)
                {
                    WorkflowExecutionFilter executionFilter = countOpenWorkflowExecutionsRequest.ExecutionFilter;
                    if (executionFilter != null)
                    {
                        writer.WritePropertyName("executionFilter");
                        writer.WriteObjectStart();
                        if (executionFilter != null && executionFilter.IsSetWorkflowId())
                        {
                            writer.WritePropertyName("workflowId");
                            writer.Write(executionFilter.WorkflowId);
                        }
                        writer.WriteObjectEnd();
                    }
                }

                writer.WriteObjectEnd();

                string snippet = stringWriter.ToString();
                request.Content = System.Text.Encoding.UTF8.GetBytes(snippet);
            }


            return(request);
        }
Beispiel #3
0
        public IRequest Marshall(ListClosedWorkflowExecutionsRequest listClosedWorkflowExecutionsRequest)
        {
            IRequest request = new DefaultRequest(listClosedWorkflowExecutionsRequest, "AmazonSimpleWorkflow");
            string   target  = "SimpleWorkflowService.ListClosedWorkflowExecutions";

            request.Headers["X-Amz-Target"] = target;

            request.Headers["Content-Type"] = "application/x-amz-json-1.0";

            string uriResourcePath = "";

            request.ResourcePath = uriResourcePath;


            using (StringWriter stringWriter = new StringWriter(CultureInfo.InvariantCulture))
            {
                JsonWriter writer = new JsonWriter(stringWriter);
                writer.WriteObjectStart();

                if (listClosedWorkflowExecutionsRequest != null && listClosedWorkflowExecutionsRequest.IsSetDomain())
                {
                    writer.WritePropertyName("domain");
                    writer.Write(listClosedWorkflowExecutionsRequest.Domain);
                }

                if (listClosedWorkflowExecutionsRequest != null)
                {
                    ExecutionTimeFilter startTimeFilter = listClosedWorkflowExecutionsRequest.StartTimeFilter;
                    if (startTimeFilter != null)
                    {
                        writer.WritePropertyName("startTimeFilter");
                        writer.WriteObjectStart();
                        if (startTimeFilter != null && startTimeFilter.IsSetOldestDate())
                        {
                            writer.WritePropertyName("oldestDate");
                            writer.Write(startTimeFilter.OldestDate);
                        }
                        if (startTimeFilter != null && startTimeFilter.IsSetLatestDate())
                        {
                            writer.WritePropertyName("latestDate");
                            writer.Write(startTimeFilter.LatestDate);
                        }
                        writer.WriteObjectEnd();
                    }
                }

                if (listClosedWorkflowExecutionsRequest != null)
                {
                    ExecutionTimeFilter closeTimeFilter = listClosedWorkflowExecutionsRequest.CloseTimeFilter;
                    if (closeTimeFilter != null)
                    {
                        writer.WritePropertyName("closeTimeFilter");
                        writer.WriteObjectStart();
                        if (closeTimeFilter != null && closeTimeFilter.IsSetOldestDate())
                        {
                            writer.WritePropertyName("oldestDate");
                            writer.Write(closeTimeFilter.OldestDate);
                        }
                        if (closeTimeFilter != null && closeTimeFilter.IsSetLatestDate())
                        {
                            writer.WritePropertyName("latestDate");
                            writer.Write(closeTimeFilter.LatestDate);
                        }
                        writer.WriteObjectEnd();
                    }
                }

                if (listClosedWorkflowExecutionsRequest != null)
                {
                    WorkflowExecutionFilter executionFilter = listClosedWorkflowExecutionsRequest.ExecutionFilter;
                    if (executionFilter != null)
                    {
                        writer.WritePropertyName("executionFilter");
                        writer.WriteObjectStart();
                        if (executionFilter != null && executionFilter.IsSetWorkflowId())
                        {
                            writer.WritePropertyName("workflowId");
                            writer.Write(executionFilter.WorkflowId);
                        }
                        writer.WriteObjectEnd();
                    }
                }

                if (listClosedWorkflowExecutionsRequest != null)
                {
                    CloseStatusFilter closeStatusFilter = listClosedWorkflowExecutionsRequest.CloseStatusFilter;
                    if (closeStatusFilter != null)
                    {
                        writer.WritePropertyName("closeStatusFilter");
                        writer.WriteObjectStart();
                        if (closeStatusFilter != null && closeStatusFilter.IsSetStatus())
                        {
                            writer.WritePropertyName("status");
                            writer.Write(closeStatusFilter.Status);
                        }
                        writer.WriteObjectEnd();
                    }
                }

                if (listClosedWorkflowExecutionsRequest != null)
                {
                    WorkflowTypeFilter typeFilter = listClosedWorkflowExecutionsRequest.TypeFilter;
                    if (typeFilter != null)
                    {
                        writer.WritePropertyName("typeFilter");
                        writer.WriteObjectStart();
                        if (typeFilter != null && typeFilter.IsSetName())
                        {
                            writer.WritePropertyName("name");
                            writer.Write(typeFilter.Name);
                        }
                        if (typeFilter != null && typeFilter.IsSetVersion())
                        {
                            writer.WritePropertyName("version");
                            writer.Write(typeFilter.Version);
                        }
                        writer.WriteObjectEnd();
                    }
                }

                if (listClosedWorkflowExecutionsRequest != null)
                {
                    TagFilter tagFilter = listClosedWorkflowExecutionsRequest.TagFilter;
                    if (tagFilter != null)
                    {
                        writer.WritePropertyName("tagFilter");
                        writer.WriteObjectStart();
                        if (tagFilter != null && tagFilter.IsSetTag())
                        {
                            writer.WritePropertyName("tag");
                            writer.Write(tagFilter.Tag);
                        }
                        writer.WriteObjectEnd();
                    }
                }
                if (listClosedWorkflowExecutionsRequest != null && listClosedWorkflowExecutionsRequest.IsSetNextPageToken())
                {
                    writer.WritePropertyName("nextPageToken");
                    writer.Write(listClosedWorkflowExecutionsRequest.NextPageToken);
                }
                if (listClosedWorkflowExecutionsRequest != null && listClosedWorkflowExecutionsRequest.IsSetMaximumPageSize())
                {
                    writer.WritePropertyName("maximumPageSize");
                    writer.Write(listClosedWorkflowExecutionsRequest.MaximumPageSize);
                }
                if (listClosedWorkflowExecutionsRequest != null && listClosedWorkflowExecutionsRequest.IsSetReverseOrder())
                {
                    writer.WritePropertyName("reverseOrder");
                    writer.Write(listClosedWorkflowExecutionsRequest.ReverseOrder);
                }

                writer.WriteObjectEnd();

                string snippet = stringWriter.ToString();
                request.Content = System.Text.Encoding.UTF8.GetBytes(snippet);
            }


            return(request);
        }
        public IRequest Marshall(CountClosedWorkflowExecutionsRequest countClosedWorkflowExecutionsRequest)
        {
            IRequest request = new DefaultRequest(countClosedWorkflowExecutionsRequest, "AmazonSimpleWorkflow");
            string   target  = "SimpleWorkflowService.CountClosedWorkflowExecutions";

            request.Headers["X-Amz-Target"] = target;
            request.Headers["Content-Type"] = "application/x-amz-json-1.0";

            using (StringWriter stringWriter = new StringWriter())
            {
                JsonWriter writer = new JsonWriter(stringWriter);
                writer.WriteObjectStart();

                if (countClosedWorkflowExecutionsRequest != null && countClosedWorkflowExecutionsRequest.IsSetDomain())
                {
                    writer.WritePropertyName("domain");
                    writer.Write(countClosedWorkflowExecutionsRequest.Domain);
                }

                if (countClosedWorkflowExecutionsRequest != null)
                {
                    ExecutionTimeFilter startTimeFilter = countClosedWorkflowExecutionsRequest.StartTimeFilter;
                    if (startTimeFilter != null)
                    {
                        writer.WritePropertyName("startTimeFilter");
                        writer.WriteObjectStart();
                        if (startTimeFilter != null && startTimeFilter.IsSetOldestDate())
                        {
                            writer.WritePropertyName("oldestDate");
                            writer.Write(startTimeFilter.OldestDate);
                        }
                        if (startTimeFilter != null && startTimeFilter.IsSetLatestDate())
                        {
                            writer.WritePropertyName("latestDate");
                            writer.Write(startTimeFilter.LatestDate);
                        }
                        writer.WriteObjectEnd();
                    }
                }

                if (countClosedWorkflowExecutionsRequest != null)
                {
                    ExecutionTimeFilter closeTimeFilter = countClosedWorkflowExecutionsRequest.CloseTimeFilter;
                    if (closeTimeFilter != null)
                    {
                        writer.WritePropertyName("closeTimeFilter");
                        writer.WriteObjectStart();
                        if (closeTimeFilter != null && closeTimeFilter.IsSetOldestDate())
                        {
                            writer.WritePropertyName("oldestDate");
                            writer.Write(closeTimeFilter.OldestDate);
                        }
                        if (closeTimeFilter != null && closeTimeFilter.IsSetLatestDate())
                        {
                            writer.WritePropertyName("latestDate");
                            writer.Write(closeTimeFilter.LatestDate);
                        }
                        writer.WriteObjectEnd();
                    }
                }

                if (countClosedWorkflowExecutionsRequest != null)
                {
                    WorkflowExecutionFilter executionFilter = countClosedWorkflowExecutionsRequest.ExecutionFilter;
                    if (executionFilter != null)
                    {
                        writer.WritePropertyName("executionFilter");
                        writer.WriteObjectStart();
                        if (executionFilter != null && executionFilter.IsSetWorkflowId())
                        {
                            writer.WritePropertyName("workflowId");
                            writer.Write(executionFilter.WorkflowId);
                        }
                        writer.WriteObjectEnd();
                    }
                }

                if (countClosedWorkflowExecutionsRequest != null)
                {
                    WorkflowTypeFilter typeFilter = countClosedWorkflowExecutionsRequest.TypeFilter;
                    if (typeFilter != null)
                    {
                        writer.WritePropertyName("typeFilter");
                        writer.WriteObjectStart();
                        if (typeFilter != null && typeFilter.IsSetName())
                        {
                            writer.WritePropertyName("name");
                            writer.Write(typeFilter.Name);
                        }
                        if (typeFilter != null && typeFilter.IsSetVersion())
                        {
                            writer.WritePropertyName("version");
                            writer.Write(typeFilter.Version);
                        }
                        writer.WriteObjectEnd();
                    }
                }

                if (countClosedWorkflowExecutionsRequest != null)
                {
                    TagFilter tagFilter = countClosedWorkflowExecutionsRequest.TagFilter;
                    if (tagFilter != null)
                    {
                        writer.WritePropertyName("tagFilter");
                        writer.WriteObjectStart();
                        if (tagFilter != null && tagFilter.IsSetTag())
                        {
                            writer.WritePropertyName("tag");
                            writer.Write(tagFilter.Tag);
                        }
                        writer.WriteObjectEnd();
                    }
                }

                if (countClosedWorkflowExecutionsRequest != null)
                {
                    CloseStatusFilter closeStatusFilter = countClosedWorkflowExecutionsRequest.CloseStatusFilter;
                    if (closeStatusFilter != null)
                    {
                        writer.WritePropertyName("closeStatusFilter");
                        writer.WriteObjectStart();
                        if (closeStatusFilter != null && closeStatusFilter.IsSetStatus())
                        {
                            writer.WritePropertyName("status");
                            writer.Write(closeStatusFilter.Status);
                        }
                        writer.WriteObjectEnd();
                    }
                }

                writer.WriteObjectEnd();

                string snippet = stringWriter.ToString();
                request.Content = System.Text.Encoding.UTF8.GetBytes(snippet);
                return(request);
            }
        }