public BootstrapRequest PutRequest(BootstrapRequest reqItem) { var db = Database.OpenConnection(_cfg.DatabaseConnection); var employee = db.BootstrapRequest.Insert(reqItem); return(reqItem); }
private BootstrapResponse SendBootstrap(bool isInitial = false) { Uri serviceEndpoint; if (!Uri.TryCreate(String.Format(BootstrapURL, SubscriptionId), UriKind.Absolute, out serviceEndpoint)) { throw new BootstrapException(String.Format("Could not parse provided URI: {0}", String.Format(BootstrapURL, SubscriptionId))); } var serviceChannel = new WebChannelFactory <IBootstrapService>(new WebHttpBinding { Security = { Mode = WebHttpSecurityMode.Transport, Transport = { ClientCredentialType = HttpClientCredentialType.Certificate } } }, serviceEndpoint) { Credentials = { ClientCertificate = { Certificate = clientCert } } }; Guid requestId = Guid.NewGuid(); BootstrapRequest request = new BootstrapRequest { InitialBootstrap = isInitial, ConsecutiveFailures = 0, RequestId = requestId, SubscriptionId = SubscriptionId, ConnectorId = ConnectorId, AgentVersion = SDKVersion, AgentSdkVersion = SDKVersion, ProxyDataModelVersion = SDKVersion, BootstrapDataModelVersion = SDKVersion, MachineName = MachineName, OperatingSystemVersion = OSVersion, OperatingSystemSKU = OSSKU, OperatingSystemLanguage = OSLanguage, OperatingSystemLocale = OSLocale, UseSpnegoAuthentication = false, UseServiceBusTcpConnectivityMode = false, IsProxyPortResponseFallbackDisabledFromRegistry = true, CurrentProxyPortResponseMode = "Primary", UpdaterStatus = "Stopped", LatestDotNetVersionInstalled = LastNETVersion, PerformanceMetrics = new ConnectorPerformanceMetrics(new List <AggregatedCpuData>(), 0, 0, 0, 0), }; var bootstrapService = serviceChannel.CreateChannel(); Task <BootstrapResponse> resp = null; BootstrapResponse result = null; for (int i = 0; i < RetryCount; i++) { try { resp = bootstrapService.ConnectorBootstrapAsync(request); result = resp.GetAwaiter().GetResult(); break; } catch (Exception e) { Thread.Sleep(5000); } } return(result); }