private async Task <bool> ExecuteAsync() { using (var client = new GrafanaClient(Host, AccessToken)) { var deploy = new DeployImporter( grafanaClient: client, sourceTagValue: Tag, dashboardDirectory: DashboardDirectory, datasourceDirectory: DataSourceDirectory, notificationDirectory: NotificationDirectory, environments: Environments.Select(e => e.ItemSpec).ToArray(), parametersFilePath: ParametersFile, environment: Environment, log: Log); try { await deploy.ImportFromGrafana(DashboardId); } catch (HttpRequestException e) { Log.LogErrorFromException(e, showStackTrace: false, showDetail: false, file: "MonitoringImport"); return(false); } } return(true); }
public object DeepCopy() { var newTable = (CmapSubtable)MemberwiseClone(); newTable.CharGlyphIdMap = CharGlyphIdMap.ToDictionary(pair => pair.Key, pair => pair.Value); newTable.Environments = Environments.Select(environment => (Environment)environment.DeepCopy()).ToList(); return(newTable); }
public IEnumerable <SystemModel> SplitModel() { return(Environments.Select(e => new SystemModel(Enumerable.Empty <Lifecycle>(), Enumerable.Empty <ProjectGroup>(), Enumerable.Empty <LibraryVariableSet>(), Enumerable.Empty <Project>(), Enumerable.Repeat(e, 1), Enumerable.Empty <UserRole>(), Enumerable.Empty <Team>())) .Concat(ProjectGroups.Select(grp => new SystemModel(Enumerable.Empty <Lifecycle>(), Enumerable.Repeat(grp, 1), Enumerable.Empty <LibraryVariableSet>(), Enumerable.Empty <Project>(), Enumerable.Empty <Environment>(), Enumerable.Empty <UserRole>(), Enumerable.Empty <Team>())) .Concat(Projects.Select(prj => new SystemModel(Enumerable.Empty <Lifecycle>(), Enumerable.Empty <ProjectGroup>(), Enumerable.Empty <LibraryVariableSet>(), Enumerable.Repeat(prj, 1), Enumerable.Empty <Environment>(), Enumerable.Empty <UserRole>(), Enumerable.Empty <Team>()))) .Concat(Lifecycles.Select(lf => new SystemModel(Enumerable.Repeat(lf, 1), Enumerable.Empty <ProjectGroup>(), Enumerable.Empty <LibraryVariableSet>(), Enumerable.Empty <Project>(), Enumerable.Empty <Environment>(), Enumerable.Empty <UserRole>(), Enumerable.Empty <Team>()))) .Concat(LibraryVariableSets.Select(lvs => new SystemModel(Enumerable.Empty <Lifecycle>(), Enumerable.Empty <ProjectGroup>(), Enumerable.Repeat(lvs, 1), Enumerable.Empty <Project>(), Enumerable.Empty <Environment>(), Enumerable.Empty <UserRole>(), Enumerable.Empty <Team>()))) .Concat(UserRoles.Select(ur => new SystemModel(Enumerable.Empty <Lifecycle>(), Enumerable.Empty <ProjectGroup>(), Enumerable.Empty <LibraryVariableSet>(), Enumerable.Empty <Project>(), Enumerable.Empty <Environment>(), Enumerable.Repeat(ur, 1), Enumerable.Empty <Team>()))) .Concat(Teams.Select(t => new SystemModel(Enumerable.Empty <Lifecycle>(), Enumerable.Empty <ProjectGroup>(), Enumerable.Empty <LibraryVariableSet>(), Enumerable.Empty <Project>(), Enumerable.Empty <Environment>(), Enumerable.Empty <UserRole>(), Enumerable.Repeat(t, 1)))))); }
private void PreCompute() { var factors = Environments.Select(e => new BigUInt((BigInteger)(e.parameters.PlainModulus.Value))); var uIntBigFactor = factors.Aggregate((n1, n2) => n1 * n2); bigFactor = (BigInteger)uIntBigFactor.ToBigInteger(); var minors = factors.Select(p => uIntBigFactor / p).ToList(); var t = new BigUInt(); BigUInt[] ys = minors.Zip(factors, (m, p) => Reminder(m, p, t).ModuloInvert(p)).ToArray(); t.Dispose(); preComputedCoefficients = ys.Zip(minors, (y, m) => y * m).Select(v => (BigInteger)v.ToBigInteger()).ToArray(); foreach (var y in ys) { t.Dispose(); } }
/// <inheritdoc /> protected override async Task <int> OnExecute(CommandLineApplication app) { if (!CheckParameters()) { return(1); } var json = GetInput(); if (!ValidateInput(json, out var export)) { Output.WriteError("input failed to validate"); return(1); } var sourceEnvironment = GetExportedEnvironment(export); if (sourceEnvironment is null) { Output.WriteError("no usable Exported Environment could be found"); return(1); } var targetEnvironments = await GetEnvironmentKeys(Environments.Select(e => { var split = e.Split('/'); return(new EnvironmentIdentifier(split[0], split[1])); })); if (targetEnvironments is null) { Output.WriteError("target environments could not be retrieved for comparison"); return(1); } var comparisons = CompareEnvironments(sourceEnvironment, targetEnvironments); if (comparisons is null || !comparisons.Any()) { Output.WriteError("environments could not be compared"); return(1); } return(await WriteResult(comparisons)); }
public override string Print() { var builder = new StringBuilder(); Comments.AppendComments(builder); builder.AppendLine($"scenario {Name}"); builder.AppendLine("{"); Deployment.Comments?.AppendComments(builder); builder.AppendLine($"{Constants.TabulationSymbol}deployment {Deployment.Print(PrintParameters.NameOnly)};"); var environments = string.Join(", ", Environments.Select(env => env.Print())); builder.AppendLine($"{Constants.TabulationSymbol}environments {environments};"); if (Actions.Count > 1) { builder.AppendLine($"{Constants.TabulationSymbol}sequence"); builder.AppendLine($"{Constants.TabulationSymbol}{{"); foreach (var baseActionModel in Actions) { builder.AppendLine($"{Constants.TabulationSymbol}{Constants.TabulationSymbol}{baseActionModel.Print()}"); } builder.AppendLine($"{Constants.TabulationSymbol}}}"); } else { builder.AppendLine($"{Constants.TabulationSymbol}{Actions.First().Print()}"); } foreach (var definition in Definitions) { builder.AppendLine($"{Constants.TabulationSymbol}{definition.Print()};"); } builder.Append("}"); return(builder.ToString()); }
public IEnumerable <string> GetEnvironmentNames() { return(Environments.Select(e => e.Name)); }
public override Step[] Step(int action) { return(Environments.Select(e => e.Step(action)).ToArray()); }
public override NDArray[] Reset() { return(Environments.Select(e => e.Reset()).ToArray()); }