public async Task WaitDeployment(StartDeploymentResponse deploymentResult)
        {
            while (true)
            {
                var actualDeployment = await _client.GetDeploymentAsync(new GetDeploymentRequest()
                {
                    ApplicationId    = deploymentResult.ApplicationId,
                    EnvironmentId    = deploymentResult.EnvironmentId,
                    DeploymentNumber = deploymentResult.DeploymentNumber
                });

                Console.WriteLine($"Deployment is {actualDeployment.State}");

                if (actualDeployment.State == DeploymentState.COMPLETE)
                {
                    break;
                }

                if (actualDeployment.State == DeploymentState.ROLLED_BACK)
                {
                    throw new Exception("An error occured during deployment, check management console for details.");
                }

                Thread.Sleep(5000);
            }
        }
Exemple #2
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            StartDeploymentResponse response = new StartDeploymentResponse();

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

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("OperationId", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.OperationId = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }
Exemple #3
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            StartDeploymentResponse response = new StartDeploymentResponse();

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

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("ApplicationId", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.ApplicationId = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("CompletedAt", targetDepth))
                {
                    var unmarshaller = DateTimeUnmarshaller.Instance;
                    response.CompletedAt = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("ConfigurationLocationUri", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.ConfigurationLocationUri = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("ConfigurationName", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.ConfigurationName = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("ConfigurationProfileId", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.ConfigurationProfileId = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("ConfigurationVersion", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.ConfigurationVersion = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("DeploymentDurationInMinutes", targetDepth))
                {
                    var unmarshaller = IntUnmarshaller.Instance;
                    response.DeploymentDurationInMinutes = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("DeploymentNumber", targetDepth))
                {
                    var unmarshaller = IntUnmarshaller.Instance;
                    response.DeploymentNumber = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("DeploymentStrategyId", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.DeploymentStrategyId = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("Description", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.Description = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("EnvironmentId", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.EnvironmentId = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("EventLog", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <DeploymentEvent, DeploymentEventUnmarshaller>(DeploymentEventUnmarshaller.Instance);
                    response.EventLog = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("FinalBakeTimeInMinutes", targetDepth))
                {
                    var unmarshaller = IntUnmarshaller.Instance;
                    response.FinalBakeTimeInMinutes = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("GrowthFactor", targetDepth))
                {
                    var unmarshaller = FloatUnmarshaller.Instance;
                    response.GrowthFactor = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("GrowthType", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.GrowthType = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("PercentageComplete", targetDepth))
                {
                    var unmarshaller = FloatUnmarshaller.Instance;
                    response.PercentageComplete = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("StartedAt", targetDepth))
                {
                    var unmarshaller = DateTimeUnmarshaller.Instance;
                    response.StartedAt = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("State", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.State = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }