Scalr\Service\Aws\Ec2\V20140615\Ec2Api::revokeSecurityGroupIngress PHP Метод

revokeSecurityGroupIngress() публичный Метод

This action applies to both EC2 security groups and VPC security groups. This action removes one or more ingress rules from a security group. The values that you specify in the revoke request (e.g., ports, etc.) must match the existing rule's values for the rule to be removed. Each rule consists of the protocol and the CIDR range or source security group. For the TCP and UDP protocols, you must also specify the destination port or range of ports. For the ICMP protocol, you must also specify the ICMP type and code. Rule changes are propagated to instances within the security group as quickly as possible. However, depending on the number of instances, a small delay might occur
public revokeSecurityGroupIngress ( Scalr\Service\Aws\Ec2\DataType\IpPermissionList $ipPermissions, string $groupId = null, string $groupName = null ) : boolean
$ipPermissions Scalr\Service\Aws\Ec2\DataType\IpPermissionList Ip permission list object
$groupId string optional The ID of the EC2 or VPC security group to modify. The group must belong to your account.
$groupName string optional The name of the EC2 security group to modify. It can be used instead of group ID for EC2 security groups.
Результат boolean Returns true on success
    public function revokeSecurityGroupIngress(IpPermissionList $ipPermissions, $groupId = null, $groupName = null)
    {
        $result = false;
        $options = $ipPermissions->getQueryArrayBare('IpPermissions');
        if ($groupName === null && $groupId === null || $groupName !== null && $groupId !== null) {
            throw new \InvalidArgumentException(sprintf('Either groupName or groupId is required for the %s. ' . 'Also you cannot specify both in the same call.', __METHOD__));
        }
        if ($groupId !== null) {
            $options['GroupId'] = (string) $groupId;
        } else {
            if ($groupName !== null) {
                $options['GroupName'] = (string) $groupName;
            }
        }
        $response = $this->client->call(ucfirst(__FUNCTION__), $options);
        if ($response->getError() === false) {
            $sxml = simplexml_load_string($response->getRawContent());
            if ((string) $sxml->return != 'true') {
                throw new Ec2Exception(sprintf('Amazon Ec2 could not revoke ingress rules to a security group "%s". It returned "%s"', $options['GroupId'] ?: $options['GroupName'], $sxml->return));
            }
            $result = true;
        }
        return $result;
    }
Ec2Api