You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jclouds.apache.org by Andrew Bayer <no...@github.com> on 2013/06/15 03:00:26 UTC
[jclouds] JCLOUDS-99. Enable use of Iterable for
aws-ec2 (#35)
- Added AWSEC2CreateSecurityGroupIfNeeded, using
AWSSecurityGroupClient's ability to call
authorizeSecurityGroupInRegion with Iterable<IpPermission>
- Added a utility method,
ComputeServiceUtils.getPortRangesInList(int... ports), to get pairs of
start/end ports covering all ranges in a list of ports. Used above.
You can merge this Pull Request by running:
git pull https://github.com/abayer/jclouds-1 jclouds-99
Or you can view, comment on it, or merge it online at:
https://github.com/jclouds/jclouds/pull/35
-- Commit Summary --
* JCLOUDS-99. Enable use of Iterable<IpPermission> for aws-ec2
-- File Changes --
M compute/src/main/java/org/jclouds/compute/util/ComputeServiceUtils.java (29)
M compute/src/test/java/org/jclouds/compute/util/ComputeServiceUtilsTest.java (11)
M providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/compute/config/AWSEC2ComputeServiceDependenciesModule.java (4)
A providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/compute/loaders/AWSEC2CreateSecurityGroupIfNeeded.java (130)
M providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/compute/internal/BaseAWSEC2ComputeServiceExpectTest.java (23)
A providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/compute/loaders/AWSEC2CreateSecurityGroupIfNeededTest.java (99)
-- Patch Links --
https://github.com/jclouds/jclouds/pull/35.patch
https://github.com/jclouds/jclouds/pull/35.diff
Re: [jclouds] JCLOUDS-99. Enable use of Iterable for
aws-ec2 (#35)
Posted by BuildHive <no...@github.com>.
[jclouds » jclouds #102](https://buildhive.cloudbees.com/job/jclouds/job/jclouds/102/) SUCCESS
This pull request looks good
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/35#issuecomment-19569278
Re: [jclouds] JCLOUDS-99. Enable use of Iterable for
aws-ec2 (#35)
Posted by BuildHive <no...@github.com>.
[jclouds » jclouds #99](https://buildhive.cloudbees.com/job/jclouds/job/jclouds/99/) SUCCESS
This pull request looks good
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/35#issuecomment-19513790
Re: [jclouds] JCLOUDS-99. Enable use of Iterable for
aws-ec2 (#35)
Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-java-7-pull-requests #454](https://jclouds.ci.cloudbees.com/job/jclouds-java-7-pull-requests/454/) SUCCESS
This pull request looks good
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/35#issuecomment-19569967
Re: [jclouds] JCLOUDS-99. Enable use of Iterable for
aws-ec2 (#35)
Posted by BuildHive <no...@github.com>.
[jclouds » jclouds #94](https://buildhive.cloudbees.com/job/jclouds/job/jclouds/94/) SUCCESS
This pull request looks good
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/35#issuecomment-19489472
Re: [jclouds] JCLOUDS-99. Enable use of Iterable for
aws-ec2 (#35)
Posted by Andrew Phillips <no...@github.com>.
> @@ -257,4 +265,21 @@ public String toString() {
> }
> }
>
> + public static Map<Integer, Integer> getPortRangesFromList(int... ports) {
Perhaps add some kind of comment to this method to explain the de-duplication...the comment that "got eaten" during that force push? ;-)
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/35/files#r4854734
Re: [jclouds] JCLOUDS-99. Enable use of Iterable for
aws-ec2 (#35)
Posted by Andrew Bayer <no...@github.com>.
Closed #35.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/35
Re: [jclouds] JCLOUDS-99. Enable use of Iterable for
aws-ec2 (#35)
Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-java-7-pull-requests #452](https://jclouds.ci.cloudbees.com/job/jclouds-java-7-pull-requests/452/) SUCCESS
This pull request looks good
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/35#issuecomment-19514411
Re: [jclouds] JCLOUDS-99. Enable use of Iterable for
aws-ec2 (#35)
Posted by BuildHive <no...@github.com>.
[jclouds » jclouds #98](https://buildhive.cloudbees.com/job/jclouds/job/jclouds/98/) FAILURE
Looks like there's a problem with this pull request
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/35#issuecomment-19513064
Re: [jclouds] JCLOUDS-99. Enable use of Iterable for
aws-ec2 (#35)
Posted by Andrew Bayer <no...@github.com>.
Pushing.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/35#issuecomment-19714875
Re: [jclouds] JCLOUDS-99. Enable use of Iterable for
aws-ec2 (#35)
Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-java-7-pull-requests #447](https://jclouds.ci.cloudbees.com/job/jclouds-java-7-pull-requests/447/) SUCCESS
This pull request looks good
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/35#issuecomment-19489590
Re: [jclouds] JCLOUDS-99. Enable use of Iterable for
aws-ec2 (#35)
Posted by Andrew Bayer <an...@gmail.com>.
The original comment was eaten by a force push of mine, I think, so
commenting here - yes, deduplication. As a result, we'll go from [5, 6, 7,
10, 11, 20] to [[5, 7], [10, 11], [20, 20]] - so we'd save at least one
call to authorizeSecurityGroupIngress or equivalent in this case (well,
actually, if we're using aws-ec2, it doesn't really matter much anyway, but
generally? it does.).
A.
On Mon, Jun 17, 2013 at 3:08 PM, Andrew Phillips
<no...@github.com>wrote:
> > @@ -257,4 +265,21 @@ public String toString() {
> > }
> > }
> >
> > + public static Map<Integer, Integer> getPortRangesFromList(int...
> ports) {
> > + Set<Integer> sortedPorts =
> ImmutableSortedSet.copyOf(Ints.asList(ports));
> > +
> > + RangeSet<Integer> ranges = TreeRangeSet.create();
> > +
> > + for (Integer port : sortedPorts) {
> > + ranges.add(Range.closedOpen(port, port + 1));
> > + }
> > +
> > + Map<Integer, Integer> portRanges = Maps.newHashMap();
> > +
> > + for (Range<Integer> r : ranges.asRanges()) {
> > + portRanges.put(r.lowerEndpoint(), r.upperEndpoint() - 1);
> > + }
>
> I'm probably missing something here, but what is gained by the
> intermediate creating of a `RangeSet`? Is it some kind of deduplication?
> I.e. is there no way to easily go from the sorted input range straight to
> the `Map` result?
>
> ---
> Reply to this email directly or view it on GitHub:
> https://github.com/jclouds/jclouds/pull/35/files#r4736475
>
Re: [jclouds] JCLOUDS-99. Enable use of Iterable for
aws-ec2 (#35)
Posted by Andrew Phillips <no...@github.com>.
> @@ -257,4 +265,21 @@ public String toString() {
> }
> }
>
> + public static Map<Integer, Integer> getPortRangesFromList(int... ports) {
> + Set<Integer> sortedPorts = ImmutableSortedSet.copyOf(Ints.asList(ports));
> +
> + RangeSet<Integer> ranges = TreeRangeSet.create();
> +
> + for (Integer port : sortedPorts) {
> + ranges.add(Range.closedOpen(port, port + 1));
> + }
> +
> + Map<Integer, Integer> portRanges = Maps.newHashMap();
> +
> + for (Range<Integer> r : ranges.asRanges()) {
> + portRanges.put(r.lowerEndpoint(), r.upperEndpoint() - 1);
> + }
I'm probably missing something here, but what is gained by the intermediate creating of a `RangeSet`? Is it some kind of deduplication? I.e. is there no way to easily go from the sorted input range straight to the `Map` result?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/35/files#r4736475
Re: [jclouds] JCLOUDS-99. Enable use of Iterable for
aws-ec2 (#35)
Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-java-7-pull-requests #451](https://jclouds.ci.cloudbees.com/job/jclouds-java-7-pull-requests/451/) SUCCESS
This pull request looks good
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/35#issuecomment-19513719