public override async Task <IEnumerable <string> > GetSuggestionsAsync(IComponentConfiguration config) { using (var client = this.CreateClient(config)) { return(await client.ListStatesAsync().ConfigureAwait(false)); } }
public VectorsCalculator(IComponentConfiguration componentConfiguration, ICameraCalibration calibration, IVectorsFilter filter) { cameraCalibration = calibration; vectorsFilter = filter; configuration = componentConfiguration; }
public async Task <IEnumerable <string> > GetSuggestionsAsync(IComponentConfiguration config) { string ownerName = AH.CoalesceString(config[nameof(GitHubCredentials.OrganizationName)], config[nameof(GitHubCredentials.UserName)]); if (string.IsNullOrEmpty(ownerName)) { return(Enumerable.Empty <string>()); } GitHubClient client; try { client = new GitHubClient(config[nameof(GitHubCredentials.ApiUrl)], config[nameof(GitHubCredentials.UserName)], AH.CreateSecureString(config[nameof(GitHubCredentials.Password)].ToString()), config[nameof(GitHubCredentials.OrganizationName)]); } catch (InvalidOperationException) { return(Enumerable.Empty <string>()); } var orgs = await client.GetOrganizationsAsync(CancellationToken.None).ConfigureAwait(false); var names = from m in orgs let name = m["login"]?.ToString() where !string.IsNullOrEmpty(name) select name; return(names); }
/// <summary> /// Constructs from a type name and component name /// </summary> public ConfiguredComponent(string typeName, string componentName) { this.typeName = typeName; this.requiredConfiguration = new TypeRequiredConfiguration(typeName); this.configuration = new StandardConfiguration(); this.matchedName = componentName; }
public async Task <IEnumerable <string> > GetSuggestionsAsync(IComponentConfiguration config) { var credentialName = config["CredentialName"]; if (string.IsNullOrEmpty(credentialName)) { return(Enumerable.Empty <string>()); } var credentials = ResourceCredentials.Create <GitHubCredentials>(credentialName); string ownerName = AH.CoalesceString(credentials.OrganizationName, credentials.UserName); string repositoryName = AH.CoalesceString(config["RepositoryName"], credentials.RepositoryName); if (string.IsNullOrEmpty(ownerName) || string.IsNullOrEmpty(repositoryName)) { return(Enumerable.Empty <string>()); } var client = new GitHubClient(credentials.ApiUrl, credentials.UserName, credentials.Password, credentials.OrganizationName); var milestones = await client.GetMilestonesAsync(ownerName, repositoryName, "open").ConfigureAwait(false); var titles = from m in milestones let title = m["title"]?.ToString() where !string.IsNullOrEmpty(title) select title; return(new[] { "$ReleaseName", "$ReleaseNumber" }.Concat(titles)); }
public async Task <IEnumerable <string> > GetSuggestionsAsync(IComponentConfiguration config) { var credentialName = config[nameof(IHasCredentials.CredentialName)]; if (string.IsNullOrEmpty(credentialName)) { return(Enumerable.Empty <string>()); } var credentials = ResourceCredentials.Create <GitHubCredentials>(credentialName); string ownerName = AH.CoalesceString(credentials.OrganizationName, credentials.UserName); if (string.IsNullOrEmpty(ownerName)) { return(Enumerable.Empty <string>()); } var client = new GitHubClient(credentials.ApiUrl, credentials.UserName, credentials.Password, credentials.OrganizationName); var orgs = await client.GetOrganizationsAsync(CancellationToken.None).ConfigureAwait(false); var names = from m in orgs let name = m["login"]?.ToString() where !string.IsNullOrEmpty(name) select name; return(names); }
public async Task <IEnumerable <string> > GetSuggestionsAsync(IComponentConfiguration config) { var credentialName = config["CredentialName"]; if (string.IsNullOrEmpty(credentialName)) { return(Enumerable.Empty <string>()); } var credentials = ResourceCredentials.Create <GitHubCredentials>(credentialName); string ownerName = AH.CoalesceString(credentials.OrganizationName, credentials.UserName); if (string.IsNullOrEmpty(ownerName)) { return(Enumerable.Empty <string>()); } var client = new GitHubClient(credentials.ApiUrl, credentials.UserName, credentials.Password, credentials.OrganizationName); var repos = await client.GetRepositoriesAsync().ConfigureAwait(false); var names = from m in repos let name = m["name"]?.ToString() where !string.IsNullOrEmpty(name) select name; return(new[] { "$ApplicationName" }.Concat(names)); }
public Task <IEnumerable <string> > GetSuggestionsAsync(IComponentConfiguration config) { if (!string.IsNullOrEmpty(config[nameof(IisSiteConfiguration.Bindings)])) { return(Empty); } string bindingInfo = config[nameof(IisSiteConfiguration.BindingInformation)]; string protocol = config[nameof(IisSiteConfiguration.BindingProtocol)]; if (string.IsNullOrEmpty(bindingInfo) || string.IsNullOrEmpty(protocol)) { return(Empty); } var info = BindingInfo.FromBindingInformation(bindingInfo, protocol, null, null); if (info == null) { return(Empty); } return(Task.FromResult(Enumerable.Repeat($@"@( %( IPAddress: {info.IpAddress}, Port: {info.Port}, HostName: {info.HostName}, Protocol: {info.Protocol} ) )", 1) )); }
public ComponentManager(IComponentConfiguration configuration, IImageProvider imageProvider, ICameraDevice cameraDevice) { device = cameraDevice; provider = imageProvider; componentConfiguration = configuration; }
public async Task <IEnumerable <string> > GetSuggestionsAsync(IComponentConfiguration config) { var credentialName = config["CredentialName"]; if (string.IsNullOrEmpty(credentialName)) { return(Enumerable.Empty <string>()); } var credentials = ResourceCredentials.Create <GitLabCredentials>(credentialName); string ownerName = AH.CoalesceString(credentials.GroupName, credentials.UserName); string repositoryName = AH.CoalesceString(config["ProjectName"], credentials.ProjectName); if (string.IsNullOrEmpty(ownerName) || string.IsNullOrEmpty(repositoryName)) { return(Enumerable.Empty <string>()); } var client = new GitLabClient(credentials.ApiUrl, credentials.UserName, credentials.Password, credentials.GroupName); var milestones = await client.GetMilestonesAsync(repositoryName, "open", CancellationToken.None).ConfigureAwait(false); var titles = from m in milestones let title = m["title"]?.ToString() where !string.IsNullOrEmpty(title) select title; if (SDK.ProductName == "BuildMaster") { titles = new[] { "$ReleaseName", "$ReleaseNumber" }.Concat(titles); } return(titles); }
public async Task <IEnumerable <string> > GetSuggestionsAsync(IComponentConfiguration config) { var credentialName = config["CredentialName"]; var jobName = config["JobName"]; if (string.IsNullOrEmpty(credentialName) || string.IsNullOrEmpty(jobName)) { return(Enumerable.Empty <string>()); } var branchName = config["BranchName"]; int?projectId = AH.ParseInt(AH.CoalesceString(config["ProjectId"], config["ApplicationId"])); int?environmentId = AH.ParseInt(config["EnvironmentId"]); var credentials = (JenkinsLegacyCredentials)ResourceCredentials.TryCreate(JenkinsLegacyCredentials.TypeName, credentialName, environmentId: environmentId, applicationId: projectId, inheritFromParent: false); if (credentials == null) { return(Enumerable.Empty <string>()); } using (var cts = new CancellationTokenSource(new TimeSpan(0, 0, 30))) { var client = this.CreateClient(config, cts.Token); return(await client.GetBuildNumbersAsync(jobName, branchName).ConfigureAwait(false)); } }
public async Task <IEnumerable <string> > GetSuggestionsAsync(IComponentConfiguration config) { var credentialName = config["CredentialName"]; if (string.IsNullOrEmpty(credentialName)) { return(Enumerable.Empty <string>()); } var projectName = config["ProjectName"]; if (string.IsNullOrEmpty(projectName)) { return(Enumerable.Empty <string>()); } var buildConfigurationName = config["BuildConfigurationName"]; if (string.IsNullOrEmpty(projectName)) { return(Enumerable.Empty <string>()); } var credentials = ResourceCredentials.Create <TeamCityCredentials>(credentialName); using (var client = new TeamCityWebClient(credentials)) { return(await client.GetBuildNumbersAsync(projectName, buildConfigurationName).ConfigureAwait(false)); } }
public async Task <IEnumerable <string> > GetSuggestionsAsync(IComponentConfiguration config) { var credentialName = config["CredentialName"]; var projectName = AH.CoalesceString(config["TeamProject"], config["TeamProjectName"]); var definitionName = config["BuildDefinition"]; if (string.IsNullOrEmpty(credentialName) || string.IsNullOrEmpty(projectName) || string.IsNullOrEmpty(definitionName)) { return(Enumerable.Empty <string>()); } var credentials = ResourceCredentials.Create <TfsCredentials>(credentialName); var api = new TfsRestApi(credentials, null); var definition = await api.GetBuildDefinitionAsync(projectName, definitionName).ConfigureAwait(false); if (definition == null) { return(Enumerable.Empty <string>()); } var builds = await api.GetBuildsAsync(projectName, definition.id).ConfigureAwait(false); return(builds.Select(b => b.buildNumber)); }
public async Task <IEnumerable <string> > GetSuggestionsAsync(IComponentConfiguration config) { var credentialName = config["CredentialName"]; if (string.IsNullOrEmpty(credentialName)) { return(Enumerable.Empty <string>()); } var productCredentials = ResourceCredentials.TryCreate <InedoProductCredentials>(credentialName); if (productCredentials != null) { var url = new Uri(productCredentials.Host, UriKind.Absolute).GetLeftPart(UriPartial.Authority); var c = new ProGetClient(url, null, "api", AH.Unprotect(productCredentials.ApiKey)); return(await c.GetFeedNamesAsync().ConfigureAwait(false)); } #pragma warning disable CS0618 // Type or member is obsolete var credentials = ResourceCredentials.Create <ProGetCredentials>(credentialName); #pragma warning restore CS0618 // Type or member is obsolete string baseUrl = new Uri(credentials.Url, UriKind.Absolute).GetLeftPart(UriPartial.Authority); var client = new ProGetClient(baseUrl, null, credentials.UserName, AH.Unprotect(credentials.Password)); return(await client.GetFeedNamesAsync().ConfigureAwait(false)); }
public async Task <IEnumerable <string> > GetSuggestionsAsync(IComponentConfiguration config) { var credentialName = config["CredentialName"]; if (string.IsNullOrEmpty(credentialName)) { return(Enumerable.Empty <string>()); } var credentials = ResourceCredentials.Create <GitLabCredentials>(credentialName); string ownerName = AH.CoalesceString(credentials.GroupName, credentials.UserName); if (string.IsNullOrEmpty(ownerName)) { return(Enumerable.Empty <string>()); } var client = new GitLabClient(credentials.ApiUrl, credentials.UserName, credentials.Password, credentials.GroupName); var repos = await client.GetProjectsAsync(CancellationToken.None).ConfigureAwait(false); var names = from m in repos let name = m["path_with_namespace"]?.ToString() where !string.IsNullOrEmpty(name) select name; if (SDK.ProductName == "BuildMaster") { names = new[] { $"{ownerName}/$ApplicationName" }.Concat(names); } return(names); }
public async Task <IEnumerable <string> > GetSuggestionsAsync(IComponentConfiguration config) { var credentialName = config["CredentialName"]; if (string.IsNullOrEmpty(credentialName)) { return(Enumerable.Empty <string>()); } var credentials = GitLabCredentials.TryCreate(credentialName, config); if (credentials == null) { return(Enumerable.Empty <string>()); } string ownerName = AH.CoalesceString(credentials.GroupName, credentials.UserName); if (string.IsNullOrEmpty(ownerName)) { return(Enumerable.Empty <string>()); } var client = new GitLabClient(credentials.ApiUrl, credentials.UserName, credentials.Password, credentials.GroupName); var groups = await client.GetGroupsAsync(CancellationToken.None).ConfigureAwait(false); var names = from m in groups let name = m["full_path"]?.ToString() where !string.IsNullOrEmpty(name) orderby name select name; return(names); }
internal static GitLabCredentials TryCreate(string name, IComponentConfiguration config) { int?projectId = (config.EditorContext as IOperationEditorContext)?.ProjectId ?? AH.ParseInt(AH.CoalesceString(config["ProjectId"], config["ApplicationId"])); int?environmentId = AH.ParseInt(config["EnvironmentId"]); return((GitLabCredentials)ResourceCredentials.TryCreate(GitLabCredentials.TypeName, name, environmentId: environmentId, applicationId: projectId, inheritFromParent: false)); }
public async Task <IEnumerable <string> > GetSuggestionsAsync(IComponentConfiguration config) { var credentialName = config["CredentialName"]; var feedName = config["FeedName"]; if (string.IsNullOrEmpty(credentialName) || string.IsNullOrEmpty(feedName)) { return(Enumerable.Empty <string>()); } ProGetClient client = null; var productCredentials = ResourceCredentials.TryCreate <InedoProductCredentials>(credentialName); if (productCredentials != null) { client = new ProGetClient(productCredentials.Host, feedName, "api", AH.Unprotect(productCredentials.ApiKey)); } if (client == null) { #pragma warning disable CS0618 // Type or member is obsolete var credentials = ResourceCredentials.Create <ProGetCredentials>(credentialName); #pragma warning restore CS0618 // Type or member is obsolete client = new ProGetClient(credentials.Url, feedName, credentials.UserName, AH.Unprotect(credentials.Password)); } var packages = await client.GetPackagesAsync().ConfigureAwait(false); return(from p in packages let name = new PackageName(p.@group, p.name) orderby name.Group, name.Name select name.ToString()); }
public async Task <IEnumerable <string> > GetSuggestionsAsync(IComponentConfiguration config) { var credentialName = config["CredentialName"]; var jobName = config["JobName"]; if (string.IsNullOrEmpty(credentialName) || string.IsNullOrEmpty(jobName)) { return(Enumerable.Empty <string>()); } var branchName = config["BranchName"]; string buildNumber = AH.CoalesceString(config["BuildNumber"], "lastSuccessfulBuild"); int?projectId = AH.ParseInt(AH.CoalesceString(config["ProjectId"], config["ApplicationId"])); int?environmentId = AH.ParseInt(config["EnvironmentId"]); var credentials = (JenkinsLegacyCredentials)ResourceCredentials.TryCreate(JenkinsLegacyCredentials.TypeName, credentialName, environmentId: environmentId, applicationId: projectId, inheritFromParent: false); if (credentials == null) { return(Enumerable.Empty <string>()); } using (var cts = new CancellationTokenSource(new TimeSpan(0, 0, 30))) { var client = new JenkinsClient(credentials.UserName, credentials.Password, credentials.ServerUrl, false, null, cts.Token); return((await client.GetBuildArtifactsAsync(jobName, branchName, buildNumber)) .Select(a => a.RelativePath) .ToList()); } }
public async Task <IEnumerable <string> > GetSuggestionsAsync(IComponentConfiguration config) { var credentialName = config["CredentialName"]; var feedName = config["FeedName"]; var packageName = config["PackageName"]; if (string.IsNullOrEmpty(credentialName) || string.IsNullOrEmpty(feedName) || string.IsNullOrEmpty(packageName)) { return(Enumerable.Empty <string>()); } ProGetClient client = null; var productCredentials = ResourceCredentials.TryCreate <InedoProductCredentials>(credentialName); if (productCredentials != null) { client = new ProGetClient(productCredentials.Host, feedName, "api", AH.Unprotect(productCredentials.ApiKey)); } #pragma warning disable CS0618 // Type or member is obsolete var credentials = ResourceCredentials.Create <ProGetCredentials>(credentialName); #pragma warning restore CS0618 // Type or member is obsolete if (client == null) { client = new ProGetClient(credentials.Url, feedName, credentials.UserName, AH.Unprotect(credentials.Password)); } var package = await client.GetPackageInfoAsync(PackageName.Parse(packageName)); return(new[] { "latest", "latest-stable" }.Concat(package.versions)); }
public Task <IEnumerable <string> > GetSuggestionsAsync(IComponentConfiguration config) { return(Task.FromResult(new[] { "checksumFiles", "autoUninstaller", "allowGlobalConfirmation", "failOnAutoUninstaller", "failOnStandardError", "powershellHost", "logEnvironmentValues", "virusCheck", "failOnInvalidOrMissingLicense", "ignoreInvalidOptionsSwitches", "usePackageExitCodes", "useFipsCompliantChecksums", "allowEmptyChecksums", "allowEmptyChecksumsSecure", "scriptsCheckLastExitCode", "showNonElevatedWarnings", "showDownloadProgress", "stopOnFirstPackageFailure", "useRememberedArgumentsForUpgrades", "ignoreUnfoundPackagesOnUpgradeOutdated", "removePackageInformationOnUninstall", "logWithoutColor" }.Where(f => f.ToLowerInvariant().Contains(config["Feature"].ToString().ToLowerInvariant())))); }
public Calibration(IComponentConfiguration componentConfiguration, IChessboardCornersDetector cornersDetector, IStereoCalibration stereoCalibration) { stereo = stereoCalibration; detector = cornersDetector; configuration = componentConfiguration; configuration.CalibrationStatusChanged += OnCalibrationStatusChanged; }
public CameraMovementDetector(ICameraImageConverter imageConverter, IChessboardCornersDetector detector, IVectorsCalculator calculator, IComponentConfiguration componentConfiguration) { converter = imageConverter; vectorsCalculator = calculator; cornersDetector = detector; configuration = componentConfiguration; }
public async Task <IEnumerable <string> > GetSuggestionsAsync(IComponentConfiguration config) { string name = typeof(OtterCredentials).GetCustomAttribute <ScriptAliasAttribute>()?.Alias; var credentials = from c in (await new DB.Context(false).Credentials_GetCredentialsAsync().ConfigureAwait(false)) where name == null || c.CredentialType_Name == name select c.Credential_Name; return(credentials); }
public Task <IEnumerable <string> > GetSuggestionsAsync(IComponentConfiguration config) { var result = SDK.GetPackageSources() .Where(s => s.PackageType == AttachedPackageType.NuGet) .OrderBy(s => s.Name) .Select(s => s.Name); return(Task.FromResult(result)); }
public CameraDevice(IComponentConfiguration componentConfiguration, IImageProvider imageProvider, ICameraImageConverter cameraImageConverter) { converter = cameraImageConverter; provider = imageProvider; configuration = componentConfiguration; configuration.CameraIndexChanged += OnCameraIndexChanged; configuration.RunningChanged += OnRunningChanged; }
public StereoImaging(IDisparitySolver disparitySolver, ICalibration cameraCalibration, ICameraImageConverter cameraImageConverter, IComponentConfiguration componentConfiguration) { calibration = cameraCalibration; disparity = disparitySolver; converter = cameraImageConverter; configuration = componentConfiguration; NewDisparityMap += OnNewDisparityMap; }
public object InstantiateComponent(Type type, IComponentConfiguration configuration) { if (!_builders.ContainsKey(type)) { return(null); } IConfigurableComponentBuilder builder = _builders[type].First(b => b.CanBuild(configuration)); return(builder.Build(configuration, _serviceProvider)); }
public Task <IEnumerable <string> > GetSuggestionsAsync(IComponentConfiguration config) { var credentials = ResourceCredentials.Create <ArtifactoryCredentials>(config[nameof(IHasCredentials <ArtifactoryCredentials> .CredentialName)]); var baseUrl = AH.CoalesceString(config[nameof(ArtifactoryCredentials.BaseUrl)], credentials?.BaseUrl); var userName = AH.CoalesceString(config[nameof(ArtifactoryCredentials.UserName)], credentials?.UserName); var password = CoalescePassword(config[nameof(ArtifactoryCredentials.Password)], credentials?.Password); return(GetSuggestionsAsync(new ArtifactoryCredentials { BaseUrl = baseUrl, UserName = userName, Password = password }, config)); }
public Task <IEnumerable <string> > GetSuggestionsAsync(IComponentConfiguration config) { // The most common Linux signals used to terminate processes. return(Task.FromResult <IEnumerable <string> >(new[] { "SIGKILL", "SIGTERM", "SIGINT", "SIGHUP", "SIGQUIT" })); }
public HarrisDetector(IComponentConfiguration componentConfiguration, IImageFactory factory, IImageConverter imageConverter, ICameraImageConverter cameraImageConverter) { cameraConverter = cameraImageConverter; converter = imageConverter; imageFactory = factory; configuration = componentConfiguration; UpdateDetector(); configuration.ConfigurationChanged += OnConfigurationChanged; }
public Task <IEnumerable <string> > GetSuggestionsAsync(IComponentConfiguration config) { return(Task.FromResult(getItems())); IEnumerable <string> getItems() { return(SDK.GetRaftItems(RaftItemType.Script, config.EditorContext) .Where(i => i.Name.EndsWith(".sh", StringComparison.OrdinalIgnoreCase)) .OrderBy(i => i.Name) .Select(i => i.Name) .ToList()); } }
protected YouTrackClient CreateClient(IComponentConfiguration config) { var credentials = ResourceCredentials.Create <YouTrackCredentials>(config[nameof(IHasCredentials <YouTrackCredentials> .CredentialName)]); return(new YouTrackClient( new YouTrackCredentials { ServerUrl = AH.CoalesceString(config[nameof(YouTrackOperationBase.ServerUrl)], credentials?.ServerUrl), UserName = AH.CoalesceString(config[nameof(YouTrackOperationBase.UserName)], credentials?.UserName), Password = AH.CreateSecureString(AH.CoalesceString(config[nameof(YouTrackOperationBase.Password)], AH.Unprotect(credentials?.Password))), PermanentToken = AH.CreateSecureString(AH.CoalesceString(config[nameof(YouTrackOperationBase.PermanentToken)], AH.Unprotect(credentials?.PermanentToken))), } )); }
public async Task <IEnumerable <string> > GetSuggestionsAsync(IComponentConfiguration config) { var credentialName = config["CredentialName"]; if (string.IsNullOrEmpty(credentialName)) { return(Enumerable.Empty <string>()); } var credentials = ResourceCredentials.Create <ProGetCredentials>(credentialName); string baseUrl = new Uri(credentials.Url, UriKind.Absolute).GetLeftPart(UriPartial.Authority); var client = new ProGetClient(baseUrl, null, credentials.UserName, ConvertValue(credentials.Password)); return(await client.GetFeedNamesAsync().ConfigureAwait(false)); }
public async Task <IEnumerable <string> > GetSuggestionsAsync(IComponentConfiguration config) { var credentialName = config["CredentialName"]; if (string.IsNullOrEmpty(credentialName)) { return(Enumerable.Empty <string>()); } var credentials = ResourceCredentials.Create <JenkinsCredentials>(credentialName); var client = new JenkinsClient(credentials); var jobs = await client.GetJobNamesAsync().ConfigureAwait(false); return(jobs); }
public async Task <IEnumerable <string> > GetSuggestionsAsync(IComponentConfiguration config) { string credentialName = config["CredentialName"]; if (string.IsNullOrEmpty(credentialName)) { return(Enumerable.Empty <string>()); } var credentials = ResourceCredentials.Create <InedoProductCredentials>(credentialName); var client = OtterClient.Create(credentials.Host, credentials.ApiKey); var roles = await client.EnumerateInfrastructureAsync(InfrastructureEntity.Role).ConfigureAwait(false); return(roles); }
public async Task <IEnumerable <string> > GetSuggestionsAsync(IComponentConfiguration config) { string credentialName = config["CredentialName"]; if (string.IsNullOrEmpty(credentialName)) { return(Enumerable.Empty <string>()); } var credentials = ResourceCredentials.Create <OtterCredentials>(credentialName); var client = new OtterClient(credentials.Host, credentials.ApiKey); var servers = await client.EnumerateInfrastructureAsync(InfrastructureEntity.Environment).ConfigureAwait(false); return(servers); }
public ComponentManager(IHarrisDetector features, IComponentConfiguration configuration) { componentConfiguration = configuration; detector = features; }