List of usage examples for com.amazonaws.services.ecs.model Service getCreatedAt
public java.util.Date getCreatedAt()
The Unix timestamp for when the service was created.
From source file:com.netflix.spinnaker.clouddriver.ecs.deploy.EcsServerGroupNameResolver.java
License:Open Source License
@Override public List<TakenSlot> getTakenSlots(String familyName) { List<String> relevantServices = new ArrayList<>(); String nextToken = null;/* w ww. j ava2s. c om*/ do { ListServicesRequest request = new ListServicesRequest().withCluster(ecsClusterName); if (nextToken != null) { request.setNextToken(nextToken); } ListServicesResult result = ecs.listServices(request); for (String serviceArn : result.getServiceArns()) { if (serviceArn.contains(familyName)) { relevantServices.add(serviceArn); } } nextToken = result.getNextToken(); } while (nextToken != null && nextToken.length() != 0); List<TakenSlot> slots = new ArrayList<>(); List<List<String>> serviceBatches = Lists.partition(relevantServices, 10); for (List<String> serviceBatch : serviceBatches) { DescribeServicesRequest request = new DescribeServicesRequest().withCluster(ecsClusterName) .withServices(serviceBatch); DescribeServicesResult result = ecs.describeServices(request); for (Service service : result.getServices()) { Names names = Names.parseName(service.getServiceName()); slots.add(new TakenSlot(service.getServiceName(), names.getSequence(), service.getCreatedAt())); } } return slots; }
From source file:com.netflix.spinnaker.clouddriver.ecs.provider.agent.ServiceCachingAgent.java
License:Apache License
public static Map<String, Object> convertServiceToAttributes(String accountName, String region, Service service) { Map<String, Object> attributes = new HashMap<>(); String applicationName = service.getServiceName().contains("-") ? StringUtils.substringBefore(service.getServiceName(), "-") : service.getServiceName();/*from ww w. ja va2 s . com*/ String clusterName = StringUtils.substringAfterLast(service.getClusterArn(), "/"); attributes.put("account", accountName); attributes.put("region", region); attributes.put("applicationName", applicationName); attributes.put("serviceName", service.getServiceName()); attributes.put("serviceArn", service.getServiceArn()); attributes.put("clusterName", clusterName); attributes.put("clusterArn", service.getClusterArn()); attributes.put("roleArn", service.getRoleArn()); attributes.put("taskDefinition", service.getTaskDefinition()); attributes.put("desiredCount", service.getDesiredCount()); attributes.put("maximumPercent", service.getDeploymentConfiguration().getMaximumPercent()); attributes.put("minimumHealthyPercent", service.getDeploymentConfiguration().getMinimumHealthyPercent()); attributes.put("loadBalancers", service.getLoadBalancers()); attributes.put("createdAt", service.getCreatedAt().getTime()); return attributes; }