@Beta public class JcloudsLocationSecurityGroupCustomizer extends BasicJcloudsLocationCustomizer
is an optional extension to jclouds compute service. It allows the manipulation of
{@link SecurityGroup}s.
This customizer can be injected into {@link JcloudsLocation#obtainOnce} using
It will be executed after the provisiioning of the {@link JcloudsMachineLocation} to apply app-specific
customization related to the security groups.
Modifier and Type | Method and Description |
---|---|
JcloudsLocationSecurityGroupCustomizer |
addPermissionsToLocation(JcloudsMachineLocation location,
org.jclouds.net.domain.IpPermission... permissions) |
JcloudsLocationSecurityGroupCustomizer |
addPermissionsToLocation(JcloudsMachineLocation location,
java.lang.Iterable<org.jclouds.net.domain.IpPermission> permissions)
Applies the given security group permissions to the given location.
|
JcloudsLocationSecurityGroupCustomizer |
addPermissionsToLocation(JcloudsMachineLocation location,
SecurityGroupDefinition securityGroupDefinition) |
void |
customize(JcloudsLocation location,
org.jclouds.compute.ComputeService computeService,
org.jclouds.compute.domain.Template template)
Replaces security groups configured on the given template with one that allows
SSH access on port 22 and allows communication on all ports between machines in
the same group.
|
java.lang.String |
getBrooklynCidrBlock() |
static JcloudsLocationSecurityGroupCustomizer |
getInstance(Entity entity)
Gets a customizer for the given entity's application.
|
static JcloudsLocationSecurityGroupCustomizer |
getInstance(java.lang.String applicationId)
Gets the customizer for the given applicationId.
|
static com.google.common.base.Predicate<java.lang.Exception> |
newAwsExceptionRetryPredicate() |
JcloudsLocationSecurityGroupCustomizer |
setRetryExceptionPredicate(com.google.common.base.Predicate<java.lang.Exception> predicate) |
JcloudsLocationSecurityGroupCustomizer |
setSshCidrSupplier(com.google.common.base.Supplier<Cidr> cidrSupplier) |
customize, customize, customize, customize, postRelease, postRelease, preRelease, preRelease
public static JcloudsLocationSecurityGroupCustomizer getInstance(java.lang.String applicationId)
applicationId
- An identifier for the application the customizer is to be used forpublic static JcloudsLocationSecurityGroupCustomizer getInstance(Entity entity)
entity
- The entity the customizer is to be used forpublic JcloudsLocationSecurityGroupCustomizer setRetryExceptionPredicate(com.google.common.base.Predicate<java.lang.Exception> predicate)
predicate
- A predicate whose return value indicates whether a request to add a security group
or permission may be retried after its input Exception
was thrown.public JcloudsLocationSecurityGroupCustomizer setSshCidrSupplier(com.google.common.base.Supplier<Cidr> cidrSupplier)
cidrSupplier
- A supplier returning a CIDR for hosts that are allowed to SSH to locations.public JcloudsLocationSecurityGroupCustomizer addPermissionsToLocation(JcloudsMachineLocation location, org.jclouds.net.domain.IpPermission... permissions)
#addPermissionsToLocation(brooklyn.location.jclouds.JcloudsSshMachineLocation, java.lang.Iterable)
public JcloudsLocationSecurityGroupCustomizer addPermissionsToLocation(JcloudsMachineLocation location, SecurityGroupDefinition securityGroupDefinition)
#addPermissionsToLocation(brooklyn.location.jclouds.JcloudsSshMachineLocation, java.lang.Iterable)
public JcloudsLocationSecurityGroupCustomizer addPermissionsToLocation(JcloudsMachineLocation location, java.lang.Iterable<org.jclouds.net.domain.IpPermission> permissions)
Takes no action if the location's compute service does not have a security group extension.
permissions
- The set of permissions to be applied to the locationlocation
- Location to gain permissionspublic void customize(JcloudsLocation location, org.jclouds.compute.ComputeService computeService, org.jclouds.compute.domain.Template template)
locations
.
This method is called by Brooklyn when obtaining machines, as part of the
JcloudsLocationCustomizer
contract. It
should not be called from anywhere else.
customize
in interface JcloudsLocationCustomizer
customize
in class BasicJcloudsLocationCustomizer
location
- The Brooklyn location that has called this method while obtaining a machinecomputeService
- The compute service being used by the location argument to provision a machinetemplate
- The machine template created by the location argumentpublic java.lang.String getBrooklynCidrBlock()
public static com.google.common.base.Predicate<java.lang.Exception> newAwsExceptionRetryPredicate()
AWSResponseException
whose error code is either InvalidGroup.InUse
, DependencyViolation
or
RequestLimitExceeded
.