public WorkloadDefinition( WorkloadDefinitionId id, bool isAbstract, string?description, WorkloadDefinitionKind kind, List <WorkloadDefinitionId>?extends, List <WorkloadPackId>?packs, List <string>?platforms) { Id = id; IsAbstract = isAbstract; Description = description; Kind = kind; Extends = extends; Packs = packs; Platforms = platforms; }
public IEnumerable <string> GetPacksInWorkload(string workloadId) { if (string.IsNullOrEmpty(workloadId)) { throw new ArgumentException($"'{nameof(workloadId)}' cannot be null or empty", nameof(workloadId)); } var id = new WorkloadDefinitionId(workloadId); if (!_workloads.TryGetValue(id, out var workload)) { throw new Exception($"Workload not found: {id}. Known workloads: {string.Join(" ", _workloads.Select(workload => workload.Key.ToString()))}"); } if (workload.Extends?.Count > 0) { return(GetPacksInWorkload(workload).Select(p => p.ToString())); } #nullable disable return(workload.Packs.Select(p => p.ToString()) ?? Enumerable.Empty <string>());