Scalr\Service\Aws\Ec2\V20150415\Ec2Api::authorizeSecurityGroupEgress PHP Method

authorizeSecurityGroupEgress() public method

Adds one or more egress rules to a security group for use with a VPC. Specifically, this action permits instances to send traffic to one or more destination CIDR IP address ranges, or to one or more destination security groups for the same VPC. Important! You can have up to 50 rules per group (covering both ingress and egress rules). A security group is for use with instances either in the EC2-Classic platform or in a specific VPC. This action doesn't apply to security groups for EC2-Classic. Each rule consists of the protocol (for example, TCP), plus either a CIDR range or a source group. For the TCP and UDP protocols, you must also specify the destination port or port range. For the ICMP protocol, you must also specify the ICMP type and code. You can use -1 for the type or code to mean all types or all codes. Rule changes are propagated to affected instances as quickly as possible. However, a small delay might occur.
public authorizeSecurityGroupEgress ( Scalr\Service\Aws\Ec2\DataType\IpPermissionList $ipPermissions, string $groupId ) : boolean
$ipPermissions Scalr\Service\Aws\Ec2\DataType\IpPermissionList Ip permission list object
$groupId string optional The ID of the security group to modify.
return boolean Returns true on success
    public function authorizeSecurityGroupEgress(IpPermissionList $ipPermissions, $groupId)
    {
        $result = false;
        $options = $ipPermissions->getQueryArrayBare('IpPermissions');
        $options['GroupId'] = (string) $groupId;
        $action = ucfirst(__FUNCTION__);
        $response = $this->client->call($action, $options);
        if ($response->getError() === false) {
            $sxml = simplexml_load_string($response->getRawContent());
            if ((string) $sxml->return != 'true') {
                throw new Ec2Exception(sprintf('Amazon Ec2 could not %s GroupId:"%s". It returned "%s"', $action, $options['GroupId'], $sxml->return));
            }
            $result = true;
        }
        return $result;
    }
Ec2Api