示例#1
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context)
        {
            ListTemplatesResponse response = new ListTemplatesResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.IsStartElement)
                {
                    if (context.TestExpression("ListTemplatesResult", 2))
                    {
                        UnmarshallResult(context, response);
                        continue;
                    }

                    if (context.TestExpression("ResponseMetadata", 2))
                    {
                        response.ResponseMetadata = ResponseMetadataUnmarshaller.Instance.Unmarshall(context);
                    }
                }
            }

            return(response);
        }
        public static ListTemplatesResponse Unmarshall(UnmarshallerContext _ctx)
        {
            ListTemplatesResponse listTemplatesResponse = new ListTemplatesResponse();

            listTemplatesResponse.HttpResponse = _ctx.HttpResponse;
            listTemplatesResponse.RequestId    = _ctx.StringValue("ListTemplates.RequestId");
            listTemplatesResponse.PageNumber   = _ctx.IntegerValue("ListTemplates.PageNumber");
            listTemplatesResponse.PageSize     = _ctx.IntegerValue("ListTemplates.PageSize");
            listTemplatesResponse.TotalCount   = _ctx.LongValue("ListTemplates.TotalCount");
            listTemplatesResponse.TotalAmount  = _ctx.LongValue("ListTemplates.TotalAmount");

            List <ListTemplatesResponse.ListTemplates_Template> listTemplatesResponse_templates = new List <ListTemplatesResponse.ListTemplates_Template>();

            for (int i = 0; i < _ctx.Length("ListTemplates.Templates.Length"); i++)
            {
                ListTemplatesResponse.ListTemplates_Template template = new ListTemplatesResponse.ListTemplates_Template();
                template.TemplateId   = _ctx.StringValue("ListTemplates.Templates[" + i + "].TemplateId");
                template.TemplateName = _ctx.StringValue("ListTemplates.Templates[" + i + "].TemplateName");
                template.Type         = _ctx.IntegerValue("ListTemplates.Templates[" + i + "].Type");
                template.IsDefault    = _ctx.BooleanValue("ListTemplates.Templates[" + i + "].IsDefault");
                template.CreateTime   = _ctx.StringValue("ListTemplates.Templates[" + i + "].CreateTime");
                template.UpdateTime   = _ctx.StringValue("ListTemplates.Templates[" + i + "].UpdateTime");

                listTemplatesResponse_templates.Add(template);
            }
            listTemplatesResponse.Templates = listTemplatesResponse_templates;

            return(listTemplatesResponse);
        }
示例#3
0
        private static void UnmarshallResult(XmlUnmarshallerContext context, ListTemplatesResponse response)
        {
            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

            if (context.IsStartOfDocument)
            {
                targetDepth += 2;
            }

            while (context.ReadAtDepth(originalDepth))
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression("NextToken", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        response.NextToken = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("TemplatesMetadata/member", targetDepth))
                    {
                        var unmarshaller = TemplateMetadataUnmarshaller.Instance;
                        var item         = unmarshaller.Unmarshall(context);
                        response.TemplatesMetadata.Add(item);
                        continue;
                    }
                }
            }

            return;
        }
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            ListTemplatesResponse response = new ListTemplatesResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("NextToken", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.NextToken = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("RequestId", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.RequestId = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("TemplateSummaryList", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <TemplateSummary, TemplateSummaryUnmarshaller>(TemplateSummaryUnmarshaller.Instance);
                    response.TemplateSummaryList = unmarshaller.Unmarshall(context);
                    continue;
                }
            }
            response.Status = (int)context.ResponseData.StatusCode;

            return(response);
        }
        public static ListTemplatesResponse Unmarshall(UnmarshallerContext context)
        {
            ListTemplatesResponse listTemplatesResponse = new ListTemplatesResponse();

            listTemplatesResponse.HttpResponse   = context.HttpResponse;
            listTemplatesResponse.HttpStatusCode = context.IntegerValue("ListTemplates.HttpStatusCode");
            listTemplatesResponse.PageNumber     = context.IntegerValue("ListTemplates.PageNumber");
            listTemplatesResponse.PageSize       = context.IntegerValue("ListTemplates.PageSize");
            listTemplatesResponse.RequestId      = context.StringValue("ListTemplates.RequestId");
            listTemplatesResponse.Success        = context.BooleanValue("ListTemplates.Success");
            listTemplatesResponse.TotalCount     = context.IntegerValue("ListTemplates.TotalCount");

            List <ListTemplatesResponse.ListTemplates_Template> listTemplatesResponse_templates = new List <ListTemplatesResponse.ListTemplates_Template>();

            for (int i = 0; i < context.Length("ListTemplates.Templates.Length"); i++)
            {
                ListTemplatesResponse.ListTemplates_Template template = new ListTemplatesResponse.ListTemplates_Template();
                template.CreateTime   = context.StringValue("ListTemplates.Templates[" + i + "].CreateTime");
                template.Description  = context.StringValue("ListTemplates.Templates[" + i + "].Description");
                template.TemplateId   = context.StringValue("ListTemplates.Templates[" + i + "].TemplateId");
                template.TemplateName = context.StringValue("ListTemplates.Templates[" + i + "].TemplateName");
                template.UpdateTime   = context.StringValue("ListTemplates.Templates[" + i + "].UpdateTime");

                listTemplatesResponse_templates.Add(template);
            }
            listTemplatesResponse.Templates = listTemplatesResponse_templates;

            return(listTemplatesResponse);
        }
示例#6
0
        public static ListTemplatesResponse Unmarshall(UnmarshallerContext context)
        {
            ListTemplatesResponse listTemplatesResponse = new ListTemplatesResponse();

            listTemplatesResponse.HttpResponse = context.HttpResponse;
            listTemplatesResponse.RequestId    = context.StringValue("ListTemplates.RequestId");
            listTemplatesResponse.MaxResults   = context.IntegerValue("ListTemplates.MaxResults");
            listTemplatesResponse.NextToken    = context.StringValue("ListTemplates.NextToken");

            List <ListTemplatesResponse.ListTemplates_Template> listTemplatesResponse_templates = new List <ListTemplatesResponse.ListTemplates_Template>();

            for (int i = 0; i < context.Length("ListTemplates.Templates.Length"); i++)
            {
                ListTemplatesResponse.ListTemplates_Template template = new ListTemplatesResponse.ListTemplates_Template();
                template.TemplateName        = context.StringValue("ListTemplates.Templates[" + i + "].TemplateName");
                template.TemplateId          = context.StringValue("ListTemplates.Templates[" + i + "].TemplateId");
                template.CreatedDate         = context.StringValue("ListTemplates.Templates[" + i + "].CreatedDate");
                template.CreatedBy           = context.StringValue("ListTemplates.Templates[" + i + "].CreatedBy");
                template.UpdatedDate         = context.StringValue("ListTemplates.Templates[" + i + "].UpdatedDate");
                template.UpdatedBy           = context.StringValue("ListTemplates.Templates[" + i + "].UpdatedBy");
                template.Hash                = context.StringValue("ListTemplates.Templates[" + i + "].Hash");
                template.Description         = context.StringValue("ListTemplates.Templates[" + i + "].Description");
                template.ShareType           = context.StringValue("ListTemplates.Templates[" + i + "].ShareType");
                template.TemplateFormat      = context.StringValue("ListTemplates.Templates[" + i + "].TemplateFormat");
                template.TemplateVersion     = context.StringValue("ListTemplates.Templates[" + i + "].TemplateVersion");
                template.TotalExecutionCount = context.IntegerValue("ListTemplates.Templates[" + i + "].TotalExecutionCount");
                template.Popularity          = context.IntegerValue("ListTemplates.Templates[" + i + "].Popularity");

                listTemplatesResponse_templates.Add(template);
            }
            listTemplatesResponse.Templates = listTemplatesResponse_templates;

            return(listTemplatesResponse);
        }
示例#7
0
        public static ListTemplatesResponse Unmarshall(UnmarshallerContext _ctx)
        {
            ListTemplatesResponse listTemplatesResponse = new ListTemplatesResponse();

            listTemplatesResponse.HttpResponse = _ctx.HttpResponse;
            listTemplatesResponse.PageNumber   = _ctx.IntegerValue("ListTemplates.PageNumber");
            listTemplatesResponse.PageSize     = _ctx.IntegerValue("ListTemplates.PageSize");
            listTemplatesResponse.RequestId    = _ctx.StringValue("ListTemplates.RequestId");
            listTemplatesResponse.TotalCount   = _ctx.IntegerValue("ListTemplates.TotalCount");

            List <ListTemplatesResponse.ListTemplates_Template> listTemplatesResponse_templates = new List <ListTemplatesResponse.ListTemplates_Template>();

            for (int i = 0; i < _ctx.Length("ListTemplates.Templates.Length"); i++)
            {
                ListTemplatesResponse.ListTemplates_Template template = new ListTemplatesResponse.ListTemplates_Template();
                template.CreateTime      = _ctx.StringValue("ListTemplates.Templates[" + i + "].CreateTime");
                template.Description     = _ctx.StringValue("ListTemplates.Templates[" + i + "].Description");
                template.TemplateId      = _ctx.StringValue("ListTemplates.Templates[" + i + "].TemplateId");
                template.TemplateName    = _ctx.StringValue("ListTemplates.Templates[" + i + "].TemplateName");
                template.UpdateTime      = _ctx.StringValue("ListTemplates.Templates[" + i + "].UpdateTime");
                template.TemplateVersion = _ctx.StringValue("ListTemplates.Templates[" + i + "].TemplateVersion");
                template.ShareType       = _ctx.StringValue("ListTemplates.Templates[" + i + "].ShareType");
                template.OwnerId         = _ctx.StringValue("ListTemplates.Templates[" + i + "].OwnerId");
                template.TemplateARN     = _ctx.StringValue("ListTemplates.Templates[" + i + "].TemplateARN");

                listTemplatesResponse_templates.Add(template);
            }
            listTemplatesResponse.Templates = listTemplatesResponse_templates;

            return(listTemplatesResponse);
        }
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            ListTemplatesResponse response = new ListTemplatesResponse();

            var unmarshaller = TemplatesResponseUnmarshaller.Instance;

            response.TemplatesResponse = unmarshaller.Unmarshall(context);

            return(response);
        }
        public ICommandResponse ParseResponse(WebResponse webResponse)
        {
            var response = new ListTemplatesResponse();
            var responseStream = webResponse.GetResponseStream();
            if ((responseStream != null) && (responseStream.CanRead))
            {
                var responseDocument = XDocument.Load(responseStream);
                response.Templates =
                    responseDocument.Root.Elements()
                        .Where(e => e.Name.LocalName.Equals("template", StringComparison.InvariantCultureIgnoreCase))
                        .Select(Template.From);
            }

            return response;
        }
示例#10
0
        public ICommandResponse ParseResponse(WebResponse webResponse)
        {
            var response       = new ListTemplatesResponse();
            var responseStream = webResponse.GetResponseStream();

            if ((responseStream != null) && (responseStream.CanRead))
            {
                var responseDocument = XDocument.Load(responseStream);
                response.Templates =
                    responseDocument.Root.Elements()
                    .Where(e => e.Name.LocalName.Equals("template", StringComparison.InvariantCultureIgnoreCase))
                    .Select(Template.From);
            }

            return(response);
        }
示例#11
0
        public async Task <List <TemplateMetadata> > ListTemplates()
        {
            List <TemplateMetadata> list = new List <TemplateMetadata>();

            _listtemprequest = new ListTemplatesRequest();
            try
            {
                _listtempresponse = await _Client.ListTemplatesAsync(_listtemprequest);

                if (_listtempresponse.HttpStatusCode.ToString() == "OK")
                {
                    list = _listtempresponse.TemplatesMetadata;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Data: {ex.Data}");
                Console.WriteLine($"Source: {ex.Source}");
                Console.WriteLine($"Message: {ex.Message}");
            }
            return(list);
        }