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

describeSecurityGroups() public method

Describes one or more of your security groups. This includes both EC2 security groups and VPC security groups
public describeSecurityGroups ( ListDataType $groupName = null, ListDataType $groupId = null, Scalr\Service\Aws\Ec2\DataType\SecurityGroupFilterList $filter = null ) : Scalr\Service\Aws\Ec2\DataType\SecurityGroupList
$groupName Scalr\Service\Aws\DataType\ListDataType optional One or more security group names.
$groupId Scalr\Service\Aws\DataType\ListDataType optional One or more security group IDs.
$filter Scalr\Service\Aws\Ec2\DataType\SecurityGroupFilterList optional The name/value pairs list for the filter.
return Scalr\Service\Aws\Ec2\DataType\SecurityGroupList Returns SecurityGroupList
    public function describeSecurityGroups(ListDataType $groupName = null, ListDataType $groupId = null, SecurityGroupFilterList $filter = null)
    {
        $result = null;
        if ($groupName !== null) {
            $options = $groupName->getQueryArrayBare('GroupName');
        } else {
            $options = [];
        }
        if ($groupId !== null) {
            $options = array_merge($options, $groupId->getQueryArrayBare('GroupId'));
        }
        if ($filter !== null) {
            $options = array_merge($options, $filter->getQueryArrayBare('Filter'));
        }
        $response = $this->client->call(ucfirst(__FUNCTION__), $options);
        if ($response->getError() === false) {
            $sxml = simplexml_load_string($response->getRawContent());
            $response = null;
            $result = new SecurityGroupList();
            $result->setEc2($this->ec2)->setRequestId((string) $sxml->requestId);
            if (!empty($sxml->securityGroupInfo->item)) {
                foreach ($sxml->securityGroupInfo->item as $v) {
                    $sgid = (string) $v->groupId;
                    $item = $this->ec2->getEntityManagerEnabled() ? $this->ec2->securityGroup->get($sgid) : null;
                    if ($item === null) {
                        $item = new SecurityGroupData();
                        $item->setEc2($this->ec2);
                        $bAttach = true;
                    } else {
                        $item->resetObject();
                        $bAttach = false;
                    }
                    $item->ownerId = (string) $v->ownerId;
                    $item->groupId = (string) $v->groupId;
                    $item->groupName = $this->exist($v->groupName) ? (string) $v->groupName : null;
                    $item->groupDescription = $this->exist($v->groupDescription) ? (string) $v->groupDescription : null;
                    $item->vpcId = $this->exist($v->vpcId) ? (string) $v->vpcId : null;
                    $item->setIpPermissions($this->_loadIpPermissionList($v->ipPermissions))->setIpPermissionsEgress($this->_loadIpPermissionList($v->ipPermissionsEgress))->setTagSet($this->_loadResourceTagSetList($v->tagSet));
                    $result->append($item);
                    if ($bAttach && $this->ec2->getEntityManagerEnabled()) {
                        $this->getEntityManager()->attach($item);
                    }
                    unset($item);
                }
            }
        }
        return $result;
    }
Ec2Api