Interface SecurityGroupApi


  • public interface SecurityGroupApi
    Provides synchronous access to cloudstack via their REST API.

    See Also:
    • Method Detail

      • listSecurityGroups

        @Named("listSecurityGroups")
        @GET
        @Consumes("application/json")
        Set<SecurityGroup> listSecurityGroups​(ListSecurityGroupsOptions... options)
        Lists security groups
        Parameters:
        options - if present, how to constrain the list.
        Returns:
        security groups matching query, or empty set, if no security groups are found
      • getSecurityGroup

        @Named("listSecurityGroups")
        @GET
        @Consumes("application/json")
        SecurityGroup getSecurityGroup​(@QueryParam("id")
                                       String id)
        get a specific security group by id
        Parameters:
        id - group to get
        Returns:
        security group or null if not found
      • getSecurityGroupByName

        @Named("listSecurityGroups")
        @GET
        @Consumes("application/json")
        SecurityGroup getSecurityGroupByName​(@QueryParam("securitygroupname")
                                             String securityGroupName)
        get a specific security group by name
        Parameters:
        securityGroupName - group to get
        Returns:
        security group or null if not found
      • createSecurityGroup

        @Named("createSecurityGroup")
        @GET
        @Consumes("application/json")
        SecurityGroup createSecurityGroup​(@QueryParam("name")
                                          String name)
        Creates a security group
        Parameters:
        name - name of the security group
        Returns:
        security group
      • authorizeIngressPortsToCIDRs

        @Named("authorizeSecurityGroupIngress")
        @GET
        @Consumes("application/json")
        String authorizeIngressPortsToCIDRs​(@QueryParam("securitygroupid")
                                            String securityGroupId,
                                            @QueryParam("protocol")
                                            String protocol,
                                            @QueryParam("startport")
                                            int startPort,
                                            @QueryParam("endport")
                                            int endPort,
                                            Iterable<String> cidrList,
                                            AccountInDomainOptions... options)
        Authorizes a particular TCP or UDP ingress rule for this security group
        Parameters:
        securityGroupId - The ID of the security group
        protocol - tcp or udp
        startPort - start port for this ingress rule
        endPort - end port for this ingress rule
        cidrList - the cidr list associated
        Returns:
        response relating to the creation of this ingress rule
      • authorizeIngressPortsToSecurityGroups

        @Named("authorizeSecurityGroupIngress")
        @GET
        @Consumes("application/json")
        String authorizeIngressPortsToSecurityGroups​(@QueryParam("securitygroupid")
                                                     String securityGroupId,
                                                     @QueryParam("protocol")
                                                     String protocol,
                                                     @QueryParam("startport")
                                                     int startPort,
                                                     @QueryParam("endport")
                                                     int endPort,
                                                     com.google.common.collect.Multimap<String,​String> accountToGroup,
                                                     AccountInDomainOptions... options)
        Authorizes a particular TCP or UDP ingress rule for this security group
        Parameters:
        securityGroupId - The ID of the security group
        protocol - tcp or udp
        startPort - start port for this ingress rule
        endPort - end port for this ingress rule
        accountToGroup - mapping of account names to security groups you wish to authorize
        Returns:
        response relating to the creation of this ingress rule
      • authorizeIngressICMPToCIDRs

        @Named("authorizeSecurityGroupIngress")
        @GET
        @Consumes("application/json")
        String authorizeIngressICMPToCIDRs​(@QueryParam("securitygroupid")
                                           String securityGroupId,
                                           @QueryParam("icmpcode")
                                           int ICMPCode,
                                           @QueryParam("icmptype")
                                           int ICMPType,
                                           Iterable<String> cidrList,
                                           AccountInDomainOptions... options)
        Authorizes a particular ICMP ingress rule for this security group
        Parameters:
        securityGroupId - The ID of the security group
        ICMPCode - type of the icmp message being sent
        ICMPType - error code for this icmp message
        cidrList - the cidr list associated
        Returns:
        response relating to the creation of this ingress rule
      • authorizeIngressICMPToSecurityGroups

        @Named("authorizeSecurityGroupIngress")
        @GET
        @Consumes("application/json")
        String authorizeIngressICMPToSecurityGroups​(@QueryParam("securitygroupid")
                                                    String securityGroupId,
                                                    @QueryParam("icmpcode")
                                                    int ICMPCode,
                                                    @QueryParam("icmptype")
                                                    int ICMPType,
                                                    com.google.common.collect.Multimap<String,​String> accountToGroup,
                                                    AccountInDomainOptions... options)
        Authorizes a particular ICMP ingress rule for this security group
        Parameters:
        securityGroupId - The ID of the security group
        ICMPCode - type of the icmp message being sent
        ICMPType - error code for this icmp message
        accountToGroup - mapping of account names to security groups you wish to authorize
        Returns:
        response relating to the creation of this ingress rule
      • revokeIngressRule

        @Named("revokeSecurityGroupIngress")
        @GET
        @Consumes("application/json")
        String revokeIngressRule​(@QueryParam("id")
                                 String id,
                                 AccountInDomainOptions... options)
        Deletes a particular ingress rule from this security group
        Parameters:
        id - The ID of the ingress rule
        options - scope of the rule.
      • deleteSecurityGroup

        @Named("deleteSecurityGroup")
        @GET
        @Consumes("application/json")
        void deleteSecurityGroup​(@QueryParam("id")
                                 String id)
        delete a specific security group by id
        Parameters:
        id - group to delete