public void AddConfigurationManagementService(OrganizationCMS configurationManagementService) { if (this.ConfigurationManagementServices == null) { this.ConfigurationManagementServices = new List <OrganizationCMS>(); } this.ConfigurationManagementServices.Add(configurationManagementService); }
public void DeleteConfigurationManagementService(Guid organizationId, Guid organizationCMSId) { Organization organization = FindOrganizationById(organizationId); if (organization == null) { throw new ApplicationException($"The organization with id {organizationId} does not exists"); } OrganizationCMS organizationCMS = organization.GetConfigurationManagementServiceById(organizationCMSId); if (organizationCMS == null) { throw new ApplicationException($"The organization configuration management service with id {organizationCMSId} does not exists"); } organizationCMS.Delete(this.Id); }
public void UpdateConfigurationManagementService(Guid organizationId, Guid organizationCMSId, string accessId, string accessSecret) { Organization organization = FindOrganizationById(organizationId); if (organization == null) { throw new ApplicationException($"The organization with id {organizationId} does not exists"); } OrganizationCMS organizationCMS = organization.GetConfigurationManagementServiceById(organizationCMSId); if (organizationCMS == null) { throw new ApplicationException($"The organization configuration management service with id {organizationCMSId} does not exists"); } organizationCMS.UpdateCredentials(accessId, accessSecret); organizationCMS.Audit(this.Id); }
public static OrganizationCMS Create(string name, ConfigurationManagementService type, CMSConnectionType connectionType, string accountId, string accountName, string accessId, string accessSecret, string accessToken, string createdBy) { var entity = new OrganizationCMS() { Name = name, Type = type, ConnectionType = connectionType, AccountId = accountId, AccountName = accountName, AccessId = accessId, AccessSecret = accessSecret, AccessToken = accessToken, CreatedBy = createdBy, Status = EntityStatus.Active }; var validationResult = new DataValidatorManager <OrganizationCMS>().Build().Validate(entity); if (!validationResult.IsValid) { throw new ApplicationException(validationResult.Errors); } if ((type == ConfigurationManagementService.VSTS || type == ConfigurationManagementService.Bitbucket) && string.IsNullOrEmpty(accessSecret)) { throw new ApplicationException("Access Secret is required"); } return(entity); }