private static void UnmarshallResult(XmlUnmarshallerContext context, DescribeStackEventsResponse 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("StackEvents/member", targetDepth)) { var unmarshaller = StackEventUnmarshaller.Instance; var item = unmarshaller.Unmarshall(context); response.StackEvents.Add(item); continue; } } } return; }
public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context) { DescribeStackEventsResponse response = new DescribeStackEventsResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.IsStartElement) { if (context.TestExpression("DescribeStackEventsResult", 2)) { UnmarshallResult(context, response); continue; } if (context.TestExpression("ResponseMetadata", 2)) { response.ResponseMetadata = ResponseMetadataUnmarshaller.Instance.Unmarshall(context); } } } return(response); }
/// <summary> /// <para> Returns all the stack related events for the AWS account. If <c>StackName</c> is specified, returns events related to all the stacks /// with the given name. If <c>StackName</c> is not specified, returns all the events for the account. For more information about a stack's /// event history, go to the AWS CloudFormation User Guide. </para> <para><b>NOTE:</b>Events are returned, even if the stack never existed or /// has been successfully deleted.</para> /// </summary> /// /// <param name="describeStackEventsRequest">Container for the necessary parameters to execute the DescribeStackEvents service method on /// AmazonCloudFormation.</param> /// /// <returns>The response from the DescribeStackEvents service method, as returned by AmazonCloudFormation.</returns> /// public DescribeStackEventsResponse DescribeStackEvents(DescribeStackEventsRequest describeStackEventsRequest) { IRequest <DescribeStackEventsRequest> request = new DescribeStackEventsRequestMarshaller().Marshall(describeStackEventsRequest); DescribeStackEventsResponse response = Invoke <DescribeStackEventsRequest, DescribeStackEventsResponse> (request, this.signer, DescribeStackEventsResponseUnmarshaller.GetInstance()); return(response); }
public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems) { AmazonCloudFormationConfig config = new AmazonCloudFormationConfig(); config.RegionEndpoint = region; ConfigureClient(config); AmazonCloudFormationClient client = new AmazonCloudFormationClient(creds, config); DescribeStackEventsResponse resp = new DescribeStackEventsResponse(); do { DescribeStackEventsRequest req = new DescribeStackEventsRequest { NextToken = resp.NextToken }; resp = client.DescribeStackEvents(req); CheckError(resp.HttpStatusCode, "200"); foreach (var obj in resp.StackEvents) { AddObject(obj); } }while (!string.IsNullOrEmpty(resp.NextToken)); }
private static async Task <List <StackEvent> > GetLatestEventsAsync(ILogger log, IAmazonCloudFormation cloudformation, string stackName, DateTime mintimeStampForEvents, string mostRecentEventId) { var noNewEvents = false; var events = new List <StackEvent>(); DescribeStackEventsResponse response = null; do { var request = new DescribeStackEventsRequest { StackName = stackName }; if (response != null) { request.NextToken = response.NextToken; } try { response = await cloudformation.DescribeStackEventsAsync(request).ConfigureAwait(false); } catch (Exception e) { log.Error(e, "Error getting events for stack"); throw; } foreach (var evnt in response.StackEvents) { if (string.Equals(evnt.EventId, mostRecentEventId) || evnt.Timestamp < mintimeStampForEvents) { noNewEvents = true; break; } events.Add(evnt); } } while (!noNewEvents && !string.IsNullOrEmpty(response.NextToken)); return(events); }
private async Task <List <StackEvent> > GetLatestEventsAsync(string stackName, DateTime mintimeStampForEvents, string mostRecentEventId) { bool noNewEvents = false; List <StackEvent> events = new List <StackEvent>(); DescribeStackEventsResponse response = null; do { var request = new DescribeStackEventsRequest() { StackName = stackName }; if (response != null) { request.NextToken = response.NextToken; } try { response = await this.CloudFormationClient.DescribeStackEventsAsync(request); } catch (Exception e) { throw new LambdaToolsException($"Error getting events for stack: {e.Message}", LambdaToolsException.ErrorCode.CloudFormationDescribeStackEvents, e); } foreach (var evnt in response.StackEvents) { if (string.Equals(evnt.EventId, mostRecentEventId) || evnt.Timestamp < mintimeStampForEvents) { noNewEvents = true; break; } events.Add(evnt); } } while (!noNewEvents && !string.IsNullOrEmpty(response.NextToken)); return(events); }
public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context) { DescribeStackEventsResponse response = new DescribeStackEventsResponse(); while (context.Read()) { if (context.IsStartElement) { if (context.TestExpression("DescribeStackEventsResult", 2)) { response.DescribeStackEventsResult = DescribeStackEventsResultUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("ResponseMetadata", 2)) { response.ResponseMetadata = ResponseMetadataUnmarshaller.GetInstance().Unmarshall(context); } } } return(response); }
private static void UnmarshallResult(XmlUnmarshallerContext context, DescribeStackEventsResponse 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("StackEvents/member", targetDepth)) { response.StackEvents.Add(StackEventUnmarshaller.GetInstance().Unmarshall(context)); continue; } if (context.TestExpression("NextToken", targetDepth)) { response.NextToken = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } } else if (context.IsEndElement && context.CurrentDepth < originalDepth) { return; } } return; }