public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems) { AmazonEC2Config config = new AmazonEC2Config(); config.RegionEndpoint = region; ConfigureClient(config); AmazonEC2Client client = new AmazonEC2Client(creds, config); DescribeLaunchTemplatesResponse resp = new DescribeLaunchTemplatesResponse(); do { DescribeLaunchTemplatesRequest req = new DescribeLaunchTemplatesRequest { NextToken = resp.NextToken , MaxResults = maxItems }; resp = client.DescribeLaunchTemplates(req); CheckError(resp.HttpStatusCode, "200"); foreach (var obj in resp.LaunchTemplates) { AddObject(obj); } }while (!string.IsNullOrEmpty(resp.NextToken)); }
public static DescribeLaunchTemplatesResponse Unmarshall(UnmarshallerContext context) { DescribeLaunchTemplatesResponse describeLaunchTemplatesResponse = new DescribeLaunchTemplatesResponse(); describeLaunchTemplatesResponse.HttpResponse = context.HttpResponse; describeLaunchTemplatesResponse.RequestId = context.StringValue("DescribeLaunchTemplates.RequestId"); describeLaunchTemplatesResponse.TotalCount = context.IntegerValue("DescribeLaunchTemplates.TotalCount"); describeLaunchTemplatesResponse.PageNumber = context.IntegerValue("DescribeLaunchTemplates.PageNumber"); describeLaunchTemplatesResponse.PageSize = context.IntegerValue("DescribeLaunchTemplates.PageSize"); List <DescribeLaunchTemplatesResponse.DescribeLaunchTemplates_LaunchTemplateSet> describeLaunchTemplatesResponse_launchTemplateSets = new List <DescribeLaunchTemplatesResponse.DescribeLaunchTemplates_LaunchTemplateSet>(); for (int i = 0; i < context.Length("DescribeLaunchTemplates.LaunchTemplateSets.Length"); i++) { DescribeLaunchTemplatesResponse.DescribeLaunchTemplates_LaunchTemplateSet launchTemplateSet = new DescribeLaunchTemplatesResponse.DescribeLaunchTemplates_LaunchTemplateSet(); launchTemplateSet.CreateTime = context.StringValue("DescribeLaunchTemplates.LaunchTemplateSets[" + i + "].CreateTime"); launchTemplateSet.ModifiedTime = context.StringValue("DescribeLaunchTemplates.LaunchTemplateSets[" + i + "].ModifiedTime"); launchTemplateSet.LaunchTemplateId = context.StringValue("DescribeLaunchTemplates.LaunchTemplateSets[" + i + "].LaunchTemplateId"); launchTemplateSet.LaunchTemplateName = context.StringValue("DescribeLaunchTemplates.LaunchTemplateSets[" + i + "].LaunchTemplateName"); launchTemplateSet.DefaultVersionNumber = context.LongValue("DescribeLaunchTemplates.LaunchTemplateSets[" + i + "].DefaultVersionNumber"); launchTemplateSet.LatestVersionNumber = context.LongValue("DescribeLaunchTemplates.LaunchTemplateSets[" + i + "].LatestVersionNumber"); launchTemplateSet.CreatedBy = context.StringValue("DescribeLaunchTemplates.LaunchTemplateSets[" + i + "].CreatedBy"); describeLaunchTemplatesResponse_launchTemplateSets.Add(launchTemplateSet); } describeLaunchTemplatesResponse.LaunchTemplateSets = describeLaunchTemplatesResponse_launchTemplateSets; return(describeLaunchTemplatesResponse); }
/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context) { DescribeLaunchTemplatesResponse response = new DescribeLaunchTemplatesResponse(); 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("launchTemplates/item", targetDepth)) { var unmarshaller = LaunchTemplateUnmarshaller.Instance; var item = unmarshaller.Unmarshall(context); response.LaunchTemplates.Add(item); continue; } if (context.TestExpression("nextToken", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.NextToken = unmarshaller.Unmarshall(context); continue; } } } return(response); }
public static DescribeLaunchTemplatesResponse Unmarshall(UnmarshallerContext _ctx) { DescribeLaunchTemplatesResponse describeLaunchTemplatesResponse = new DescribeLaunchTemplatesResponse(); describeLaunchTemplatesResponse.HttpResponse = _ctx.HttpResponse; describeLaunchTemplatesResponse.RequestId = _ctx.StringValue("DescribeLaunchTemplates.RequestId"); describeLaunchTemplatesResponse.TotalCount = _ctx.IntegerValue("DescribeLaunchTemplates.TotalCount"); describeLaunchTemplatesResponse.PageNumber = _ctx.IntegerValue("DescribeLaunchTemplates.PageNumber"); describeLaunchTemplatesResponse.PageSize = _ctx.IntegerValue("DescribeLaunchTemplates.PageSize"); List <DescribeLaunchTemplatesResponse.DescribeLaunchTemplates_LaunchTemplateSet> describeLaunchTemplatesResponse_launchTemplateSets = new List <DescribeLaunchTemplatesResponse.DescribeLaunchTemplates_LaunchTemplateSet>(); for (int i = 0; i < _ctx.Length("DescribeLaunchTemplates.LaunchTemplateSets.Length"); i++) { DescribeLaunchTemplatesResponse.DescribeLaunchTemplates_LaunchTemplateSet launchTemplateSet = new DescribeLaunchTemplatesResponse.DescribeLaunchTemplates_LaunchTemplateSet(); launchTemplateSet.CreateTime = _ctx.StringValue("DescribeLaunchTemplates.LaunchTemplateSets[" + i + "].CreateTime"); launchTemplateSet.ModifiedTime = _ctx.StringValue("DescribeLaunchTemplates.LaunchTemplateSets[" + i + "].ModifiedTime"); launchTemplateSet.LaunchTemplateId = _ctx.StringValue("DescribeLaunchTemplates.LaunchTemplateSets[" + i + "].LaunchTemplateId"); launchTemplateSet.LaunchTemplateName = _ctx.StringValue("DescribeLaunchTemplates.LaunchTemplateSets[" + i + "].LaunchTemplateName"); launchTemplateSet.DefaultVersionNumber = _ctx.LongValue("DescribeLaunchTemplates.LaunchTemplateSets[" + i + "].DefaultVersionNumber"); launchTemplateSet.LatestVersionNumber = _ctx.LongValue("DescribeLaunchTemplates.LaunchTemplateSets[" + i + "].LatestVersionNumber"); launchTemplateSet.CreatedBy = _ctx.StringValue("DescribeLaunchTemplates.LaunchTemplateSets[" + i + "].CreatedBy"); launchTemplateSet.ResourceGroupId = _ctx.StringValue("DescribeLaunchTemplates.LaunchTemplateSets[" + i + "].ResourceGroupId"); List <DescribeLaunchTemplatesResponse.DescribeLaunchTemplates_LaunchTemplateSet.DescribeLaunchTemplates_Tag> launchTemplateSet_tags = new List <DescribeLaunchTemplatesResponse.DescribeLaunchTemplates_LaunchTemplateSet.DescribeLaunchTemplates_Tag>(); for (int j = 0; j < _ctx.Length("DescribeLaunchTemplates.LaunchTemplateSets[" + i + "].Tags.Length"); j++) { DescribeLaunchTemplatesResponse.DescribeLaunchTemplates_LaunchTemplateSet.DescribeLaunchTemplates_Tag tag = new DescribeLaunchTemplatesResponse.DescribeLaunchTemplates_LaunchTemplateSet.DescribeLaunchTemplates_Tag(); tag.TagKey = _ctx.StringValue("DescribeLaunchTemplates.LaunchTemplateSets[" + i + "].Tags[" + j + "].TagKey"); tag.TagValue = _ctx.StringValue("DescribeLaunchTemplates.LaunchTemplateSets[" + i + "].Tags[" + j + "].TagValue"); launchTemplateSet_tags.Add(tag); } launchTemplateSet.Tags = launchTemplateSet_tags; describeLaunchTemplatesResponse_launchTemplateSets.Add(launchTemplateSet); } describeLaunchTemplatesResponse.LaunchTemplateSets = describeLaunchTemplatesResponse_launchTemplateSets; return(describeLaunchTemplatesResponse); }