Re: [jclouds/jclouds-labs] [JCLOUDS-1430] Aliyun ECS (#443)

2018-08-02 Thread Ignasi Barrera
nacx commented on this pull request. > + vSwitchId = setIfTestSystemPropertyPresent(properties, provider + > ".vSwitchId"); + return properties; + } + + @Override + protected TemplateBuilder templateBuilder() { + return super.templateBuilder() +

Re: [jclouds/jclouds-labs] [JCLOUDS-1430] Aliyun ECS (#443)

2018-08-02 Thread Ignasi Barrera
nacx commented on this pull request. > + this.instanceSuspendedPredicate = instanceSuspendedPredicate; + this.regionIds = regionIds; + this.cleanupResources = cleanupResources; + } + + @Override + public NodeAndInitialCredentials createNodeWithGroupEncodedIntoName(String

Re: [jclouds/jclouds-labs] [JCLOUDS-1430] Aliyun ECS (#443)

2018-08-02 Thread Andrea Turli
andreaturli commented on this pull request. > + vSwitchId = setIfTestSystemPropertyPresent(properties, provider + > ".vSwitchId"); + return properties; + } + + @Override + protected TemplateBuilder templateBuilder() { + return super.templateBuilder() +

Re: [jclouds/jclouds-labs] [JCLOUDS-1430] Aliyun ECS (#443)

2018-08-02 Thread Andrea Turli
andreaturli commented on this pull request. > @@ -92,4 +94,14 @@ public boolean apply(@Nullable String input) { }), "Cannot starts with " + Iterables.toString(FORBIDDEN_PREFIX)); } + /** +* This is strictly not needed but apparently tags with `-` can create a problem when

Re: [jclouds/jclouds-labs] [JCLOUDS-1430] Aliyun ECS (#443)

2018-08-02 Thread Andrea Turli
andreaturli commented on this pull request. > + + String securityGroupId = null; + if (!options.getGroups().isEmpty()) { + Iterable securityGroupNames = api.securityGroupApi().list(location.getId()).concat().transform(new Function() { +@Override +

Re: [jclouds/jclouds-labs] [JCLOUDS-1430] Aliyun ECS (#443)

2018-08-02 Thread Andrea Turli
andreaturli commented on this pull request. > + } else { +logger.warn(">> security group: (%s) has not been deleted.", securityGroupId); + } + } + + return instanceDeleted; + } + + private List getSecurityGroupIdsUsedByNode(RegionAndId regionAndId) {

Re: [jclouds/jclouds-labs] [JCLOUDS-1430] Aliyun ECS (#443)

2018-08-02 Thread Andrea Turli
andreaturli commented on this pull request. > + if (hardware.isPresent()) { + builder.hardware(hardware.get()); + } else { + logger.info(">> hardware with id %s for instance %s was not found. " + + "This might be because the image that was used

Re: [jclouds/jclouds-labs] [JCLOUDS-1430] Aliyun ECS (#443)

2018-08-02 Thread Andrea Turli
andreaturli commented on this pull request. > + +import com.google.common.base.MoreObjects; +import com.google.common.base.Objects; +import org.jclouds.compute.options.TemplateOptions; + +import static com.google.common.base.Objects.equal; + +/** + * Custom options for the Alibaba Elastic

Re: [jclouds/jclouds-labs] [JCLOUDS-1430] Aliyun ECS (#443)

2018-08-02 Thread Andrea Turli
andreaturli commented on this pull request. > + private final Supplier> hardwares; + private final Supplier> locations; + private final Function toPortableStatus; + private final GroupNamingConvention groupNamingConvention; + @Resource @Named(ComputeServiceConstants.COMPUTE_LOGGER)

Re: [jclouds/jclouds-labs] [JCLOUDS-1430] Aliyun ECS (#443)

2018-08-02 Thread Andrea Turli
andreaturli commented on this pull request. > + @Override + public boolean apply(@Nullable InstanceType input) { +return contains(instanceTypeIds.build(), input.instanceTypeId()); + } + }).toList(); + +

Re: [jclouds/jclouds-labs] [JCLOUDS-1430] Aliyun ECS (#443)

2018-08-02 Thread Andrea Turli
andreaturli commented on this pull request. > + transform(listLocations(), new Function() { + @Override + public String apply(Region location) { +return location.id(); + } + })); + + for (String

Re: [jclouds/jclouds-labs] [JCLOUDS-1430] Aliyun ECS (#443)

2018-08-02 Thread Andrea Turli
andreaturli commented on this pull request. > + for (String regionId : availableLocationNames) { + instanceTypeIds.addAll(getInstanceTypeId(regionId)); + } + + List instanceTypes = FluentIterable.from(api.instanceApi().listTypes()) + .filter(new Predicate()

Re: [jclouds/jclouds-labs] [JCLOUDS-1430] Aliyun ECS (#443)

2018-08-02 Thread Andrea Turli
andreaturli commented on this pull request. > + + for (String regionId : availableLocationNames) { + images.addAll(api.imageApi().list(regionId).concat()); + } + return images.build(); + } + + @Override + public Image getImage(final String id) { + Optional

Re: [jclouds/jclouds-labs] [JCLOUDS-1430] Aliyun ECS (#443)

2018-08-02 Thread Andrea Turli
andreaturli commented on this pull request. > + transform(listLocations(), new Function() { + @Override + public String apply(Region location) { +return location.id(); + } + })); + + for (String

Re: [jclouds/jclouds-labs] [JCLOUDS-1430] Aliyun ECS (#443)

2018-08-02 Thread Andrea Turli
andreaturli commented on this pull request. > +} + } + } + return instanceTypeIds; + } + + @Override + public Iterable listImages() { + final ImmutableList.Builder images = ImmutableList.builder(); + final List availableLocationNames = newArrayList(

Re: [jclouds/jclouds-labs] [JCLOUDS-1430] Aliyun ECS (#443)

2018-08-02 Thread Andrea Turli
andreaturli commented on this pull request. > + + InstanceRequest instanceRequest = api.instanceApi().create(regionId, imageId, securityGroupId, name, instanceType, + CreateInstanceOptions.Builder + .vSwitchId(vSwitchId) +

Re: [jclouds/jclouds-labs] [JCLOUDS-1430] Aliyun ECS (#443)

2018-08-02 Thread Andrea Turli
andreaturli commented on this pull request. > + this.instanceSuspendedPredicate = instanceSuspendedPredicate; + this.regionIds = regionIds; + this.cleanupResources = cleanupResources; + } + + @Override + public NodeAndInitialCredentials