public SystemModelBuilder BuildWith(SystemModelBuilder builder) { foreach (var environment in Environments.EnsureNotNull()) { builder.AddEnvironment(environment.ToModel()); } foreach (var projectGroup in ProjectGroups.EnsureNotNull()) { builder.AddProjectGroup(projectGroup.ToModel()); } foreach (var project in Projects.EnsureNotNull()) { builder.AddProject(project.ToModel()); } foreach (var lifecycle in Lifecycles.EnsureNotNull()) { builder.AddLifecycle(lifecycle.ToModel()); } foreach (var libraryVariableSet in LibraryVariableSets.EnsureNotNull()) { builder.AddLibraryVariableSet(libraryVariableSet.ToModel()); } foreach (var userRoles in UserRoles.EnsureNotNull()) { builder.AddUserRole(userRoles.ToModel()); } foreach (var team in Teams.EnsureNotNull()) { builder.AddTeam(team.ToModel()); } foreach (var machinePolicy in MachinePolicies.EnsureNotNull()) { builder.AddMachinePolicy(machinePolicy.ToModel()); } foreach (var tenant in Tenants.EnsureNotNull()) { builder.AddTenant(tenant.ToModel()); } foreach (var tagset in TagSets.EnsureNotNull()) { builder.AddTagSet(tagset.ToModel()); } return(builder); }
public IEnumerable <SystemModel> SplitModel() { return(MachinePolicies.Select(t => new SystemModel(Enumerable.Repeat(t, 1), Enumerable.Empty <Lifecycle>(), Enumerable.Empty <ProjectGroup>(), Enumerable.Empty <LibraryVariableSet>(), Enumerable.Empty <Project>(), Enumerable.Empty <Environment>(), Enumerable.Empty <UserRole>(), Enumerable.Empty <Team>(), Enumerable.Empty <Tenant>(), Enumerable.Empty <TagSet>())) .Concat(Environments.Select(e => new SystemModel(Enumerable.Empty <MachinePolicy>(), Enumerable.Empty <Lifecycle>(), Enumerable.Empty <ProjectGroup>(), Enumerable.Empty <LibraryVariableSet>(), Enumerable.Empty <Project>(), Enumerable.Repeat(e, 1), Enumerable.Empty <UserRole>(), Enumerable.Empty <Team>(), Enumerable.Empty <Tenant>(), Enumerable.Empty <TagSet>()))) .Concat(ProjectGroups.Select(grp => new SystemModel(Enumerable.Empty <MachinePolicy>(), Enumerable.Empty <Lifecycle>(), Enumerable.Repeat(grp, 1), Enumerable.Empty <LibraryVariableSet>(), Enumerable.Empty <Project>(), Enumerable.Empty <Environment>(), Enumerable.Empty <UserRole>(), Enumerable.Empty <Team>(), Enumerable.Empty <Tenant>(), Enumerable.Empty <TagSet>()))) .Concat(Projects.Select(prj => new SystemModel(Enumerable.Empty <MachinePolicy>(), Enumerable.Empty <Lifecycle>(), Enumerable.Empty <ProjectGroup>(), Enumerable.Empty <LibraryVariableSet>(), Enumerable.Repeat(prj, 1), Enumerable.Empty <Environment>(), Enumerable.Empty <UserRole>(), Enumerable.Empty <Team>(), Enumerable.Empty <Tenant>(), Enumerable.Empty <TagSet>()))) .Concat(Lifecycles.Select(lf => new SystemModel(Enumerable.Empty <MachinePolicy>(), Enumerable.Repeat(lf, 1), Enumerable.Empty <ProjectGroup>(), Enumerable.Empty <LibraryVariableSet>(), Enumerable.Empty <Project>(), Enumerable.Empty <Environment>(), Enumerable.Empty <UserRole>(), Enumerable.Empty <Team>(), Enumerable.Empty <Tenant>(), Enumerable.Empty <TagSet>()))) .Concat(LibraryVariableSets.Select(lvs => new SystemModel(Enumerable.Empty <MachinePolicy>(), Enumerable.Empty <Lifecycle>(), Enumerable.Empty <ProjectGroup>(), Enumerable.Repeat(lvs, 1), Enumerable.Empty <Project>(), Enumerable.Empty <Environment>(), Enumerable.Empty <UserRole>(), Enumerable.Empty <Team>(), Enumerable.Empty <Tenant>(), Enumerable.Empty <TagSet>()))) .Concat(UserRoles.Select(ur => new SystemModel(Enumerable.Empty <MachinePolicy>(), Enumerable.Empty <Lifecycle>(), Enumerable.Empty <ProjectGroup>(), Enumerable.Empty <LibraryVariableSet>(), Enumerable.Empty <Project>(), Enumerable.Empty <Environment>(), Enumerable.Repeat(ur, 1), Enumerable.Empty <Team>(), Enumerable.Empty <Tenant>(), Enumerable.Empty <TagSet>()))) .Concat(Teams.Select(t => new SystemModel(Enumerable.Empty <MachinePolicy>(), Enumerable.Empty <Lifecycle>(), Enumerable.Empty <ProjectGroup>(), Enumerable.Empty <LibraryVariableSet>(), Enumerable.Empty <Project>(), Enumerable.Empty <Environment>(), Enumerable.Empty <UserRole>(), Enumerable.Repeat(t, 1), Enumerable.Empty <Tenant>(), Enumerable.Empty <TagSet>()))) .Concat(Tenants.Select(t => new SystemModel(Enumerable.Empty <MachinePolicy>(), Enumerable.Empty <Lifecycle>(), Enumerable.Empty <ProjectGroup>(), Enumerable.Empty <LibraryVariableSet>(), Enumerable.Empty <Project>(), Enumerable.Empty <Environment>(), Enumerable.Empty <UserRole>(), Enumerable.Empty <Team>(), Enumerable.Repeat(t, 1), Enumerable.Empty <TagSet>()))) .Concat(TagSets.Select(t => new SystemModel(Enumerable.Empty <MachinePolicy>(), Enumerable.Empty <Lifecycle>(), Enumerable.Empty <ProjectGroup>(), Enumerable.Empty <LibraryVariableSet>(), Enumerable.Empty <Project>(), Enumerable.Empty <Environment>(), Enumerable.Empty <UserRole>(), Enumerable.Empty <Team>(), Enumerable.Empty <Tenant>(), Enumerable.Repeat(t, 1))))); }