Github user neykov commented on a diff in the pull request:
https://github.com/apache/brooklyn-server/pull/425#discussion_r87450045
--- Diff:
locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/networking/JcloudsLocationSecurityGroupEditor.java
---
@@ -0,0 +1,223 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.brooklyn.location.jclouds.networking;
+
+import com.google.common.base.Optional;
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterables;
+import org.apache.brooklyn.util.exceptions.Exceptions;
+import org.apache.brooklyn.util.guava.Maybe;
+import org.jclouds.aws.AWSResponseException;
+import org.jclouds.compute.ComputeService;
+import org.jclouds.compute.domain.SecurityGroup;
+import org.jclouds.compute.extensions.SecurityGroupExtension;
+import org.jclouds.domain.Location;
+import org.jclouds.net.domain.IpPermission;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Set;
+import java.util.concurrent.Callable;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+public class JcloudsLocationSecurityGroupEditor {
+
+ private static final Logger LOG =
LoggerFactory.getLogger(JcloudsLocationSecurityGroupEditor.class);
+
+ private final Location location;
+ private final ComputeService computeService;
+ private final Optional<SecurityGroupExtension> securityApi;
+ private final String locationId;
+ private final Predicate<Exception> isExceptionRetryable;
+
+ /**
+ * Constructor.
+ * @param location JClouds location where security groups will be
managed.
+ * @param computeService The JClouds compute service instance.
+ * @param predicate A predicate indicating whether the customiser can
retry a request to add a security group
+ * or a rule after an throwable is thrown.
+ */
+ public JcloudsLocationSecurityGroupEditor(Location location,
ComputeService computeService, Predicate<Exception> predicate) {
+ this.location = location;
+ this.computeService = computeService;
+ this.locationId =
this.computeService.getContext().unwrap().getId();
--- End diff --
Isn't the `computeService` extracted from the `location`? Why not pass only
the `location` in.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---