public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems) { AmazonECSConfig config = new AmazonECSConfig(); config.RegionEndpoint = region; ConfigureClient(config); AmazonECSClient client = new AmazonECSClient(creds, config); ListServicesResponse resp = new ListServicesResponse(); do { ListServicesRequest req = new ListServicesRequest { NextToken = resp.NextToken , MaxResults = maxItems }; resp = client.ListServices(req); CheckError(resp.HttpStatusCode, "200"); foreach (var obj in resp.ServiceArns) { AddObject(obj); } }while (!string.IsNullOrEmpty(resp.NextToken)); }
/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { ListServicesResponse response = new ListServicesResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("NextToken", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.NextToken = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("Services", targetDepth)) { var unmarshaller = new ListUnmarshaller <ServiceInfo, ServiceInfoUnmarshaller>(ServiceInfoUnmarshaller.Instance); response.Services = unmarshaller.Unmarshall(context); continue; } } return(response); }
public async Task TestListServices() { // ARRANGE PriceListClient client = new PriceListClient(); // ACT ListServicesResponse services = await client.ListServicesAsync(); // ASSERT Assert.True(!services.IsError()); Assert.True(services.Services.Any()); }
public static ListServicesResponse Unmarshall(UnmarshallerContext _ctx) { ListServicesResponse listServicesResponse = new ListServicesResponse(); listServicesResponse.HttpResponse = _ctx.HttpResponse; listServicesResponse.Code = _ctx.IntegerValue("ListServices.Code"); listServicesResponse.ErrorMsg = _ctx.StringValue("ListServices.ErrorMsg"); listServicesResponse.PageNumber = _ctx.IntegerValue("ListServices.PageNumber"); listServicesResponse.PageSize = _ctx.IntegerValue("ListServices.PageSize"); listServicesResponse.RequestId = _ctx.StringValue("ListServices.RequestId"); listServicesResponse.TotalCount = _ctx.LongValue("ListServices.TotalCount"); listServicesResponse.ClusterIP = _ctx.StringValue("ListServices.ClusterIP"); listServicesResponse.ClusterIP1 = _ctx.StringValue("ListServices.ClusterIP"); List <ListServicesResponse.ListServices_ServiceInstance> listServicesResponse_data = new List <ListServicesResponse.ListServices_ServiceInstance>(); for (int i = 0; i < _ctx.Length("ListServices.Data.Length"); i++) { ListServicesResponse.ListServices_ServiceInstance serviceInstance = new ListServicesResponse.ListServices_ServiceInstance(); serviceInstance.AppId = _ctx.LongValue("ListServices.Data[" + i + "].AppId"); serviceInstance.EnvId = _ctx.LongValue("ListServices.Data[" + i + "].EnvId"); serviceInstance.Headless = _ctx.BooleanValue("ListServices.Data[" + i + "].Headless"); serviceInstance.K8sServiceId = _ctx.StringValue("ListServices.Data[" + i + "].K8sServiceId"); serviceInstance.Name = _ctx.StringValue("ListServices.Data[" + i + "].Name"); serviceInstance.ServiceId = _ctx.LongValue("ListServices.Data[" + i + "].ServiceId"); serviceInstance.ServiceType = _ctx.StringValue("ListServices.Data[" + i + "].ServiceType"); serviceInstance.ClusterIP = _ctx.StringValue("ListServices.Data[" + i + "].ClusterIP"); List <ListServicesResponse.ListServices_ServiceInstance.ListServices_ServicePortMapping> serviceInstance_portMappings = new List <ListServicesResponse.ListServices_ServiceInstance.ListServices_ServicePortMapping>(); for (int j = 0; j < _ctx.Length("ListServices.Data[" + i + "].PortMappings.Length"); j++) { ListServicesResponse.ListServices_ServiceInstance.ListServices_ServicePortMapping servicePortMapping = new ListServicesResponse.ListServices_ServiceInstance.ListServices_ServicePortMapping(); servicePortMapping.Name = _ctx.StringValue("ListServices.Data[" + i + "].PortMappings[" + j + "].Name"); servicePortMapping.NodePort = _ctx.IntegerValue("ListServices.Data[" + i + "].PortMappings[" + j + "].NodePort"); servicePortMapping.Port = _ctx.IntegerValue("ListServices.Data[" + i + "].PortMappings[" + j + "].Port"); servicePortMapping.Protocol = _ctx.StringValue("ListServices.Data[" + i + "].PortMappings[" + j + "].Protocol"); servicePortMapping.TargetPort = _ctx.StringValue("ListServices.Data[" + i + "].PortMappings[" + j + "].TargetPort"); serviceInstance_portMappings.Add(servicePortMapping); } serviceInstance.PortMappings = serviceInstance_portMappings; listServicesResponse_data.Add(serviceInstance); } listServicesResponse.Data = listServicesResponse_data; return(listServicesResponse); }
public static ListServicesResponse Unmarshall(UnmarshallerContext _ctx) { ListServicesResponse listServicesResponse = new ListServicesResponse(); listServicesResponse.HttpResponse = _ctx.HttpResponse; listServicesResponse.RequestId = _ctx.StringValue("ListServices.RequestId"); List <ListServicesResponse.ListServices_Service> listServicesResponse_services = new List <ListServicesResponse.ListServices_Service>(); for (int i = 0; i < _ctx.Length("ListServices.Services.Length"); i++) { ListServicesResponse.ListServices_Service service = new ListServicesResponse.ListServices_Service(); service.ServiceName = _ctx.StringValue("ListServices.Services[" + i + "].ServiceName"); service.Pid = _ctx.StringValue("ListServices.Services[" + i + "].Pid"); service.RegionId = _ctx.StringValue("ListServices.Services[" + i + "].RegionId"); listServicesResponse_services.Add(service); } listServicesResponse.Services = listServicesResponse_services; return(listServicesResponse); }