Class CloudStackSecurityGroupExtension
java.lang.Object
org.jclouds.cloudstack.compute.extensions.CloudStackSecurityGroupExtension
- All Implemented Interfaces:
SecurityGroupExtension
An extension to compute service to allow for the manipulation of
SecurityGroup
s. Implementation
is optional by providers.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final CloudStackApi
protected final BlockUntilJobCompletesAndReturnResult
protected final com.google.common.base.Function
<SecurityGroup, SecurityGroup> protected final com.google.common.cache.LoadingCache
<ZoneAndName, SecurityGroup> protected final com.google.common.base.Predicate
<String> protected final GroupNamingConvention.Factory
-
Constructor Summary
ConstructorsConstructorDescriptionCloudStackSecurityGroupExtension
(CloudStackApi api, com.google.common.base.Function<SecurityGroup, SecurityGroup> groupConverter, com.google.common.cache.LoadingCache<ZoneAndName, SecurityGroup> groupCreator, GroupNamingConvention.Factory namingConvention, com.google.common.base.Supplier<Set<? extends Location>> locations, BlockUntilJobCompletesAndReturnResult blockUntilJobCompletesAndReturnResult, com.google.common.base.Predicate<String> jobComplete) -
Method Summary
Modifier and TypeMethodDescriptionaddIpPermission
(IpPermission ipPermission, SecurityGroup group) Add a @{link IpPermission} to an existing @{link SecurityGroup}.addIpPermission
(IpProtocol protocol, int startPort, int endPort, com.google.common.collect.Multimap<String, String> tenantIdGroupNamePairs, Iterable<String> ipRanges, Iterable<String> groupIds, SecurityGroup group) Add a @{link IpPermission} to an existing @{link SecurityGroup}, based on the parameters given.createSecurityGroup
(String name, Location location) Create a new @{link SecurityGroup} from the parameters given.Get a security group by id.List security groups.List security groups for a given instance given the instance's ID.listSecurityGroupsInLocation
(Location location) Note that for the time being, security groups are not scoped by location in CloudStack, so this will simply return listSecurityGroups().removeIpPermission
(IpPermission ipPermission, SecurityGroup group) Remove a @{link IpPermission} from an existing @{link SecurityGroup}.removeIpPermission
(IpProtocol protocol, int startPort, int endPort, com.google.common.collect.Multimap<String, String> tenantIdGroupNamePairs, Iterable<String> ipRanges, Iterable<String> groupIds, SecurityGroup group) Remove a @{link IpPermission} from an existing @{link SecurityGroup}, based on the parameters given.boolean
Remove an existing @{link SecurityGroup}, and its permissions.boolean
Returns true if this SecurityGroupExtension supports exclusion CIDR groups.boolean
Returns true if this SecurityGroupExtension supports group IDs.boolean
Returns true if this SecurityGroupExtension supports port ranges for group authorization.boolean
Returns true if this SecurityGroupExtension supports tenant ID + group ID pairs.boolean
Returns true if this SecurityGroupExtension supports tenant ID + group name pairs.
-
Field Details
-
api
-
groupConverter
-
groupCreator
-
namingConvention
-
locations
-
blockUntilJobCompletesAndReturnResult
-
jobComplete
-
-
Constructor Details
-
CloudStackSecurityGroupExtension
@Inject public CloudStackSecurityGroupExtension(CloudStackApi api, com.google.common.base.Function<SecurityGroup, SecurityGroup> groupConverter, com.google.common.cache.LoadingCache<ZoneAndName, SecurityGroup> groupCreator, GroupNamingConvention.Factory namingConvention, com.google.common.base.Supplier<Set<? extends Location>> locations, BlockUntilJobCompletesAndReturnResult blockUntilJobCompletesAndReturnResult, com.google.common.base.Predicate<String> jobComplete)
-
-
Method Details
-
listSecurityGroups
Description copied from interface:SecurityGroupExtension
List security groups.- Specified by:
listSecurityGroups
in interfaceSecurityGroupExtension
- Returns:
- The set of @{link SecurityGroup}s we have access to.
-
listSecurityGroupsInLocation
Note that for the time being, security groups are not scoped by location in CloudStack, so this will simply return listSecurityGroups().- Specified by:
listSecurityGroupsInLocation
in interfaceSecurityGroupExtension
- Parameters:
location
-- Returns:
- security groups
-
listSecurityGroupsForNode
Description copied from interface:SecurityGroupExtension
List security groups for a given instance given the instance's ID.- Specified by:
listSecurityGroupsForNode
in interfaceSecurityGroupExtension
- Returns:
- The set of @{link SecurityGroup}s for the given instance..
-
getSecurityGroupById
Description copied from interface:SecurityGroupExtension
Get a security group by id.- Specified by:
getSecurityGroupById
in interfaceSecurityGroupExtension
- Returns:
- The @{link SecurityGroup}, if it exists.
-
createSecurityGroup
Description copied from interface:SecurityGroupExtension
Create a new @{link SecurityGroup} from the parameters given.- Specified by:
createSecurityGroup
in interfaceSecurityGroupExtension
- Parameters:
name
- The name of the security grouplocation
- The @{link Location} of the security group- Returns:
- The SecurityGroup that has been created.
-
removeSecurityGroup
Description copied from interface:SecurityGroupExtension
Remove an existing @{link SecurityGroup}, and its permissions.- Specified by:
removeSecurityGroup
in interfaceSecurityGroupExtension
- Parameters:
id
- The id of the SecurityGroup to delete.- Returns:
- true if we were able to remove the group, false otherwise.
-
addIpPermission
Description copied from interface:SecurityGroupExtension
Add a @{link IpPermission} to an existing @{link SecurityGroup}. Applies the permission to the security group on the provider.- Specified by:
addIpPermission
in interfaceSecurityGroupExtension
- Parameters:
group
- The SecurityGroup to add the permission to.- Returns:
- The SecurityGroup with the new permission added, after the permission has been applied on the provider.
-
addIpPermission
public SecurityGroup addIpPermission(IpProtocol protocol, int startPort, int endPort, com.google.common.collect.Multimap<String, String> tenantIdGroupNamePairs, Iterable<String> ipRanges, Iterable<String> groupIds, SecurityGroup group) Description copied from interface:SecurityGroupExtension
Add a @{link IpPermission} to an existing @{link SecurityGroup}, based on the parameters given. Applies the permission to the security group on the provider.- Specified by:
addIpPermission
in interfaceSecurityGroupExtension
- Parameters:
protocol
- The @{link IpProtocol} for the permission.startPort
- The first port in the range to be opened, or -1 for ICMP.endPort
- The last port in the range to be opened, or -1 for ICMP.tenantIdGroupNamePairs
- source of traffic allowed is on basis of another group in a tenant, as opposed to by cidripRanges
- An Iterable of Strings representing the IP range(s) the permission should allow.groupIds
- An Iterable of @{link SecurityGroup} IDs this permission should allow.group
- The SecurityGroup to add the permission to.- Returns:
- The SecurityGroup with the new permission added, after the permission has been applied on the provider.
-
removeIpPermission
Description copied from interface:SecurityGroupExtension
Remove a @{link IpPermission} from an existing @{link SecurityGroup}. Removes the permission from the security group on the provider.- Specified by:
removeIpPermission
in interfaceSecurityGroupExtension
- Parameters:
group
- The SecurityGroup to remove the permission from.- Returns:
- The SecurityGroup with the permission removed, after the permission has been removed on the provider.
-
removeIpPermission
public SecurityGroup removeIpPermission(IpProtocol protocol, int startPort, int endPort, com.google.common.collect.Multimap<String, String> tenantIdGroupNamePairs, Iterable<String> ipRanges, Iterable<String> groupIds, SecurityGroup group) Description copied from interface:SecurityGroupExtension
Remove a @{link IpPermission} from an existing @{link SecurityGroup}, based on the parameters given. Removes the permission from the security group on the provider.- Specified by:
removeIpPermission
in interfaceSecurityGroupExtension
- Parameters:
protocol
- The @{link IpProtocol} for the permission.startPort
- The first port in the range to be opened, or -1 for ICMP.endPort
- The last port in the range to be opened, or -1 for ICMP.tenantIdGroupNamePairs
- source of traffic allowed is on basis of another group in a tenant, as opposed to by cidripRanges
- An Iterable of Strings representing the IP range(s) the permission should allow.groupIds
- An Iterable of @{link SecurityGroup} IDs this permission should allow.group
- The SecurityGroup to remove the permission from.- Returns:
- The SecurityGroup with the permission removed, after the permission has been removed from the provider.
-
supportsTenantIdGroupNamePairs
public boolean supportsTenantIdGroupNamePairs()Description copied from interface:SecurityGroupExtension
Returns true if this SecurityGroupExtension supports tenant ID + group name pairs.- Specified by:
supportsTenantIdGroupNamePairs
in interfaceSecurityGroupExtension
-
supportsTenantIdGroupIdPairs
public boolean supportsTenantIdGroupIdPairs()Description copied from interface:SecurityGroupExtension
Returns true if this SecurityGroupExtension supports tenant ID + group ID pairs.- Specified by:
supportsTenantIdGroupIdPairs
in interfaceSecurityGroupExtension
-
supportsGroupIds
public boolean supportsGroupIds()Description copied from interface:SecurityGroupExtension
Returns true if this SecurityGroupExtension supports group IDs.- Specified by:
supportsGroupIds
in interfaceSecurityGroupExtension
-
supportsPortRangesForGroups
public boolean supportsPortRangesForGroups()Description copied from interface:SecurityGroupExtension
Returns true if this SecurityGroupExtension supports port ranges for group authorization.- Specified by:
supportsPortRangesForGroups
in interfaceSecurityGroupExtension
-
supportsExclusionCidrBlocks
public boolean supportsExclusionCidrBlocks()Description copied from interface:SecurityGroupExtension
Returns true if this SecurityGroupExtension supports exclusion CIDR groups.- Specified by:
supportsExclusionCidrBlocks
in interfaceSecurityGroupExtension
-