private static void UnmarshallResult(XmlUnmarshallerContext context, DescribeStackResourcesResponse 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("StackResources/member", targetDepth))
                    {
                        var unmarshaller = StackResourceUnmarshaller.Instance;
                        var item         = unmarshaller.Unmarshall(context);
                        response.StackResources.Add(item);
                        continue;
                    }
                }
            }

            return;
        }
Ejemplo n.º 2
0
        private static void UnmarshallResult(XmlUnmarshallerContext context, DescribeStackResourcesResponse 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("StackResources/member", targetDepth))
                    {
                        response.StackResources.Add(StackResourceUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth < originalDepth)
                {
                    return;
                }
            }



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

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

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

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

            return(response);
        }
        /// <summary>
        /// <para> Returns AWS resource descriptions for running and deleted stacks. If <c>StackName</c> is specified, all the associated resources that
        /// are part of the stack are returned. If <c>PhysicalResourceId</c> is specified, all the associated resources of the stack the resource
        /// belongs to are returned. </para> <para>For deleted stacks, DescribeStackResources returns resource information for up to 90 days after the
        /// stack has been deleted. </para> <para> You must specify <c>StackName</c> or <c>PhysicalResourceId.</c> In addition, you can specify
        /// <c>LogicalResourceId</c> to filter the returned result. For more information about resources, the <c>LogicalResourceId</c> and
        /// <c>PhysicalResourceId</c> , go to the AWS CloudFormation User Guide. </para> <para><b>NOTE:</b> A ValidationError is returned if you specify
        /// both StackName and PhysicalResourceId in the same request. </para>
        /// </summary>
        ///
        /// <param name="describeStackResourcesRequest">Container for the necessary parameters to execute the DescribeStackResources service method on
        ///           AmazonCloudFormation.</param>
        ///
        /// <returns>The response from the DescribeStackResources service method, as returned by AmazonCloudFormation.</returns>
        ///
        public DescribeStackResourcesResponse DescribeStackResources(DescribeStackResourcesRequest describeStackResourcesRequest)
        {
            IRequest <DescribeStackResourcesRequest> request  = new DescribeStackResourcesRequestMarshaller().Marshall(describeStackResourcesRequest);
            DescribeStackResourcesResponse           response = Invoke <DescribeStackResourcesRequest, DescribeStackResourcesResponse> (request, this.signer, DescribeStackResourcesResponseUnmarshaller.GetInstance());

            return(response);
        }
        public static async Task <string> GetPhysicalStackResourceId(string stackName, string logicalResourceId, Credentials credentials)
        {
            DescribeStackResourcesResponse response = await GetClient(credentials).DescribeStackResourcesAsync(
                new DescribeStackResourcesRequest {
                StackName = stackName
            });

            return(response.StackResources.FirstOrDefault(resource => resource.LogicalResourceId == logicalResourceId)?.PhysicalResourceId);
        }
Ejemplo n.º 6
0
        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);

            DescribeStackResourcesResponse resp = new DescribeStackResourcesResponse();
            DescribeStackResourcesRequest  req  = new DescribeStackResourcesRequest
            {
            };

            resp = client.DescribeStackResources(req);
            CheckError(resp.HttpStatusCode, "200");

            foreach (var obj in resp.StackResources)
            {
                AddObject(obj);
            }
        }
        public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context)
        {
            DescribeStackResourcesResponse response = new DescribeStackResourcesResponse();

            while (context.Read())
            {
                if (context.IsStartElement)
                {
                    if (context.TestExpression("DescribeStackResourcesResult", 2))
                    {
                        response.DescribeStackResourcesResult = DescribeStackResourcesResultUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("ResponseMetadata", 2))
                    {
                        response.ResponseMetadata = ResponseMetadataUnmarshaller.GetInstance().Unmarshall(context);
                    }
                }
            }


            return(response);
        }