private static void UnmarshallResult(XmlUnmarshallerContext context, DescribeEventsResponse 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("Events/Event", targetDepth)) { var unmarshaller = EventUnmarshaller.Instance; var item = unmarshaller.Unmarshall(context); response.Events.Add(item); continue; } if (context.TestExpression("Marker", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.Marker = unmarshaller.Unmarshall(context); continue; } } } return; }
/// <summary> /// <para>Returns list of event descriptions matching criteria up to the last 6 weeks.</para> <para><b>NOTE:</b> This action returns the most /// recent 1,000 events from the specified NextToken. </para> /// </summary> /// /// <param name="describeEventsRequest">Container for the necessary parameters to execute the DescribeEvents service method on /// AmazonElasticBeanstalk.</param> /// /// <returns>The response from the DescribeEvents service method, as returned by AmazonElasticBeanstalk.</returns> /// public DescribeEventsResponse DescribeEvents(DescribeEventsRequest describeEventsRequest) { IRequest <DescribeEventsRequest> request = new DescribeEventsRequestMarshaller().Marshall(describeEventsRequest); DescribeEventsResponse response = Invoke <DescribeEventsRequest, DescribeEventsResponse> (request, this.signer, DescribeEventsResponseUnmarshaller.GetInstance()); return(response); }
public static DescribeEventsResponse Unmarshall(UnmarshallerContext context) { DescribeEventsResponse describeEventsResponse = new DescribeEventsResponse(); describeEventsResponse.HttpResponse = context.HttpResponse; describeEventsResponse.RequestId = context.StringValue("DescribeEvents.RequestId"); describeEventsResponse.PageNo = context.IntegerValue("DescribeEvents.PageNo"); describeEventsResponse.PageSize = context.IntegerValue("DescribeEvents.PageSize"); describeEventsResponse.Total = context.IntegerValue("DescribeEvents.Total"); List <DescribeEventsResponse.DescribeEvents_Events> describeEventsResponse_data = new List <DescribeEventsResponse.DescribeEvents_Events>(); for (int i = 0; i < context.Length("DescribeEvents.Data.Length"); i++) { DescribeEventsResponse.DescribeEvents_Events events = new DescribeEventsResponse.DescribeEvents_Events(); events.ResourceId = context.StringValue("DescribeEvents.Data[" + i + "].ResourceId"); events.EventType = context.StringValue("DescribeEvents.Data[" + i + "].EventType"); events.EventCategory = context.StringValue("DescribeEvents.Data[" + i + "].EventCategory"); events.Status = context.StringValue("DescribeEvents.Data[" + i + "].Status"); events.SupportModify = context.StringValue("DescribeEvents.Data[" + i + "].SupportModify"); events.PlanTime = context.StringValue("DescribeEvents.Data[" + i + "].PlanTime"); events.ExpireTime = context.StringValue("DescribeEvents.Data[" + i + "].ExpireTime"); events.EventId = context.StringValue("DescribeEvents.Data[" + i + "].EventId"); describeEventsResponse_data.Add(events); } describeEventsResponse.Data = describeEventsResponse_data; return(describeEventsResponse); }
/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context) { DescribeEventsResponse response = new DescribeEventsResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.IsStartElement) { if (context.TestExpression("DescribeEventsResult", 2)) { UnmarshallResult(context, response); continue; } if (context.TestExpression("ResponseMetadata", 2)) { response.ResponseMetadata = ResponseMetadataUnmarshaller.Instance.Unmarshall(context); } } } return(response); }
public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems) { AmazonRedshiftConfig config = new AmazonRedshiftConfig(); config.RegionEndpoint = region; ConfigureClient(config); AmazonRedshiftClient client = new AmazonRedshiftClient(creds, config); DescribeEventsResponse resp = new DescribeEventsResponse(); do { DescribeEventsRequest req = new DescribeEventsRequest { Marker = resp.Marker , MaxRecords = maxItems }; resp = client.DescribeEvents(req); CheckError(resp.HttpStatusCode, "200"); foreach (var obj in resp.Events) { AddObject(obj); } }while (!string.IsNullOrEmpty(resp.Marker)); }
/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { DescribeEventsResponse response = new DescribeEventsResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("Events", targetDepth)) { var unmarshaller = new ListUnmarshaller <DMSEvent, DMSEventUnmarshaller>(DMSEventUnmarshaller.Instance); response.Events = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("Marker", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.Marker = unmarshaller.Unmarshall(context); continue; } } return(response); }
public static DescribeEventsResponse Unmarshall(UnmarshallerContext context) { DescribeEventsResponse describeEventsResponse = new DescribeEventsResponse(); describeEventsResponse.HttpResponse = context.HttpResponse; describeEventsResponse.RequestId = context.StringValue("DescribeEvents.RequestId"); describeEventsResponse.TotalRecordCount = context.IntegerValue("DescribeEvents.TotalRecordCount"); describeEventsResponse.PageRecordCount = context.IntegerValue("DescribeEvents.PageRecordCount"); describeEventsResponse.PageNumber = context.IntegerValue("DescribeEvents.PageNumber"); List <DescribeEventsResponse.DescribeEvents_EventItemsItem> describeEventsResponse_eventItems = new List <DescribeEventsResponse.DescribeEvents_EventItemsItem>(); for (int i = 0; i < context.Length("DescribeEvents.EventItems.Length"); i++) { DescribeEventsResponse.DescribeEvents_EventItemsItem eventItemsItem = new DescribeEventsResponse.DescribeEvents_EventItemsItem(); eventItemsItem.EventId = context.IntegerValue("DescribeEvents.EventItems[" + i + "].EventId"); eventItemsItem.EventType = context.StringValue("DescribeEvents.EventItems[" + i + "].EventType"); eventItemsItem.EventName = context.StringValue("DescribeEvents.EventItems[" + i + "].EventName"); eventItemsItem.EventTime = context.StringValue("DescribeEvents.EventItems[" + i + "].EventTime"); eventItemsItem.ResourceType = context.StringValue("DescribeEvents.EventItems[" + i + "].ResourceType"); eventItemsItem.ResourceName = context.StringValue("DescribeEvents.EventItems[" + i + "].ResourceName"); eventItemsItem.Region = context.StringValue("DescribeEvents.EventItems[" + i + "].Region"); eventItemsItem.EventUserType = context.StringValue("DescribeEvents.EventItems[" + i + "].EventUserType"); eventItemsItem.EventReason = context.StringValue("DescribeEvents.EventItems[" + i + "].EventReason"); eventItemsItem.EventPayload = context.StringValue("DescribeEvents.EventItems[" + i + "].EventPayload"); eventItemsItem.EventRecordTime = context.StringValue("DescribeEvents.EventItems[" + i + "].EventRecordTime"); describeEventsResponse_eventItems.Add(eventItemsItem); } describeEventsResponse.EventItems = describeEventsResponse_eventItems; return(describeEventsResponse); }
public static DescribeEventsResponse Unmarshall(UnmarshallerContext context) { DescribeEventsResponse describeEventsResponse = new DescribeEventsResponse(); describeEventsResponse.HttpResponse = context.HttpResponse; describeEventsResponse.RequestId = context.StringValue("DescribeEvents.RequestId"); describeEventsResponse.PageNumber = context.IntegerValue("DescribeEvents.PageNumber"); describeEventsResponse.PageSize = context.IntegerValue("DescribeEvents.PageSize"); describeEventsResponse.TotalCount = context.IntegerValue("DescribeEvents.TotalCount"); List <DescribeEventsResponse.DescribeEvents__Event> describeEventsResponse_events = new List <DescribeEventsResponse.DescribeEvents__Event>(); for (int i = 0; i < context.Length("DescribeEvents.Events.Length"); i++) { DescribeEventsResponse.DescribeEvents__Event _event = new DescribeEventsResponse.DescribeEvents__Event(); _event.ResourceId = context.StringValue("DescribeEvents.Events[" + i + "].ResourceId"); _event.EventType = context.StringValue("DescribeEvents.Events[" + i + "].EventType"); _event.EventCategory = context.StringValue("DescribeEvents.Events[" + i + "].EventCategory"); _event.Status = context.StringValue("DescribeEvents.Events[" + i + "].Status"); _event.SupportModify = context.StringValue("DescribeEvents.Events[" + i + "].SupportModify"); _event.PlanTime = context.StringValue("DescribeEvents.Events[" + i + "].PlanTime"); _event.ExpireTime = context.StringValue("DescribeEvents.Events[" + i + "].ExpireTime"); _event.EventId = context.StringValue("DescribeEvents.Events[" + i + "].EventId"); describeEventsResponse_events.Add(_event); } describeEventsResponse.Events = describeEventsResponse_events; return(describeEventsResponse); }
public static DescribeEventsResponse Unmarshall(UnmarshallerContext context) { DescribeEventsResponse describeEventsResponse = new DescribeEventsResponse(); describeEventsResponse.HttpResponse = context.HttpResponse; return(describeEventsResponse); }
public static DescribeEventsResponse Unmarshall(UnmarshallerContext context) { DescribeEventsResponse describeEventsResponse = new DescribeEventsResponse(); describeEventsResponse.HttpResponse = context.HttpResponse; describeEventsResponse.RequestId = context.StringValue("DescribeEvents.RequestId"); describeEventsResponse.PageSize = context.IntegerValue("DescribeEvents.PageSize"); describeEventsResponse.CurrentPage = context.IntegerValue("DescribeEvents.CurrentPage"); describeEventsResponse.TotalCount = context.IntegerValue("DescribeEvents.TotalCount"); List <DescribeEventsResponse.DescribeEvents__Event> describeEventsResponse_items = new List <DescribeEventsResponse.DescribeEvents__Event>(); for (int i = 0; i < context.Length("DescribeEvents.Items.Length"); i++) { DescribeEventsResponse.DescribeEvents__Event _event = new DescribeEventsResponse.DescribeEvents__Event(); _event.Id = context.LongValue("DescribeEvents.Items[" + i + "].Id"); _event.UserId = context.LongValue("DescribeEvents.Items[" + i + "].UserId"); _event.LoginName = context.StringValue("DescribeEvents.Items[" + i + "].LoginName"); _event.DisplayName = context.StringValue("DescribeEvents.Items[" + i + "].DisplayName"); _event.ProductCode = context.StringValue("DescribeEvents.Items[" + i + "].ProductCode"); _event.TargetProductCode = context.StringValue("DescribeEvents.Items[" + i + "].TargetProductCode"); _event.TypeCode = context.StringValue("DescribeEvents.Items[" + i + "].TypeCode"); _event.TypeName = context.StringValue("DescribeEvents.Items[" + i + "].TypeName"); _event.TelephoneNum = context.StringValue("DescribeEvents.Items[" + i + "].TelephoneNum"); _event.SubTypeCode = context.StringValue("DescribeEvents.Items[" + i + "].SubTypeCode"); _event.SubTypeName = context.StringValue("DescribeEvents.Items[" + i + "].SubTypeName"); _event.AlertTime = context.LongValue("DescribeEvents.Items[" + i + "].AlertTime"); _event.EventTime = context.LongValue("DescribeEvents.Items[" + i + "].EventTime"); _event.Status = context.IntegerValue("DescribeEvents.Items[" + i + "].Status"); _event.StatusName = context.StringValue("DescribeEvents.Items[" + i + "].StatusName"); _event.DealUserId = context.LongValue("DescribeEvents.Items[" + i + "].DealUserId"); _event.DealLoginName = context.StringValue("DescribeEvents.Items[" + i + "].DealLoginName"); _event.DealDisplayName = context.StringValue("DescribeEvents.Items[" + i + "].DealDisplayName"); _event.DealTime = context.LongValue("DescribeEvents.Items[" + i + "].DealTime"); _event.DepartName = context.StringValue("DescribeEvents.Items[" + i + "].DepartName"); _event.Backed = context.BooleanValue("DescribeEvents.Items[" + i + "].Backed"); describeEventsResponse_items.Add(_event); } describeEventsResponse.Items = describeEventsResponse_items; return(describeEventsResponse); }
public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context) { DescribeEventsResponse response = new DescribeEventsResponse(); while (context.Read()) { if (context.IsStartElement) { if (context.TestExpression("DescribeEventsResult", 2)) { response.DescribeEventsResult = DescribeEventsResultUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("ResponseMetadata", 2)) { response.ResponseMetadata = ResponseMetadataUnmarshaller.GetInstance().Unmarshall(context); } } } return(response); }
private static void UnmarshallResult(XmlUnmarshallerContext context, DescribeEventsResponse response) { int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; if (context.IsStartOfDocument) { targetDepth += 2; } while (context.Read()) { if (context.IsStartElement || context.IsAttribute) { if (context.TestExpression("Marker", targetDepth)) { response.Marker = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("Events/Event", targetDepth)) { response.Events.Add(EventUnmarshaller.GetInstance().Unmarshall(context)); continue; } } else if (context.IsEndElement && context.CurrentDepth < originalDepth) { return; } } return; }
public async Task UpdateEnvironmentTest() { var application = "TestApp"; var environment = "TestEnv"; var solutionStack = "TestWindowsStack"; var iamProfile = "arn:aws:fake-profile"; var mockS3Client = new Mock <IAmazonS3>(); var calls = new Dictionary <string, int>(); Action <string> addCall = x => { if (calls.ContainsKey(x)) { calls[x] = calls[x] + 1; } else { calls[x] = 1; } }; var mockEbClient = new Mock <IAmazonElasticBeanstalk>(); mockEbClient.Setup(client => client.DescribeApplicationsAsync(It.IsAny <DescribeApplicationsRequest>(), It.IsAny <CancellationToken>())) .Callback <DescribeApplicationsRequest, CancellationToken>((request, token) => { Assert.Equal(application, request.ApplicationNames[0]); }) .Returns((DescribeApplicationsRequest r, CancellationToken token) => { addCall("DescribeApplicationsAsync"); return(Task.FromResult(new DescribeApplicationsResponse { Applications = new List <ApplicationDescription> { new ApplicationDescription { ApplicationName = application } } })); }); mockEbClient.Setup(client => client.CreateStorageLocationAsync(It.IsAny <CancellationToken>())) .Returns((CancellationToken token) => { addCall("CreateStorageLocationAsync"); return(Task.FromResult(new CreateStorageLocationResponse { S3Bucket = "TestBucket" })); }); mockEbClient.Setup(client => client.DescribeEventsAsync(It.IsAny <DescribeEventsRequest>(), It.IsAny <CancellationToken>())) .Callback <DescribeEventsRequest, CancellationToken>((request, token) => { Assert.Equal(application, request.ApplicationName); Assert.Equal(environment, request.EnvironmentName); }) .Returns((DescribeEventsRequest r, CancellationToken token) => { addCall("DescribeEventsAsync"); var response = new DescribeEventsResponse { Events = new List <EventDescription> { new EventDescription { ApplicationName = application, EnvironmentName = environment, Message = "Dummy Message", EventDate = DateTime.Now } } }; return(Task.FromResult(response)); }); mockEbClient.Setup(client => client.CreateApplicationAsync(It.IsAny <CreateApplicationRequest>(), It.IsAny <CancellationToken>())) .Callback <CreateApplicationRequest, CancellationToken>((request, token) => { Assert.Equal(application, request.ApplicationName); }) .Returns((CreateApplicationRequest r, CancellationToken token) => { addCall("CreateApplicationAsync"); return(Task.FromResult(new CreateApplicationResponse())); }); mockEbClient.Setup(client => client.CreateEnvironmentAsync(It.IsAny <CreateEnvironmentRequest>(), It.IsAny <CancellationToken>())) .Returns((CreateEnvironmentRequest r, CancellationToken token) => { addCall("CreateEnvironmentAsync"); return(Task.FromResult(new CreateEnvironmentResponse())); }); mockEbClient.Setup(client => client.UpdateEnvironmentAsync(It.IsAny <UpdateEnvironmentRequest>(), It.IsAny <CancellationToken>())) .Callback <UpdateEnvironmentRequest, CancellationToken>((request, token) => { Assert.Equal(application, request.ApplicationName); Assert.Equal(environment, request.EnvironmentName); var xraySetting = request.OptionSettings.FirstOrDefault(x => string.Equals(x.OptionName, "XRayEnabled") && string.Equals(x.Namespace, "aws:elasticbeanstalk:xray")); Assert.Equal(xraySetting.Value.ToLower(), "true"); }) .Returns((UpdateEnvironmentRequest r, CancellationToken token) => { addCall("UpdateEnvironmentAsync"); return(Task.FromResult(new UpdateEnvironmentResponse())); }); mockEbClient.Setup(client => client.DescribeEnvironmentsAsync(It.IsAny <DescribeEnvironmentsRequest>(), It.IsAny <CancellationToken>())) .Returns((DescribeEnvironmentsRequest r, CancellationToken token) => { addCall("DescribeEnvironmentsAsync"); return(Task.FromResult(new DescribeEnvironmentsResponse { Environments = new List <EnvironmentDescription> { new EnvironmentDescription { ApplicationName = application, EnvironmentName = environment, DateCreated = DateTime.Now.AddMinutes(-1), DateUpdated = DateTime.Now, Status = EnvironmentStatus.Ready } } })); }); var deployCommand = new DeployEnvironmentCommand(new ConsoleToolLogger(), TestUtilities.TestBeanstalkWebAppPath, new string[] { "-app", application, "-env", environment, "--solution-stack", solutionStack, "--instance-profile", iamProfile, "--region", "us-moq-1", "--enable-xray", "true" }); deployCommand.DisableInteractive = true; deployCommand.EBClient = mockEbClient.Object; deployCommand.S3Client = mockS3Client.Object; await deployCommand.ExecuteAsync(); Assert.Null(deployCommand.LastToolsException); Assert.False(calls.ContainsKey("CreateApplicationAsync")); Assert.False(calls.ContainsKey("CreateEnvironmentAsync")); Assert.True(calls.ContainsKey("UpdateEnvironmentAsync")); }