Exemple #1
0
        public override void ExecuteCmdlet()
        {
            base.ExecuteCmdlet();

            InvokeInDeploymentOperationContext(() =>
            {
                List <DeployResult> deployments = DeploymentChannel.GetDeployments(MaxResults ?? DefaultMaxResults);

                if (CommitId != null)
                {
                    DeployResult deployment = deployments.FirstOrDefault(d => d.Id.Equals(CommitId));
                    if (deployment == null)
                    {
                        throw new Exception(string.Format(Resources.InvalidDeployment, CommitId));
                    }

                    if (Details)
                    {
                        SetDetails(deployment);
                    }

                    deployments.Add(deployment);
                }
                else if (Details)
                {
                    foreach (DeployResult deployResult in deployments)
                    {
                        SetDetails(deployResult);
                    }
                }

                WriteObject(deployments, true);
            });
        }
        public override void ExecuteCmdlet()
        {
            base.ExecuteCmdlet();

            if (!Force.IsPresent &&
                !ShouldProcess("", string.Format(Resources.RedeployCommit, CommitId),
                               Resources.ShouldProcessCaption))
            {
                return;
            }

            InvokeInDeploymentOperationContext(() => DeploymentChannel.Deploy(CommitId));

            // List new deployments
            InvokeInDeploymentOperationContext(() =>
            {
                List <DeployResult> deployments = DeploymentChannel.GetDeployments(GetAzureWebsiteDeploymentCommand.DefaultMaxResults);
                WriteObject(deployments, true);
            });
        }