private static void UnmarshallResult(XmlUnmarshallerContext context, CreateChangeSetResponse 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("Id", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        response.Id = unmarshaller.Unmarshall(context);
                        continue;
                    }
                }
            }

            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)
        {
            CreateChangeSetResponse response = new CreateChangeSetResponse();

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

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

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

            return(response);
        }
        public static CreateChangeSetResponse Unmarshall(UnmarshallerContext context)
        {
			CreateChangeSetResponse createChangeSetResponse = new CreateChangeSetResponse();

			createChangeSetResponse.HttpResponse = context.HttpResponse;
			createChangeSetResponse.Dummy = context.StringValue("CreateChangeSet.Dummy");
        
			return createChangeSetResponse;
        }
        public static CreateChangeSetResponse Unmarshall(UnmarshallerContext _ctx)
        {
            CreateChangeSetResponse createChangeSetResponse = new CreateChangeSetResponse();

            createChangeSetResponse.HttpResponse = _ctx.HttpResponse;
            createChangeSetResponse.Dummy        = _ctx.StringValue("CreateChangeSet.Dummy");

            return(createChangeSetResponse);
        }
Example #5
0
        public static CreateChangeSetResponse Unmarshall(UnmarshallerContext _ctx)
        {
            CreateChangeSetResponse createChangeSetResponse = new CreateChangeSetResponse();

            createChangeSetResponse.HttpResponse = _ctx.HttpResponse;
            createChangeSetResponse.ChangeSetId  = _ctx.StringValue("CreateChangeSet.ChangeSetId");
            createChangeSetResponse.RequestId    = _ctx.StringValue("CreateChangeSet.RequestId");
            createChangeSetResponse.StackId      = _ctx.StringValue("CreateChangeSet.StackId");

            return(createChangeSetResponse);
        }
Example #6
0
        static void ApplyCloudFormationChangeSetExample()
        {
            string bucket_Name  = QSS3BucketName;
            string templateName = QSS3KeyPrefix + TdwUtils.cfClassPathBastionChangeSet.Replace("tdw_cf_template\\", "");
            string stack_name   = QSS3KeyPrefix + TdwUtils.cfClassPathBastion.Replace("tdw_cf_template\\", "");

            stack_name = stack_name.Replace("-", "");
            stack_name = stack_name.Replace(".template", "");
            AmazonS3Client s3Client = new AmazonS3Client();

            Amazon.CloudFormation.AmazonCloudFormationClient cfClient = new AmazonCloudFormationClient();

            GetObjectRequest getObjectRequest = new GetObjectRequest
            {
                BucketName = bucket_Name,
                Key        = templateName,
            };

            string data = null;

            using (GetObjectResponse getObjectResponse = s3Client.GetObject(getObjectRequest))
            {
                using (var stream = getObjectResponse.ResponseStream)
                    using (var reader = new StreamReader(stream))
                    {
                        data = reader.ReadToEnd();
                    }
            }

            List <string> CfCapabilities = new List <string>();

            CfCapabilities.Add("CAPABILITY_IAM");

            List <Amazon.CloudFormation.Model.Parameter> parameters = new List <Amazon.CloudFormation.Model.Parameter>();

            parameters.Add(new Parameter
            {
                ParameterKey   = "pEnvTag",
                ParameterValue = "development"
            });

            List <string> notificationArns = new List <string>();

            notificationArns.Add("aws:sns:eu-west-1:009837347446:tdwcftdevmainbastion-LoggingTemplate-1E3KD8XDHOSTY-rSecurityAlarmTopic-1TNN0GI7819UM");

            List <string> resourceTypes = new List <string>();

            resourceTypes.Add("AWS::*");

            List <Amazon.CloudFormation.Model.Tag> tagList = new List <Amazon.CloudFormation.Model.Tag>();

            tagList.Add(new Amazon.CloudFormation.Model.Tag()
            {
                Key = "environment", Value = "development"
            });

            CreateChangeSetRequest cfReq = new CreateChangeSetRequest()
            {
                Capabilities  = CfCapabilities,
                ChangeSetName = "tdwv010001",
                ChangeSetType = ChangeSetType.UPDATE,
                ClientToken   = "fromappsettingsv010001",
                Description   = "Adding kinesis template to tdw stack and parameterizing env parameter",
                //NotificationARNs = notificationArns,
                Parameters = parameters,
                //ResourceTypes = resourceTypes,
                //RoleARN
                StackName    = stack_name,
                Tags         = tagList,
                TemplateBody = data
                               //UsePreviousTemplate = true
            };

            CreateChangeSetResponse cfResp = cfClient.CreateChangeSet(cfReq);
        }