public void SetDeploymentState(Guid deploymentId, DeploymentState deploymentState)
        {
            Guard.NotEmpty(deploymentId, "deploymentId");
              Guard.NotNull(deploymentState, "deploymentState");

              _deploymentStateByIdDict[deploymentId] = deploymentState;

              List<Guid> deploymentIdsForUserIdentity;

              if (!_deploymentIdsByUserIdentityDict.TryGetValue(deploymentState.UserIdentity, out deploymentIdsForUserIdentity))
              {
            deploymentIdsForUserIdentity = new List<Guid>();
              }

              deploymentIdsForUserIdentity.Add(deploymentId);
        }
Esempio n. 2
0
        public void SetDeploymentState(Guid deploymentId, DeploymentState deploymentState)
        {
            Guard.NotEmpty(deploymentId, "deploymentId");
            Guard.NotNull(deploymentState, "deploymentState");

            _deploymentStateByIdDict[deploymentId] = deploymentState;

            List <Guid> deploymentIdsForUserIdentity;

            if (!_deploymentIdsByUserIdentityDict.TryGetValue(deploymentState.UserIdentity, out deploymentIdsForUserIdentity))
            {
                deploymentIdsForUserIdentity = new List <Guid>();
            }

            deploymentIdsForUserIdentity.Add(deploymentId);
        }
        private Guid SetDeploymentState(string environmentName, string projectConfigurationName, string projectName)
        {
            Guid deploymentId = Guid.NewGuid();

              var deploymentState =
            new DeploymentState(
              deploymentId,
              UserIdentity,
              projectName,
              projectConfigurationName,
              environmentName);

              _deploymentStateProvider.SetDeploymentState(
            deploymentId,
            deploymentState);

              return deploymentId;
        }
Esempio n. 4
0
        private ActionResult DoDeployOrSimulate(bool isSimulation, string projectName, string projectConfigurationName, string projectConfigurationBuildId, string targetEnvironmentName, ProjectType? projectType, List<string> targetMachines = null)
        {
            if (string.IsNullOrEmpty(projectName))
              {
            return BadRequest();
              }

              if (string.IsNullOrEmpty(projectConfigurationName))
              {
            return BadRequest();
              }

              if (string.IsNullOrEmpty(projectConfigurationBuildId))
              {
            return BadRequest();
              }

              if (string.IsNullOrEmpty(targetEnvironmentName))
              {
            return BadRequest();
              }

              if (!projectType.HasValue)
              {
            return BadRequest();
              }

              try
              {
            Guid deploymentId = Guid.NewGuid();

            var projectConfigurationModel = new ProjectConfigurationModel(projectConfigurationName);

            var deploymentState =
              new DeploymentState(
            deploymentId,
            UserIdentity,
            projectName,
            projectConfigurationModel.ConfigurationName,
            targetEnvironmentName);

            _deploymentStateProvider.SetDeploymentState(
              deploymentId,
              deploymentState);

            _agentService.DeployAsync(
              deploymentId,
              _sessionService.UniqueClientId,
              SecurityUtils.CurrentUsername,
              CreateDeploymentInfo(
            deploymentId,
            isSimulation,
            projectName,
            projectConfigurationModel.ConfigurationName,
            projectConfigurationBuildId,
            targetEnvironmentName,
            projectType.Value,
            targetMachines));

            return Json(new { Status = "OK" });
              }
              catch (Exception exc)
              {
            return HandleAjaxError(exc);
              }
        }