public GetServersResult GetServers(GetServersRequest request) { using (var context = new DataAccessContext()) { List <Device> devices; if (!String.IsNullOrEmpty(request.Name)) { var device = context.GetDeviceBroker().GetDeviceByName(request.Name); devices = new List <Device> (); if (device != null) { devices.Add(device); } } else if (!String.IsNullOrEmpty(request.AETitle)) { devices = context.GetDeviceBroker().GetDevicesByAETitle(request.AETitle); } else { devices = context.GetDeviceBroker().GetDevices(); } var converted = devices.Select(d => d.ToDataContract()).ToList(); return(new GetServersResult { ServerEntries = converted }); } }
/// <summary> /// The GetServers API returns a list of all servers in your server catalog. For this /// call to succeed, you must previously have called ImportServerCatalog. /// </summary> /// <param name="request">Container for the necessary parameters to execute the GetServers service method.</param> /// /// <returns>The response from the GetServers service method, as returned by ServerMigrationService.</returns> /// <exception cref="Amazon.ServerMigrationService.Model.UnauthorizedOperationException"> /// This user does not have permissions to perform this operation. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/sms-2016-10-24/GetServers">REST API Reference for GetServers Operation</seealso> public virtual GetServersResponse GetServers(GetServersRequest request) { var marshaller = new GetServersRequestMarshaller(); var unmarshaller = GetServersResponseUnmarshaller.Instance; return(Invoke <GetServersRequest, GetServersResponse>(request, marshaller, unmarshaller)); }
public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems) { AmazonServerMigrationServiceConfig config = new AmazonServerMigrationServiceConfig(); config.RegionEndpoint = region; ConfigureClient(config); AmazonServerMigrationServiceClient client = new AmazonServerMigrationServiceClient(creds, config); GetServersResponse resp = new GetServersResponse(); do { GetServersRequest req = new GetServersRequest { NextToken = resp.NextToken , MaxResults = maxItems }; resp = client.GetServers(req); CheckError(resp.HttpStatusCode, "200"); foreach (var obj in resp.ServerList) { AddObject(obj); } }while (!string.IsNullOrEmpty(resp.NextToken)); }
public GetServersResult GetServers(GetServersRequest request) { var result = new GetServersResult { ServerEntries = new List <ServerDirectoryEntry>() }; if (!string.IsNullOrEmpty(request.AETitle)) { var entry = this.FindLocalPartition(request.AETitle); if (entry != null) { result.ServerEntries.Add(entry); } else { var device = FindServer(request.AETitle); if (device != null) { result.ServerEntries.Add(FromDeviceToServerDirectoryEntry(device)); } } } return(result); }
/// <summary> /// Initiates the asynchronous execution of the GetServers operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the GetServers operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/sms-2016-10-24/GetServers">REST API Reference for GetServers Operation</seealso> public virtual Task <GetServersResponse> GetServersAsync(GetServersRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new GetServersRequestMarshaller(); var unmarshaller = GetServersResponseUnmarshaller.Instance; return(InvokeAsync <GetServersRequest, GetServersResponse>(request, marshaller, unmarshaller, cancellationToken)); }
public GetServersResult GetServers(GetServersRequest request) { IEnumerable<ServerDirectoryEntry> entries = Entries; if (!String.IsNullOrEmpty(request.Name)) entries = entries.Where(e => e.Server.Name == request.Name); else if (!String.IsNullOrEmpty(request.AETitle)) entries = entries.Where(e => e.Server.AETitle == request.AETitle); return new GetServersResult { ServerEntries = entries.ToList() }; }
public GetServersResult GetServers(GetServersRequest request) { IEnumerable <ServerDirectoryEntry> entries = Entries; if (!String.IsNullOrEmpty(request.Name)) { entries = entries.Where(e => e.Server.Name == request.Name); } else if (!String.IsNullOrEmpty(request.AETitle)) { entries = entries.Where(e => e.Server.AETitle == request.AETitle); } return(new GetServersResult { ServerEntries = entries.ToList() }); }
public GetServersResponse GetServers(GetServersRequest request) { var response = new GetServersResponse(); response.ServerInfoList = new List <ServerInfo>(); //var list = _hbArchiveItems.Where(w => w.ApplicationName == request.ServiceName || request.AllServers).GroupBy(x => x.ClientMachine).Select(group => new { ServerName = group.Key, Items = group.ToList() }).ToList(); var deneme = _allInfo.Where(w => w.ApplicationName == request.ServiceName || request.AllServers) .GroupBy(g => g.ServerName) .Select(group => new { ServerName = group.Key, Items = group.ToList() }) .ToList(); foreach (var item in deneme) { var serviceInfo = item.Items.OrderByDescending(x => x.LastHeartBeatDate).FirstOrDefault(); if (serviceInfo != null) { response.ServerInfoList.Add(new ServerInfo() { ServerName = item.ServerName, LastHb = serviceInfo.LastHeartBeatDate }); } } //var deneme = list.Join(_allInfo, hbArchiveItem => hbArchiveItem.ServerName, // allService => allService.ServerName, // (hbArchiveItem, allService) => new { HbArchiveItem = hbArchiveItem, ServiceInfo = allService }); //foreach (var hbArchiveItem in list) //{ // response.ServerInfoList.Add(new ServerInfo() // { // ServerName = hbArchiveItem.ClientMachine, // LastHb = // }); //} return(response); }
public GetServersResult GetServers(GetServersRequest request) { var result = new GetServersResult { ServerEntries = new List<ServerDirectoryEntry>() }; if (!string.IsNullOrEmpty(request.AETitle)) { var entry = this.FindLocalPartition(request.AETitle); if (entry != null) result.ServerEntries.Add(entry); else { var device = FindServer(request.AETitle); if (device != null) result.ServerEntries.Add(FromDeviceToServerDirectoryEntry(device)); } } return result; }
public GetServersResult GetServers(GetServersRequest request) { return(Call(_real.GetServers, request)); }
public GetServersResponse GetServers(GetServersRequest request) { return(_hbArchiveProcessor.GetServers(request)); }
public abstract GetServersResult GetServers(GetServersRequest request);